improved paste.log

This commit is contained in:
Didier Clermonté 2018-10-23 18:18:23 +02:00 committed by root
parent f6ef4f4255
commit 5414471fc1
2 changed files with 18 additions and 15 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
/data/
/paste.log
/*~

View File

@ -62,19 +62,7 @@ class Filesystem extends AbstractData
}
return self::$_instance;
}
/**
* Add log
*
* @access public
* @return bool
*/
public 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);
}
/**
* Create a paste.
*
@ -117,8 +105,8 @@ class Filesystem extends AbstractData
$paste->attachmentname = $paste->meta->attachmentname;
unset($paste->meta->attachmentname);
}
self::logToChapril("READ",$pasteid);
}
self::logToChapril("READ",$pasteid);
return $paste;
}
@ -150,8 +138,8 @@ class Filesystem extends AbstractData
}
$dir->close();
rmdir($discdir);
self::logToChapril("DELETE",$pasteid);
}
self::logToChapril("DELETE",$pasteid);
}
}
@ -452,4 +440,16 @@ class Filesystem extends AbstractData
{
return json_decode(substr(file_get_contents($file), strlen(self::PROTECTION_LINE . PHP_EOL)));
}
/**
* 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);
}
}