Compare commits
2 commits
master
...
libre-serv
Author | SHA1 | Date | |
---|---|---|---|
|
f70ef78229 | ||
|
f97df0fc7e |
2 changed files with 19 additions and 1 deletions
|
@ -63,6 +63,7 @@ class Filesystem extends AbstractData
|
||||||
if (!is_dir($storagedir)) {
|
if (!is_dir($storagedir)) {
|
||||||
mkdir($storagedir, 0700, true);
|
mkdir($storagedir, 0700, true);
|
||||||
}
|
}
|
||||||
|
self::logToMetrics("CREATE",$pasteid);
|
||||||
return DataStore::store($file, $paste);
|
return DataStore::store($file, $paste);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,6 +79,7 @@ class Filesystem extends AbstractData
|
||||||
if (!$this->exists($pasteid)) {
|
if (!$this->exists($pasteid)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
self::logToMetrics("READ",$pasteid);
|
||||||
return self::upgradePreV1Format(
|
return self::upgradePreV1Format(
|
||||||
DataStore::get(self::_dataid2path($pasteid) . $pasteid . '.php')
|
DataStore::get(self::_dataid2path($pasteid) . $pasteid . '.php')
|
||||||
);
|
);
|
||||||
|
@ -111,6 +113,7 @@ class Filesystem extends AbstractData
|
||||||
$dir->close();
|
$dir->close();
|
||||||
rmdir($discdir);
|
rmdir($discdir);
|
||||||
}
|
}
|
||||||
|
self::logToMetrics("DELETE",$pasteid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,6 +168,7 @@ class Filesystem extends AbstractData
|
||||||
if (!is_dir($storagedir)) {
|
if (!is_dir($storagedir)) {
|
||||||
mkdir($storagedir, 0700, true);
|
mkdir($storagedir, 0700, true);
|
||||||
}
|
}
|
||||||
|
self::logToMetrics("COMMENT",$pasteid);
|
||||||
return DataStore::store($file, $comment);
|
return DataStore::store($file, $comment);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -362,4 +366,18 @@ class Filesystem extends AbstractData
|
||||||
{
|
{
|
||||||
return (bool) preg_match('/^[a-f0-9]{2}$/', $element);
|
return (bool) preg_match('/^[a-f0-9]{2}$/', $element);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add custom log
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
private function logToMetrics($message, $id=null)
|
||||||
|
{
|
||||||
|
$today = date('Y-m-d H:i:s');
|
||||||
|
$line="$today $message \t$id\n";
|
||||||
|
$dir= '/var/www/paste.libre-service.eu/data';
|
||||||
|
return (bool) file_put_contents("$dir/metrics.log",$line,FILE_APPEND|LOCK_EX);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -576,7 +576,7 @@ endif;
|
||||||
<footer class="container">
|
<footer class="container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<h4 class="col-md-5 col-xs-8"><?php echo I18n::_($NAME); ?> <small>- <?php echo I18n::_('Because ignorance is bliss'); ?></small></h4>
|
<h4 class="col-md-5 col-xs-8"><?php echo I18n::_($NAME); ?> <small>- <?php echo I18n::_('Because ignorance is bliss'); ?></small></h4>
|
||||||
<p class="col-md-1 col-xs-4 text-center"><?php echo $VERSION; ?></p>
|
<p class="col-md-1 col-xs-4 text-center"><a href="https://forge.devinsy.fr/libre-service.eu/paste.libre-service.eu-pastebin"><?php echo "version libre-service.eu-$VERSION"; ?></a></p>
|
||||||
<p id="aboutbox" class="col-md-6 col-xs-12">
|
<p id="aboutbox" class="col-md-6 col-xs-12">
|
||||||
<?php echo sprintf(
|
<?php echo sprintf(
|
||||||
I18n::_('%s is a minimalist, open source online pastebin where the server has zero knowledge of pasted data. Data is encrypted/decrypted %sin the browser%s using 256 bits AES.',
|
I18n::_('%s is a minimalist, open source online pastebin where the server has zero knowledge of pasted data. Data is encrypted/decrypted %sin the browser%s using 256 bits AES.',
|
||||||
|
|
Loading…
Reference in a new issue