本文整理汇总了PHP中VQMod::_cachePathFull方法的典型用法代码示例。如果您正苦于以下问题:PHP VQMod::_cachePathFull方法的具体用法?PHP VQMod::_cachePathFull怎么用?PHP VQMod::_cachePathFull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VQMod
的用法示例。
在下文中一共展示了VQMod::_cachePathFull方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: modCheck
/**
* VQMod::modCheck()
*
* @param string $sourceFile path for file
* @return string
* @description Checks if a file has modifications and applies them, returning cache files or the file name
*/
public static function modCheck($sourceFile)
{
if (!self::$_folderChecks) {
if (self::$logging) {
// Create log folder if it doesn't exist
$log_folder = self::path(self::$logFolder, true);
self::dirCheck($log_folder);
}
// Create cache folder if it doesn't exist
$cache_folder = self::path(self::$vqCachePath, true);
self::dirCheck($cache_folder);
// Store cache folder path to save on repeat checks for path validity
self::$_cachePathFull = self::path(self::$vqCachePath);
self::$_folderChecks = true;
}
if (!preg_match('%^([a-z]:)?[\\\\/]%i', $sourceFile)) {
$sourcePath = self::path($sourceFile);
} else {
$sourcePath = self::_realpath($sourceFile);
}
if (!$sourcePath || is_dir($sourcePath) || in_array($sourcePath, self::$_doNotMod)) {
return $sourceFile;
}
$stripped_filename = preg_replace('~^' . preg_quote(self::getCwd(), '~i') . '~', '', $sourcePath);
$cacheFile = self::_cacheName($stripped_filename);
$file_last_modified = filemtime($sourcePath);
if (file_exists($cacheFile) && filemtime($cacheFile) >= self::$_lastModifiedTime && filemtime($cacheFile) >= $file_last_modified) {
return $cacheFile;
}
if (isset(self::$_filesModded[$sourcePath])) {
return self::$_filesModded[$sourcePath]['cached'] ? $cacheFile : $sourceFile;
}
$changed = false;
$fileHash = sha1_file($sourcePath);
$fileData = file_get_contents($sourcePath);
foreach (self::$_mods as $modObject) {
foreach ($modObject->mods as $path => $mods) {
if (self::_checkMatch($path, $sourcePath)) {
$modObject->applyMod($mods, $fileData);
}
}
}
if (sha1($fileData) != $fileHash) {
$writePath = $cacheFile;
if (!file_exists($writePath) || is_writable($writePath)) {
file_put_contents($writePath, $fileData);
$changed = true;
}
}
self::$_filesModded[$sourcePath] = array('cached' => $changed);
return $changed ? $writePath : $sourcePath;
}