[ Index ] |
|
Code source de Claroline 188 |
1 <?php // $Id: upgrade_main_db_16.lib.php,v 1.4 2006/09/01 13:27:10 mathieu Exp $ 2 if ( count( get_included_files() ) == 1 ) die( '---' ); 3 /** 4 * CLAROLINE 5 * 6 * Sql query to update main database 7 * 8 * @version 1.8 $Revision: 1.4 $ 9 * 10 * @copyright (c) 2001-2006 Universite catholique de Louvain (UCL) 11 * 12 * @license http://www.gnu.org/copyleft/gpl.html (GPL) GENERAL PUBLIC LICENSE 13 * 14 * @see http://www.claroline.net/wiki/index.php/Upgrade_claroline_1.6 15 * 16 * @package UPGRADE 17 * 18 * @author Claro Team <cvs@claroline.net> 19 * @author Mathieu Laurent <mla@claroline.net> 20 * @author Christophe Gesché <moosh@claroline.net> 21 * 22 */ 23 24 /*=========================================================================== 25 Upgrade to claroline 1.6 26 ===========================================================================*/ 27 28 function upgrade_main_database_to_16 () 29 { 30 $tbl_mdb_names = claro_sql_get_main_tbl(); 31 $tool = 'MAINDB16'; 32 33 switch( $step = get_upgrade_status($tool) ) 34 { 35 case 1 : 36 37 $lenForDbNameOfACourse = 20 + 30; // (max for prefix + max for code course); 38 39 // Update table admin 40 $sqlForUpdate[] = "ALTER IGNORE TABLE `" . $tbl_mdb_names['admin'] . "` CHANGE `idUser` `idUser` int(11) unsigned NOT NULL default '0'"; 41 42 // Create new table class 43 $sqlForUpdate[] = "CREATE TABLE IF NOT EXISTS `" . $tbl_mdb_names['class'] . "` ( 44 `id` int(11) NOT NULL auto_increment, 45 `name` varchar(100) NOT NULL default '', 46 `class_parent_id` int(11) default NULL, 47 `class_level` int(11) NOT NULL default '0', 48 PRIMARY KEY (`id`) 49 ) TYPE=MyISAM"; 50 51 // Create new table rel_class_user 52 $sqlForUpdate[] = "CREATE TABLE IF NOT EXISTS `" . $tbl_mdb_names['rel_class_user'] . "` ( 53 `id` int(11) NOT NULL auto_increment, 54 `user_id` int(11) NOT NULL default '0', 55 `class_id` int(11) NOT NULL default '0', 56 PRIMARY KEY (`id`) 57 ) TYPE=MyISAM"; 58 59 // Update table user_id 60 $sqlForUpdate[] = "ALTER IGNORE TABLE `" . $tbl_mdb_names['user'] . "` CHANGE `user_id` `user_id` int(11) unsigned NOT NULL auto_increment" ; 61 $sqlForUpdate[] = "ALTER IGNORE TABLE `" . $tbl_mdb_names['user'] . "` CHANGE `creatorId` `creatorId` int(11) unsigned default NULL" ; 62 63 // Update table cours 64 $sqlForUpdate[] = " ALTER IGNORE TABLE `" . $tbl_mdb_names['course'] . "` CHANGE `dbName` `dbName` varchar(".$lenForDbNameOfACourse.") default NULL"; 65 66 // Create new table config_file 67 $sqlForUpdate[] = "CREATE TABLE IF NOT EXISTS `" . $tbl_mdb_names['config_file'] . "` ( 68 `config_code` varchar(30) NOT NULL default '', 69 `config_hash` varchar(40) NOT NULL default '', 70 PRIMARY KEY (`config_code` ) 71 ) TYPE=MyISAM AVG_ROW_LENGTH=48"; 72 73 74 // Create new table sso 75 $sqlForUpdate[] = "CREATE TABLE IF NOT EXISTS`" . $tbl_mdb_names['sso'] . "` ( 76 `id` int(11) NOT NULL auto_increment, 77 `cookie` varchar(255) NOT NULL default '', 78 `rec_time` datetime NOT NULL default '0000-00-00 00:00:00', 79 `user_id` int(11) NOT NULL default '0', 80 PRIMARY KEY (`id`) 81 ) TYPE=MyISAM"; 82 83 // Update course tool icon 84 $sqlForUpdate[] = "UPDATE `" . $tbl_mdb_names['tool'] . "` SET `icon` = 'announcement.gif' WHERE `claro_label` = 'CLANN___'"; 85 $sqlForUpdate[] = "UPDATE `" . $tbl_mdb_names['tool'] . "` SET `icon` = 'assignment.gif' WHERE `claro_label` = 'CLWRK___'"; 86 $sqlForUpdate[] = "UPDATE `" . $tbl_mdb_names['tool'] . "` SET `icon` = 'chat.gif' WHERE `claro_label` = 'CLCHT___'"; 87 $sqlForUpdate[] = "UPDATE `" . $tbl_mdb_names['tool'] . "` SET `icon` = 'document.gif' WHERE `claro_label` = 'CLDOC___'"; 88 $sqlForUpdate[] = "UPDATE `" . $tbl_mdb_names['tool'] . "` SET `icon` = 'learnpath.gif' WHERE `claro_label` = 'CLLNP___'"; 89 $sqlForUpdate[] = "UPDATE `" . $tbl_mdb_names['tool'] . "` SET `icon` = 'user.gif' WHERE `claro_label` = 'CLUSR___'"; 90 91 // Update table track_e_default 92 $sqlForUpdate[] = "ALTER IGNORE TABLE `" . $tbl_mdb_names['track_e_default'] . "` CHANGE `default_user_id` `default_user_id` int(11) NOT NULL default '0'" ; 93 94 // Update table login_user_id 95 $sqlForUpdate[] = "ALTER IGNORE TABLE `" . $tbl_mdb_names['track_e_login'] . "` CHANGE `login_user_id` `login_user_id` int(11) NOT NULL default '0'" ; 96 97 if ( upgrade_apply_sql($sqlForUpdate) ) 98 { 99 $step = set_upgrade_status($tool, 2); 100 } 101 else 102 { 103 return $step ; 104 } 105 106 case 2 : 107 108 if ( fill_table_config_with_md5() ) 109 { 110 $step = set_upgrade_status($tool, 0); 111 } 112 else 113 { 114 return $step ; 115 } 116 117 default : 118 119 $step = set_upgrade_status($tool, 0); 120 return $step; 121 } 122 123 return false; 124 } 125 126 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Thu Nov 29 14:38:42 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |