diff --git a/main/admin/settings.lib.php b/main/admin/settings.lib.php index e822ed4f0b..b6dc07c57b 100755 --- a/main/admin/settings.lib.php +++ b/main/admin/settings.lib.php @@ -1228,7 +1228,7 @@ function generate_settings_form($settings, $settings_by_access_list) { } } foreach ($valid_encodings as $key => &$encoding) { - if (api_is_encoding_supported($key) && Database::is_encoding_supported($key)) { + if (api_is_encoding_supported($key)) { $encoding = $key; } else { unset($valid_encodings[$key]); diff --git a/main/inc/global.inc.php b/main/inc/global.inc.php index e9ef85d8a2..8c1a726b24 100755 --- a/main/inc/global.inc.php +++ b/main/inc/global.inc.php @@ -194,8 +194,12 @@ if (empty($charset)) { // Preserving the value of the global variable $charset. $charset_initial_value = $charset; +// Enables the portablity layer and configures PHP for UTF-8 +//\Patchwork\Utf8\Bootup::initAll(); + // Initialization of the internationalization library. api_initialize_internationalization(); + // Initialization of the default encoding that will be used by the multibyte string routines in the internationalization library. api_set_internationalization_default_encoding($charset); diff --git a/main/inc/lib/internationalization.lib.php b/main/inc/lib/internationalization.lib.php index a367f75f9f..eae172c4e5 100755 --- a/main/inc/lib/internationalization.lib.php +++ b/main/inc/lib/internationalization.lib.php @@ -6,6 +6,7 @@ * Internationalization library for Chamilo 1.8.7 LMS * A library implementing internationalization related functions. * License: GNU General Public License Version 3 (Free Software Foundation) + * @todo use Patchwork-UTF8 instead of custom changes. * @author Ivan Tcholakov, , 2009, 2010 * @author More authors, mentioned in the correpsonding fragments of this source. * @package chamilo.library @@ -58,12 +59,12 @@ define('PERSON_NAME_DATA_EXPORT', PERSON_NAME_EASTERN_ORDER); // The following constants are used for tuning language detection functionality. // We reduce the text for language detection to the given number of characters // for increasing speed and to decrease memory consumption. -define ('LANGUAGE_DETECT_MAX_LENGTH', 2000); +define('LANGUAGE_DETECT_MAX_LENGTH', 2000); // Maximum allowed difference in so called delta-points for aborting certain language detection. // The value 80000 is good enough for speed and detection accuracy. // If you set the value of $max_delta too low, no language will be recognized. // $max_delta = 400 * 350 = 140000 is the best detection with lowest speed. -define ('LANGUAGE_DETECT_MAX_DELTA', 140000); +define('LANGUAGE_DETECT_MAX_DELTA', 140000); /** * Initialization of some internal default values in the internationalization library. @@ -1811,6 +1812,7 @@ function api_strlen($string, $encoding = null) { if (_api_iconv_supports($encoding)) { return @iconv_strlen($string, $encoding); } + return strlen($string); } @@ -3300,8 +3302,8 @@ function api_detect_encoding($string, $language = null) { */ function api_is_valid_utf8(&$string) { - return Utf8::isUtf8($string); + return Utf8::isUtf8($string); } /** diff --git a/main/install/index.php b/main/install/index.php index 4442565f7f..42796143dc 100755 --- a/main/install/index.php +++ b/main/install/index.php @@ -125,7 +125,6 @@ require_once __DIR__.'/version.php'; if (isAlreadyInstalledSystem()) { // The system has already been installed, so block re-installation. $global_error_code = 6; - // @todo uncomment this. require '../inc/global_error_message.inc.php'; die(); } @@ -407,6 +406,7 @@ if ($installType == 'new') { $update_from_version = isset($update_from_version) ? $update_from_version : null; $instalation_type_label = get_lang('UpdateFromLMSVersion').(is_array($update_from_version) ? implode('|', $update_from_version) : ''); } + if (!empty($instalation_type_label) && empty($_POST['step6'])) { echo ''; } @@ -675,7 +675,14 @@ if (@$_POST['step2']) { Database::query("ALTER TABLE c_survey MODIFY COLUMN anonymous char(10) NOT NULL default '0'"); // Migrate using the file Version110.php - migrate('110', 1, $dbNameForm, $dbUsernameForm, $dbPassForm, $dbHostForm, $manager); + migrate( + 110, + $dbNameForm, + $dbUsernameForm, + $dbPassForm, + $dbHostForm, + $manager + ); include 'update-files-1.9.0-1.10.0.inc.php'; // Only updates the configuration.inc.php with the new version include 'update-configuration.inc.php'; diff --git a/main/install/install.lib.php b/main/install/install.lib.php index 3822ad44fd..c435d8e516 100755 --- a/main/install/install.lib.php +++ b/main/install/install.lib.php @@ -636,6 +636,7 @@ function display_language_selection() * * @param string $installType * @param boolean $badUpdatePath + * @param boolean $badUpdatePath * @param string The updatePath given (if given) * @param array $update_from_version_8 The different subversions from version 1.9 * @@ -978,13 +979,19 @@ function display_requirements( - +
: + +
- + - +
@@ -1087,8 +1094,12 @@ function display_requirements( // And now display the choice buttons (go back or install) ?>

- - + + - + - + @@ -1148,11 +1163,9 @@ function display_license_agreement()

- - -  <?php echo get_lang('Hide') ?>  - - + +  <?php echo get_lang('Hide') ?>  +
@@ -1907,7 +1920,16 @@ function installSettings( } } -function migrate($to, $chamiloVersion, $dbNameForm, $dbUsernameForm, $dbPassForm, $dbHostForm, $manager) +/** + * @param string $chamiloVersion + * @param string $dbNameForm + * @param string $dbUsernameForm + * @param string $dbPassForm + * @param string $dbHostForm + * @param $manager + * @throws \Doctrine\DBAL\DBALException + */ +function migrate($chamiloVersion, $dbNameForm, $dbUsernameForm, $dbPassForm, $dbHostForm, $manager) { $debug = true; // Config doctrine migrations @@ -1929,22 +1951,24 @@ function migrate($to, $chamiloVersion, $dbNameForm, $dbUsernameForm, $dbPassForm // Table name that will store migrations log (will be created automatically, default name is: doctrine_migration_versions) $config->setMigrationsTableName('version'); // Namespace of your migration classes, do not forget escape slashes, do not add last slash - $config->setMigrationsNamespace('Chamilo\CoreBundle\Migrations\Schema\v'.$chamiloVersion); + $config->setMigrationsNamespace('Chamilo\CoreBundle\Migrations\Schema\V'.$chamiloVersion); // Directory where your migrations are located - $config->setMigrationsDirectory(api_get_path(SYS_PATH).'src/Chamilo/CoreBundle/Migrations/Schema/v'.$chamiloVersion); + $config->setMigrationsDirectory(api_get_path(SYS_PATH).'src/Chamilo/CoreBundle/Migrations/Schema/V'.$chamiloVersion); // Load your migrations $config->registerMigrationsFromDirectory($config->getMigrationsDirectory()); $migration = new \Doctrine\DBAL\Migrations\Migration($config); $migrations = $config->getMigrations(); + /** @var Doctrine\DBAL\Migrations\Version $migration */ foreach ($migrations as $migrationItem) { $migrationItem->getMigration()->setEntityManager($manager); } - //$to = '110'; - // Retrieve SQL queries that should be run to migrate you schema to $to version, if $to == null - schema will be migrated to latest version + $to = null; + // Retrieve SQL queries that should be run to migrate you schema to $to version, + // if $to == null - schema will be migrated to latest version $versions = $migration->getSql($to); if ($debug) { $nl = '
'; diff --git a/src/Chamilo/CoreBundle/Migrations/Schema/v1/Version110.php b/src/Chamilo/CoreBundle/Migrations/Schema/V110/Version110.php similarity index 90% rename from src/Chamilo/CoreBundle/Migrations/Schema/v1/Version110.php rename to src/Chamilo/CoreBundle/Migrations/Schema/V110/Version110.php index 32e3d6d4f2..4aae997f5a 100644 --- a/src/Chamilo/CoreBundle/Migrations/Schema/v1/Version110.php +++ b/src/Chamilo/CoreBundle/Migrations/Schema/V110/Version110.php @@ -1,13 +1,14 @@ addSql("CREATE TABLE IF NOT EXISTS c_student_publication_comment (id INT PRIMARY KEY NOT NULL AUTO_INCREMENT, work_id INT NOT NULL, c_id INT NOT NULL, comment text, file VARCHAR(255), user_id int NOT NULL, sent_at datetime NOT NULL)"); $this->addSql("CREATE TABLE IF NOT EXISTS c_attendance_calendar_rel_group (id int NOT NULL auto_increment PRIMARY KEY, c_id INT NOT NULL, group_id INT NOT NULL, calendar_id INT NOT NULL)"); - $this->addSql(" - CREATE TABLE IF NOT EXISTS sequence_rule ( - id int unsigned not null auto_increment, - description TEXT default '', - PRIMARY KEY (id) - )"); - - $this->addSql(" - CREATE TABLE IF NOT EXISTS sequence_condition ( - id int unsigned not null auto_increment, - description TEXT default '', - mat_op char(2) not null, - param float not null, - act_true int unsigned, - act_false int unsigned, - PRIMARY KEY (id) - );"); - - $this->addSql(" - CREATE TABLE IF NOT EXISTS sequence_rule_condition ( - id int unsigned not null auto_increment, - sequence_rule_id int unsigned not null, - sequence_condition_id int unsigned not null, - PRIMARY KEY (id) - );"); - - $this->addSql(" - CREATE TABLE IF NOT EXISTS sequence_method ( - id int unsigned not null auto_increment, - description TEXT default '', - formula TEXT default '', - assign int unsigned not null, - met_type varchar(50) default '', - PRIMARY KEY (id) - );"); - - $this->addSql(" - CREATE TABLE IF NOT EXISTS sequence_rule_method ( - id int unsigned not null auto_increment, - sequence_rule_id int unsigned not null, - sequence_method_id int unsigned not null, - method_order int unsigned not null, - PRIMARY KEY (id) - );"); - - $this->addSql(" - CREATE TABLE IF NOT EXISTS sequence_variable ( - id int unsigned not null auto_increment, - description TEXT default '', - name varchar(50), - default_val varchar(50) default '', - PRIMARY KEY (id) - );"); - - $this->addSql(" - CREATE TABLE IF NOT EXISTS sequence_formula ( - id int unsigned not null auto_increment, - sequence_method_id int unsigned not null, - sequence_variable_id int unsigned not null, - PRIMARY KEY (id) - );"); - - $this->addSql(" - CREATE TABLE IF NOT EXISTS sequence_valid ( - id int unsigned not null auto_increment, - sequence_variable_id int unsigned not null, - sequence_condition_id int unsigned not null, - PRIMARY KEY (id) - );"); - - $this->addSql(" - CREATE TABLE IF NOT EXISTS sequence_type_entity ( - id int unsigned not null auto_increment, - name varchar(50) not null default '', - description TEXT default '', - ent_table varchar(50) not null, - PRIMARY KEY (id) - );"); - - $this->addSql(" - CREATE TABLE IF NOT EXISTS sequence_row_entity ( - id int unsigned not null auto_increment, - sequence_type_entity_id int unsigned not null, - c_id int unsigned not null, - session_id int unsigned not null default 0, - row_id int unsigned not null, - name varchar(200) not null default '', - PRIMARY KEY (id) - );"); - - $this->addSql(" - CREATE TABLE IF NOT EXISTS sequence ( - id int unsigned not null auto_increment, - sequence_row_entity_id int unsigned not null, - sequence_row_entity_id_next int unsigned not null, - is_part tinyint unsigned not null default 0, - PRIMARY KEY (id) - );"); - - $this->addSql(" - CREATE TABLE IF NOT EXISTS sequence_value ( - id int unsigned not null auto_increment, - user_id int unsigned not null, - sequence_row_entity_id int unsigned not null, - advance float not null default 0.0, - complete_items int not null default 0, - total_items int not null default 1, - success tinyint not null default 0, - success_date datetime not null, - available tinyint not null default 0, - available_start_date datetime not null, - available_end_date datetime not null, - PRIMARY KEY (id) - );"); - //$this->addSql("ALTER TABLE skill_rel_user ADD COLUMN course_id INT NOT NULL DEFAULT 0 AFTER id"); //$this->addSql("ALTER TABLE skill_rel_user ADD COLUMN session_id INT NOT NULL DEFAULT 0 AFTER course_id"); //$this->addSql("ALTER TABLE skill_rel_user ADD INDEX idx_select_cs (course_id, session_id)"); @@ -745,11 +631,11 @@ class Version110 extends AbstractMigrationChamilo */ //$this->addSql('ALTER TABLE user DROP COLUMN user_id'); - //$this->addSql("UPDATE settings_current SET selected_value = '1.10.0.35' WHERE variable = 'chamilo_database_version'"); } /** + * We don't allow downgrades yet * @param Schema $schema */ public function down(Schema $schema) diff --git a/src/Chamilo/CoreBundle/Migrations/Schema/V110/Version20150423093100.php b/src/Chamilo/CoreBundle/Migrations/Schema/V110/Version20150423093100.php new file mode 100644 index 0000000000..0697ffd6f4 --- /dev/null +++ b/src/Chamilo/CoreBundle/Migrations/Schema/V110/Version20150423093100.php @@ -0,0 +1,147 @@ +addSql(" + CREATE TABLE IF NOT EXISTS sequence_rule ( + id int unsigned not null auto_increment, + description TEXT default '', + PRIMARY KEY (id) + )"); + + $this->addSql(" + CREATE TABLE IF NOT EXISTS sequence_condition ( + id int unsigned not null auto_increment, + description TEXT default '', + mat_op char(2) not null, + param float not null, + act_true int unsigned, + act_false int unsigned, + PRIMARY KEY (id) + );"); + + $this->addSql(" + CREATE TABLE IF NOT EXISTS sequence_rule_condition ( + id int unsigned not null auto_increment, + sequence_rule_id int unsigned not null, + sequence_condition_id int unsigned not null, + PRIMARY KEY (id) + );"); + + $this->addSql(" + CREATE TABLE IF NOT EXISTS sequence_method ( + id int unsigned not null auto_increment, + description TEXT default '', + formula TEXT default '', + assign int unsigned not null, + met_type varchar(50) default '', + PRIMARY KEY (id) + );"); + + $this->addSql(" + CREATE TABLE IF NOT EXISTS sequence_rule_method ( + id int unsigned not null auto_increment, + sequence_rule_id int unsigned not null, + sequence_method_id int unsigned not null, + method_order int unsigned not null, + PRIMARY KEY (id) + );"); + + $this->addSql(" + CREATE TABLE IF NOT EXISTS sequence_variable ( + id int unsigned not null auto_increment, + description TEXT default '', + name varchar(50), + default_val varchar(50) default '', + PRIMARY KEY (id) + );"); + + $this->addSql(" + CREATE TABLE IF NOT EXISTS sequence_formula ( + id int unsigned not null auto_increment, + sequence_method_id int unsigned not null, + sequence_variable_id int unsigned not null, + PRIMARY KEY (id) + );"); + + $this->addSql(" + CREATE TABLE IF NOT EXISTS sequence_valid ( + id int unsigned not null auto_increment, + sequence_variable_id int unsigned not null, + sequence_condition_id int unsigned not null, + PRIMARY KEY (id) + );"); + + $this->addSql(" + CREATE TABLE IF NOT EXISTS sequence_type_entity ( + id int unsigned not null auto_increment, + name varchar(50) not null default '', + description TEXT default '', + ent_table varchar(50) not null, + PRIMARY KEY (id) + );"); + + $this->addSql(" + CREATE TABLE IF NOT EXISTS sequence_row_entity ( + id int unsigned not null auto_increment, + sequence_type_entity_id int unsigned not null, + c_id int unsigned not null, + session_id int unsigned not null default 0, + row_id int unsigned not null, + name varchar(200) not null default '', + PRIMARY KEY (id) + );"); + + $this->addSql(" + CREATE TABLE IF NOT EXISTS sequence ( + id int unsigned not null auto_increment, + sequence_row_entity_id int unsigned not null, + sequence_row_entity_id_next int unsigned not null, + is_part tinyint unsigned not null default 0, + PRIMARY KEY (id) + );"); + + $this->addSql(" + CREATE TABLE IF NOT EXISTS sequence_value ( + id int unsigned not null auto_increment, + user_id int unsigned not null, + sequence_row_entity_id int unsigned not null, + advance float not null default 0.0, + complete_items int not null default 0, + total_items int not null default 1, + success tinyint not null default 0, + success_date datetime not null, + available tinyint not null default 0, + available_start_date datetime not null, + available_end_date datetime not null, + PRIMARY KEY (id) + );"); + } + + /** + * We don't allow downgrades yet + * @param Schema $schema + */ + public function down(Schema $schema) + { + } +} diff --git a/src/Chamilo/CoreBundle/Migrations/Schema/v1/Version111.php b/src/Chamilo/CoreBundle/Migrations/Schema/V111/Version111.php similarity index 93% rename from src/Chamilo/CoreBundle/Migrations/Schema/v1/Version111.php rename to src/Chamilo/CoreBundle/Migrations/Schema/V111/Version111.php index ee99e48d94..521eab49ac 100644 --- a/src/Chamilo/CoreBundle/Migrations/Schema/v1/Version111.php +++ b/src/Chamilo/CoreBundle/Migrations/Schema/V111/Version111.php @@ -1,7 +1,7 @@