本文整理汇总了PHP中CFile::CleanCache方法的典型用法代码示例。如果您正苦于以下问题:PHP CFile::CleanCache方法的具体用法?PHP CFile::CleanCache怎么用?PHP CFile::CleanCache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFile
的用法示例。
在下文中一共展示了CFile::CleanCache方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Delete
/**
* <p>Метод удаляет файл из таблицы зарегистрированных файлов (b_file) и с диска. Статичный метод.</p>
*
*
* @param int $id Цифровой идентификатор файла.
*
* @return mixed
*
* <h4>Example</h4>
* <pre>
* <?
* // удаляем изображение формы
* $arFilter = array("ID" => 1, "ID_EXACT_MATCH" => "Y");
* $rsForm = CForm::GetList($by, $order, $arFilter, $is_filtered);
* if ($arForm = $rsForm->Fetch())
* {
* if (intval($arForm["IMAGE_ID"])>0) <b>CFile::Delete</b>($arForm["IMAGE_ID"]);
* }
* ?>
* </pre>
*
*
* <h4>See Also</h4>
* <ul> <li> <a href="http://dev.1c-bitrix.ru/api_help/main/functions/file/deletedirfiles.php">DeleteDirFiles</a> </li>
* <li> <a href="http://dev.1c-bitrix.ru/api_help/main/functions/file/deletedirfilesex.php">DeleteDirFilesEx</a> </li>
* </ul><a name="examples"></a>
*
*
* @static
* @link http://dev.1c-bitrix.ru/api_help/main/reference/cfile/delete.php
* @author Bitrix
*/
public static function Delete($ID)
{
global $DB;
$io = CBXVirtualIo::GetInstance();
$ID = intval($ID);
if ($ID <= 0) {
return;
}
$res = CFile::GetByID($ID);
if ($res = $res->Fetch()) {
$delete_size = 0;
$upload_dir = COption::GetOptionString("main", "upload_dir", "upload");
$dname = $_SERVER["DOCUMENT_ROOT"] . "/" . $upload_dir . "/" . $res["SUBDIR"];
$fname = $dname . "/" . $res["FILE_NAME"];
$file = $io->GetFile($fname);
if ($file->isExists() && $file->unlink()) {
$delete_size += $res["FILE_SIZE"];
}
$delete_size += CFile::ResizeImageDelete($res);
$DB->Query("DELETE FROM b_file WHERE ID = " . $ID);
$directory = $io->GetDirectory($dname);
if ($directory->isExists() && $directory->isEmpty()) {
$directory->rmdir();
}
CFile::CleanCache($ID);
foreach (GetModuleEvents("main", "OnFileDelete", true) as $arEvent) {
ExecuteModuleEventEx($arEvent, array($res));
}
/****************************** QUOTA ******************************/
if ($delete_size > 0 && COption::GetOptionInt("main", "disk_space") > 0) {
CDiskQuota::updateDiskQuota("file", $delete_size, "delete");
}
/****************************** QUOTA ******************************/
}
}
示例2: UpdateDesc
function UpdateDesc($ID, $desc)
{
global $DB;
$DB->Query("UPDATE b_file SET DESCRIPTION='" . $DB->ForSql($desc, 255) . "' WHERE ID=" . intval($ID));
CFile::CleanCache($ID);
}
示例3: FixFileContentType
/**
* @param array[string]string $arFile
* @return void
*/
public static function FixFileContentType(&$arFile)
{
global $DB;
$fixedContentType = "";
if ($arFile["CONTENT_TYPE"] === "image/jpg") {
$fixedContentType = "image/jpeg";
} else {
$hexContentType = unpack("H*", $arFile["CONTENT_TYPE"]);
if ($hexContentType[1] === "e0f3e4e8ee2f6d706567" || $hexContentType[1] === "d0b0d183d0b4d0b8d0be2f6d706567") {
$fixedContentType = "audio/mpeg";
}
}
if ($fixedContentType !== "") {
$arFile["CONTENT_TYPE"] = $fixedContentType;
$DB->Query("\n\t\t\t\tUPDATE b_file\n\t\t\t\tSET CONTENT_TYPE = '" . $DB->ForSQL($fixedContentType) . "'\n\t\t\t\tWHERE ID = " . intval($arFile["ID"]) . "\n\t\t\t");
CFile::CleanCache($arFile["ID"]);
}
}
示例4: UpdateExternalId
function UpdateExternalId($ID, $external_id)
{
global $DB;
$external_id = trim($external_id);
$DB->Query("UPDATE b_file SET EXTERNAL_ID=" . ($external_id != "" ? "'" . $DB->ForSql($external_id, 50) . "'" : "null") . " WHERE ID=" . intval($ID));
CFile::CleanCache($ID);
}
示例5: intval
}
if (isset($_SESSION["arMoveStat_skip"])) {
$_skip = intval($_SESSION["arMoveStat_skip"]);
}
}
$files_per_step = 50;
$rsNextFile = $DB->Query($DB->TopSQL("\n\t\t\t\t\tSELECT *\n\t\t\t\t\tFROM b_file\n\t\t\t\t\tWHERE ID > " . intval($ob->LAST_FILE_ID) . "\n\t\t\t\t\tAND (HANDLER_ID IS NULL OR HANDLER_ID <> '" . $DB->ForSQL($ob->ID) . "')\n\t\t\t\t\tORDER BY ID ASC\n\t\t\t\t", $files_per_step));
$counter = 0;
$bWasMoved = false;
$moveResult = CCloudStorage::FILE_SKIPPED;
while ($moveResult == CCloudStorage::FILE_PARTLY_UPLOADED || is_array($arFile = $rsNextFile->Fetch())) {
CCloudStorage::FixFileContentType($arFile);
$moveResult = CCloudStorage::MoveFile($arFile, $ob);
if ($moveResult == CCloudStorage::FILE_MOVED) {
$DB->Query("\n\t\t\t\t\t\t\tUPDATE b_file\n\t\t\t\t\t\t\tSET HANDLER_ID = '" . $DB->ForSQL($ob->ID) . "'\n\t\t\t\t\t\t\tWHERE ID = " . intval($arFile["ID"]) . "\n\t\t\t\t\t\t");
CFile::CleanCache($arFile["ID"]);
$_done += 1;
$_size += doubleval($arFile["FILE_SIZE"]);
$bWasMoved = true;
$ob->Update(array("LAST_FILE_ID" => $arFile["ID"]));
$counter++;
} elseif ($moveResult == CCloudStorage::FILE_SKIPPED) {
$e = $APPLICATION->GetException();
if (is_object($e)) {
$message = new CAdminMessage(GetMessage("CLO_STORAGE_LIST_MOVE_FILE_ERROR"), $e);
break;
} else {
$_skip += 1;
$ob->Update(array("LAST_FILE_ID" => $arFile["ID"]));
$counter++;
}