本文整理汇总了PHP中wfUtils::errorsOff方法的典型用法代码示例。如果您正苦于以下问题:PHP wfUtils::errorsOff方法的具体用法?PHP wfUtils::errorsOff怎么用?PHP wfUtils::errorsOff使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wfUtils
的用法示例。
在下文中一共展示了wfUtils::errorsOff方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fileTooBig
public static function fileTooBig($file)
{
//Deals with files > 2 gigs on 32 bit systems which are reported with the wrong size due to integer overflow
wfUtils::errorsOff();
$fh = @fopen($file, 'r');
wfUtils::errorsOn();
if (!$fh) {
return false;
}
$offset = WORDFENCE_MAX_FILE_SIZE_TO_PROCESS + 1;
$tooBig = false;
try {
if (@fseek($fh, $offset, SEEK_SET) === 0) {
if (strlen(fread($fh, 1)) === 1) {
$tooBig = true;
}
}
//Otherwise we couldn't seek there so it must be smaller
fclose($fh);
return $tooBig;
} catch (Exception $e) {
return true;
}
//If we get an error don't scan this file, report it's too big.
}
示例2: wfHash
public static function wfHash($file)
{
wfUtils::errorsOff();
$md5 = @md5_file($file, false);
wfUtils::errorsOn();
if (!$md5) {
return false;
}
$fp = @fopen($file, "rb");
if (!$fp) {
return false;
}
$ctx = hash_init('sha256');
while (!feof($fp)) {
hash_update($ctx, str_replace(array("\n", "\r", "\t", " "), "", fread($fp, 65536)));
}
$shac = hash_final($ctx, false);
return array($md5, $shac);
}
示例3: scan_diskSpace
private function scan_diskSpace()
{
$this->statusIDX['diskSpace'] = wordfence::statusStart("Scanning to check available disk space");
wfUtils::errorsOff();
$total = @disk_total_space('.');
$free = @disk_free_space('.');
wfUtils::errorsOn();
if (!$total || !$free) {
//If we get zeros it's probably not reading right. If free is zero then we're out of space and already in trouble.
wordfence::statusEnd($this->statusIDX['diskSpace'], false);
return;
}
$this->status(2, 'info', "Total disk space: " . sprintf('%.4f', $total / 1024 / 1024 / 1024) . "GB -- Free disk space: " . sprintf('%.4f', $free / 1024 / 1024 / 1024) . "GB");
$freeMegs = sprintf('%.2f', $free / 1024 / 1024);
$this->status(2, 'info', "The disk has {$freeMegs} MB space available");
if ($freeMegs < 5) {
$level = 1;
} else {
if ($freeMegs < 20) {
$level = 2;
} else {
wordfence::statusEnd($this->statusIDX['diskSpace'], false);
return;
}
}
if ($this->addIssue('diskSpace', $level, 'diskSpace' . $level, 'diskSpace' . $level, "You have {$freeMegs}" . "MB disk space remaining", "You only have {$freeMegs}" . " Megabytes of your disk space remaining. Please free up disk space or your website may stop serving requests.", array('spaceLeft' => $freeMegs . "MB"))) {
wordfence::statusEnd($this->statusIDX['diskSpace'], true);
} else {
wordfence::statusEnd($this->statusIDX['diskSpace'], false);
}
}
示例4: getTempDir
private static function getTempDir()
{
if (!self::$tmpDirCache) {
$dirs = self::getPotentialTempDirs();
$finalDir = 'notmp';
wfUtils::errorsOff();
foreach ($dirs as $dir) {
$dir = rtrim($dir, '/') . '/';
$fh = @fopen($dir . 'wftmptest.txt', 'w');
if (!$fh) {
continue;
}
$bytes = @fwrite($fh, 'test');
if ($bytes != 4) {
@fclose($fh);
continue;
}
@fclose($fh);
if (!@unlink($dir . 'wftmptest.txt')) {
continue;
}
$finalDir = $dir;
break;
}
wfUtils::errorsOn();
self::$tmpDirCache = $finalDir;
}
if (self::$tmpDirCache == 'notmp') {
return false;
} else {
return self::$tmpDirCache;
}
}
示例5: getTempDir
private static function getTempDir()
{
if (!self::$tmpDirCache) {
$dirs = array(wfUtils::getPluginBaseDir() . 'wordfence/tmp/', sys_get_temp_dir(), ABSPATH . 'wp-content/uploads/');
$finalDir = 'notmp';
wfUtils::errorsOff();
foreach ($dirs as $dir) {
$dir = rtrim($dir, '/') . '/';
$fh = @fopen($dir . 'wftmptest.txt', 'w');
if (!$fh) {
continue;
}
$bytes = @fwrite($fh, 'test');
if ($bytes != 4) {
@fclose($fh);
continue;
}
@fclose($fh);
if (!@unlink($dir . 'wftmptest.txt')) {
continue;
}
$finalDir = $dir;
break;
}
wfUtils::errorsOn();
self::$tmpDirCache = $finalDir;
}
if (self::$tmpDirCache == 'notmp') {
return false;
} else {
return self::$tmpDirCache;
}
}