本文整理匯總了PHP中AEPlatform::get_running_backups方法的典型用法代碼示例。如果您正苦於以下問題:PHP AEPlatform::get_running_backups方法的具體用法?PHP AEPlatform::get_running_backups怎麽用?PHP AEPlatform::get_running_backups使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類AEPlatform
的用法示例。
在下文中一共展示了AEPlatform::get_running_backups方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: reset
/**
* Resets the Kettenrad state, wipping out any pending backups and/or stale
* temporary data.
* @param array $config Configuration parameters for the reset operation
*/
public static function reset( $config = array() )
{
$default_config = array(
'global' => true, // Reset all origins when true
'log' => false, // Log our actions
);
$config = (object)array_merge($default_config, $config);
// Pause logging if so desired
if(!$config->log) AEUtilLogger::WriteLog(false,'');
$tag = null;
if(!$config->global)
{
// If we're not resetting globally, get a list of running backups per tag
$tag = AEPlatform::get_backup_origin();
}
// Cache the factory before proceeding
$factory = AEFactory::serialize();
$runningList = AEPlatform::get_running_backups($tag);
// Origins we have to clean
$origins = array(
AEPlatform::get_backup_origin()
);
// 1. Detect failed backups
if(is_array($runningList) && !empty($runningList))
{
// The current timestamp
$now = time();
// Mark running backups as failed
foreach($runningList as $running)
{
if(empty($tag))
{
// Check the timestamp of the log file to decide if it's stuck,
// but only if a tag is not set
$tstamp = @filemtime( AEUtilLogger::logName($running['origin']) );
if($tstamp !== false)
{
// We can only check the timestamp if it's returned. If not, we assume the backup is stale
$difference = abs($now - $tstamp);
// Backups less than 3 minutes old are not considered stale
if($difference < 180) continue;
}
}
$filenames = AEUtilStatistics::get_all_filenames($running);
// Process if there are files to delete...
if(!is_null($filenames))
{
// Delete the failed backup's archive, if exists
foreach($filenames as $failedArchive)
{
AEPlatform::unlink($failedArchive);
}
}
// Mark the backup failed
$running['status'] = 'fail';
$running['multipart'] = 0;
$dummy = null;
AEPlatform::set_or_update_statistics( $running['id'], $running, $dummy );
$origins[] = $running['origin'];
}
}
if(!empty($origins))
{
$origins = array_unique($origins);
foreach($origins as $tag)
{
AECoreKettenrad::load($tag);
// Remove temporary files
AEUtilTempfiles::deleteTempFiles();
// Delete any stale temporary data
AEUtilTempvars::reset($tag);
}
}
// Reload the factory
AEFactory::unserialize($factory);
unset($factory);
// Unpause logging if it was previously paused
if(!$config->log) AEUtilLogger::WriteLog(true,'');
}