本文整理汇总了PHP中FileCache::deleteFromCacheById方法的典型用法代码示例。如果您正苦于以下问题:PHP FileCache::deleteFromCacheById方法的具体用法?PHP FileCache::deleteFromCacheById怎么用?PHP FileCache::deleteFromCacheById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileCache
的用法示例。
在下文中一共展示了FileCache::deleteFromCacheById方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateFileInCache
/**
* Updates file in cashe. Even if it already in it.
* @param $fileitentifier
*/
public static function updateFileInCache($fileitentifier) {
$path = FileModification::createDirectory('filecache');
$path = FileModification::createDirectory('filecache/'.Yii::app()->user->clientID);
if (is_file($fileitentifier)) {
//if this if image from filesystem
//convert to pdf
$result_file_array = FileModification::PdfByFilePath($fileitentifier);
$filepath = $result_file_array['filepath'];
$filename = $result_file_array['filename'];
$path_to_base = $filepath;
$fileId = sha1_file($filepath).sha1($filepath);
} else {
//if this is image from database
$image = Images::model()->findByAttributes(array(
'Document_ID' => intval($fileitentifier)
));
if($image) {
$mime = explode('/', $image->Mime_Type);
$temp_file_path = $path . '/' . $image->File_Name;
$infile = stripslashes($image->Img);
file_put_contents($temp_file_path, $infile);
$fileId = intval($fileitentifier);
$path_to_base = $temp_file_path;
}
}
FileCache::deleteFromCacheById($fileitentifier);
FileCache::deleteFromCacheById($fileId);
$fileCash = new FileCache();
$fileCash->file_id = $fileId;
$fileCash->path = $path_to_base;
$fileCash->client_id = Yii::app()->user->clientID;
$fileCash->user_id = Yii::app()->user->userID;
$fileCash->Created = time();
$fileCash->save();
$result_id = $fileCash->file_id;
return $result_id;
}