Exemplo n.º 1
0
/**
 * Check version of downloaded upgrade vs. current version
 *
 * @param new version dir name
 * @return string message or NULL
 */
function check_version($new_version_dir)
{
    global $rsc_url, $upgrade_path, $conf_path;
    $new_version_file = get_upgrade_folder_path($new_version_dir) . '/conf/_application.php';
    if (!file_exists($new_version_file)) {
        // Invalid structure of the downloaded upgrade package
        debug_die('/conf/_application.php not found in /b2evolution/blogs/ nor /b2evolution/site/ nor /b2evolution/! You may have downloaded an invalid ZIP package.');
    }
    require $new_version_file;
    $vc = version_compare($app_version, $GLOBALS['app_version']);
    if ($vc < 0) {
        $result = 'old';
    } elseif ($vc == 0) {
        if ($app_date == $GLOBALS['app_date']) {
            $result = 'same';
        } elseif ($app_date < $GLOBALS['app_date']) {
            $result = 'old';
        }
    }
    if (empty($result)) {
        return NULL;
    } elseif ($result == 'old') {
        return T_('This is an old version!') . '<p>' . T_('You should NOT install this older version.') . '</p>';
    } elseif ($result == 'same') {
        return T_('This package is already installed!') . '<p style="color:#000">' . T_('No upgrade is needed at this time. You might force a re-install if you want to force a cleanup.') . '</p>';
    }
}
Exemplo n.º 2
0
/**
 * Check version of downloaded upgrade vs. current version
 *
 * @param new version dir name
 * @return string message or NULL
 */
function check_version($new_version_dir)
{
    global $rsc_url, $upgrade_path, $conf_path;
    $new_version_file = get_upgrade_folder_path($new_version_dir) . '/conf/_application.php';
    if (!file_exists($new_version_file)) {
        // Invalid structure of the downloaded upgrade package
        debug_die('No config file found with b2evolution version! Probably you have downloaded the invalid package.');
    }
    require $new_version_file;
    $vc = version_compare($app_version, $GLOBALS['app_version']);
    if ($vc < 0) {
        return T_('This is an old version!');
    } elseif ($vc == 0) {
        if ($app_date == $GLOBALS['app_date']) {
            return T_('This package is already installed!');
        } elseif ($app_date < $GLOBALS['app_date']) {
            return T_('This is an old version!');
        }
    }
    return NULL;
}
Exemplo n.º 3
0
     $block_item_Widget->disp_template_replaced('block_start');
     $upgrade_name = param('upd_name', 'string', '', true);
     $success = true;
 }
 // Enable maintenance mode
 $success = $success && switch_maintenance_mode(true, 'upgrade', T_('System upgrade is in progress. Please reload this page in a few minutes.'));
 if ($success) {
     // Set maximum execution time
     set_max_execution_time(1800);
     // 30 minutes
     // Verify that all destination files can be overwritten
     echo '<h4>' . T_('Verifying that all destination files can be overwritten...') . '</h4>';
     evo_flush();
     $read_only_list = array();
     // Get a folder path where we should get the files
     $upgrade_folder_path = get_upgrade_folder_path($upgrade_name);
     $success = verify_overwrite($upgrade_folder_path, no_trailing_slash($basepath), 'Verifying', false, $read_only_list);
     if ($success && empty($read_only_list)) {
         // We can backup files and database
         // Load Backup class (PHP4) and backup all of the folders and files
         load_class('maintenance/model/_backup.class.php', 'Backup');
         $Backup = new Backup();
         $Backup->include_all();
         if (!function_exists('gzopen')) {
             $Backup->pack_backup_files = false;
         }
         // Start backup
         if ($success = $Backup->start_backup()) {
             // We can upgrade files and database
             // Copying new folders and files
             echo '<h4>' . T_('Copying new folders and files...') . '</h4>';