Changeset 10034

Show
Ignore:
Timestamp:
11/28/08 16:50:20 (1 month ago)
Author:
afz
Message:

port upgrade stuff from branch

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/jaws/html/upgrade/JawsUpgrader.php

    r7925 r10034  
    1717     * @var string 
    1818     */ 
    19     var $Path = ''
     19    var $_db_file_config
    2020 
    2121    /** 
     
    3030     * @param string The path this upgrader is running from. 
    3131     */ 
    32     function JawsUpgrader($path
     32    function JawsUpgrader($db_config
    3333    { 
    34         $this->Path = $path
     34        $this->_db_file_config = $db_config
    3535    } 
    3636 
     
    5959        if ($instance) { 
    6060            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 
    6571                return $stage; 
    6672            } 
    6773 
    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__); 
    6976        } 
    7077 
     
    9198     * @return  bool|Jaws_Error 
    9299     */ 
    93     function LoadStages($list
     100    function LoadStages(&$stages
    94101    { 
    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; 
    100102        foreach ($stages as $stage) { 
    101103            if (isset($stage['name']) && isset($stage['file'])) { 
  • trunk/jaws/html/upgrade/index.php

    r9222 r10034  
    3737} 
    3838 
    39 define('JAWS_PATH', dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR); 
    40 define('JAWS_IPATH', JAWS_PATH); //temporary 
    41  
     39require dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'config/JawsConfig.php'; 
    4240// lets setup the include_path 
    4341set_include_path('.' . PATH_SEPARATOR . JAWS_PATH . 'libraries/pear'); 
     
    4947require_once JAWS_PATH . 'include/Jaws/Version.php'; 
    5048require_once JAWS_PATH . 'include/Jaws/Utils.php'; 
    51 require_once JAWS_PATH . 'include/Jaws/Gadget/Info.php'; 
     49require_once JAWS_PATH . 'include/Jaws/GadgetInfo.php'; 
    5250 
    5351if (!isset($_SESSION['upgrade'])) { 
     
    9391} 
    9492 
     93require_once 'stagelist.php'; 
    9594require_once 'JawsUpgrader.php'; 
    9695require_once 'JawsUpgraderStage.php'; 
    97  
    98 // this variables currently temporary util we complete multible instance installing 
    99 define('JAWS_DATA', JAWS_PATH . 'data'. DIRECTORY_SEPARATOR); 
    10096define('UPGRADE_PATH', dirname(__FILE__) . DIRECTORY_SEPARATOR); 
    10197 
    102 $upgrader = new JawsUpgrader(JAWS_PATH); 
    103 $upgrader->loadStages('stagelist.php'); 
     98$upgrader = new JawsUpgrader($db); 
     99$upgrader->loadStages($stages); 
    104100$stages = $upgrader->getStages(); 
    105101$stage = $stages[$_SESSION['upgrade']['stage']]; 
  • trunk/jaws/html/upgrade/stagelist.php

    r7925 r10034  
    3232// Database setup and population. 
    3333$stages[] = array( 
    34     'name'  => _t('UPGRADE_DATABASE'), 
    35     'file'  => 'Database', 
     34    'name'    => _t('UPGRADE_DATABASE'), 
     35    'file'    => 'Database', 
     36    'options' => $db, 
    3637); 
    3738 
     
    4849); 
    4950 
     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 
    5087// Saves the config file. 
    5188$stages[] = array( 
  • trunk/jaws/html/upgrade/stages/07To080.php

    r9746 r10034  
    4343        // Connect to database 
    4444        require_once JAWS_PATH . 'include/Jaws/DB.php'; 
    45         $_SESSION['upgrade']['Database']['charset'] = ''; 
    4645        $GLOBALS['db'] = new Jaws_DB($_SESSION['upgrade']['Database']); 
    4746        if (Jaws_Error::IsError($GLOBALS['db'])) { 
     
    133132        //Make sure user don't have any data/cache/registry|acl stuff 
    134133        $path = JAWS_DATA . 'cache/registry'; 
    135         if (!Jaws_Utils::Delete($path)) { 
     134        if (!Jaws_Utils::Delete($path, false)) { 
    136135            log_upgrade("Can't delete $path"); 
    137136        } 
    138137 
    139138        $path = JAWS_DATA . 'cache/acl'; 
    140         if (!Jaws_Utils::Delete($path)) { 
     139        if (!Jaws_Utils::Delete($path, false)) { 
    141140            log_upgrade("Can't delete $path"); 
    142141        } 
     
    206205                    array('/network/proxy_user', ''), 
    207206                    array('/network/proxy_pass', ''), 
    208                     array('/network/mailer', 'phpmail'), 
     207                    array('/network/mailer', 'smtp'), 
    209208                    array('/network/from_email', ''), 
    210209                    array('/network/from_name', ''), 
     
    278277        //Make sure user don't have any data/cache/registry|acl stuff 
    279278        $path = JAWS_DATA . 'cache/registry'; 
    280         if (!Jaws_Utils::Delete($path)) { 
     279        if (!Jaws_Utils::Delete($path, false)) { 
    281280            log_upgrade("Can't delete $path"); 
    282281        } 
    283282 
    284283        $path = JAWS_DATA . 'cache/acl'; 
    285         if (!Jaws_Utils::Delete($path)) { 
     284        if (!Jaws_Utils::Delete($path, false)) { 
    286285            log_upgrade("Can't delete $path"); 
    287286        } 
  • trunk/jaws/html/upgrade/stages/08To081.php

    r9365 r10034  
    4242        // Connect to database 
    4343        require_once JAWS_PATH . 'include/Jaws/DB.php'; 
    44         $_SESSION['upgrade']['Database']['charset'] = ''; 
    4544        $GLOBALS['db'] = new Jaws_DB($_SESSION['upgrade']['Database']); 
    4645        if (Jaws_Error::IsError($GLOBALS['db'])) { 
     
    8180        $GLOBALS['app']->Registry->commit('core'); 
    8281 
    83         if ($_SESSION['upgrade']['versions_to_upgrade'] == 1) { 
    84             $_SESSION['upgrade']['stage']++; 
    85         } 
    8682        return true; 
    8783    } 
  • trunk/jaws/html/upgrade/stages/Database.php

    r10013 r10034  
    2626        'port'     => '', 
    2727    ); 
     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    } 
    2854 
    2955    /** 
     
    282308            'prefix'   => $prefix, 
    283309            'driver'   => $post['driver'], 
    284             'charset'  => 'UTF8'
     310            'charset'  => $this->_db_charset
    285311        ); 
    286312 
  • trunk/jaws/html/upgrade/stages/Report.php

    r9599 r10034  
    3131 
    3232        $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                                         ), 
    3345                                   array( 
    3446                                         'version'   => '0.8.4',