Exemple #1
0
         $success = switch_maintenance_mode(true, 'all', T_('System backup is in progress. Please reload this page in a few minutes.'));
         // Make sure we exit the maintenance mode if PHP dies
         register_shutdown_function('switch_maintenance_mode', false, '', true);
         break;
     case 'open':
         // Don't lock the site
         break;
     default:
         debug_die('Invalid system lock type received!');
         break;
 }
 if ($success) {
     // We can start backup
     set_max_execution_time(1800);
     // 30 minutes
     $current_Backup->start_backup();
 }
 // Unlock b2evolution
 switch ($lock_type) {
     case 'maintenance_lock':
         // Disable maintenance lock
         switch_maintenance_lock(false);
         break;
     case 'maintenance_mode':
         // Disable maintenance mode
         switch_maintenance_mode(false, 'all');
         break;
     default:
         // Nothing to do because the b2evoltuion was not locked
         break;
 }
Exemple #2
0
 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>';
         evo_flush();
         $success = verify_overwrite($upgrade_folder_path, no_trailing_slash($basepath), 'Copying', true, $read_only_list);
         if (!$success || !empty($read_only_list)) {
             // In case if something was changed before the previous verify_overwrite check
             echo '<p style="color:red"><strong>' . T_('The files and database backup was created successfully but all folders and files could not be overwritten');
             if (empty($read_only_list)) {
                 // There was some error in the verify_overwrite() function, but the corresponding error message was already displayed.
                 echo '.</strong></p>';
             } else {
                 // Some file/folder could not be overwritten, display it
                 echo ':</strong></p>';
                 foreach ($read_only_list as $read_only_file) {