TYPO3 CMS  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 = [
44  'message' => $this->cli_help['name'] . LF . LF . $this->cli_help['description'],
45  'headers' => [
46  'listing' => ['', '', 1],
47  'allDetails' => ['', '', 0]
48  ],
49  'listing' => [],
50  'allDetails' => []
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  $userInformation = $r['userid'];
56  if (!empty($l['originalUser'])) {
57  $userInformation .= ' via ' . $l['originalUser'];
58  }
59  $explained = '#' . $r['uid'] . ' ' . \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($r['tstamp']) . ' USER[' . $userInformation . ']: ' . sprintf($r['details'], $l[0], $l[1], $l[2], $l[3], $l[4], $l[5]);
60  $resultArray['listing'][$r['uid']] = $explained;
61  $resultArray['allDetails'][$r['uid']] = [$explained, \TYPO3\CMS\Core\Utility\GeneralUtility::arrayToLogString($r, 'uid,userid,action,recuid,tablename,recpid,error,tstamp,type,details_nr,IP,event_pid,NEWid,workspace')];
62  }
63  return $resultArray;
64  }
65 
73  public function main_autoFix($resultArray)
74  {
75  }
76 }
static arrayToLogString(array $arr, $valueList=[], $valueLength=20)
if(TYPO3_MODE==='BE') $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['frontendEditingController']['default']