output_status_page();
}
/**
* Outputs the clone status
*
* @param bool $die - Defines if should die at the end
* @return void
*/
public function output_status_page($die = true) {
$this->current_status = $this->get_status();
$this->page_start();
echo '
';
echo '';
echo $this->get_content();
?>
get_progress_item_icon(self::INSTALLED); ?>
get_progress_item_icon(self::UPLOADING); ?>
= $this->current_status) {
_e('Receiving site data', 'updraftplus');
} else {
_e('Site data received', 'updraftplus');
}
?>
get_progress_item_icon(self::RESTORING); ?>
= $this->current_status) {
_e('Deploying site data', 'updraftplus');
} else {
_e('Site data has been deployed', 'updraftplus');
}
?>
get_progress_item_icon(); ?>
' . $this->get_status_description() . ''; ?>
';
$this->page_end();
if ($die) die();
}
/**
* This function will output the start of the updraftclone status page
*
* @return void
*/
public function page_start() {
echo '
UpdraftClone
';
}
/**
* This function will output the end of the updraftclone status page
*
* @return void
*/
public function page_end() {
?>
current_status) {
case self::INSTALLED:
$code = __("WordPress installed", "updraftplus");
break;
case self::UPLOADING:
$code = __("Receiving site data", "updraftplus");
break;
case self::RESTORING:
$code = __("Deploying site data", "updraftplus");
break;
default:
$code = "";
break;
}
return $code;
}
/**
* This function will get and return the clone status description ready to be displayed on the page
*
* @return string - the clone status description
*/
public function get_status_description() {
global $updraftplus;
$description = "";
switch ($this->current_status) {
case self::INSTALLED:
$description = __('WordPress installed; now awaiting the site data to be sent.', 'updraftplus');
break;
case self::UPLOADING:
$backup_details = $this->get_backup_details();
$description = sprintf(__('The sending of the site data has begun. So far %s data archives totalling %s have been received', 'updraftplus'), ''.$backup_details['sets'].'', ''.round($backup_details['uploaded'], 2).' MB');
break;
case self::RESTORING:
UpdraftPlus_Backup_History::rebuild();
$backup_details = $this->get_backup_details();
$description = __('The site data has all been received, and its import has begun.', 'updraftplus').' '.sprintf(__('%s archives remain', 'updraftplus'), ''.$backup_details['sets'].'');
break;
default:
$description = "(?)";
break;
}
return $description;
}
/**
* This function will return information about the backup such as the amount of sets and the size of the backup set
*
* @return array - an array with backup information
*/
public function get_backup_details() {
global $updraftplus;
$backup_history = UpdraftPlus_Backup_History::get_history();
$backupable_entities = $updraftplus->get_backupable_file_entities();
$sets = 0;
$uploaded = 0;
foreach ($backupable_entities as $key => $info) {
foreach ($backup_history as $timestamp => $backup) {
if (isset($backup[$key]) && isset($backup[$key.'-size'])) {
$sets += count($backup[$key]);
$uploaded += $backup[$key.'-size'];
}
}
}
$uploaded = round($uploaded / 1048576, 1);
return array('uploaded' => $uploaded, 'sets' => $sets);
}
/**
* This function will get and return the clone content ready to be displayed on the page
*
* @return string - the clone content
*/
public function get_content() {
$content = '
';
return $content;
}
/**
* This function will work out what stage the clone is in and return the correct status code
*
* @return int - the clone status code
*/
public function get_status() {
global $updraftplus;
$backup_history = UpdraftPlus_Backup_History::get_history();
if (empty($backup_history)) return self::INSTALLED;
$updraft_dir = trailingslashit($updraftplus->backups_dir_location());
if (file_exists($updraft_dir.'ready_for_restore')) return self::RESTORING;
return self::UPLOADING;
}
/**
* Get the progress item class
*
* @param int $number The status number
* @return string
*/
private function get_progress_item_class($number) {
return ($number === $this->current_status) ? 'active' : (($number < $this->current_status) ? 'done' : '');
}
/**
* Get the progress item icon
*
* @param int $number The status number
* @return string
*/
private function get_progress_item_icon($number = 1000) {
$icon = '';
return $icon;
}
}
if (defined('UPDRAFTPLUS_THIS_IS_CLONE') && 1 == UPDRAFTPLUS_THIS_IS_CLONE) {
$updraftplus_temporary_clone_status = new UpdraftPlus_Temporary_Clone_Status();
}