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

actualizeFeed return number of new articles as 3rd

Seokseong Jeon 9 лет назад
Родитель
Сommit
09787cfd7a
2 измененных файлов с 5 добавлено и 3 удалено
  1. 3 1
      app/Controllers/feedController.php
  2. 2 2
      cli/actualize-user.php

+ 3 - 1
app/Controllers/feedController.php

@@ -254,6 +254,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController {
 		$pshbMinAge = time() - (3600 * 24);  //TODO: Make a configuration.
 
 		$updated_feeds = 0;
+		$nb_new_articles = 0;
 		$is_read = FreshRSS_Context::$user_conf->mark_when['reception'] ? 1 : 0;
 		foreach ($feeds as $feed) {
 			$url = $feed->url();	//For detection of HTTP 301
@@ -372,6 +373,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController {
 							$entryDAO->beginTransaction();
 						}
 						$entryDAO->addEntry($entry->toArray());
+						$nb_new_articles++;
 					}
 				}
 				$entryDAO->updateLastSeen($feed->id(), $oldGuids, $mtime);
@@ -434,7 +436,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController {
 				break;
 			}
 		}
-		return array($updated_feeds, reset($feeds));
+		return array($updated_feeds, reset($feeds), $nb_new_articles);
 	}
 
 	/**

+ 2 - 2
cli/actualize-user.php

@@ -14,9 +14,9 @@ $username = cliInitUser($options['user']);
 
 fwrite(STDERR, 'FreshRSS actualizing user “' . $username . "”…\n");
 
-list($nbUpdatedFeeds, $feed) = FreshRSS_feed_Controller::actualizeFeed(0, '', true);
+list($nbUpdatedFeeds, $feed, $nbNewArticles) = FreshRSS_feed_Controller::actualizeFeed(0, '', true);
 
-echo "FreshRSS actualized $nbUpdatedFeeds feeds for $username\n";
+echo "FreshRSS actualized $nbUpdatedFeeds feeds for $username ($nbNewArticles new articles)\n";
 
 invalidateHttpCache($username);