Просмотр исходного кода

Remove calls to syslog()

Temporary fix:

- Change syslog by Minz_Log::notice in most of the files
- Logs are stored in USERS_PATH/_/log.txt for actualize_script.php
- Simply comment syslog in SimplePie

See https://github.com/FreshRSS/FreshRSS/issues/711
Marien Fressinaud 11 лет назад
Родитель
Сommit
59ea9f2a3b

+ 2 - 2
app/Models/Feed.php

@@ -249,10 +249,10 @@ class FreshRSS_Feed extends Minz_Model {
 				}
 
 				if (($mtime === true) ||($mtime > $this->lastUpdate)) {
-					syslog(LOG_DEBUG, 'FreshRSS no cache ' . $mtime . ' > ' . $this->lastUpdate . ' for ' . $subscribe_url);
+					Minz_Log::notice('FreshRSS no cache ' . $mtime . ' > ' . $this->lastUpdate . ' for ' . $subscribe_url);
 					$this->loadEntries($feed);	// et on charge les articles du flux
 				} else {
-					syslog(LOG_DEBUG, 'FreshRSS use cache for ' . $subscribe_url);
+					Minz_Log::notice('FreshRSS use cache for ' . $subscribe_url);
 					$this->entries = array();
 				}
 

+ 8 - 4
app/actualize_script.php

@@ -21,6 +21,9 @@ $_GET['force'] = true;
 $_SERVER['HTTP_HOST'] = '';
 
 
+$log_file = join_path(USERS_PATH, '_', 'log.txt');
+
+
 $app = new FreshRSS();
 
 $system_conf = Minz_Configuration::get('system');
@@ -41,13 +44,13 @@ $min_last_activity = time() - $limits['max_inactivity'];
 foreach ($users as $user) {
 	if (($user !== $system_conf->default_user) &&
 			(FreshRSS_UserDAO::mtime($user) < $min_last_activity)) {
-		syslog(LOG_INFO, 'FreshRSS skip inactive user ' . $user);
+		Minz_Log::notice('FreshRSS skip inactive user ' . $user, $log_file);
 		if (defined('STDOUT')) {
 			fwrite(STDOUT, 'FreshRSS skip inactive user ' . $user . "\n");	//Unbuffered
 		}
 		continue;
 	}
-	syslog(LOG_INFO, 'FreshRSS actualize ' . $user);
+	Minz_Log::notice('FreshRSS actualize ' . $user, $log_file);
 	if (defined('STDOUT')) {
 		fwrite(STDOUT, 'Actualize ' . $user . "...\n");	//Unbuffered
 	}
@@ -62,7 +65,8 @@ foreach ($users as $user) {
 
 
 	if (!invalidateHttpCache()) {
-		syslog(LOG_NOTICE, 'FreshRSS write access problem in ' . join_path(USERS_PATH, $user, 'log.txt'));
+		Minz_Log::notice('FreshRSS write access problem in ' . join_path(USERS_PATH, $user, 'log.txt'),
+		                 $log_file);
 		if (defined('STDERR')) {
 			fwrite(STDERR, 'Write access problem in ' . join_path(USERS_PATH, $user, 'log.txt') . "\n");
 		}
@@ -70,7 +74,7 @@ foreach ($users as $user) {
 }
 
 
-syslog(LOG_INFO, 'FreshRSS actualize done.');
+Minz_Log::notice('FreshRSS actualize done.', $log_file);
 if (defined('STDOUT')) {
 	fwrite(STDOUT, 'Done.' . "\n");
 	$end_date = date_create('now');

+ 2 - 2
lib/SimplePie/SimplePie.php

@@ -1529,11 +1529,11 @@ class SimplePie
 					{	//FreshRSS
 						$md5 = $this->cleanMd5($file->body);
 						if ($this->data['md5'] === $md5) {
-							syslog(LOG_DEBUG, 'SimplePie MD5 cache match for ' . $this->feed_url);
+							// syslog(LOG_DEBUG, 'SimplePie MD5 cache match for ' . $this->feed_url);
 							$cache->touch();
 							return true;	//Content unchanged even though server did not send a 304
 						} else {
-							syslog(LOG_DEBUG, 'SimplePie MD5 cache no match for ' . $this->feed_url);
+							// syslog(LOG_DEBUG, 'SimplePie MD5 cache no match for ' . $this->feed_url);
 							$this->data['md5'] = $md5;
 						}
 					}

+ 1 - 1
lib/SimplePie/SimplePie/File.php

@@ -79,7 +79,7 @@ class SimplePie_File
 		$this->useragent = $useragent;
 		if (preg_match('/^http(s)?:\/\//i', $url))
 		{
-			syslog(LOG_INFO, 'SimplePie GET ' . $url);	//FreshRSS
+			// syslog(LOG_INFO, 'SimplePie GET ' . $url);	//FreshRSS
 			if ($useragent === null)
 			{
 				$useragent = ini_get('user_agent');

+ 1 - 1
lib/lib_rss.php

@@ -180,7 +180,7 @@ function sanitizeHTML($data, $base = '') {
 function get_content_by_parsing ($url, $path) {
 	require_once (LIB_PATH . '/lib_phpQuery.php');
 
-	syslog(LOG_INFO, 'FreshRSS GET ' . $url);
+	Minz_Log::notice('FreshRSS GET ' . $url);
 	$html = file_get_contents ($url);
 
 	if ($html) {