From 8ee8a573f1f7e9cc45f9b3c46627d15670f14f3a Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sat, 29 Sep 2018 20:47:17 +0200 Subject: Custom labels (#2027) * First draft of custom tags https://github.com/FreshRSS/FreshRSS/issues/928 https://github.com/FreshRSS/FreshRSS/issues/1367 * SMALLINT to BIGINT for id_entry And uppercase SQL types * Fix layout for unreads * Start UI menu * Change menu order * Clean database helpers https://github.com/FreshRSS/FreshRSS/pull/2027#discussion_r217971535 * Travis rules do not understand PostgreSQL constants Grrr * Tag controller + UI * Add column attributes to tags * Use only favicon for now, for label * Fix styling for different themes * Constant for maximum InnoDB index length in Unicode https://github.com/FreshRSS/FreshRSS/pull/2027#discussion_r219052200 (I would have personnally prefered keeping the readability of a real value instead of a constant, in this case of many SQL fields) * Use FreshRSS_Factory::createCategoryDao * Add view of all articles containing any tag * Fix search in tags * Mark as read tags * Partial auto-update unread tags * More auto update tag unreads * Add tag deletion * Do not purge tagged articles * Minor comment * Fix SQLite and UI bug * Google Reader API support for user tags Add SQL check that tag names must be distinct from category names * whitespace * Add missing API for EasyRSS * Compatibility SQLite Problematic parentheses * Add SQL DISTINCT for cases with multiple tags * Fix for PostgreSQL PostgreSQL needs some additional type hint to avoid "could not determine data type of parameter $1" http://www.postgresql-archive.org/Could-not-determine-data-type-of-parameter-1-tp2171092p2171094.html --- app/Controllers/categoryController.php | 8 +-- app/Controllers/configureController.php | 10 ++-- app/Controllers/entryController.php | 14 ++++++ app/Controllers/feedController.php | 6 +-- app/Controllers/indexController.php | 11 +++- app/Controllers/javascriptController.php | 4 +- app/Controllers/statsController.php | 2 +- app/Controllers/subscriptionController.php | 2 +- app/Controllers/tagController.php | 80 ++++++++++++++++++++++++++++++ 9 files changed, 121 insertions(+), 16 deletions(-) create mode 100644 app/Controllers/tagController.php (limited to 'app/Controllers') diff --git a/app/Controllers/categoryController.php b/app/Controllers/categoryController.php index f3b35a323..2551a79d4 100644 --- a/app/Controllers/categoryController.php +++ b/app/Controllers/categoryController.php @@ -16,7 +16,7 @@ class FreshRSS_category_Controller extends Minz_ActionController { Minz_Error::error(403); } - $catDAO = new FreshRSS_CategoryDAO(); + $catDAO = FreshRSS_Factory::createCategoryDao(); $catDAO->checkDefault(); } @@ -27,7 +27,7 @@ class FreshRSS_category_Controller extends Minz_ActionController { * - new-category */ public function createAction() { - $catDAO = new FreshRSS_CategoryDAO(); + $catDAO = FreshRSS_Factory::createCategoryDao(); $url_redirect = array('c' => 'subscription', 'a' => 'index'); $limits = FreshRSS_Context::$system_conf->limits; @@ -75,7 +75,7 @@ class FreshRSS_category_Controller extends Minz_ActionController { * - name */ public function updateAction() { - $catDAO = new FreshRSS_CategoryDAO(); + $catDAO = FreshRSS_Factory::createCategoryDao(); $url_redirect = array('c' => 'subscription', 'a' => 'index'); if (Minz_Request::isPost()) { @@ -116,7 +116,7 @@ class FreshRSS_category_Controller extends Minz_ActionController { */ public function deleteAction() { $feedDAO = FreshRSS_Factory::createFeedDao(); - $catDAO = new FreshRSS_CategoryDAO(); + $catDAO = FreshRSS_Factory::createCategoryDao(); $url_redirect = array('c' => 'subscription', 'a' => 'index'); if (Minz_Request::isPost()) { diff --git a/app/Controllers/configureController.php b/app/Controllers/configureController.php index d34b5d59d..20bcd2e76 100755 --- a/app/Controllers/configureController.php +++ b/app/Controllers/configureController.php @@ -243,8 +243,9 @@ class FreshRSS_configure_Controller extends Minz_ActionController { * checking if categories and feeds are still in use. */ public function queriesAction() { - $category_dao = new FreshRSS_CategoryDAO(); + $category_dao = FreshRSS_Factory::createCategoryDao(); $feed_dao = FreshRSS_Factory::createFeedDao(); + $tag_dao = FreshRSS_Factory::createTagDao(); if (Minz_Request::isPost()) { $params = Minz_Request::param('queries', array()); @@ -277,16 +278,17 @@ class FreshRSS_configure_Controller extends Minz_ActionController { * lean data. */ public function addQueryAction() { - $category_dao = new FreshRSS_CategoryDAO(); + $category_dao = FreshRSS_Factory::createCategoryDao(); $feed_dao = FreshRSS_Factory::createFeedDao(); + $tag_dao = FreshRSS_Factory::createTagDao(); $queries = array(); foreach (FreshRSS_Context::$user_conf->queries as $key => $query) { - $queries[$key] = new FreshRSS_UserQuery($query, $feed_dao, $category_dao); + $queries[$key] = new FreshRSS_UserQuery($query, $feed_dao, $category_dao, $tag_dao); } $params = Minz_Request::fetchGET(); $params['url'] = Minz_Url::display(array('params' => $params)); $params['name'] = _t('conf.query.number', count($queries) + 1); - $queries[] = new FreshRSS_UserQuery($params, $feed_dao, $category_dao); + $queries[] = new FreshRSS_UserQuery($params, $feed_dao, $category_dao, $tag_dao); FreshRSS_Context::$user_conf->queries = $queries; FreshRSS_Context::$user_conf->save(); diff --git a/app/Controllers/entryController.php b/app/Controllers/entryController.php index 16a15c447..21d51af34 100755 --- a/app/Controllers/entryController.php +++ b/app/Controllers/entryController.php @@ -53,6 +53,7 @@ class FreshRSS_entry_Controller extends Minz_ActionController { } $params = array(); + $this->view->tags = array(); $entryDAO = FreshRSS_Factory::createEntryDao(); if ($id === false) { @@ -81,6 +82,12 @@ class FreshRSS_entry_Controller extends Minz_ActionController { case 'a': $entryDAO->markReadEntries($id_max, false, 0, FreshRSS_Context::$search, FreshRSS_Context::$state, $is_read); break; + case 't': + $entryDAO->markReadTag($get, $id_max, FreshRSS_Context::$search, FreshRSS_Context::$state, $is_read); + break; + case 'T': + $entryDAO->markReadTag('', $id_max, FreshRSS_Context::$search, FreshRSS_Context::$state, $is_read); + break; } if ($next_get !== 'a') { @@ -91,6 +98,13 @@ class FreshRSS_entry_Controller extends Minz_ActionController { } } else { $entryDAO->markRead($id, $is_read); + + $tagDAO = FreshRSS_Factory::createTagDao(); + foreach ($tagDAO->getTagsForEntry($id) as $tag) { + if (!empty($tag['checked'])) { + $this->view->tags[] = $tag['id']; + } + } } if (!$this->ajax) { diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php index 2f7495884..2c8cdaa5c 100755 --- a/app/Controllers/feedController.php +++ b/app/Controllers/feedController.php @@ -43,7 +43,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController { FreshRSS_UserDAO::touch(); @set_time_limit(300); - $catDAO = new FreshRSS_CategoryDAO(); + $catDAO = FreshRSS_Factory::createCategoryDao(); $url = trim($url); @@ -192,7 +192,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController { // GET request: we must ask confirmation to user before adding feed. Minz_View::prependTitle(_t('sub.feed.title_add') . ' · '); - $this->catDAO = new FreshRSS_CategoryDAO(); + $this->catDAO = FreshRSS_Factory::createCategoryDao(); $this->view->categories = $this->catDAO->listCategories(false); $this->view->feed = new FreshRSS_Feed($url); try { @@ -556,7 +556,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController { } FreshRSS_UserDAO::touch(); - $catDAO = new FreshRSS_CategoryDAO(); + $catDAO = FreshRSS_Factory::createCategoryDao(); if ($cat_id > 0) { $cat = $catDAO->searchById($cat_id); $cat_id = $cat == null ? 0 : $cat->id(); diff --git a/app/Controllers/indexController.php b/app/Controllers/indexController.php index ddffdba73..8b905c881 100755 --- a/app/Controllers/indexController.php +++ b/app/Controllers/indexController.php @@ -32,8 +32,15 @@ class FreshRSS_index_Controller extends Minz_ActionController { Minz_Error::error(404); } - $this->view->callbackBeforeContent = function($view) { + $this->view->callbackBeforeContent = function ($view) { try { + $tagDAO = FreshRSS_Factory::createTagDao(); + $view->tags = $tagDAO->listTags(true); + $view->nbUnreadTags = 0; + foreach ($view->tags as $tag) { + $view->nbUnreadTags += $tag->nbUnread(); + } + FreshRSS_Context::$number++; //+1 for pagination $entries = FreshRSS_index_Controller::listEntriesByContext(); FreshRSS_Context::$number--; @@ -158,7 +165,7 @@ class FreshRSS_index_Controller extends Minz_ActionController { */ private function updateContext() { if (empty(FreshRSS_Context::$categories)) { - $catDAO = new FreshRSS_CategoryDAO(); + $catDAO = FreshRSS_Factory::createCategoryDao(); FreshRSS_Context::$categories = $catDAO->listCategories(); } diff --git a/app/Controllers/javascriptController.php b/app/Controllers/javascriptController.php index 9d7acf647..cdf14c7a0 100755 --- a/app/Controllers/javascriptController.php +++ b/app/Controllers/javascriptController.php @@ -13,8 +13,10 @@ class FreshRSS_javascript_Controller extends Minz_ActionController { public function nbUnreadsPerFeedAction() { header('Content-Type: application/json; charset=UTF-8'); - $catDAO = new FreshRSS_CategoryDAO(); + $catDAO = FreshRSS_Factory::createCategoryDao(); $this->view->categories = $catDAO->listCategories(true, false); + $tagDAO = FreshRSS_Factory::createTagDao(); + $this->view->tags = $tagDAO->listTags(true); } //For Web-form login diff --git a/app/Controllers/statsController.php b/app/Controllers/statsController.php index 5d1dee72c..acfacb890 100644 --- a/app/Controllers/statsController.php +++ b/app/Controllers/statsController.php @@ -131,7 +131,7 @@ class FreshRSS_stats_Controller extends Minz_ActionController { */ public function repartitionAction() { $statsDAO = FreshRSS_Factory::createStatsDAO(); - $categoryDAO = new FreshRSS_CategoryDAO(); + $categoryDAO = FreshRSS_Factory::createCategoryDao(); $feedDAO = FreshRSS_Factory::createFeedDao(); Minz_View::appendScript(Minz_Url::display('/scripts/flotr2.min.js?' . @filemtime(PUBLIC_PATH . '/scripts/flotr2.min.js'))); $id = Minz_Request::param('id', null); diff --git a/app/Controllers/subscriptionController.php b/app/Controllers/subscriptionController.php index 701a588e0..511cea11b 100644 --- a/app/Controllers/subscriptionController.php +++ b/app/Controllers/subscriptionController.php @@ -14,7 +14,7 @@ class FreshRSS_subscription_Controller extends Minz_ActionController { Minz_Error::error(403); } - $catDAO = new FreshRSS_CategoryDAO(); + $catDAO = FreshRSS_Factory::createCategoryDao(); $feedDAO = FreshRSS_Factory::createFeedDao(); $catDAO->checkDefault(); diff --git a/app/Controllers/tagController.php b/app/Controllers/tagController.php new file mode 100644 index 000000000..106e0afa8 --- /dev/null +++ b/app/Controllers/tagController.php @@ -0,0 +1,80 @@ +ajax = Minz_Request::param('ajax'); + if ($this->ajax) { + $this->view->_useLayout(false); + Minz_Request::_param('ajax'); + } + } + + /** + * This action adds (checked=true) or removes (checked=false) a tag to an entry. + */ + public function tagEntryAction() { + if (Minz_Request::isPost()) { + $id_tag = Minz_Request::param('id_tag'); + $name_tag = trim(Minz_Request::param('name_tag')); + $id_entry = Minz_Request::param('id_entry'); + $checked = Minz_Request::paramTernary('checked'); + if ($id_entry != false) { + $tagDAO = FreshRSS_Factory::createTagDao(); + if ($id_tag == 0 && $name_tag != '' && $checked) { + //Create new tag + $id_tag = $tagDAO->addTag(array('name' => $name_tag)); + } + if ($id_tag != 0) { + $tagDAO->tagEntry($id_tag, $id_entry, $checked); + } + } + } else { + Minz_Error::error(405); + } + if (!$this->ajax) { + Minz_Request::forward(array( + 'c' => 'index', + 'a' => 'index', + ), true); + } + } + + public function deleteAction() { + if (Minz_Request::isPost()) { + $id_tag = Minz_Request::param('id_tag'); + if ($id_tag != false) { + $tagDAO = FreshRSS_Factory::createTagDao(); + $tagDAO->deleteTag($id_tag); + } + } else { + Minz_Error::error(405); + } + if (!$this->ajax) { + Minz_Request::forward(array( + 'c' => 'index', + 'a' => 'index', + ), true); + } + } + + public function getTagsForEntryAction() { + $this->view->_useLayout(false); + header('Content-Type: application/json; charset=UTF-8'); + header('Cache-Control: private, no-cache, no-store, must-revalidate'); + $id_entry = Minz_Request::param('id_entry', 0); + $tagDAO = FreshRSS_Factory::createTagDao(); + $this->view->tags = $tagDAO->getTagsForEntry($id_entry); + } +} -- cgit v1.2.3 From 83756c657fbfaeb39f51e412521bd5c80df63a19 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 30 Sep 2018 18:04:49 +0200 Subject: git clean before git auto-update (#2036) * git clean before git auto-update To avoid https://github.com/FreshRSS/FreshRSS/issues/2012 in the future * More generic SQLite file filter * Another -f https://git-scm.com/docs/git-clean --- app/Controllers/updateController.php | 8 +++++++- data/users/.gitignore | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'app/Controllers') diff --git a/app/Controllers/updateController.php b/app/Controllers/updateController.php index c67b358bb..2be644c85 100644 --- a/app/Controllers/updateController.php +++ b/app/Controllers/updateController.php @@ -32,7 +32,13 @@ class FreshRSS_update_Controller extends Minz_ActionController { $output = array(); $return = 1; try { - exec('git pull --ff-only', $output, $return); + exec('git clean -f -d -f', $output, $return); + if ($return == 0) { + exec('git pull --ff-only', $output, $return); + } else { + $line = is_array($output) ? implode('; ', $output) : '' . $output; + Minz_Log::warning('git clean warning:' . $line); + } } catch (Exception $e) { Minz_Log::warning('git pull error:' . $e->getMessage()); } diff --git a/data/users/.gitignore b/data/users/.gitignore index 3705c06b7..03ee0bd34 100644 --- a/data/users/.gitignore +++ b/data/users/.gitignore @@ -1,5 +1,5 @@ */ */config.php -*/db.sqlite +*/*.sqlite !_/ */log*.txt -- cgit v1.2.3 From 8221c807a10942c77309547e9c7dc709146f7117 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 14 Oct 2018 12:36:54 +0200 Subject: Fix actualize bug after install (#2044) Until the next logout/login, the auto actualize feeds feature would be called wrongly --- app/Controllers/javascriptController.php | 1 + 1 file changed, 1 insertion(+) (limited to 'app/Controllers') diff --git a/app/Controllers/javascriptController.php b/app/Controllers/javascriptController.php index cdf14c7a0..d56da9cbb 100755 --- a/app/Controllers/javascriptController.php +++ b/app/Controllers/javascriptController.php @@ -7,6 +7,7 @@ class FreshRSS_javascript_Controller extends Minz_ActionController { public function actualizeAction() { header('Content-Type: application/json; charset=UTF-8'); + Minz_Session::_param('actualize_feeds', false); $feedDAO = FreshRSS_Factory::createFeedDao(); $this->view->feeds = $feedDAO->listFeedsOrderUpdate(FreshRSS_Context::$user_conf->ttl_default); } -- cgit v1.2.3 From c8b54ae807f583723748b5a8cebf9925fb288f9d Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 14 Oct 2018 13:48:59 +0200 Subject: Fix MySQL create table feeds (#2047) https://github.com/FreshRSS/FreshRSS/issues/2042 --- app/Controllers/userController.php | 2 +- app/Models/EntryDAO.php | 2 +- app/SQL/install.sql.mysql.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'app/Controllers') diff --git a/app/Controllers/userController.php b/app/Controllers/userController.php index 75a4303d6..2f066e25f 100644 --- a/app/Controllers/userController.php +++ b/app/Controllers/userController.php @@ -166,7 +166,7 @@ class FreshRSS_user_Controller extends Minz_ActionController { $entryDAO = FreshRSS_Factory::createEntryDao($this->view->current_user); $this->view->nb_articles = $entryDAO->count(); - $databaseDAO = FreshRSS_Factory::createDatabaseDAO(); + $databaseDAO = FreshRSS_Factory::createDatabaseDAO($this->view->current_user); $this->view->size_user = $databaseDAO->size(); } } diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.php index a86de67d6..a01c2227b 100644 --- a/app/Models/EntryDAO.php +++ b/app/Models/EntryDAO.php @@ -992,7 +992,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable { $stm = $this->bd->prepare($sql); $stm->execute(); $res = $stm->fetchAll(PDO::FETCH_COLUMN, 0); - return $res[0]; + return isset($res[0]) ? $res[0] : 0; } public function countNotRead($minPriority = null) { $sql = 'SELECT COUNT(e.id) AS count FROM `' . $this->prefix . 'entry` e'; diff --git a/app/SQL/install.sql.mysql.php b/app/SQL/install.sql.mysql.php index eb454b1a3..222f7e8a7 100644 --- a/app/SQL/install.sql.mysql.php +++ b/app/SQL/install.sql.mysql.php @@ -18,7 +18,7 @@ CREATE TABLE IF NOT EXISTS `%1$sfeed` ( `website` VARCHAR(255) CHARACTER SET latin1, `description` TEXT, `lastUpdate` INT(11) DEFAULT 0, -- Until year 2038 - `priority` TINYNT(2) NOT NULL DEFAULT 10, + `priority` TINYINT(2) NOT NULL DEFAULT 10, `pathEntries` VARCHAR(511) DEFAULT NULL, `httpAuth` VARCHAR(511) DEFAULT NULL, `error` BOOLEAN DEFAULT 0, -- cgit v1.2.3 From 5b030dcc6ff1393e29ecc6e5c76f129c7ad6c914 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 14 Oct 2018 14:37:50 +0200 Subject: Ensure fast flush of HTTP headers and HTML head (#2045) * Ensure fast flush of HTTP headers and HTML head The fast flush optimisation done in https://github.com/FreshRSS/FreshRSS/pull/1133 does not seem to work anymore (need to check if it is related to a PHP version). Work-around when PHP flush() is not working Can be tested by adding a `sleep(5);` after: https://github.com/FreshRSS/FreshRSS/blob/ee902ee7c4370421802768c3105ba269a4f97b16/app/layout/layout.phtml#L27 Follow-up of the performance checks of https://github.com/FreshRSS/FreshRSS/pull/2040 * output_buffering in .user.ini for PHP CGI / FPM * Reuse .user.ini for Docker PHP config * Longer flush Flush a bit later, to be compatible with the default value of 4096 for PHP output_buffering, and thus avoid the need of tuning the value. --- app/Controllers/indexController.php | 26 ++++++++++++++++---------- app/layout/layout.phtml | 21 ++++++++++++--------- app/views/index/global.phtml | 5 +++++ app/views/index/normal.phtml | 5 +++++ app/views/index/reader.phtml | 5 +++++ 5 files changed, 43 insertions(+), 19 deletions(-) (limited to 'app/Controllers') diff --git a/app/Controllers/indexController.php b/app/Controllers/indexController.php index 8b905c881..fa914ef87 100755 --- a/app/Controllers/indexController.php +++ b/app/Controllers/indexController.php @@ -32,7 +32,16 @@ class FreshRSS_index_Controller extends Minz_ActionController { Minz_Error::error(404); } - $this->view->callbackBeforeContent = function ($view) { + $this->view->categories = FreshRSS_Context::$categories; + + $this->view->rss_title = FreshRSS_Context::$name . ' | ' . Minz_View::title(); + $title = FreshRSS_Context::$name; + if (FreshRSS_Context::$get_unread > 0) { + $title = '(' . FreshRSS_Context::$get_unread . ') ' . $title; + } + Minz_View::prependTitle($title . ' · '); + + $this->view->callbackBeforeFeeds = function ($view) { try { $tagDAO = FreshRSS_Factory::createTagDao(); $view->tags = $tagDAO->listTags(true); @@ -40,7 +49,13 @@ class FreshRSS_index_Controller extends Minz_ActionController { foreach ($view->tags as $tag) { $view->nbUnreadTags += $tag->nbUnread(); } + } catch (Exception $e) { + Minz_Log::notice($e->getMessage()); + } + }; + $this->view->callbackBeforeEntries = function ($view) { + try { FreshRSS_Context::$number++; //+1 for pagination $entries = FreshRSS_index_Controller::listEntriesByContext(); FreshRSS_Context::$number--; @@ -67,15 +82,6 @@ class FreshRSS_index_Controller extends Minz_ActionController { Minz_Log::notice($e->getMessage()); Minz_Error::error(404); } - - $view->categories = FreshRSS_Context::$categories; - - $view->rss_title = FreshRSS_Context::$name . ' | ' . Minz_View::title(); - $title = FreshRSS_Context::$name; - if (FreshRSS_Context::$get_unread > 0) { - $title = '(' . FreshRSS_Context::$get_unread . ') ' . $title; - } - Minz_View::prependTitle($title . ' · '); }; } diff --git a/app/layout/layout.phtml b/app/layout/layout.phtml index b244639a4..2e16672e6 100644 --- a/app/layout/layout.phtml +++ b/app/layout/layout.phtml @@ -18,13 +18,7 @@ allow_referrer) { ?> -callbackBeforeContent)) { - call_user_func($this->callbackBeforeContent, $this); - } -?> + -partial('header'); ?> +partial('header'); +?>
- render(); ?> + callbackBeforeFeeds)) { + call_user_func($this->callbackBeforeFeeds, $this); + } + $this->render(); + ?>
partial('nav_menu'); + flush(); + if (isset($this->callbackBeforeEntries)) { + call_user_func($this->callbackBeforeEntries, $this); + } + $class = ''; if (FreshRSS_Context::$user_conf->hide_read_feeds && FreshRSS_Context::isStateEnabled(FreshRSS_Entry::STATE_NOT_READ) && diff --git a/app/views/index/normal.phtml b/app/views/index/normal.phtml index ac2ea812d..d5ae8e2f9 100644 --- a/app/views/index/normal.phtml +++ b/app/views/index/normal.phtml @@ -3,6 +3,11 @@ $this->partial('aside_feed'); $this->partial('nav_menu'); +flush(); +if (isset($this->callbackBeforeEntries)) { + call_user_func($this->callbackBeforeEntries, $this); +} + if (!empty($this->entries)) { $display_today = true; $display_yesterday = true; diff --git a/app/views/index/reader.phtml b/app/views/index/reader.phtml index a92767f1c..c15b936ee 100644 --- a/app/views/index/reader.phtml +++ b/app/views/index/reader.phtml @@ -1,6 +1,11 @@ partial('nav_menu'); +flush(); +if (isset($this->callbackBeforeEntries)) { + call_user_func($this->callbackBeforeEntries, $this); +} + if (!empty($this->entries)) { $lazyload = FreshRSS_Context::$user_conf->lazyload; $content_width = FreshRSS_Context::$user_conf->content_width; -- cgit v1.2.3 From 0aecf442946f7aa618fcc759f79807cd81346dc4 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Wed, 17 Oct 2018 18:03:50 +0200 Subject: Option to force clear cache (#2052) https://github.com/FreshRSS/FreshRSS/issues/1020#issuecomment-428515868 --- app/Controllers/subscriptionController.php | 1 + app/Models/Feed.php | 14 +++++++++++++- app/i18n/cz/sub.php | 1 + app/i18n/de/sub.php | 1 + app/i18n/en/sub.php | 1 + app/i18n/es/sub.php | 1 + app/i18n/fr/sub.php | 1 + app/i18n/he/sub.php | 1 + app/i18n/it/sub.php | 1 + app/i18n/kr/sub.php | 1 + app/i18n/nl/sub.php | 1 + app/i18n/pt-br/sub.php | 1 + app/i18n/ru/sub.php | 1 + app/i18n/tr/sub.php | 1 + app/i18n/zh-cn/sub.php | 1 + app/views/helpers/feed/update.phtml | 7 +++++++ 16 files changed, 34 insertions(+), 1 deletion(-) (limited to 'app/Controllers') diff --git a/app/Controllers/subscriptionController.php b/app/Controllers/subscriptionController.php index 511cea11b..0b1439ba5 100644 --- a/app/Controllers/subscriptionController.php +++ b/app/Controllers/subscriptionController.php @@ -98,6 +98,7 @@ class FreshRSS_subscription_Controller extends Minz_ActionController { $feed->_attributes('mark_updated_article_unread', Minz_Request::paramTernary('mark_updated_article_unread')); $feed->_attributes('read_upon_reception', Minz_Request::paramTernary('read_upon_reception')); + $feed->_attributes('clear_cache', Minz_Request::paramTernary('clear_cache')); if (FreshRSS_Auth::hasAccess('admin')) { $feed->_attributes('ssl_verify', Minz_Request::paramTernary('ssl_verify')); diff --git a/app/Models/Feed.php b/app/Models/Feed.php index d09577e6e..e1dd2990d 100644 --- a/app/Models/Feed.php +++ b/app/Models/Feed.php @@ -286,6 +286,10 @@ class FreshRSS_Feed extends Minz_Model { if (!$loadDetails) { //Only activates auto-discovery when adding a new feed $feed->set_autodiscovery_level(SIMPLEPIE_LOCATOR_NONE); } + if ($this->attributes('clear_cache')) { + // Do not use `$simplePie->enable_cache(false);` as it would prevent caching in multiuser context + $this->clearCache(); + } Minz_ExtensionManager::callHook('simplepie_before_init', $feed, $this); $mtime = $feed->init(); @@ -465,8 +469,16 @@ class FreshRSS_Feed extends Minz_Model { $this->entries = $entries; } + protected function cacheFilename() { + return CACHE_PATH . '/' . md5($this->url) . '.spc'; + } + + public function clearCache() { + return @unlink($this->cacheFilename()); + } + public function cacheModifiedTime() { - return @filemtime(CACHE_PATH . '/' . md5($this->url) . '.spc'); + return @filemtime($this->cacheFilename()); } public function lock() { diff --git a/app/i18n/cz/sub.php b/app/i18n/cz/sub.php index 5caf9acbe..55441aaf8 100644 --- a/app/i18n/cz/sub.php +++ b/app/i18n/cz/sub.php @@ -27,6 +27,7 @@ return array( 'password' => 'Heslo', 'username' => 'Přihlašovací jméno', ), + 'clear_cache' => 'Always clear cache', //TODO 'css_help' => 'Stáhne zkrácenou verzi RSS kanálů (pozor, náročnější na čas!)', 'css_path' => 'Původní CSS soubor článku z webových stránek', 'description' => 'Popis', diff --git a/app/i18n/de/sub.php b/app/i18n/de/sub.php index 0ba818c69..ff5c11d2b 100644 --- a/app/i18n/de/sub.php +++ b/app/i18n/de/sub.php @@ -27,6 +27,7 @@ return array( 'password' => 'HTTP-Passwort', 'username' => 'HTTP-Nutzername', ), + 'clear_cache' => 'Always clear cache', //TODO 'css_help' => 'Ruft gekürzte RSS-Feeds ab (Achtung, benötigt mehr Zeit!)', 'css_path' => 'Pfad zur CSS-Datei des Artikels auf der Original-Webseite', 'description' => 'Beschreibung', diff --git a/app/i18n/en/sub.php b/app/i18n/en/sub.php index 5ff41a4b3..22c7edc30 100644 --- a/app/i18n/en/sub.php +++ b/app/i18n/en/sub.php @@ -27,6 +27,7 @@ return array( 'password' => 'HTTP password', 'username' => 'HTTP username', ), + 'clear_cache' => 'Always clear cache', 'css_help' => 'Retrieves truncated RSS feeds (caution, requires more time!)', 'css_path' => 'Articles CSS path on original website', 'description' => 'Description', diff --git a/app/i18n/es/sub.php b/app/i18n/es/sub.php index 3abc85578..8a4fb98de 100755 --- a/app/i18n/es/sub.php +++ b/app/i18n/es/sub.php @@ -22,6 +22,7 @@ return array( 'password' => 'Contraseña HTTP', 'username' => 'Nombre de usuario HTTP', ), + 'clear_cache' => 'Always clear cache', //TODO 'css_help' => 'Recibir fuentes RSS truncadas (aviso, ¡necesita más tiempo!)', 'css_path' => 'Ruta a la CSS de los artículos en la web original', 'description' => 'Descripción', diff --git a/app/i18n/fr/sub.php b/app/i18n/fr/sub.php index c6af2fb90..d3921f1d9 100644 --- a/app/i18n/fr/sub.php +++ b/app/i18n/fr/sub.php @@ -27,6 +27,7 @@ return array( 'password' => 'Mot de passe HTTP', 'username' => 'Identifiant HTTP', ), + 'clear_cache' => 'Toujours vider le cache', 'css_help' => 'Permet de récupérer les flux tronqués (attention, demande plus de temps !)', 'css_path' => 'Sélecteur CSS des articles sur le site d’origine', 'description' => 'Description', diff --git a/app/i18n/he/sub.php b/app/i18n/he/sub.php index a263cd728..711004662 100644 --- a/app/i18n/he/sub.php +++ b/app/i18n/he/sub.php @@ -27,6 +27,7 @@ return array( 'password' => 'HTTP סיסמה', 'username' => 'HTTP שם משתמש', ), + 'clear_cache' => 'Always clear cache', //TODO 'css_help' => 'קבלת הזנות RSS קטומות (זהירות, לוקח זמן רב יותר!)', 'css_path' => 'נתיב הCSS של המאמר באתר המקורי', 'description' => 'תיאור', diff --git a/app/i18n/it/sub.php b/app/i18n/it/sub.php index 22d58a27f..b22340c9b 100644 --- a/app/i18n/it/sub.php +++ b/app/i18n/it/sub.php @@ -27,6 +27,7 @@ return array( 'password' => 'HTTP password', 'username' => 'HTTP username', ), + 'clear_cache' => 'Always clear cache', //TODO 'css_help' => 'In caso di RSS feeds troncati (attenzione, richiede molto tempo!)', 'css_path' => 'Percorso del foglio di stile CSS del sito di origine', 'description' => 'Descrizione', diff --git a/app/i18n/kr/sub.php b/app/i18n/kr/sub.php index de200c330..ee6b25e3f 100644 --- a/app/i18n/kr/sub.php +++ b/app/i18n/kr/sub.php @@ -27,6 +27,7 @@ return array( 'password' => 'HTTP 암호', 'username' => 'HTTP 사용자 이름', ), + 'clear_cache' => 'Always clear cache', //TODO 'css_help' => '글의 일부가 포함된 RSS 피드를 가져옵니다 (주의, 시간이 좀 더 걸립니다!)', 'css_path' => '웹사이트 상의 글 본문에 해당하는 CSS 경로', 'description' => '설명', diff --git a/app/i18n/nl/sub.php b/app/i18n/nl/sub.php index 4ce254ef5..fec7fb4e7 100644 --- a/app/i18n/nl/sub.php +++ b/app/i18n/nl/sub.php @@ -27,6 +27,7 @@ return array( 'password' => 'HTTP wachtwoord', 'username' => 'HTTP gebruikers naam', ), + 'clear_cache' => 'Always clear cache', //TODO 'css_help' => 'Haalt verstoorde RSS feeds op (attentie, heeft meer tijd nodig!)', 'css_path' => 'Artikelen CSS pad op originele website', 'description' => 'Omschrijving', diff --git a/app/i18n/pt-br/sub.php b/app/i18n/pt-br/sub.php index 1b084f08f..daa24e8f3 100644 --- a/app/i18n/pt-br/sub.php +++ b/app/i18n/pt-br/sub.php @@ -27,6 +27,7 @@ return array( 'password' => 'Senha HTTP', 'username' => 'Usuário HTTP', ), + 'clear_cache' => 'Always clear cache', //TODO 'css_help' => 'Retorna RSS feeds truncados (atenção, requer mais tempo!)', 'css_path' => 'Caminho do CSS do artigo no site original', 'description' => 'Descrição', diff --git a/app/i18n/ru/sub.php b/app/i18n/ru/sub.php index bef49623f..12901998d 100644 --- a/app/i18n/ru/sub.php +++ b/app/i18n/ru/sub.php @@ -27,6 +27,7 @@ return array( 'password' => 'HTTP password',// TODO 'username' => 'HTTP username',// TODO ), + 'clear_cache' => 'Always clear cache', //TODO 'css_help' => 'Retrieves truncated RSS feeds (caution, requires more time!)',// TODO 'css_path' => 'Articles CSS path on original website',// TODO 'description' => 'Description',// TODO diff --git a/app/i18n/tr/sub.php b/app/i18n/tr/sub.php index e8cd15d0d..ef0c8ffbd 100644 --- a/app/i18n/tr/sub.php +++ b/app/i18n/tr/sub.php @@ -27,6 +27,7 @@ return array( 'password' => 'HTTP şifre', 'username' => 'HTTP kullanıcı adı', ), + 'clear_cache' => 'Always clear cache', //TODO 'css_help' => 'Dikkat, daha çok zaman gerekir!', 'css_path' => 'Makaleleri kendi CSS görünümü ile göster', 'description' => 'Tanım', diff --git a/app/i18n/zh-cn/sub.php b/app/i18n/zh-cn/sub.php index 034f8a9d9..4980b803a 100644 --- a/app/i18n/zh-cn/sub.php +++ b/app/i18n/zh-cn/sub.php @@ -27,6 +27,7 @@ return array( 'password' => 'HTTP 密码', 'username' => 'HTTP 用户名', ), + 'clear_cache' => 'Always clear cache', //TODO 'css_help' => '用于获取全文(注意,这将耗费更多时间!)', 'css_path' => '原文的 CSS 选择器', 'description' => '描述', diff --git a/app/views/helpers/feed/update.phtml b/app/views/helpers/feed/update.phtml index 7144aab46..4dbaacd04 100644 --- a/app/views/helpers/feed/update.phtml +++ b/app/views/helpers/feed/update.phtml @@ -205,6 +205,13 @@ +
+ +
+ feed->attributes('clear_cache') ? ' checked="checked"' : ''; ?> /> +
+
+
-- cgit v1.2.3 From 46510febf18951b05bfc9afbbdbaf7d5cadf96a9 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 21 Oct 2018 16:33:28 +0200 Subject: Improved flow for password change (#2057) https://github.com/FreshRSS/FreshRSS/issues/2056 --- app/Controllers/userController.php | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'app/Controllers') diff --git a/app/Controllers/userController.php b/app/Controllers/userController.php index 2f066e25f..95859c92c 100644 --- a/app/Controllers/userController.php +++ b/app/Controllers/userController.php @@ -91,6 +91,10 @@ class FreshRSS_user_Controller extends Minz_ActionController { } public function updateAction() { + if (!FreshRSS_Auth::hasAccess('admin')) { + Minz_Error::error(403); + } + if (Minz_Request::isPost()) { $passwordPlain = Minz_Request::param('newPasswordPlain', '', true); Minz_Request::_param('newPasswordPlain'); //Discard plain-text password ASAP @@ -104,8 +108,12 @@ class FreshRSS_user_Controller extends Minz_ActionController { )); if ($ok) { - Minz_Request::good(_t('feedback.user.updated', $username), - array('c' => 'user', 'a' => 'manage')); + $isSelfUpdate = Minz_Session::param('currentUser', '_') === $username; + if ($passwordPlain == '' || !$isSelfUpdate) { + Minz_Request::good(_t('feedback.user.updated', $username), array('c' => 'user', 'a' => 'manage')); + } else { + Minz_Request::good(_t('feedback.profile.updated'), array('c' => 'index', 'a' => 'index')); + } } else { Minz_Request::bad(_t('feedback.user.updated.error', $username), array('c' => 'user', 'a' => 'manage')); @@ -138,8 +146,11 @@ class FreshRSS_user_Controller extends Minz_ActionController { Minz_Session::_param('passwordHash', FreshRSS_Context::$user_conf->passwordHash); if ($ok) { - Minz_Request::good(_t('feedback.profile.updated'), - array('c' => 'user', 'a' => 'profile')); + if ($passwordPlain == '') { + Minz_Request::good(_t('feedback.profile.updated'), array('c' => 'user', 'a' => 'profile')); + } else { + Minz_Request::good(_t('feedback.profile.updated'), array('c' => 'index', 'a' => 'index')); + } } else { Minz_Request::bad(_t('feedback.profile.error'), array('c' => 'user', 'a' => 'profile')); -- cgit v1.2.3 From 6a686daafa526d4b0a247d6db407edca540e5083 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Wed, 24 Oct 2018 13:07:39 +0200 Subject: Allow dot in username (#2062) * Allow dot in username https://github.com/FreshRSS/FreshRSS/issues/2061 * Missing quotes for special chars in PostgreSQL --- app/Controllers/userController.php | 2 +- app/Models/CategoryDAO.php | 2 +- app/SQL/install.sql.mysql.php | 2 +- app/SQL/install.sql.pgsql.php | 24 ++++++++++++------------ app/SQL/install.sql.sqlite.php | 2 +- 5 files changed, 16 insertions(+), 16 deletions(-) (limited to 'app/Controllers') diff --git a/app/Controllers/userController.php b/app/Controllers/userController.php index 95859c92c..2338c8b2a 100644 --- a/app/Controllers/userController.php +++ b/app/Controllers/userController.php @@ -38,7 +38,7 @@ class FreshRSS_user_Controller extends Minz_ActionController { * The username is also used as folder name, file name, and part of SQL table name. * '_' is a reserved internal username. */ - const USERNAME_PATTERN = '[0-9a-zA-Z_]{2,38}|[0-9a-zA-Z]'; + const USERNAME_PATTERN = '[0-9a-zA-Z_][0-9a-zA-Z_.]{1,38}|[0-9a-zA-Z]'; public static function checkUsername($username) { return preg_match('/^' . self::USERNAME_PATTERN . '$/', $username) === 1; diff --git a/app/Models/CategoryDAO.php b/app/Models/CategoryDAO.php index 0519fc4c7..ba7eb765e 100644 --- a/app/Models/CategoryDAO.php +++ b/app/Models/CategoryDAO.php @@ -158,7 +158,7 @@ class FreshRSS_CategoryDAO extends Minz_ModelPdo implements FreshRSS_Searchable $sql = 'INSERT INTO `' . $this->prefix . 'category`(id, name) VALUES(?, ?)'; if (parent::$sharedDbType === 'pgsql') { //Force call to nextval() - $sql .= " RETURNING nextval('" . $this->prefix . "category_id_seq');"; + $sql .= ' RETURNING nextval(\'"' . $this->prefix . 'category_id_seq"\');'; } $stm = $this->bd->prepare($sql); diff --git a/app/SQL/install.sql.mysql.php b/app/SQL/install.sql.mysql.php index 222f7e8a7..1fc7e44d3 100644 --- a/app/SQL/install.sql.mysql.php +++ b/app/SQL/install.sql.mysql.php @@ -1,5 +1,5 @@ Date: Thu, 25 Oct 2018 22:43:13 +0200 Subject: MySQL GUID case sensitive (#2078) * MySQL GUID case sensitive latin1_bin https://github.com/FreshRSS/FreshRSS/issues/2077 * Prepare update for existing bases * Perform DB update during actualize * Reduce frequency slightly * No optimize at the same time * Take advantage of the SQL modifications in 1.12 * Move higher up * Move to purge, which all users can manually call --- app/Controllers/entryController.php | 4 ++++ app/Models/DatabaseDAO.php | 19 +++++++++++++++++++ app/Models/TagDAO.php | 5 +++++ app/SQL/install.sql.mysql.php | 17 +++++++++++------ 4 files changed, 39 insertions(+), 6 deletions(-) (limited to 'app/Controllers') diff --git a/app/Controllers/entryController.php b/app/Controllers/entryController.php index 21d51af34..78ddbf085 100755 --- a/app/Controllers/entryController.php +++ b/app/Controllers/entryController.php @@ -207,6 +207,10 @@ class FreshRSS_entry_Controller extends Minz_ActionController { $feedDAO->updateCachedValues(); + //Minor DB checks: + $databaseDAO = FreshRSS_Factory::createDatabaseDAO(); + $databaseDAO->ensureCaseInsensitiveGuids(); //FreshRSS 1.12 + invalidateHttpCache(); Minz_Request::good(_t('feedback.sub.purge_completed', $nb_total), array( 'c' => 'configure', diff --git a/app/Models/DatabaseDAO.php b/app/Models/DatabaseDAO.php index 54076d7a9..dbd328bf7 100644 --- a/app/Models/DatabaseDAO.php +++ b/app/Models/DatabaseDAO.php @@ -141,4 +141,23 @@ class FreshRSS_DatabaseDAO extends Minz_ModelPdo { } return $ok; } + + public function ensureCaseInsensitiveGuids() { + $ok = true; + $db = FreshRSS_Context::$system_conf->db; + if ($db['type'] === 'mysql') { + include_once(APP_PATH . '/SQL/install.sql.mysql.php'); + if (defined('SQL_UPDATE_GUID_LATIN1_BIN')) { //FreshRSS 1.12 + try { + $sql = sprintf(SQL_UPDATE_GUID_LATIN1_BIN, $this->prefix); + $stm = $this->bd->prepare($sql); + $ok = $stm->execute(); + } catch (Exception $e) { + $ok = false; + Minz_Log::error('FreshRSS_DatabaseDAO::ensureCaseInsensitiveGuids error: ' . $e->getMessage()); + } + } + } + return $ok; + } } diff --git a/app/Models/TagDAO.php b/app/Models/TagDAO.php index ad67c1abe..1b59c8971 100644 --- a/app/Models/TagDAO.php +++ b/app/Models/TagDAO.php @@ -15,6 +15,11 @@ class FreshRSS_TagDAO extends Minz_ModelPdo implements FreshRSS_Searchable { try { $db = FreshRSS_Context::$system_conf->db; require_once(APP_PATH . '/SQL/install.sql.' . $db['type'] . '.php'); + + Minz_Log::warning('SQL ALTER GUID case sensitivity...'); + $databaseDAO = FreshRSS_Factory::createDatabaseDAO(); + $databaseDAO->ensureCaseInsensitiveGuids(); + Minz_Log::warning('SQL CREATE TABLE tag...'); if (defined('SQL_CREATE_TABLE_TAGS')) { $sql = sprintf(SQL_CREATE_TABLE_TAGS, $this->prefix); diff --git a/app/SQL/install.sql.mysql.php b/app/SQL/install.sql.mysql.php index 1fc7e44d3..b3353ac95 100644 --- a/app/SQL/install.sql.mysql.php +++ b/app/SQL/install.sql.mysql.php @@ -12,10 +12,10 @@ ENGINE = INNODB; CREATE TABLE IF NOT EXISTS `%1$sfeed` ( `id` SMALLINT NOT NULL AUTO_INCREMENT, -- v0.7 - `url` VARCHAR(511) CHARACTER SET latin1 NOT NULL, + `url` VARCHAR(511) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL, `category` SMALLINT DEFAULT 0, -- v0.7 `name` VARCHAR(' . FreshRSS_DatabaseDAO::LENGTH_INDEX_UNICODE . ') NOT NULL, - `website` VARCHAR(255) CHARACTER SET latin1, + `website` VARCHAR(255) CHARACTER SET latin1 COLLATE latin1_bin, `description` TEXT, `lastUpdate` INT(11) DEFAULT 0, -- Until year 2038 `priority` TINYINT(2) NOT NULL DEFAULT 10, @@ -38,11 +38,11 @@ ENGINE = INNODB; CREATE TABLE IF NOT EXISTS `%1$sentry` ( `id` BIGINT NOT NULL, -- v0.7 - `guid` VARCHAR(760) CHARACTER SET latin1 NOT NULL, -- Maximum for UNIQUE is 767B + `guid` VARCHAR(760) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL, -- Maximum for UNIQUE is 767B `title` VARCHAR(255) NOT NULL, `author` VARCHAR(255), `content_bin` BLOB, -- v0.7 - `link` VARCHAR(1023) CHARACTER SET latin1 NOT NULL, + `link` VARCHAR(1023) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL, `date` INT(11), -- Until year 2038 `lastSeen` INT(11) DEFAULT 0, -- v1.1.1, Until year 2038 `hash` BINARY(16), -- v1.1.1 @@ -66,11 +66,11 @@ INSERT IGNORE INTO `%1$scategory` (id, name) VALUES(1, "%2$s"); define('SQL_CREATE_TABLE_ENTRYTMP', ' CREATE TABLE IF NOT EXISTS `%1$sentrytmp` ( -- v1.7 `id` BIGINT NOT NULL, - `guid` VARCHAR(760) CHARACTER SET latin1 NOT NULL, + `guid` VARCHAR(760) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL, `title` VARCHAR(255) NOT NULL, `author` VARCHAR(255), `content_bin` BLOB, - `link` VARCHAR(1023) CHARACTER SET latin1 NOT NULL, + `link` VARCHAR(1023) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL, `date` INT(11), `lastSeen` INT(11) DEFAULT 0, `hash` BINARY(16), @@ -136,3 +136,8 @@ ALTER TABLE `%1$sentry` MODIFY `author` VARCHAR(255) CHARACTER SET utf8mb4 COLLA ALTER TABLE `%1$sentry` MODIFY `tags` VARCHAR(1023) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; OPTIMIZE TABLE `%1$sentry`; '); + +define('SQL_UPDATE_GUID_LATIN1_BIN', ' -- v1.12 +ALTER TABLE `%1$sentrytmp` MODIFY `guid` VARCHAR(760) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL; +ALTER TABLE `%1$sentry` MODIFY `guid` VARCHAR(760) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL; +'); -- cgit v1.2.3 From c57aade0f22205c40792184b78f5071b5c769a8b Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Fri, 26 Oct 2018 21:05:00 +0200 Subject: Introduce a routine for minor DB maintenance (#2080) --- app/Controllers/entryController.php | 3 +-- app/Controllers/feedController.php | 6 ++++++ app/Models/DatabaseDAO.php | 4 ++++ 3 files changed, 11 insertions(+), 2 deletions(-) (limited to 'app/Controllers') diff --git a/app/Controllers/entryController.php b/app/Controllers/entryController.php index 78ddbf085..fc0af0639 100755 --- a/app/Controllers/entryController.php +++ b/app/Controllers/entryController.php @@ -207,9 +207,8 @@ class FreshRSS_entry_Controller extends Minz_ActionController { $feedDAO->updateCachedValues(); - //Minor DB checks: $databaseDAO = FreshRSS_Factory::createDatabaseDAO(); - $databaseDAO->ensureCaseInsensitiveGuids(); //FreshRSS 1.12 + $databaseDAO->minorDbMaintenance(); invalidateHttpCache(); Minz_Request::good(_t('feedback.sub.purge_completed', $nb_total), array( diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php index 2c8cdaa5c..f2b1b8960 100755 --- a/app/Controllers/feedController.php +++ b/app/Controllers/feedController.php @@ -481,6 +481,9 @@ class FreshRSS_feed_Controller extends Minz_ActionController { if ($entryDAO->inTransaction()) { $entryDAO->commit(); } + + $databaseDAO = FreshRSS_Factory::createDatabaseDAO(); + $databaseDAO->minorDbMaintenance(); } return array($updated_feeds, reset($feeds), $nb_new_articles); } @@ -511,6 +514,9 @@ class FreshRSS_feed_Controller extends Minz_ActionController { $entryDAO->commitNewEntries(); $feedDAO->updateCachedValues(); $entryDAO->commit(); + + $databaseDAO = FreshRSS_Factory::createDatabaseDAO(); + $databaseDAO->minorDbMaintenance(); } else { list($updated_feeds, $feed, $nb_new_articles) = self::actualizeFeed($id, $url, $force, null, false, $noCommit); } diff --git a/app/Models/DatabaseDAO.php b/app/Models/DatabaseDAO.php index dbd328bf7..b331eccc3 100644 --- a/app/Models/DatabaseDAO.php +++ b/app/Models/DatabaseDAO.php @@ -160,4 +160,8 @@ class FreshRSS_DatabaseDAO extends Minz_ModelPdo { } return $ok; } + + public function minorDbMaintenance() { + $this->ensureCaseInsensitiveGuids(); + } } -- cgit v1.2.3