TYPO3 API  SVNRelease
class.syslog.php
Go to the documentation of this file.
00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 2007-2011 Kasper Skårhøj (kasperYYYY@typo3.com)
00006 *  All rights reserved
00007 *
00008 *  This script is part of the TYPO3 project. The TYPO3 project is
00009 *  free software; you can redistribute it and/or modify
00010 *  it under the terms of the GNU General Public License as published by
00011 *  the Free Software Foundation; either version 2 of the License, or
00012 *  (at your option) any later version.
00013 *
00014 *  The GNU General Public License can be found at
00015 *  http://www.gnu.org/copyleft/gpl.html.
00016 *  A copy is found in the textfile GPL.txt and important notices to the license
00017 *  from the author is found in LICENSE.txt distributed with these scripts.
00018 *
00019 *
00020 *  This script is distributed in the hope that it will be useful,
00021 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00022 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023 *  GNU General Public License for more details.
00024 *
00025 *  This copyright notice MUST APPEAR in all copies of the script!
00026 ***************************************************************/
00027 /**
00028  * Cleaner module: syslog
00029  * User function called from tx_lowlevel_cleaner_core configured in ext_localconf.php
00030  *
00031  * @author  Kasper Skårhøj <kasperYYYY@typo3.com>
00032  */
00033 /**
00034  * [CLASS/FUNCTION INDEX of SCRIPT]
00035  *
00036  *
00037  *
00038  *   57: class tx_lowlevel_cleanflexform extends tx_lowlevel_cleaner_core
00039  *   64:     function tx_lowlevel_cleanflexform()
00040  *   89:     function main()
00041  *  122:     function main_parseTreeCallBack($tableName,$uid,$echoLevel,$versionSwapmode,$rootIsVersion)
00042  *  154:     function main_autoFix($resultArray)
00043  *
00044  * TOTAL FUNCTIONS: 4
00045  * (This index is automatically created/updated by the extension "extdeveval")
00046  *
00047  */
00048 
00049 
00050 /**
00051  * syslog
00052  *
00053  * @author  Kasper Skårhøj <kasperYYYY@typo3.com>
00054  * @package TYPO3
00055  * @subpackage tx_lowlevel
00056  */
00057 class tx_lowlevel_syslog extends tx_lowlevel_cleaner_core {
00058 
00059     /**
00060      * Constructor
00061      *
00062      * @return  void
00063      */
00064     function tx_lowlevel_cleanflexform()    {
00065         parent::tx_lowlevel_cleaner_core();
00066 
00067         $this->cli_help['name'] = 'syslog -- Show entries from syslog';
00068         $this->cli_help['description'] = trim('
00069 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.
00070 ');
00071 
00072         $this->cli_help['examples'] = '';
00073     }
00074 
00075     /**
00076      * Find syslog
00077      *
00078      * @return  array
00079      */
00080     function main() {
00081         global $TYPO3_DB;
00082 
00083             // Initialize result array:
00084         $resultArray = array(
00085             'message' => $this->cli_help['name'].LF.LF.$this->cli_help['description'],
00086             'headers' => array(
00087                 'listing' => array('','',1),
00088                 'allDetails' => array('','',0),
00089             ),
00090             'listing' => array(),
00091             'allDetails' => array()
00092         );
00093 
00094         $rows = $TYPO3_DB->exec_SELECTgetRows(
00095                 '*',
00096                 'sys_log',
00097                 'tstamp>' . ($GLOBALS['EXEC_TIME'] - 25 * 3600)
00098             );
00099         foreach($rows as $r)    {
00100             $l = unserialize($r['log_data']);
00101             $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]);
00102             $resultArray['listing'][$r['uid']] = $explained;
00103             $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'));
00104         }
00105 
00106         return $resultArray;
00107     }
00108 
00109     /**
00110      * Mandatory autofix function
00111      * Will run auto-fix on the result array. Echos status during processing.
00112      *
00113      * @param   array       Result array from main() function
00114      * @return  void
00115      */
00116     function main_autoFix($resultArray) {
00117     }
00118 }
00119 
00120 ?>