|
Revision 727, 1.0 KB
(checked in by brieb, 2 years ago)
|
- Added more rights look ups to certain pages
- Fixed several path disclosure errors
|
| Line | |
|---|
| 1 | <?php |
|---|
| 2 | |
|---|
| 3 | //uncomment for debug purposes |
|---|
| 4 | //if(!class_exists("appError")) |
|---|
| 5 | // include_once("../../include/session.php"); |
|---|
| 6 | |
|---|
| 7 | class cleanSysLog{ |
|---|
| 8 | |
|---|
| 9 | function cleanSysLog($db){ |
|---|
| 10 | $this->db = $db; |
|---|
| 11 | }//end method --cleanImports-- |
|---|
| 12 | |
|---|
| 13 | //This method should remove any logs older than the 2000th |
|---|
| 14 | //when ordering by creationdate (desc) |
|---|
| 15 | function removeExcessLogs(){ |
|---|
| 16 | |
|---|
| 17 | $querystatement = " |
|---|
| 18 | SELECT |
|---|
| 19 | `id`, |
|---|
| 20 | `stamp` |
|---|
| 21 | FROM |
|---|
| 22 | `log` |
|---|
| 23 | ORDER BY |
|---|
| 24 | `stamp` DESC |
|---|
| 25 | LIMIT |
|---|
| 26 | 2000,1; |
|---|
| 27 | "; |
|---|
| 28 | |
|---|
| 29 | $queryresult = $this->db->query($querystatement); |
|---|
| 30 | |
|---|
| 31 | if($this->db->numRows($queryresult)){ |
|---|
| 32 | |
|---|
| 33 | $therecord = $this->db->fetchArray($queryresult); |
|---|
| 34 | |
|---|
| 35 | $querystatement = " |
|---|
| 36 | DELETE FROM |
|---|
| 37 | `log` |
|---|
| 38 | WHERE |
|---|
| 39 | `stamp` > '".$therecord["stamp"]."'; |
|---|
| 40 | "; |
|---|
| 41 | |
|---|
| 42 | $queryresult = $this->db->query($querystatement); |
|---|
| 43 | |
|---|
| 44 | }//end if |
|---|
| 45 | |
|---|
| 46 | }//end method --removeExcessLogs- |
|---|
| 47 | |
|---|
| 48 | }//end class --cleanImports-- |
|---|
| 49 | |
|---|
| 50 | if(!isset($noOutput) && isset($db)){ |
|---|
| 51 | |
|---|
| 52 | $clean = new cleanSysLog($db); |
|---|
| 53 | $clean->removeExcessLogs(); |
|---|
| 54 | |
|---|
| 55 | }//end if |
|---|
| 56 | ?> |
|---|