aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2017-05-07 11:19:34 +0200
committerGravatar GitHub <noreply@github.com> 2017-05-07 11:19:34 +0200
commit2c0f5ff19452d33cb033c2052619ef8f0cc79c97 (patch)
tree941b7bcef7afeefae2991364b26ae4909c091a6f
parent53f00571e554f6eeea4fea19d9ddc5eca2ce2997 (diff)
parent0bc59ba140b19d8e0a1762e5ffed66b0c61bd322 (diff)
Merge pull request #1517 from gsongsong/cli-act-num-articles
actualizeFeed return number of new articles as 3rd
-rw-r--r--CREDITS.md1
-rwxr-xr-xapp/Controllers/feedController.php6
-rwxr-xr-xcli/actualize-user.php4
-rw-r--r--p/api/pshb.php2
4 files changed, 8 insertions, 5 deletions
diff --git a/CREDITS.md b/CREDITS.md
index c7aa808e3..c3464848c 100644
--- a/CREDITS.md
+++ b/CREDITS.md
@@ -17,6 +17,7 @@ People are sorted by name so please keep this order.
* [dswd](https://github.com/dswd): [contributions](https://github.com/FreshRSS/FreshRSS/pulls?q=is:pr+author:dswd)
* [ealdraed](https://github.com/ealdraed): [contributions](https://github.com/FreshRSS/FreshRSS/commits?author=ealdraed)
* [Frans de Jonge](https://github.com/Frenzie): [contributions](https://github.com/FreshRSS/FreshRSS/commits?author=Frenzie), [Web](http://fransdejonge.com/)
+* [gsongsong](https://github.com/gsongsong): [contributions](https://github.com/FreshRSS/FreshRSS/pulls?q=is:pr+author:gsongsong)
* [Guillaume Fillon](https://github.com/kokaz): [contributions](https://github.com/FreshRSS/FreshRSS/pulls?q=is:pr+author:kokaz), [Web](http://www.guillaume-fillon.com/)
* [Guillaume Hayot](https://github.com/postblue): [contributions](https://github.com/FreshRSS/FreshRSS/pulls?q=is:pr+author:postblue), [Web](https://postblue.info/)
* [hckweb](https://github.com/hckweb): [contributions](https://github.com/FreshRSS/FreshRSS/commits?author=hckweb)
diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php
index d1f0d3535..8e0e5dd6d 100755
--- a/app/Controllers/feedController.php
+++ b/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
@@ -374,6 +375,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController {
$entryDAO->beginTransaction();
}
$entryDAO->addEntry($entry->toArray());
+ $nb_new_articles++;
}
}
$entryDAO->updateLastSeen($feed->id(), $oldGuids, $mtime);
@@ -450,7 +452,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController {
$entryDAO->commit();
}
}
- return array($updated_feeds, reset($feeds));
+ return array($updated_feeds, reset($feeds), $nb_new_articles);
}
/**
@@ -480,7 +482,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController {
$feedDAO->updateCachedValues();
$entryDAO->commit();
} else {
- list($updated_feeds, $feed) = self::actualizeFeed($id, $url, $force, null, false, $noCommit);
+ list($updated_feeds, $feed, $nb_new_articles) = self::actualizeFeed($id, $url, $force, null, false, $noCommit);
}
if (Minz_Request::param('ajax')) {
diff --git a/cli/actualize-user.php b/cli/actualize-user.php
index 29d51753a..932c6975c 100755
--- a/cli/actualize-user.php
+++ b/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);
diff --git a/p/api/pshb.php b/p/api/pshb.php
index 378f43516..a0b64ede1 100644
--- a/p/api/pshb.php
+++ b/p/api/pshb.php
@@ -136,7 +136,7 @@ foreach ($users as $userFilename) {
join_path(USERS_PATH, '_', 'config.default.php'));
new Minz_ModelPdo($username); //TODO: FIXME: Quick-fix while waiting for a better FreshRSS() constructor/init
FreshRSS_Context::init();
- list($updated_feeds, $feed) = FreshRSS_feed_Controller::actualizeFeed(0, $self, false, $simplePie);
+ list($updated_feeds, $feed, $nb_new_articles) = FreshRSS_feed_Controller::actualizeFeed(0, $self, false, $simplePie);
if ($updated_feeds > 0 || $feed != false) {
$nb++;
} else {