Changeset 10032
- Timestamp:
- 11/28/08 16:46:50 (1 month ago)
- Files:
-
- branches/0.8/jaws/html/upgrade/JawsUpgrader.php (modified) (4 diffs)
- branches/0.8/jaws/html/upgrade/index.php (modified) (2 diffs)
- branches/0.8/jaws/html/upgrade/stagelist.php (modified) (2 diffs)
- branches/0.8/jaws/html/upgrade/stages/07To080.php (modified) (1 diff)
- branches/0.8/jaws/html/upgrade/stages/082To083.php (modified) (1 diff)
- branches/0.8/jaws/html/upgrade/stages/083To084.php (modified) (1 diff)
- branches/0.8/jaws/html/upgrade/stages/084To085.php (modified) (1 diff)
- branches/0.8/jaws/html/upgrade/stages/085To086.php (modified) (2 diffs)
- branches/0.8/jaws/html/upgrade/stages/086To087 (added)
- branches/0.8/jaws/html/upgrade/stages/086To087.php (added)
- branches/0.8/jaws/html/upgrade/stages/086To087/icon.png (added)
- branches/0.8/jaws/html/upgrade/stages/086To087/templates (added)
- branches/0.8/jaws/html/upgrade/stages/086To087/templates/display.html (added)
- branches/0.8/jaws/html/upgrade/stages/08To081.php (modified) (1 diff)
- branches/0.8/jaws/html/upgrade/stages/Database.php (modified) (2 diffs)
- branches/0.8/jaws/html/upgrade/stages/Report.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/0.8/jaws/html/upgrade/JawsUpgrader.php
r7925 r10032 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'])) { branches/0.8/jaws/html/upgrade/index.php
r8838 r10032 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'); … … 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']]; branches/0.8/jaws/html/upgrade/stagelist.php
r9813 r10032 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 … … 78 79 ); 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 80 87 // Saves the config file. 81 88 $stages[] = array( branches/0.8/jaws/html/upgrade/stages/07To080.php
r9883 r10032 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'])) { branches/0.8/jaws/html/upgrade/stages/082To083.php
r9608 r10032 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'])) { branches/0.8/jaws/html/upgrade/stages/083To084.php
r9608 r10032 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'])) { branches/0.8/jaws/html/upgrade/stages/084To085.php
r9813 r10032 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'])) { branches/0.8/jaws/html/upgrade/stages/085To086.php
r9857 r10032 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'])) { … … 99 98 } 100 99 101 // don't overwrite config file, for fix problem in 0.7.x database charset connection102 if ($_SESSION['upgrade']['versions_to_upgrade'] < 7) {103 $_SESSION['upgrade']['stage']++;104 }105 106 100 return true; 107 101 } branches/0.8/jaws/html/upgrade/stages/08To081.php
r9391 r10032 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'])) { branches/0.8/jaws/html/upgrade/stages/Database.php
r10012 r10032 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 branches/0.8/jaws/html/upgrade/stages/Report.php
r9813 r10032 31 31 32 32 $supportedversions = array( 33 array( 34 'version' => '0.8.7', 35 'stage' => '11', 36 ), 33 37 array( 34 38 'version' => '0.8.6',
