aboutsummaryrefslogtreecommitdiff
path: root/app/Models/LogDAO.php
diff options
context:
space:
mode:
authorGravatar Clément <clement@selfhost.fr> 2017-02-15 14:14:03 +0100
committerGravatar Clément <clement@selfhost.fr> 2017-02-15 14:14:03 +0100
commit5a1bb1393b4496eb35a2ffb3cc63d41c9dc1e2e5 (patch)
tree67028e45792c575c25c92616633f64cc7a4a13eb /app/Models/LogDAO.php
parent7e949d50320317b5c3b5a2da2bdaf324e794b2f7 (diff)
parent5f637bd816b7323885bfe1751a1724ee59a822f6 (diff)
Merge remote-tracking branch 'FreshRSS/master'
Diffstat (limited to 'app/Models/LogDAO.php')
-rw-r--r--app/Models/LogDAO.php19
1 files changed, 12 insertions, 7 deletions
diff --git a/app/Models/LogDAO.php b/app/Models/LogDAO.php
index d1e515200..ab258cd58 100644
--- a/app/Models/LogDAO.php
+++ b/app/Models/LogDAO.php
@@ -2,15 +2,15 @@
class FreshRSS_LogDAO {
public static function lines() {
- $logs = array ();
- $handle = @fopen(LOG_PATH . '/' . Minz_Session::param('currentUser', '_') . '.log', 'r');
+ $logs = array();
+ $handle = @fopen(join_path(DATA_PATH, 'users', Minz_Session::param('currentUser', '_'), 'log.txt'), 'r');
if ($handle) {
while (($line = fgets($handle)) !== false) {
- if (preg_match ('/^\[([^\[]+)\] \[([^\[]+)\] --- (.*)$/', $line, $matches)) {
+ if (preg_match('/^\[([^\[]+)\] \[([^\[]+)\] --- (.*)$/', $line, $matches)) {
$myLog = new FreshRSS_Log ();
- $myLog->_date ($matches[1]);
- $myLog->_level ($matches[2]);
- $myLog->_info ($matches[3]);
+ $myLog->_date($matches[1]);
+ $myLog->_level($matches[2]);
+ $myLog->_info($matches[3]);
$logs[] = $myLog;
}
}
@@ -20,6 +20,11 @@ class FreshRSS_LogDAO {
}
public static function truncate() {
- file_put_contents(LOG_PATH . '/' . Minz_Session::param('currentUser', '_') . '.log', '');
+ file_put_contents(join_path(DATA_PATH, 'users', Minz_Session::param('currentUser', '_'), 'log.txt'), '');
+ if (FreshRSS_Auth::hasAccess('admin')) {
+ file_put_contents(join_path(DATA_PATH, 'users', '_', 'log.txt'), '');
+ file_put_contents(join_path(DATA_PATH, 'users', '_', 'log_api.txt'), '');
+ file_put_contents(join_path(DATA_PATH, 'users', '_', 'log_pshb.txt'), '');
+ }
}
}