本文整理匯總了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();
}
}