当前位置: 首页>>代码示例>>PHP>>正文


PHP CFile::CleanCache方法代码示例

本文整理汇总了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>
  * &lt;?
  * // удаляем изображение формы
  * $arFilter = array("ID" =&gt; 1, "ID_EXACT_MATCH" =&gt; "Y");
  * $rsForm = CForm::GetList($by, $order, $arFilter, $is_filtered);
  * if ($arForm = $rsForm-&gt;Fetch())
  * {
  *     if (intval($arForm["IMAGE_ID"])&gt;0) <b>CFile::Delete</b>($arForm["IMAGE_ID"]);	
  * }
  * ?&gt;
  * </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 ******************************/
     }
 }
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:67,代码来源:file.php

示例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);
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:6,代码来源:file.php

示例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"]);
     }
 }
开发者ID:rasuldev,项目名称:torino,代码行数:22,代码来源:storage.php

示例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);
 }
开发者ID:nycmic,项目名称:bittest,代码行数:7,代码来源:file.php

示例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++;
         }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:31,代码来源:clouds_storage_list.php


注:本文中的CFile::CleanCache方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。