Beispiel #1
0
 public function action_show()
 {
     /*
     Kohana::$log->add(Log::ERROR, 'coverable error; nonrecoverable ble error');
     Kohana::$log->add(Log::DEBUG, 'coveraoverable eror; nonrecoverable eror');
     Kohana::$log->add(Log::INFO, 'coverabverable erable errror');
     Kohana::$log->add(Log::NOTICE, 'coverable error; nonrecole ble error');
     Kohana::$log->add(Log::WARNING, 'coverrrerror; nonreerror; nonrecoveracor');
     */
     //$rr .= 'fddf';
     $logreader = new LogReader();
     $log = $logreader->set_config($this->params);
     $levels = $log->get_levels();
     $level = Arr::get($_GET, 'level');
     $msgs = $log->get_messages($level);
     $msgs = array_reverse($msgs);
     $this->content = View::factory('log/show');
     $this->content->level = $level;
     $this->content->levels = $levels;
     $this->content->msgs = $msgs;
 }
 /**
  * @param OutputPage &$out where to send output
  * @private
  */
 function showPrevNext(&$out)
 {
     global $wgContLang, $wgRequest;
     $pieces = array();
     $pieces[] = 'type=' . urlencode($this->reader->queryType());
     $pieces[] = 'user='******'page=' . urlencode($this->reader->queryTitle());
     $pieces[] = 'pattern=' . urlencode($this->reader->queryPattern());
     $bits = implode('&', $pieces);
     list($limit, $offset) = $wgRequest->getLimitOffset();
     # TODO: use timestamps instead of offsets to make it more natural
     # to go huge distances in time
     $html = wfViewPrevNext($offset, $limit, $wgContLang->specialpage('Log'), $bits, $this->numResults < $limit);
     $out->addHTML('<p>' . $html . '</p>');
 }
 /**
  * If there are rows in the deletion log for this page, show them,
  * along with a nice little note for the user
  *
  * @param OutputPage $out
  */
 private function showDeletionLog($out)
 {
     $title = $this->mTitle;
     $reader = new LogReader(new FauxRequest(array('page' => $title->getPrefixedText(), 'type' => 'delete')));
     if ($reader->hasRows()) {
         $out->addHtml('<div id="mw-recreate-deleted-warn">');
         $out->addWikiMsg('recreate-deleted-warn');
         $viewer = new LogViewer($reader);
         $viewer->showList($out);
         $out->addHtml('</div>');
     }
 }
Beispiel #4
0
 public function showLog()
 {
     if (isset($this->settings[$this->key])) {
         $log = new LogReader($this->settings[$this->key]['path'] . $this->files[$this->key][$this->selected], $this->settings[$this->key]['delimiter'], $this->settings[$this->key]['data_regexp'], $this->settings[$this->key]['data_keys']);
         $timestamp = isset($_GET['timestamp']) ? intval($_GET['timestamp']) : 0;
         // Used for auto refresh
         $data = $log->readLogFile($this->position, $this->lines);
         $data = $log->formatLog($data);
         $data = array_reverse($data);
         foreach ($data as $line) {
             if (!is_a($line['datetime'], 'DateTime')) {
                 $line['datetime'] = new DateTime();
             }
             if (intval($line['datetime']->format('U')) > $timestamp) {
                 $class = 'default';
                 if (strpos(strtolower($line['level']), 'error') !== false) {
                     $class = 'danger';
                 }
                 if (strpos(strtolower($line['level']), 'info') !== false) {
                     $class = 'info';
                 }
                 if (strpos(strtolower($line['level']), 'warn') !== false) {
                     $class = 'warning';
                 }
                 echo '<tr class="' . $class . '" data-line="' . $line['line'] . '" data-timestamp="' . $line['datetime']->format('U') . '"><td class="date-row mono-row">' . $line['datetime']->format('d-m-Y H:i:s') . '</td><td class="mono-row"><span class="level-label label label-' . $class . '">' . $line['level'] . '</span></td><td class="message"><pre>' . $line['message'] . '</pre></td></tr>';
             }
         }
     } else {
         return '';
     }
 }
 /**
  * If there are rows in the deletion log for this file, show them,
  * along with a nice little note for the user
  *
  * @param OutputPage $out
  * @param string filename
  */
 private function showDeletionLog($out, $filename)
 {
     $reader = new LogReader(new FauxRequest(array('page' => $filename, 'type' => 'delete')));
     if ($reader->hasRows()) {
         $out->addHtml('<div id="mw-upload-deleted-warn">');
         $out->addWikiMsg('upload-wasdeleted');
         $viewer = new LogViewer($reader);
         $viewer->showList($out);
         $out->addHtml('</div>');
     }
 }