本文整理汇总了PHP中wfUtils::getLastError方法的典型用法代码示例。如果您正苦于以下问题:PHP wfUtils::getLastError方法的具体用法?PHP wfUtils::getLastError怎么用?PHP wfUtils::getLastError使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wfUtils
的用法示例。
在下文中一共展示了wfUtils::getLastError方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: recursiveDelete
public static function recursiveDelete($dir)
{
$files = array_diff(scandir($dir), array('.', '..'));
foreach ($files as $file) {
if (is_dir($dir . '/' . $file)) {
if (!self::recursiveDelete($dir . '/' . $file)) {
return false;
}
} else {
if ($file == 'clear.lock') {
continue;
}
//Don't delete our lock file
$size = filesize($dir . '/' . $file);
if ($size) {
self::$cacheStats['totalData'] += round($size / 1024);
}
if (strpos($dir, 'wfcache/') === false) {
self::$lastRecursiveDeleteError = "Not deleting file in directory {$dir} because it appears to be in the wrong path.";
self::$cacheStats['totalErrors']++;
return false;
//Safety check that we're in a subdir of the cache
}
if (@unlink($dir . '/' . $file)) {
self::$cacheStats['filesDeleted']++;
} else {
self::$lastRecursiveDeleteError = "Could not delete file " . $dir . "/" . $file . " : " . wfUtils::getLastError();
self::$cacheStats['totalErrors']++;
return false;
}
}
}
if ($dir != WP_CONTENT_DIR . '/wfcache/') {
if (strpos($dir, 'wfcache/') === false) {
self::$lastRecursiveDeleteError = "Not deleting directory {$dir} because it appears to be in the wrong path.";
self::$cacheStats['totalErrors']++;
return false;
//Safety check that we're in a subdir of the cache
}
if (@rmdir($dir)) {
self::$cacheStats['dirsDeleted']++;
} else {
self::$lastRecursiveDeleteError = "Could not delete directory {$dir} : " . wfUtils::getLastError();
self::$cacheStats['totalErrors']++;
return false;
}
return true;
} else {
return true;
}
}