/** * 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); }
function duplicator_activate() { global $wpdb; $table_name = $wpdb->prefix . "duplicator_packages"; //PRIMARY KEY must have 2 spaces before for dbDelta to work $sql = "CREATE TABLE `{$table_name}` (\r\n\t\t\t`id`\t\tBIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,\r\n\t\t\t`name`\t\tVARCHAR(250)\tNOT NULL,\r\n\t\t\t`hash`\t\tVARCHAR(50)\t\tNOT NULL,\r\n\t\t\t`status`\tINT(11)\t\t\tNOT NULL,\r\n\t\t\t`created`\tDATETIME\t\tNOT NULL DEFAULT '0000-00-00 00:00:00',\r\n\t\t\t`owner`\t\tVARCHAR(60)\t\tNOT NULL,\r\n\t\t\t`package`\tMEDIUMBLOB\t\tNOT NULL )"; require_once DUPLICATOR_WPROOTPATH . 'wp-admin/includes/upgrade.php'; @dbDelta($sql); //WordPress Options Hooks update_option('duplicator_version_plugin', DUPLICATOR_VERSION); //Setup All Directories DUP_Util::InitSnapshotDirectory(); }
function duplicator_activate() { global $wpdb; //Only update database on version update if (DUPLICATOR_VERSION != get_option("duplicator_version_plugin")) { $table_name = $wpdb->prefix . "duplicator_packages"; //PRIMARY KEY must have 2 spaces before for dbDelta to work //see: https://codex.wordpress.org/Creating_Tables_with_Plugins $sql = "CREATE TABLE `{$table_name}` (\n\t\t\t id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,\n\t\t\t name VARCHAR(250) NOT NULL,\n\t\t\t hash VARCHAR(50) NOT NULL,\n\t\t\t status INT(11) NOT NULL,\n\t\t\t created DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',\n\t\t\t owner VARCHAR(60) NOT NULL,\n\t\t\t package MEDIUMBLOB NOT NULL,\n\t\t\t PRIMARY KEY (id),\n\t\t\t KEY hash (hash))"; require_once DUPLICATOR_WPROOTPATH . 'wp-admin/includes/upgrade.php'; @dbDelta($sql); } //WordPress Options Hooks update_option('duplicator_version_plugin', DUPLICATOR_VERSION); //Setup All Directories DUP_Util::InitSnapshotDirectory(); }
function duplicator_package_create() { @set_time_limit(0); $errLevel = error_reporting(); error_reporting(E_ERROR); DUP_Util::InitSnapshotDirectory(); $Task = new DUP_Task(); $Task->Create(); //JSON:Debug Response //Pass = 1, Warn = 2, Fail = 3 $json = array(); $json['Status'] = 1; $json['Package'] = $Task->Package; $json['Runtime'] = $Task->Package->Runtime; $json['ExeSize'] = $Task->Package->ExeSize; $json['ZipSize'] = $Task->Package->ZipSize; $json_response = json_encode($json); error_reporting($errLevel); die($json_response); }
<?php require_once DUPLICATOR_PLUGIN_PATH . 'classes/package.php'; global $wpdb; //POST BACK $action_updated = null; if (isset($_POST['action'])) { $action_result = DUP_Settings::DeleteWPOption($_POST['action']); switch ($_POST['action']) { case 'duplicator_package_active': $action_response = __('Package settings have been reset.', 'duplicator'); break; } } DUP_Util::InitSnapshotDirectory(); $Package = DUP_Package::GetActive(); $package_hash = $Package->MakeHash(); $dup_tests = array(); $dup_tests = DUP_Server::GetRequirements(); $default_name = DUP_Package::GetDefaultName(); $view_state = DUP_UI::GetViewStateArray(); $ui_css_storage = isset($view_state['dup-pack-storage-panel']) && $view_state['dup-pack-storage-panel'] ? 'display:block' : 'display:none'; $ui_css_archive = isset($view_state['dup-pack-archive-panel']) && $view_state['dup-pack-archive-panel'] ? 'display:block' : 'display:none'; $ui_css_installer = isset($view_state['dup-pack-installer-panel']) && $view_state['dup-pack-installer-panel'] ? 'display:block' : 'display:none'; $dup_intaller_files = implode(", ", array_keys(DUP_Server::GetInstallerFiles())); $dbbuild_mode = DUP_Settings::Get('package_mysqldump') && DUP_Database::GetMySqlDumpPath() ? 'mysqldump' : 'PHP'; ?> <style> /* ----------------------------- REQUIREMENTS*/