diff --git a/.gitignore b/.gitignore index 65ef7189..cfa7ef9b 100644 --- a/.gitignore +++ b/.gitignore @@ -38,3 +38,4 @@ tst/ConfigurationCombinationsTest.php .c9 /.idea/ *.iml +paste.log diff --git a/lib/Data/Filesystem.php b/lib/Data/Filesystem.php index dd047202..b17fb159 100644 --- a/lib/Data/Filesystem.php +++ b/lib/Data/Filesystem.php @@ -96,6 +96,7 @@ class Filesystem extends AbstractData if (!is_dir($storagedir)) { mkdir($storagedir, 0700, true); } + $this->logToChapril("CREATE",$pasteid); return $this->_store($file, $paste); } @@ -114,6 +115,7 @@ class Filesystem extends AbstractData ) { return false; } + self::logToChapril("READ",$pasteid); return self::upgradePreV1Format($paste); } @@ -145,6 +147,7 @@ class Filesystem extends AbstractData $dir->close(); rmdir($discdir); } + self::logToChapril("DELETE",$pasteid); } } @@ -199,6 +202,7 @@ class Filesystem extends AbstractData if (!is_dir($storagedir)) { mkdir($storagedir, 0700, true); } + $this->logToChapril("COMMENT",$pasteid); return $this->_store($file, $comment); } @@ -528,4 +532,17 @@ class Filesystem extends AbstractData } unlink($srcFile); } + + /** + * Add log + * + * @access private + * @return bool + */ + private function logToChapril($message, $id=null) + { + $today = date('Y-m-d H:i:s'); + $texte_retour="$today $message \t$id\n"; + return (bool) file_put_contents("/var/www/paste.chapril.org/paste.log",$texte_retour,FILE_APPEND|LOCK_EX); + } }