Beispiel #1
0
/**
 *  duplicator_package_build
 *  Returns the package result status
 *  
 *  @return json   json object of package results
 */
function duplicator_package_build()
{
    header('Content-Type: application/json');
    DUP_Util::CheckPermissions('export');
    @set_time_limit(0);
    $errLevel = error_reporting();
    error_reporting(E_ERROR);
    DUP_Util::InitSnapshotDirectory();
    $Package = DUP_Package::GetActive();
    if (!is_readable(DUPLICATOR_SSDIR_PATH_TMP . "/{$Package->ScanFile}")) {
        die("The scan result file was not found.  Please run the scan step before building the package.");
    }
    $Package->Build();
    //JSON:Debug Response
    //Pass = 1, Warn = 2, Fail = 3
    $json = array();
    $json['Status'] = 1;
    $json['Package'] = $Package;
    $json['Runtime'] = $Package->Runtime;
    $json['ExeSize'] = $Package->ExeSize;
    $json['ZipSize'] = $Package->ZipSize;
    $json_response = json_encode($json);
    error_reporting($errLevel);
    die($json_response);
}
Beispiel #2
0
 /** 
  * Gets the system checks which are not required
  * @return array   An array of system checks
  */
 public static function GetChecks()
 {
     $checks = array();
     //WEB SERVER
     $web_test1 = false;
     foreach ($GLOBALS['DUPLICATOR_SERVER_LIST'] as $value) {
         if (stristr($_SERVER['SERVER_SOFTWARE'], $value)) {
             $web_test1 = true;
             break;
         }
     }
     $checks['SRV']['WEB']['model'] = $web_test1;
     $checks['SRV']['WEB']['ALL'] = $web_test1 ? 'Good' : 'Warn';
     //PHP SETTINGS
     $php_test1 = ini_get("open_basedir");
     $php_test1 = empty($php_test1) ? true : false;
     $php_test2 = ini_get("max_execution_time");
     $php_test2 = $php_test2 > DUPLICATOR_SCAN_TIMEOUT || (strcmp($php_test2, 'Off') == 0 || $php_test2 == 0) ? true : false;
     $php_test3 = function_exists('mysqli_connect');
     $checks['SRV']['PHP']['openbase'] = $php_test1;
     $checks['SRV']['PHP']['maxtime'] = $php_test2;
     $checks['SRV']['PHP']['mysqli'] = $php_test3;
     $checks['SRV']['PHP']['ALL'] = $php_test1 && $php_test2 && $php_test3 ? 'Good' : 'Warn';
     //WORDPRESS SETTINGS
     global $wp_version;
     $wp_test1 = version_compare($wp_version, DUPLICATOR_SCAN_MIN_WP) >= 0 ? true : false;
     //Core Files
     $files = array();
     $files['wp-config.php'] = file_exists(DUP_Util::SafePath(DUPLICATOR_WPROOTPATH . '/wp-config.php'));
     $wp_test2 = $files['wp-config.php'];
     //Cache
     $Package = DUP_Package::GetActive();
     $cache_path = DUP_Util::SafePath(WP_CONTENT_DIR) . '/cache';
     $dirEmpty = DUP_Util::IsDirectoryEmpty($cache_path);
     $dirSize = DUP_Util::GetDirectorySize($cache_path);
     $cach_filtered = in_array($cache_path, explode(';', $Package->Archive->FilterDirs));
     $wp_test3 = $cach_filtered || $dirEmpty || $dirSize < DUPLICATOR_SCAN_CACHESIZE ? true : false;
     $checks['SRV']['WP']['version'] = $wp_test1;
     $checks['SRV']['WP']['core'] = $wp_test2;
     $checks['SRV']['WP']['cache'] = $wp_test3;
     $checks['SRV']['WP']['ALL'] = $wp_test1 && $wp_test2 && $wp_test3 ? 'Good' : 'Warn';
     return $checks;
 }
