From d3735d04fcdb557a2ecc798f9914b9f769daf781 Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Mon, 18 Nov 2019 10:04:32 +0100 Subject: Add log in fever api saving process (#2664) Before, there was no user log when the fever api credential saving process was failing. There was one though for the admin user but it did not appear in the interface. Now, there is a user log showing what the problem is. The admin log is still there but catch only unknown errors. See #2663 --- app/Controllers/userController.php | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'app/Controllers') diff --git a/app/Controllers/userController.php b/app/Controllers/userController.php index 7ce6b298a..5209edc84 100644 --- a/app/Controllers/userController.php +++ b/app/Controllers/userController.php @@ -59,14 +59,22 @@ class FreshRSS_user_Controller extends Minz_ActionController { $apiPasswordHash = self::hashPassword($apiPasswordPlain); $userConfig->apiPasswordHash = $apiPasswordHash; - @mkdir(DATA_PATH . '/fever/', 0770, true); - self::deleteFeverKey($user); - $userConfig->feverKey = strtolower(md5($user . ':' . $apiPasswordPlain)); - $ok = file_put_contents(DATA_PATH . '/fever/.key-' . sha1(FreshRSS_Context::$system_conf->salt) . '-' . $userConfig->feverKey . '.txt', $user) !== false; - - if (!$ok) { - Minz_Log::warning('Could not save API credentials for fever API', ADMIN_LOG); - return $ok; + $feverPath = DATA_PATH . '/fever/'; + + if (!file_exists($feverPath)) { + @mkdir($feverPath, 0770, true); + } + + if (!is_writable($feverPath)) { + Minz_Log::error("Could not save Fever API credentials. The directory does not have write access."); + } else { + self::deleteFeverKey($user); + $userConfig->feverKey = strtolower(md5("{$user}:{$apiPasswordPlain}")); + $ok = file_put_contents($feverPath . '.key-' . sha1(FreshRSS_Context::$system_conf->salt) . '-' . $userConfig->feverKey . '.txt', $user) !== false; + + if (!$ok) { + Minz_Log::warning('Could not save Fever API credentials. Unknown error.', ADMIN_LOG); + } } } -- cgit v1.2.3 From bb5d15f7c6133b17016407c0cbf9cce824285d0d Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Thu, 21 Nov 2019 16:23:20 +0100 Subject: Do not obbey rel=self if WebSub is disabled (#2659) * Do not obbey rel=self if WebSub is disabled https://github.com/FreshRSS/FreshRSS/issues/2654 * Correct variable https://github.com/FreshRSS/FreshRSS/pull/2659#discussion_r347552063 * Update app/Controllers/feedController.php --- app/Controllers/feedController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app/Controllers') diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php index aabeb80ff..3eb2316b8 100755 --- a/app/Controllers/feedController.php +++ b/app/Controllers/feedController.php @@ -415,8 +415,8 @@ class FreshRSS_feed_Controller extends Minz_ActionController { $entryDAO->commit(); } - if ($feed->hubUrl() && $feed->selfUrl()) { //selfUrl has priority for WebSub - if ($feed->selfUrl() !== $url) { //https://code.google.com/p/pubsubhubbub/wiki/MovingFeedsOrChangingHubs + if ($pubSubHubbubEnabled && $feed->hubUrl() && $feed->selfUrl()) { //selfUrl has priority for WebSub + if ($feed->selfUrl() !== $url) { // https://github.com/pubsubhubbub/PubSubHubbub/wiki/Moving-Feeds-or-changing-Hubs $selfUrl = checkUrl($feed->selfUrl()); if ($selfUrl) { Minz_Log::debug('WebSub unsubscribe ' . $feed->url(false)); -- cgit v1.2.3