From b1c317a253445a6458f1263c1b622a788cc7cd0e Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 10 Dec 2017 21:31:41 +0100 Subject: Log rotation, use Minz_Log, new log constants ADMIN_LOG, API_LOG, PSHB_LOG --- app/Controllers/feedController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app/Controllers/feedController.php') diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php index 45cba9e98..883f7af05 100755 --- a/app/Controllers/feedController.php +++ b/app/Controllers/feedController.php @@ -263,7 +263,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController { if ((!$simplePiePush) && (!$feed_id) && $pubSubHubbubEnabled && ($feed->lastUpdate() > $pshbMinAge)) { //$text = 'Skip pull of feed using PubSubHubbub: ' . $url; //Minz_Log::debug($text); - //file_put_contents(USERS_PATH . '/_/log_pshb.txt', date('c') . "\t" . $text . "\n", FILE_APPEND); + //Minz_Log::debug($text, PSHB_LOG); continue; //When PubSubHubbub is used, do not pull refresh so often } @@ -371,7 +371,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController { if ($pubSubHubbubEnabled && !$simplePiePush) { //We use push, but have discovered an article by pull! $text = 'An article was discovered by pull although we use PubSubHubbub!: Feed ' . $url . ' GUID ' . $entry->guid(); - file_put_contents(USERS_PATH . '/_/log_pshb.txt', date('c') . "\t" . $text . "\n", FILE_APPEND); + Minz_Log::warning($text, PSHB_LOG); Minz_Log::warning($text); $pubSubHubbubEnabled = false; $feed->pubSubHubbubError(true); -- cgit v1.2.3 From 62e9db55b21034f92b0f4603512c3e788e0351f1 Mon Sep 17 00:00:00 2001 From: Kevin Papst Date: Sun, 17 Dec 2017 16:36:48 +0100 Subject: fixed bug when adding a category and feed at the same time (#1731) fixed bug when adding a category and feed at the same time --- app/Controllers/feedController.php | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'app/Controllers/feedController.php') diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php index 883f7af05..fff20f798 100755 --- a/app/Controllers/feedController.php +++ b/app/Controllers/feedController.php @@ -26,6 +26,18 @@ class FreshRSS_feed_Controller extends Minz_ActionController { } } + /** + * @param $url + * @param string $title + * @param int $cat_id + * @param string $new_cat_name + * @param string $http_auth + * @return FreshRSS_Feed|the + * @throws FreshRSS_AlreadySubscribed_Exception + * @throws FreshRSS_FeedNotAdded_Exception + * @throws FreshRSS_Feed_Exception + * @throws Minz_FileNotExistException + */ public static function addFeed($url, $title = '', $cat_id = 0, $new_cat_name = '', $http_auth = '') { FreshRSS_UserDAO::touch(); @set_time_limit(300); @@ -33,12 +45,13 @@ class FreshRSS_feed_Controller extends Minz_ActionController { $catDAO = new FreshRSS_CategoryDAO(); $cat = null; + if ($new_cat_name != '') { + $new_cat_id = $catDAO->addCategory(array('name' => $new_cat_name)); + $cat_id = $new_cat_id > 0 ? $new_cat_id : $cat_id; + } if ($cat_id > 0) { $cat = $catDAO->searchById($cat_id); } - if ($cat == null && $new_cat_name != '') { - $cat = $catDAO->addCategory(array('name' => $new_cat_name)); - } if ($cat == null) { $catDAO->checkDefault(); } @@ -54,7 +67,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController { throw new FreshRSS_AlreadySubscribed_Exception($url, $feed->name()); } - // Call the extension hook + /** @var FreshRSS_Feed $feed */ $feed = Minz_ExtensionManager::callHook('feed_before_insert', $feed); if ($feed === null) { throw new FreshRSS_FeedNotAdded_Exception($url, $feed->name()); @@ -136,7 +149,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController { // User want to create a new category, new_category parameter // must exist $new_cat = Minz_Request::param('new_category'); - $new_cat_name = isset($new_cat['name']) ? $new_cat['name'] : ''; + $new_cat_name = isset($new_cat['name']) ? trim($new_cat['name']) : ''; } // HTTP information are useful if feed is protected behind a -- cgit v1.2.3