Beispiel #3
0
 /** 
  * Gets the system checks which are not required
  * @return array   An array of system checks
  */
 public static function GetChecks()
 {
     $checks = array();
     //CHK-SRV-100: PHP SETTINGS
     $php_test1 = ini_get("open_basedir");
     $php_test1 = empty($php_test1) ? true : false;
     $php_test2 = ini_get("max_execution_time");
     $php_test2 = $php_test2 > DUPLICATOR_SCAN_TIMEOUT || strcmp($php_test2, 'Off') == 0 || $php_test2 == 0 ? 'Good' : 'Warn';
     $checks['CHK-SRV-100'] = $php_test1 && $php_test2 ? 'Good' : 'Warn';
     //CHK-SRV-101: WORDPRESS SETTINGS
     //Version
     global $wp_version;
     $version_test = version_compare($wp_version, DUPLICATOR_SCAN_MIN_WP) >= 0 ? true : false;
     //Cache
     $Package = DUP_Package::GetActive();
     $cache_path = DUP_Util::SafePath(WP_CONTENT_DIR) . '/cache';
     $dirEmpty = DUP_Util::IsDirectoryEmpty($cache_path);
     $dirSize = DUP_Util::GetDirectorySize($cache_path);
     $cach_filtered = in_array($cache_path, explode(';', $Package->Archive->FilterDirs));
     $cache_test = $cach_filtered || $dirEmpty || $dirSize < DUPLICATOR_SCAN_CACHESIZE ? true : false;
     //Core Files
     $files = array();
     $files['wp-config.php'] = file_exists(DUP_Util::SafePath(DUPLICATOR_WPROOTPATH . '/wp-config.php'));
     $files_test = $files['wp-config.php'];
     $checks['CHK-SRV-101'] = $files_test && $cache_test && $version_test ? 'Good' : 'Warn';
     //CHK-SRV-102: WEB SERVER
     $servers = $GLOBALS['DUPLICATOR_SERVER_LIST'];
     $test = false;
     foreach ($servers as $value) {
         if (stristr($_SERVER['SERVER_SOFTWARE'], $value)) {
             $test = true;
             break;
         }
     }
     $checks['CHK-SRV-102'] = $test ? 'Good' : 'Warn';
     //RESULTS
     $result = in_array('Warn', $checks);
     $checks['Success'] = !$result;
     return $checks;
 }
require_once DUPLICATOR_PLUGIN_PATH . 'classes/package.php';
require_once DUPLICATOR_PLUGIN_PATH . 'classes/utility.php';
if (empty($_POST)) {
    //F5 Refresh Check
    $redirect = admin_url('admin.php?page=duplicator&tab=new1');
    echo "<script>window.location.href = '{$redirect}'</script>";
    exit;
}
global $wp_version;
$Package = new DUP_Package();
if (isset($_POST['package-hash'])) {
    // If someone is trying to pass the hasn into us that is illegal so stop it immediately.
    die('Unauthorized');
}
$Package->SaveActive($_POST);
$Package = DUP_Package::GetActive();
$mysqldump_on = DUP_Settings::Get('package_mysqldump') && DUP_Database::GetMySqlDumpPath();
$mysqlcompat_on = isset($Package->Database->Compatible) && strlen($Package->Database->Compatible);
$mysqlcompat_on = $mysqldump_on && $mysqlcompat_on ? true : false;
$dbbuild_mode = $mysqldump_on ? 'mysqldump (fast)' : 'PHP (slow)';
$zip_check = DUP_Util::GetZipPath();
?>

<style>
	/* ============----------
	PROGRESS ARES-CHECKS */
	div#dup-progress-area {text-align:center; max-width:650px; min-height:200px; margin:0px auto 0px auto; padding:0px;}
	div.dup-progress-title {font-size:22px;padding:5px 0 20px 0; font-weight: bold}
	div#dup-msg-success {color:#18592A; padding:5px; text-align: left}	
	div#dup-msg-success-subtitle {font-style: italic; margin:7px 0px}	
	div#dup-msg-error {color:#A62426; padding:5px; max-width: 790px;}