mirror of
https://github.com/FreshRSS/FreshRSS.git
synced 2026-05-24 16:25:00 -04:00
Add manual commit & refresh cache to deferred insertion
This commit is contained in:
@@ -460,6 +460,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController {
|
||||
* - id (default: false): Feed ID
|
||||
* - url (default: false): Feed URL
|
||||
* - force (default: false)
|
||||
* - noCommit (default: 0): Set to 1 to prevent committing the new articles to the main database
|
||||
* If id and url are not specified, all the feeds are actualized. But if force is
|
||||
* false, process stops at 10 feeds to avoid time execution problem.
|
||||
*/
|
||||
@@ -468,9 +469,19 @@ class FreshRSS_feed_Controller extends Minz_ActionController {
|
||||
$id = Minz_Request::param('id');
|
||||
$url = Minz_Request::param('url');
|
||||
$force = Minz_Request::param('force');
|
||||
$noCommit = Minz_Request::fetchPOST('isLastFeed', 1) != 1;
|
||||
$noCommit = Minz_Request::fetchPOST('noCommit', 0) == 1;
|
||||
|
||||
list($updated_feeds, $feed) = self::actualizeFeed($id, $url, $force, null, false, $noCommit);
|
||||
if ($id == -1 && !$noCommit) { //Special request only to commit & refresh DB cache
|
||||
$updated_feeds = 0;
|
||||
$entryDAO = FreshRSS_Factory::createEntryDao();
|
||||
$feedDAO = FreshRSS_Factory::createFeedDao();
|
||||
$entryDAO->beginTransaction();
|
||||
$entryDAO->commitNewEntries();
|
||||
$feedDAO->updateCachedValues();
|
||||
$entryDAO->commit();
|
||||
} else {
|
||||
list($updated_feeds, $feed) = self::actualizeFeed($id, $url, $force, null, false, $noCommit);
|
||||
}
|
||||
|
||||
if (Minz_Request::param('ajax')) {
|
||||
// Most of the time, ajax request is for only one feed. But since
|
||||
|
||||
@@ -803,13 +803,12 @@ function updateFeed(feeds, feeds_count) {
|
||||
if (!feed) {
|
||||
return;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: feed.url,
|
||||
data : {
|
||||
_csrf: context.csrf,
|
||||
isLastFeed: feeds.length <= 0 ? 1 : 0,
|
||||
noCommit: feeds.length > 0 ? 1 : 0,
|
||||
},
|
||||
}).always(function (data) {
|
||||
feed_processed++;
|
||||
@@ -831,7 +830,6 @@ function init_actualize() {
|
||||
if (ajax_loading) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ajax_loading = true;
|
||||
|
||||
$.getJSON('./?c=javascript&a=actualize').done(function (data) {
|
||||
@@ -842,7 +840,16 @@ function init_actualize() {
|
||||
}
|
||||
if (data.feeds.length === 0) {
|
||||
openNotification(data.feedback_no_refresh, "good");
|
||||
ajax_loading = false;
|
||||
$.ajax({ //Empty request to force refresh server database cache
|
||||
type: 'POST',
|
||||
url: './?c=feed&a=actualize&id=-1',
|
||||
data : {
|
||||
_csrf: context.csrf,
|
||||
noCommit: 0,
|
||||
},
|
||||
}).always(function (data) {
|
||||
ajax_loading = false;
|
||||
});
|
||||
return;
|
||||
}
|
||||
//Progress bar
|
||||
|
||||
Reference in New Issue
Block a user