Exemple #1
0
            if (false === $phprequires || version_compare(PHP_VERSION, $phprequires, '>=')) {
                $updraftplus_have_addons++;
                if ($phpinclude) {
                    require_once UPDRAFTPLUS_DIR . '/' . $phpinclude;
                }
                include_once UPDRAFTPLUS_DIR . '/addons/' . $e;
            }
        }
    }
    @closedir($dir_handle);
}
if (is_file(UPDRAFTPLUS_DIR . '/udaddons/updraftplus-addons.php')) {
    include_once UPDRAFTPLUS_DIR . '/udaddons/updraftplus-addons.php';
}
require_once UPDRAFTPLUS_DIR . '/class-updraftplus.php';
$updraftplus = new UpdraftPlus();
$updraftplus->have_addons = $updraftplus_have_addons;
if (!$updraftplus->memory_check(192)) {
    // Experience appears to show that the memory limit is only likely to be hit (unless it is very low) by single files that are larger than available memory (when compressed)
    # Add sanity checks - found someone who'd set WP_MAX_MEMORY_LIMIT to 256K !
    if (!$updraftplus->memory_check($updraftplus->memory_check_current(WP_MAX_MEMORY_LIMIT))) {
        $new = absint($updraftplus->memory_check_current(WP_MAX_MEMORY_LIMIT));
        if ($new > 32 && $new < 100000) {
            @ini_set('memory_limit', $new . 'M');
            //up the memory limit to the maximum WordPress is allowing for large backup files
        }
    }
}
if (!class_exists('UpdraftPlus_Options')) {
    require_once UPDRAFTPLUS_DIR . '/options.php';
}
 private function get_updraft_data()
 {
     global $updraftplus;
     if (empty($updraftplus) && class_exists('UpdraftPlus')) {
         $updraftplus = new UpdraftPlus();
     }
     if (empty($updraftplus)) {
         return false;
     }
     // UNIX timestamp
     $next_scheduled_backup = wp_next_scheduled('updraft_backup');
     $next_scheduled_backup_gmt = $next_scheduled_backup_database_gmt = 0;
     if ($next_scheduled_backup) {
         // Convert to GMT
         $next_scheduled_backup_gmt = gmdate('Y-m-d H:i:s', $next_scheduled_backup);
         // Convert to blog time zone
         $next_scheduled_backup = get_date_from_gmt($next_scheduled_backup_gmt, 'D, F j, Y H:i');
     } else {
         $next_scheduled_backup = 'Nothing currently scheduled';
     }
     $next_scheduled_backup_database = wp_next_scheduled('updraft_backup_database');
     if (UpdraftPlus_Options::get_updraft_option('updraft_interval_database', UpdraftPlus_Options::get_updraft_option('updraft_interval')) === UpdraftPlus_Options::get_updraft_option('updraft_interval')) {
         $next_scheduled_backup_database = 'Nothing currently scheduled' === $next_scheduled_backup ? $next_scheduled_backup : __('At the same time as the files backup', 'updraftplus');
     } else {
         if ($next_scheduled_backup_database) {
             // Convert to GMT
             $next_scheduled_backup_database_gmt = gmdate('Y-m-d H:i:s', $next_scheduled_backup_database);
             // Convert to blog time zone
             $next_scheduled_backup_database = get_date_from_gmt($next_scheduled_backup_database_gmt, 'D, F j, Y H:i');
         } else {
             $next_scheduled_backup_database = __('Nothing currently scheduled', 'updraftplus');
         }
     }
     $updraft_dir = $updraftplus->backups_dir_location();
     $backup_disabled = $updraftplus->really_is_writable($updraft_dir) ? 0 : 1;
     $current_timegmt = time();
     $current_time = get_date_from_gmt(gmdate('Y-m-d H:i:s', $current_timegmt), 'D, F j, Y H:i');
     $out = array('updraft_backup_disabled' => $backup_disabled, 'nextsched_files_gmt' => $next_scheduled_backup_gmt, 'nextsched_database_gmt' => $next_scheduled_backup_gmt, 'nextsched_current_timegmt' => $current_timegmt, 'nextsched_current_timezone' => $current_time);
     if ($next_scheduled_backup_gmt) {
         $out['nextsched_files_timezone'] = $next_scheduled_backup;
     }
     if ($next_scheduled_backup_gmt) {
         $out['nextsched_database_timezone'] = $next_scheduled_backup_database;
     }
     $bh = $this->build_historystatus();
     $out['updraft_historystatus'] = $bh['h'];
     $out['updraft_count_backups'] = $bh['c'];
     $last_backup = $this->last_backup_html();
     $out['updraft_lastbackup_html'] = $last_backup['b'];
     $out['updraft_lastbackup_gmttime'] = $last_backup['lasttime_gmt'];
     return $out;
 }