本文整理汇总了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,'');
}