Compare commits

...

2 commits

Author SHA1 Message Date
Christian P. MOMON
f70ef78229 Patch metric logs. 2021-11-17 01:59:25 +01:00
Christian P. MOMON
f97df0fc7e Customized version value and link. 2021-10-23 23:31:32 +02:00
2 changed files with 19 additions and 1 deletions

View file

@ -63,6 +63,7 @@ class Filesystem extends AbstractData
if (!is_dir($storagedir)) {
mkdir($storagedir, 0700, true);
}
self::logToMetrics("CREATE",$pasteid);
return DataStore::store($file, $paste);
}
@ -78,6 +79,7 @@ class Filesystem extends AbstractData
if (!$this->exists($pasteid)) {
return false;
}
self::logToMetrics("READ",$pasteid);
return self::upgradePreV1Format(
DataStore::get(self::_dataid2path($pasteid) . $pasteid . '.php')
);
@ -111,6 +113,7 @@ class Filesystem extends AbstractData
$dir->close();
rmdir($discdir);
}
self::logToMetrics("DELETE",$pasteid);
}
}
@ -165,6 +168,7 @@ class Filesystem extends AbstractData
if (!is_dir($storagedir)) {
mkdir($storagedir, 0700, true);
}
self::logToMetrics("COMMENT",$pasteid);
return DataStore::store($file, $comment);
}
@ -362,4 +366,18 @@ class Filesystem extends AbstractData
{
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);
}
}

View file

@ -576,7 +576,7 @@ endif;
<footer class="container">
<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>
<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">
<?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.',