本文整理汇总了PHP中CAgent::getList方法的典型用法代码示例。如果您正苦于以下问题:PHP CAgent::getList方法的具体用法?PHP CAgent::getList怎么用?PHP CAgent::getList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CAgent
的用法示例。
在下文中一共展示了CAgent::getList方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: clean
public function clean($baseDir, $initDir = false, $filename = false)
{
if (strlen($filename)) {
$documentRoot = \Bitrix\Main\Application::getDocumentRoot();
$fn = IO\Path::combine($documentRoot, $baseDir, $initDir, $filename);
$file = new IO\File($fn);
//This checks for Zend Server CE in order to supress warnings
if (function_exists('accelerator_reset')) {
try {
$file->markWritable();
if ($file->delete()) {
\Bitrix\Main\Application::resetAccelerator();
return true;
}
} catch (\Exception $ex) {
}
} else {
if ($file->isExists()) {
$file->markWritable();
if ($file->delete()) {
\Bitrix\Main\Application::resetAccelerator();
return true;
}
}
}
return false;
} else {
static $bAgentAdded = false;
$bDelayedDelete = false;
$source = IO\Path::combine($baseDir, $initDir);
$sourceDir = new IO\Directory(IO\Path::convertRelativeToAbsolute($source));
if ($sourceDir->isExists()) {
$target = $source . ".~";
for ($i = 0; $i < 9; $i++) {
$suffix = rand(0, 999999);
$targetDir = new IO\Directory(IO\Path::convertRelativeToAbsolute($target . $suffix));
if (!$targetDir->isExists()) {
$con = \Bitrix\Main\Application::getDbConnection();
$res = $con->queryExecute("INSERT INTO b_cache_tag (SITE_ID, CACHE_SALT, RELATIVE_PATH, TAG)\n\t\t\t\t\t\t\tVALUES ('*', '*', '" . $con->getSqlHelper()->forSql($target . $suffix) . "', '*')");
if ($res) {
if ($sourceDir->rename($targetDir->getPath())) {
$bDelayedDelete = true;
}
}
break;
}
}
}
if ($bDelayedDelete) {
if (!$bAgentAdded) {
$bAgentAdded = true;
/* TODO: јгенты */
$rsAgents = \CAgent::getList(array("ID" => "DESC"), array("NAME" => "CacheEngineFiles::delayedDelete(%"));
if (!$rsAgents->fetch()) {
$res = \CAgent::addAgent("CacheEngineFiles::delayedDelete();", "main", "Y", 1);
}
}
} else {
$sourceDir->delete();
}
\Bitrix\Main\Application::resetAccelerator();
}
}