TYPO3  7.6
SyslogCommand.php
Go to the documentation of this file.
1 <?php
2 namespace TYPO3\CMS\Lowlevel;
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
21 {
25  public function __construct()
26  {
27  parent::__construct();
28  $this->cli_help['name'] = 'syslog -- Show entries from syslog';
29  $this->cli_help['description'] = trim('
30 Showing last 25 hour entries from the syslog. More features pending. This is the most basic and can be useful for nightly check test reports.
31 ');
32  $this->cli_help['examples'] = '';
33  }
34 
40  public function main()
41  {
42  // Initialize result array:
43  $resultArray = array(
44  'message' => $this->cli_help['name'] . LF . LF . $this->cli_help['description'],
45  'headers' => array(
46  'listing' => array('', '', 1),
47  'allDetails' => array('', '', 0)
48  ),
49  'listing' => array(),
50  'allDetails' => array()
51  );
52  $rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*', 'sys_log', 'tstamp>' . ($GLOBALS['EXEC_TIME'] - 25 * 3600));
53  foreach ($rows as $r) {
54  $l = unserialize($r['log_data']);
55  $explained = '#' . $r['uid'] . ' ' . \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($r['tstamp']) . ' USER[' . $r['userid'] . ']: ' . sprintf($r['details'], $l[0], $l[1], $l[2], $l[3], $l[4], $l[5]);
56  $resultArray['listing'][$r['uid']] = $explained;
57  $resultArray['allDetails'][$r['uid']] = array($explained, \TYPO3\CMS\Core\Utility\GeneralUtility::arrayToLogString($r, 'uid,userid,action,recuid,tablename,recpid,error,tstamp,type,details_nr,IP,event_pid,NEWid,workspace'));
58  }
59  return $resultArray;
60  }
61 
69  public function main_autoFix($resultArray)
70  {
71  }
72 }