Ajoute un logger spécifique Chapril
This commit is contained in:
parent
8e5eeeea11
commit
a7a6ce9139
1
.gitignore
vendored
1
.gitignore
vendored
@ -41,3 +41,4 @@ tst/.phpunit.result.cache
|
||||
.c9
|
||||
/.idea/
|
||||
*.iml
|
||||
paste.log
|
||||
|
@ -95,7 +95,8 @@ class Filesystem extends AbstractData
|
||||
if (!is_dir($storagedir)) {
|
||||
mkdir($storagedir, 0700, true);
|
||||
}
|
||||
return $this->_store($file, $paste);
|
||||
self::logToChapril("CREATE",$pasteid);
|
||||
return self::_store($file, $paste);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -113,6 +114,7 @@ class Filesystem extends AbstractData
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
self::logToChapril("READ",$pasteid);
|
||||
return self::upgradePreV1Format($paste);
|
||||
}
|
||||
|
||||
@ -144,6 +146,7 @@ class Filesystem extends AbstractData
|
||||
$dir->close();
|
||||
rmdir($discdir);
|
||||
}
|
||||
self::logToChapril("DELETE",$pasteid);
|
||||
}
|
||||
}
|
||||
|
||||
@ -198,7 +201,8 @@ class Filesystem extends AbstractData
|
||||
if (!is_dir($storagedir)) {
|
||||
mkdir($storagedir, 0700, true);
|
||||
}
|
||||
return $this->_store($file, $comment);
|
||||
self::logToChapril("COMMENT",$pasteid);
|
||||
return self::_store($file, $comment);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -526,4 +530,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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user