dc5a4cad96083c65d95d085f2c57b4bcda371157
[Packages/TYPO3.CMS.git] / typo3 / sysext / lowlevel / clmods / class.syslog.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 2007-2009 Kasper Skaarhoj (kasperYYYY@typo3.com)
6 * All rights reserved
7 *
8 * This script is part of the TYPO3 project. The TYPO3 project is
9 * free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
16 * A copy is found in the textfile GPL.txt and important notices to the license
17 * from the author is found in LICENSE.txt distributed with these scripts.
18 *
19 *
20 * This script is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * This copyright notice MUST APPEAR in all copies of the script!
26 ***************************************************************/
27 /**
28 * Cleaner module: syslog
29 * User function called from tx_lowlevel_cleaner_core configured in ext_localconf.php
30 *
31 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
32 */
33 /**
34 * [CLASS/FUNCTION INDEX of SCRIPT]
35 *
36 *
37 *
38 * 57: class tx_lowlevel_cleanflexform extends tx_lowlevel_cleaner_core
39 * 64: function tx_lowlevel_cleanflexform()
40 * 89: function main()
41 * 122: function main_parseTreeCallBack($tableName,$uid,$echoLevel,$versionSwapmode,$rootIsVersion)
42 * 154: function main_autoFix($resultArray)
43 *
44 * TOTAL FUNCTIONS: 4
45 * (This index is automatically created/updated by the extension "extdeveval")
46 *
47 */
48
49
50 /**
51 * syslog
52 *
53 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
54 * @package TYPO3
55 * @subpackage tx_lowlevel
56 */
57 class tx_lowlevel_syslog extends tx_lowlevel_cleaner_core {
58
59 /**
60 * Constructor
61 *
62 * @return void
63 */
64 function tx_lowlevel_cleanflexform() {
65 parent::tx_lowlevel_cleaner_core();
66
67 $this->cli_help['name'] = 'syslog -- Show entries from syslog';
68 $this->cli_help['description'] = trim('
69 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.
70 ');
71
72 $this->cli_help['examples'] = '';
73 }
74
75 /**
76 * Find syslog
77 *
78 * @return array
79 */
80 function main() {
81 global $TYPO3_DB;
82
83 // Initialize result array:
84 $resultArray = array(
85 'message' => $this->cli_help['name'].chr(10).chr(10).$this->cli_help['description'],
86 'headers' => array(
87 'listing' => array('','',1),
88 'allDetails' => array('','',0),
89 ),
90 'listing' => array(),
91 'allDetails' => array()
92 );
93
94 $rows = $TYPO3_DB->exec_SELECTgetRows(
95 '*',
96 'sys_log',
97 'tstamp>'.(time()-25*3600)
98 );
99 foreach($rows as $r) {
100 $l = unserialize($r['log_data']);
101 $explained = '#'.$r['uid'].' '.t3lib_BEfunc::datetime($r['tstamp']).' USER['.$r['userid'].']: '.sprintf($r['details'],$l[0],$l[1],$l[2],$l[3],$l[4],$l[5]);
102 $resultArray['listing'][$r['uid']] = $explained;
103 $resultArray['allDetails'][$r['uid']] = array($explained,t3lib_div::arrayToLogString($r,'uid,userid,action,recuid,tablename,recpid,error,tstamp,type,details_nr,IP,event_pid,NEWid,workspace'));
104 }
105
106 return $resultArray;
107 }
108
109 /**
110 * Mandatory autofix function
111 * Will run auto-fix on the result array. Echos status during processing.
112 *
113 * @param array Result array from main() function
114 * @return void
115 */
116 function main_autoFix($resultArray) {
117 }
118 }
119
120 ?>