From 99dfdbc10d9daa8059fd6c017b1580ad493aa8f6 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 8 Jul 2018 11:29:05 +0200 Subject: Avoid feed credentials in logs (#1949) * Avoid feed credentials in logs Related to https://github.com/FreshRSS/FreshRSS/pull/1891 * Changelog 1949 --- app/Controllers/feedController.php | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'app/Controllers/feedController.php') diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php index ec88156f9..168d5a661 100755 --- a/app/Controllers/feedController.php +++ b/app/Controllers/feedController.php @@ -295,12 +295,12 @@ class FreshRSS_feed_Controller extends Minz_ActionController { if ($feed->lastUpdate() + 10 >= $mtime) { continue; //Nothing newer from other users } - //Minz_Log::debug($feed->url() . ' was updated at ' . date('c', $mtime) . ' by another user'); + //Minz_Log::debug($feed->url(false) . ' was updated at ' . date('c', $mtime) . ' by another user'); //Will take advantage of the newer cache } if (!$feed->lock()) { - Minz_Log::notice('Feed already being actualized: ' . $feed->url()); + Minz_Log::notice('Feed already being actualized: ' . $feed->url(false)); continue; } @@ -351,7 +351,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController { //This entry already exists and is unchanged. TODO: Remove the test with the zero'ed hash in FreshRSS v1.3 $oldGuids[] = $entry->guid(); } else { //This entry already exists but has been updated - //Minz_Log::debug('Entry with GUID `' . $entry->guid() . '` updated in feed ' . $feed->url() . + //Minz_Log::debug('Entry with GUID `' . $entry->guid() . '` updated in feed ' . $feed->url(false) . //', old hash ' . $existingHash . ', new hash ' . $entry->hash()); $mark_updated_article_unread = $feed->attributes('mark_updated_article_unread') !== null ? ( $feed->attributes('mark_updated_article_unread') @@ -425,8 +425,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController { max($feed_history, count($entries) + 10)); if ($nb > 0) { $needFeedCacheRefresh = true; - Minz_Log::debug($nb . ' old entries cleaned in feed [' . - $feed->url() . ']'); + Minz_Log::debug($nb . ' old entries cleaned in feed [' . $feed->url(false) . ']'); } } @@ -442,25 +441,25 @@ class FreshRSS_feed_Controller extends Minz_ActionController { if ($feed->selfUrl() !== $url) { //https://code.google.com/p/pubsubhubbub/wiki/MovingFeedsOrChangingHubs $selfUrl = checkUrl($feed->selfUrl()); if ($selfUrl) { - Minz_Log::debug('PubSubHubbub unsubscribe ' . $feed->url()); + Minz_Log::debug('PubSubHubbub unsubscribe ' . $feed->url(false)); if (!$feed->pubSubHubbubSubscribe(false)) { //Unsubscribe - Minz_Log::warning('Error while PubSubHubbub unsubscribing from ' . $feed->url()); + Minz_Log::warning('Error while PubSubHubbub unsubscribing from ' . $feed->url(false)); } $feed->_url($selfUrl, false); - Minz_Log::notice('Feed ' . $url . ' canonical address moved to ' . $feed->url()); + Minz_Log::notice('Feed ' . $url . ' canonical address moved to ' . $feed->url(false)); $feedDAO->updateFeed($feed->id(), array('url' => $feed->url())); } } } elseif ($feed->url() !== $url) { // HTTP 301 Moved Permanently - Minz_Log::notice('Feed ' . $url . ' moved permanently to ' . $feed->url()); + Minz_Log::notice('Feed ' . $url . ' moved permanently to ' . $feed->url(false)); $feedDAO->updateFeed($feed->id(), array('url' => $feed->url())); } $feed->faviconPrepare(); if ($pubsubhubbubEnabledGeneral && $feed->pubSubHubbubPrepare()) { - Minz_Log::notice('PubSubHubbub subscribe ' . $feed->url()); + Minz_Log::notice('PubSubHubbub subscribe ' . $feed->url(false)); if (!$feed->pubSubHubbubSubscribe(true)) { //Subscribe - Minz_Log::warning('Error while PubSubHubbub subscribing to ' . $feed->url()); + Minz_Log::warning('Error while PubSubHubbub subscribing to ' . $feed->url(false)); } } $feed->unlock(); -- cgit v1.2.3 From 7072c091a71e176a0cd57b91d570b26c8534870e Mon Sep 17 00:00:00 2001 From: ColonelMoutarde <4697568+ColonelMoutarde@users.noreply.github.com> Date: Thu, 23 Aug 2018 19:56:48 +0200 Subject: better rand() (#1978) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit http://php.net/manual/en/function.mt-rand.php from php Doc "Many random number generators of older libcs have dubious or unknown characteristics and are slow. The mt_rand() function is a drop-in replacement for the older rand(). It uses a random number generator with known characteristics using the ยป Mersenne Twister, which will produce random numbers four times faster than what the average libc rand() provides. " --- app/Controllers/feedController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/Controllers/feedController.php') diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php index 168d5a661..2f7495884 100755 --- a/app/Controllers/feedController.php +++ b/app/Controllers/feedController.php @@ -413,7 +413,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController { $entryDAO->updateLastSeen($feed->id(), $oldGuids, $mtime); } - if ($feed_history >= 0 && rand(0, 30) === 1) { + if ($feed_history >= 0 && mt_rand(0, 30) === 1) { // TODO: move this function in web cron when available (see entry::purge) // Remove old entries once in 30. if (!$entryDAO->inTransaction()) { -- cgit v1.2.3