Pārlūkot izejas kodu

Updating chash.

Julio Montoya 11 gadi atpakaļ
vecāks
revīzija
fab240a41c

+ 32 - 0
vendor/chamilo/chash/src/Chash/Command/Installation/InstallCommand.php

@@ -359,6 +359,22 @@ class InstallCommand extends CommonCommand
                     $configuration = $this->getConfigurationHelper()->readConfigurationFile($configurationFile);
                     $this->setConfigurationArray($configuration);
 
+
+                    $configPath = $this->getConfigurationPath();
+                    // Only works with 1.10.0 >=
+                    $installChamiloPath = str_replace('config', 'main/install', $configPath);
+                    $customVersion = $installChamiloPath.$version;
+
+                    $output->writeln("Checking custom update.sql file in dir: ".$customVersion);
+                    if (is_dir($customVersion)) {
+                        $file = $customVersion.'/update.sql';
+                        if (is_file($file) && file_exists($file)) {
+                            $this->importSQLFile($file, $output);
+                        }
+                    } else {
+                        $output->writeln("Nothing to update");
+                    }
+
                     $this->setPortalSettingsInChamilo($output, $this->getHelper('db')->getConnection());
                     $this->setAdminSettingsInChamilo($output, $this->getHelper('db')->getConnection());
 
@@ -475,6 +491,22 @@ class InstallCommand extends CommonCommand
         return false;
     }
 
+    private function importSQLFile($file, $output)
+    {
+        $command = $this->getApplication()->find('dbal:import');
+
+        // Importing sql files.
+        $arguments = array(
+            'command' => 'dbal:import',
+            'file' =>  $file
+        );
+        $input = new ArrayInput($arguments);
+        $command->run($input, $output);
+
+        // Getting extra information about the installation.
+        $output->writeln("<comment>File loaded </comment><info>$file</info>");
+    }
+
      /**
      *
      * In step 3. Tests establishing connection to the database server.

+ 3 - 0
vendor/chamilo/chash/src/Chash/Resources/Database/1.10.0/db_course.sql

@@ -1394,6 +1394,8 @@ CREATE TABLE c_quiz_question (
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
 /*!40101 SET character_set_client = @saved_cs_client */;
 
+ALTER TABLE c_quiz_question ADD INDEX idx_c_q_qst_cpt (c_id, parent_id, type);
+
 --
 -- Table structure for table c_quiz_category
 --
