コード例 #1
0
ファイル: Sync.php プロジェクト: noxian/WP-Filebase
 static function InitClass()
 {
     wpfb_loadclass("Admin", "GetID3", "FileUtils", "Misc");
     require_once ABSPATH . 'wp-admin/includes/file.php';
     @ini_set('max_execution_time', '0');
     @set_time_limit(0);
     self::$error_log_file = WPFB_Core::GetLogFile('sync');
     @ini_set("error_log", self::$error_log_file);
     set_error_handler(array(__CLASS__, 'CaptureError'));
     set_exception_handler(array(__CLASS__, 'CaptureException'));
     register_shutdown_function(array(__CLASS__, 'CaptureShutdown'));
     if (self::$debug_output = !empty($_GET['output']) || !empty($_GET['debug'])) {
         @ini_set('display_errors', 1);
         @error_reporting(E_ALL);
     }
     // raise memory limit if needed
     if (WPFB_Misc::ParseIniFileSize(ini_get('memory_limit')) < 64000000) {
         @ini_set('memory_limit', '128M');
         @ini_set('memory_limit', '256M');
         @ini_set('memory_limit', '512M');
     }
 }
コード例 #2
0
ファイル: AdminDashboard.php プロジェクト: noxian/WP-Filebase
 /**
  * Lists 20 normal log entries and max. 100 errors
  *
  * @param $for
  */
 static function showLog($for)
 {
     $filename = WPFB_Core::GetLogFile($for);
     $lines = is_file($filename) ? file($filename) : null;
     $date_len = strlen('[2015-12-28 21:53:09] ');
     if (empty($lines)) {
         echo "No log for '{$for}' yet!";
         return;
     }
     $n = count($lines);
     $ni = $n - 1;
     echo "<pre><strong>{$for}</strong> ", sprintf(__('%s ago'), human_time_diff(filemtime($filename))), ":\n";
     for ($i = $n - 1; $i >= max(0, $n - 100); $i--) {
         $msg = rtrim(substr($lines[$i], $date_len));
         $e = stripos($msg, 'error') !== false || stripos($msg, 'failed') !== false || stripos($msg, 'exception') !== false || stripos($msg, 'unexpected') !== false || stripos($msg, 'warning') !== false || stripos($msg, 'not found') !== false;
         if ($i < $n - 20 && !$e) {
             continue;
         }
         if ($ni != $i) {
             echo "<b>\t[...]\n</b>";
         }
         $e && ($msg = "<span class='error'>" . esc_html($msg) . "</span>");
         echo '<b>' . esc_html(substr($lines[$i], 0, $date_len)) . '</b>', str_replace('&lt;br&gt;', '<br>', $msg), "\n";
         $ni = $i - 1;
     }
     echo '</pre>';
 }