本文整理汇总了PHP中AEPlatform::get_valid_remote_records方法的典型用法代码示例。如果您正苦于以下问题:PHP AEPlatform::get_valid_remote_records方法的具体用法?PHP AEPlatform::get_valid_remote_records怎么用?PHP AEPlatform::get_valid_remote_records使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AEPlatform
的用法示例。
在下文中一共展示了AEPlatform::get_valid_remote_records方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_remote_quotas
/**
* Applies the size and count quotas
* @return bool
*/
private function get_remote_quotas()
{
// Get all records with a remote filename
$allRecords = AEPlatform::get_valid_remote_records();
// Bail out if no records found
if(empty($allRecords)) return array();
// Try to find the files to be deleted due to quota settings
$statistics =& AEFactory::getStatistics();
$latestBackupId = $statistics->getId();
// Filter out the current record
$temp = array();
foreach($allRecords as $item)
{
if($item['id'] == $latestBackupId) continue;
$item['files'] = $this->get_remote_files($item['remote_filename'], $item['multipart']);
$temp[] = $item;
}
$allRecords = $temp;
// Bail out if only the current backup was included in the list
if(count($allRecords) == 0) return array();
// Get quota values
$registry =& AEFactory::getConfiguration();
$countQuota = $registry->get('akeeba.quota.count_quota');
$sizeQuota = $registry->get('akeeba.quota.size_quota');
$useCountQuotas = $registry->get('akeeba.quota.enable_count_quota');
$useSizeQuotas = $registry->get('akeeba.quota.enable_size_quota');
$useDayQuotas = $registry->get('akeeba.quota.maxage.enable');
$daysQuota = $registry->get('akeeba.quota.maxage.maxdays');
$preserveDay = $registry->get('akeeba.quota.maxage.keepday');
$leftover = array();
$ret = array();
$killids = array();
if($useDayQuotas) {
$killDatetime = new DateTime();
$killDatetime->sub(new DateInterval('P'.$daysQuota.'D'));
$killTS = $killDatetime->format('U');
foreach($allRecords as $def) {
$backupstart = new DateTime($def['backupstart']);
$backupTS = $backupstart->format('U');
$backupDay = $backupstart->format('d');
// Is this on a preserve day?
if($preserveDay > 0) {
if($preserveDay == $backupDay) {
$leftover[] = $def;
continue;
}
}
// Otherwise, check the timestamp
if($backupTS < $killTS) {
$ret[] = $def['files'];
$killids[] = $def['id'];
} else {
$leftover[] = $def;
}
}
}
// Do we need to apply count quotas?
if($useCountQuotas && ($countQuota >= 1) && !$useDayQuotas )
{
$countQuota--;
// Are there more files than the quota limit?
if( !(count($allRecords) > $countQuota) )
{
// No, effectively skip the quota checking
$leftover = $allRecords;
}
else
{
AEUtilLogger::WriteLog(_AE_LOG_DEBUG, "Processing remote count quotas" );
// Yes, apply the quota setting.
$totalRecords = count($allRecords);
for($count = 0; $count <= $totalRecords; $count++)
{
$def = array_pop($allRecords);
if(count($leftover) >= $countQuota)
{
$ret[] = $def['files'];
$killids[] = $def['id'];
}
else
{
$leftover[] = $def;
}
}
unset($allRecords);
//.........这里部分代码省略.........