@@ -1446,6 +1448,7 @@ CREATE TABLE c_quiz_question_rel_category (
   PRIMARY KEY (iid)
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
 
+ALTER TABLE c_quiz_question_rel_category ADD INDEX idx_c_q_qst_r_cat_qc(question_id, c_id);
 
 DROP TABLE IF EXISTS c_quiz_rel_category;
 /*!40101 SET @saved_cs_client     = @@character_set_client */;

+ 28 - 11
vendor/chamilo/chash/src/Chash/Resources/Database/1.10.0/db_main.sql

@@ -957,6 +957,8 @@ VALUES
 ('settings_latest_update', NULL, NULL, NULL, '', '','', NULL, NULL, 0),
 ('user_name_order', NULL, 'textfield', 'Platform', '', 'UserNameOrderTitle', 'UserNameOrderComment', NULL, NULL, 1),
 ('allow_teachers_to_create_sessions', NULL,'radio','Session','false','AllowTeachersToCreateSessionsTitle','AllowTeachersToCreateSessionsComment', NULL, NULL, 0),
+('use_virtual_keyboard', NULL, 'radio', 'Platform', 'false','ShowVirtualKeyboardTitle','ShowVirtualKeyboardComment', NULL, NULL, 1),
+('disable_copy_paste', NULL, 'radio', 'Platform', 'false','DisableCopyPasteTitle','DisableCopyPasteComment', NULL, NULL, 1),
 ('login_as_allowed', NULL, 'radio', 'Security', 'true', 'AdminLoginAsAllowedTitle', 'AdminLoginAsAllowedComment', 1, 0, 1),
 ('admins_can_set_users_pass', NULL, 'radio', 'security', 'true', 'AdminsCanChangeUsersPassTitle', 'AdminsCanChangeUsersPassComment', 1, 0, 1),
 ('template', NULL, 'text', 'stylesheets', 'default', 'DefaultTemplateTitle', 'DefaultTemplateComment', NULL, NULL, 1),
@@ -1311,6 +1313,10 @@ VALUES
 ('session_page_enabled', 'false', 'No'),
 ('allow_teachers_to_create_sessions', 'true', 'Yes'),
 ('allow_teachers_to_create_sessions', 'false', 'No'),
+('use_virtual_keyboard', 'true', 'Yes'),
+('use_virtual_keyboard', 'false', 'No'),
+('disable_copy_paste', 'true', 'Yes'),
+('disable_copy_paste', 'false', 'No'),
 ('login_as_allowed','true','Yes'),
 ('login_as_allowed','false','No'),
 ('admins_can_set_users_pass','true','Yes'),
@@ -3082,19 +3088,26 @@ CREATE TABLE branch_sync(
   admin_phone varchar(250) default '',
   last_sync_trans_id bigint unsigned default 0,
   last_sync_trans_date datetime,
-  last_sync_type char(20) default 'full'
+  last_sync_type char(20) default 'full',
+  ssl_pub_key varchar(250) default '',
+  branch_type varchar(250) default null,
+  lft int unsigned,
+  rgt int unsigned,
+  lvl int unsigned,
+  root int unsigned,
+  parent_id int unsigned
 );
 
-DROP TABLE IF EXISTS branch_sync_log;
-CREATE TABLE branch_sync_log(
+INSERT INTO branch_sync (id, access_url_id, branch_name, branch_ip) VALUES (1, 1, 'Local', '127.0.0.1');
+
+DROP TABLE IF EXISTS branch_transaction_log;
+CREATE TABLE branch_transaction_log(
   id bigint unsigned not null AUTO_INCREMENT PRIMARY KEY,
-  branch_sync_id int unsigned not null,
-  sync_trans_id bigint unsigned default 0,
-  sync_trans_date datetime,
-  sync_type char(20)
+  transaction_id bigint unsigned not null default 0,
+  import_time datetime,
+  message mediumtext not null
 );
 
-
 DROP TABLE IF EXISTS branch_transaction_status;
 CREATE TABLE branch_transaction_status (
     id tinyint not null PRIMARY KEY AUTO_INCREMENT,
@@ -3110,15 +3123,19 @@ CREATE TABLE branch_transaction (
     branch_id int not null default 0,
     action char(20),
     item_id char(36),
-    orig_id char(36),
     dest_id char(36),
-    info char(20),
     status_id tinyint not null default 0,
     time_insert datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
     time_update datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
     PRIMARY KEY (id, transaction_id, branch_id)
 );
 
+CREATE TABLE IF NOT EXISTS branch_transaction_data (
+    id bigint unsigned NOT NULL PRIMARY KEY,
+    data text CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL
+);
+
+
 -- Stats database
 
 
@@ -3610,4 +3627,4 @@ CREATE TABLE curriculum_rel_user (
 
 
 -- Do not move this
-UPDATE settings_current SET selected_value = '1.10.0.034' WHERE variable = 'chamilo_database_version';
+UPDATE settings_current SET selected_value = '1.10.0.035' WHERE variable = 'chamilo_database_version';

+ 5 - 1
vendor/chamilo/chash/src/Chash/Resources/Database/1.10.0/migrate-db-1.9.0-1.10.0-pre.sql

@@ -371,5 +371,9 @@ INSERT INTO settings_current(variable, subkey, type, category, selected_value, t
 
 ALTER TABLE c_quiz_category ADD COLUMN visibility INT default 1;
 
+ALTER TABLE c_quiz_question ADD INDEX idx_c_q_qst_cpt (c_id, parent_id, type);
+ALTER TABLE c_quiz_question_rel_category ADD INDEX idx_c_q_qst_r_cat_qc(question_id, c_id);
+
+
 -- Do not move this
-UPDATE settings_current SET selected_value = '1.10.0.034' WHERE variable = 'chamilo_database_version';
+UPDATE settings_current SET selected_value = '1.10.0.035' WHERE variable = 'chamilo_database_version';