Changeset 10034
- Timestamp:
- 11/28/08 16:50:20 (1 month ago)
- Files:
-
- trunk/jaws/html/upgrade/JawsUpgrader.php (modified) (4 diffs)
- trunk/jaws/html/upgrade/index.php (modified) (3 diffs)
- trunk/jaws/html/upgrade/stagelist.php (modified) (2 diffs)
- trunk/jaws/html/upgrade/stages/07To080.php (modified) (4 diffs)
- trunk/jaws/html/upgrade/stages/082To083 (added)
- trunk/jaws/html/upgrade/stages/082To083.php (added)
- trunk/jaws/html/upgrade/stages/082To083/icon.png (added)
- trunk/jaws/html/upgrade/stages/082To083/templates (added)
- trunk/jaws/html/upgrade/stages/082To083/templates/display.html (added)
- trunk/jaws/html/upgrade/stages/083To084 (added)
- trunk/jaws/html/upgrade/stages/083To084.php (added)
- trunk/jaws/html/upgrade/stages/083To084/icon.png (added)
- trunk/jaws/html/upgrade/stages/083To084/templates (added)
- trunk/jaws/html/upgrade/stages/083To084/templates/display.html (added)
- trunk/jaws/html/upgrade/stages/084To085 (added)
- trunk/jaws/html/upgrade/stages/084To085.php (added)
- trunk/jaws/html/upgrade/stages/084To085/icon.png (added)
- trunk/jaws/html/upgrade/stages/084To085/templates (added)
- trunk/jaws/html/upgrade/stages/084To085/templates/display.html (added)
- trunk/jaws/html/upgrade/stages/085To086 (added)
- trunk/jaws/html/upgrade/stages/085To086.php (added)
- trunk/jaws/html/upgrade/stages/085To086/icon.png (added)
- trunk/jaws/html/upgrade/stages/085To086/templates (added)
- trunk/jaws/html/upgrade/stages/085To086/templates/display.html (added)
- trunk/jaws/html/upgrade/stages/086To087 (added)
- trunk/jaws/html/upgrade/stages/086To087.php (added)
- trunk/jaws/html/upgrade/stages/086To087/icon.png (added)
- trunk/jaws/html/upgrade/stages/086To087/templates (added)
- trunk/jaws/html/upgrade/stages/086To087/templates/display.html (added)
- trunk/jaws/html/upgrade/stages/08To081 (added)
- trunk/jaws/html/upgrade/stages/08To081.php (modified) (2 diffs)
- trunk/jaws/html/upgrade/stages/08To081/icon.png (added)
- trunk/jaws/html/upgrade/stages/08To081/templates (added)
- trunk/jaws/html/upgrade/stages/08To081/templates/display.html (added)
- trunk/jaws/html/upgrade/stages/Database.php (modified) (2 diffs)
- trunk/jaws/html/upgrade/stages/Report.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/jaws/html/upgrade/JawsUpgrader.php
r7925 r10034 17 17 * @var string 18 18 */ 19 var $ Path = '';19 var $_db_file_config; 20 20 21 21 /** … … 30 30 * @param string The path this upgrader is running from. 31 31 */ 32 function JawsUpgrader($ path)32 function JawsUpgrader($db_config) 33 33 { 34 $this-> Path = $path;34 $this->_db_file_config = $db_config; 35 35 } 36 36 … … 59 59 if ($instance) { 60 60 include_once $file; 61 $class = 'Upgrader_' . $stage['file']; 62 $ce = version_compare(PHP_VERSION, '5.0', '>=') ? class_exists($class, false) : class_exists($class); 63 if ($ce) { 64 $stage = new $class; 61 $classname = 'Upgrader_' . $stage['file']; 62 $classExists = version_compare(PHP_VERSION, '5.0', '>=') ? 63 class_exists($classname, false) : class_exists($classname); 64 if ($classExists) { 65 if (isset($stage['options'])) { 66 $stage = new $classname($stage['options']); 67 } else { 68 $stage = new $classname; 69 } 70 65 71 return $stage; 66 72 } 67 73 68 Jaws_Error::Fatal("The ".$stage['name']." stage couldn't be loaded, because the class ".$stage['file']." couldn't be found.", __FILE__, __LINE__); 74 Jaws_Error::Fatal("The ".$stage['name']." stage couldn't be loaded, because the class ". 75 $stage['file']." couldn't be found.", __FILE__, __LINE__); 69 76 } 70 77 … … 91 98 * @return bool|Jaws_Error 92 99 */ 93 function LoadStages( $list)100 function LoadStages(&$stages) 94 101 { 95 if (!file_exists($list)) {96 Jaws_Error::Fatal("The stage list couldn't be found at <strong>${list}</strong>.", __FILE__, __LINE__);97 }98 99 include_once $list;100 102 foreach ($stages as $stage) { 101 103 if (isset($stage['name']) && isset($stage['file'])) { trunk/jaws/html/upgrade/index.php
r9222 r10034 37 37 } 38 38 39 define('JAWS_PATH', dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR); 40 define('JAWS_IPATH', JAWS_PATH); //temporary 41 39 require dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'config/JawsConfig.php'; 42 40 // lets setup the include_path 43 41 set_include_path('.' . PATH_SEPARATOR . JAWS_PATH . 'libraries/pear'); … … 49 47 require_once JAWS_PATH . 'include/Jaws/Version.php'; 50 48 require_once JAWS_PATH . 'include/Jaws/Utils.php'; 51 require_once JAWS_PATH . 'include/Jaws/Gadget /Info.php';49 require_once JAWS_PATH . 'include/Jaws/GadgetInfo.php'; 52 50 53 51 if (!isset($_SESSION['upgrade'])) { … … 93 91 } 94 92 93 require_once 'stagelist.php'; 95 94 require_once 'JawsUpgrader.php'; 96 95 require_once 'JawsUpgraderStage.php'; 97 98 // this variables currently temporary util we complete multible instance installing99 define('JAWS_DATA', JAWS_PATH . 'data'. DIRECTORY_SEPARATOR);100 96 define('UPGRADE_PATH', dirname(__FILE__) . DIRECTORY_SEPARATOR); 101 97 102 $upgrader = new JawsUpgrader( JAWS_PATH);103 $upgrader->loadStages( 'stagelist.php');98 $upgrader = new JawsUpgrader($db); 99 $upgrader->loadStages($stages); 104 100 $stages = $upgrader->getStages(); 105 101 $stage = $stages[$_SESSION['upgrade']['stage']]; trunk/jaws/html/upgrade/stagelist.php
r7925 r10034 32 32 // Database setup and population. 33 33 $stages[] = array( 34 'name' => _t('UPGRADE_DATABASE'), 35 'file' => 'Database', 34 'name' => _t('UPGRADE_DATABASE'), 35 'file' => 'Database', 36 'options' => $db, 36 37 ); 37 38 … … 48 49 ); 49 50 51 // Upgrade from 0.8.0 to 0.8.1 52 $stages[] = array( 53 'name' => _t('UPGRADE_VER_TO_VER', '0.8.0', '0.8.1'), 54 'file' => '08To081', 55 ); 56 57 // Upgrade from 0.8.2 to 0.8.3 58 $stages[] = array( 59 'name' => _t('UPGRADE_VER_TO_VER', '0.8.2', '0.8.3'), 60 'file' => '082To083', 61 ); 62 63 // Upgrade from 0.8.3 to 0.8.4 64 $stages[] = array( 65 'name' => _t('UPGRADE_VER_TO_VER', '0.8.3', '0.8.4'), 66 'file' => '083To084', 67 ); 68 69 // Upgrade from 0.8.4 to 0.8.5 70 $stages[] = array( 71 'name' => _t('UPGRADE_VER_TO_VER', '0.8.4', '0.8.5'), 72 'file' => '084To085', 73 ); 74 75 // Upgrade from 0.8.5 to 0.8.6 76 $stages[] = array( 77 'name' => _t('UPGRADE_VER_TO_VER', '0.8.5', '0.8.6'), 78 'file' => '085To086', 79 ); 80 81 // Upgrade from 0.8.6 to 0.8.7 82 $stages[] = array( 83 'name' => _t('UPGRADE_VER_TO_VER', '0.8.6', '0.8.7'), 84 'file' => '086To087', 85 ); 86 50 87 // Saves the config file. 51 88 $stages[] = array( trunk/jaws/html/upgrade/stages/07To080.php
r9746 r10034 43 43 // Connect to database 44 44 require_once JAWS_PATH . 'include/Jaws/DB.php'; 45 $_SESSION['upgrade']['Database']['charset'] = '';46 45 $GLOBALS['db'] = new Jaws_DB($_SESSION['upgrade']['Database']); 47 46 if (Jaws_Error::IsError($GLOBALS['db'])) { … … 133 132 //Make sure user don't have any data/cache/registry|acl stuff 134 133 $path = JAWS_DATA . 'cache/registry'; 135 if (!Jaws_Utils::Delete($path )) {134 if (!Jaws_Utils::Delete($path, false)) { 136 135 log_upgrade("Can't delete $path"); 137 136 } 138 137 139 138 $path = JAWS_DATA . 'cache/acl'; 140 if (!Jaws_Utils::Delete($path )) {139 if (!Jaws_Utils::Delete($path, false)) { 141 140 log_upgrade("Can't delete $path"); 142 141 } … … 206 205 array('/network/proxy_user', ''), 207 206 array('/network/proxy_pass', ''), 208 array('/network/mailer', ' phpmail'),207 array('/network/mailer', 'smtp'), 209 208 array('/network/from_email', ''), 210 209 array('/network/from_name', ''), … … 278 277 //Make sure user don't have any data/cache/registry|acl stuff 279 278 $path = JAWS_DATA . 'cache/registry'; 280 if (!Jaws_Utils::Delete($path )) {279 if (!Jaws_Utils::Delete($path, false)) { 281 280 log_upgrade("Can't delete $path"); 282 281 } 283 282 284 283 $path = JAWS_DATA . 'cache/acl'; 285 if (!Jaws_Utils::Delete($path )) {284 if (!Jaws_Utils::Delete($path, false)) { 286 285 log_upgrade("Can't delete $path"); 287 286 } trunk/jaws/html/upgrade/stages/08To081.php
r9365 r10034 42 42 // Connect to database 43 43 require_once JAWS_PATH . 'include/Jaws/DB.php'; 44 $_SESSION['upgrade']['Database']['charset'] = '';45 44 $GLOBALS['db'] = new Jaws_DB($_SESSION['upgrade']['Database']); 46 45 if (Jaws_Error::IsError($GLOBALS['db'])) { … … 81 80 $GLOBALS['app']->Registry->commit('core'); 82 81 83 if ($_SESSION['upgrade']['versions_to_upgrade'] == 1) {84 $_SESSION['upgrade']['stage']++;85 }86 82 return true; 87 83 } trunk/jaws/html/upgrade/stages/Database.php
r10013 r10034 26 26 'port' => '', 27 27 ); 28 29 /** 30 * Default values. 31 * @var string 32 * @access protected 33 */ 34 var $_db_charset = 'UTF8'; 35 36 /** 37 * Constructor 38 * 39 * @param array The database configuration 40 */ 41 function Upgrader_Database($db_config) 42 { 43 $this->_Defaults['host'] = $db_config['host']; 44 $this->_Defaults['user'] = $db_config['user']; 45 $this->_Defaults['isdba'] = $db_config['isdba']; 46 $this->_Defaults['path'] = isset($db_config['path'])? $db_config['path'] : ''; 47 $this->_Defaults['database'] = $db_config['name']; 48 $this->_Defaults['prefix'] = $db_config['prefix']; 49 $this->_Defaults['port'] = $db_config['port']; 50 51 // for fix bug in Jaws 0.7.x 52 $this->_db_charset = ($db_config['charset'] == 'UTF-8')? '' : $db_config['charset']; 53 } 28 54 29 55 /** … … 282 308 'prefix' => $prefix, 283 309 'driver' => $post['driver'], 284 'charset' => 'UTF8',310 'charset' => $this->_db_charset, 285 311 ); 286 312 trunk/jaws/html/upgrade/stages/Report.php
r9599 r10034 31 31 32 32 $supportedversions = array( 33 array( 34 'version' => '0.8.7', 35 'stage' => '11', 36 ), 37 array( 38 'version' => '0.8.6', 39 'stage' => '10', 40 ), 41 array( 42 'version' => '0.8.5', 43 'stage' => '9', 44 ), 33 45 array( 34 46 'version' => '0.8.4',
