Server : Apache System : Linux indy02.toastserver.com 3.10.0-962.3.2.lve1.5.85.el7.x86_64 #1 SMP Thu Apr 18 15:18:36 UTC 2024 x86_64 User : palandch ( 1163) PHP Version : 7.1.33 Disable Function : NONE Directory : /home/palandch/www/core/model/modx/processors/system/errorlog/ |
<?php /** * Clear the error log * * @package modx * @subpackage processors.system.errorlog */ class modSystemErrorLogClearProcessor extends modProcessor { public function checkPermissions() { return $this->modx->hasPermission('error_log_erase'); } public function process() { $file = $this->modx->getOption(xPDO::OPT_CACHE_PATH).'logs/error.log'; $content = ''; $tooLarge = false; if (file_exists($file)) { /* @var modCacheManager $cacheManager */ $cacheManager= $this->modx->getCacheManager(); $cacheManager->writeFile($file,' '); $size = round(@filesize($file) / 1000 / 1000,2); if ($size > 1) { $tooLarge = true; } else { $content = @file_get_contents($file); } } $la = array( 'name' => $file, 'log' => $content, 'tooLarge' => $tooLarge, ); return $this->success('',$la); } } return 'modSystemErrorLogClearProcessor';