Commit Graph

703 Commits

Author SHA1 Message Date
wn_ fe08299ec4 Replace special feed and category numbers with constants. 2023-03-05 19:16:48 +00:00
Andrew Dolgov c30b24d09f
deal with type errors in batch feed editor properly, un-deprecate PDO wrapper functions and document them for posterity 2022-12-30 19:51:34 +03:00
Andrew Dolgov 5c0a5da88c
batch feed editor: silence some more php8.1 undefined field warnings 2022-12-30 19:10:41 +03:00
Andrew Dolgov a16acd65fc
batch feed editor:
- fix some field changes not applying because of DB type errors
 - rework to use bound vars instead of sql query concatenation
deprecate: checkbox_to_sql_bool(), bool_to_sql_bool()
2022-12-30 19:07:15 +03:00
wn_ 371af1a39c Fix getting active feeds with errors.
fb4bc2615e incorrectly excluded feeds using the default update interval.  This change ignores the unlikely scenario where someone has the default update interval set to 'disabled'.
2022-12-24 21:22:16 +00:00
wn_ 46e2635869 Only count updating (i.e. enabled) feeds when determining active feeds with errors.
This excludes feeds that had errors and currently have updating disabled (e.g. disabled due to the site being down for a while, getting compromised, etc.).

Disabled / non-updating feeds' error states are still visible when viewed in the feed tree.
2022-12-21 21:05:59 +00:00
Andrew Dolgov d373b7b452
* bring back cache-busting for feed icons based on timestamp
* DiskCache: use singleton pattern to create less cache object instances
 * DiskCache: implement ETag
2022-12-19 21:36:50 +03:00
wn_ a355221e7f Consistently get the self URL.
This ensures all uses of the self URL get the same normalized/sanitized value.
2022-11-28 17:40:42 +00:00
Andrew Dolgov a30b9bb649
rework favicon storage to use DiskCache 2022-11-24 23:31:33 +03:00
wn_ d376cd6142 Address upcoming string interpolation deprecation.
https://wiki.php.net/rfc/deprecate_dollar_brace_string_interpolation
2022-11-12 16:20:59 +00:00
Andrew Dolgov f56a049641
fix some PHP8 warnings generated while dragging feed tree items around 2022-10-15 13:44:02 +03:00
wn_ c301053965 Use the null coalescing assignment operator in various places. 2022-08-12 18:21:38 +00:00
wn_ 3487c922b3 Replace use of 'array_merge' with the spread operator and 'array_push' in various places.
This isn't supported for arrays with string keys until PHP 8.1.

https://wiki.php.net/rfc/spread_operator_for_array
2022-08-12 17:58:38 +00:00
wn_ a63c949a55 Use arrow functions in some places. 2022-08-12 14:41:21 +00:00
wn_ 93fd85df6f Switch to direct type declarations of class properties. 2022-08-12 14:13:26 +00:00
Andrew Dolgov 26c67dba77
update phpstan to 1.8.2 2022-07-31 13:55:09 +03:00
Chih-Hsuan Yen f3aceb4648
Fix an error when disabling all user plugins
If I enabled some user plugins via Preferences -> Plugins and then
disabled all of them, an error occurred:

Jul 16 22:34:20 php[100]: PHP Fatal error:  Uncaught TypeError: array_filter(): Argument #1 ($array) must be of type array, null given in /usr/share/webapps/tt-rss/classes/pref/prefs.php:1027
Jul 16 22:34:20 php[100]: Stack trace:
Jul 16 22:34:20 php[100]: #0 /usr/share/webapps/tt-rss/classes/pref/prefs.php(1027): array_filter()
Jul 16 22:34:20 php[100]: #1 /usr/share/webapps/tt-rss/backend.php(136): Pref_Prefs->setplugins()
Jul 16 22:34:20 php[100]: #2 {main}
Jul 16 22:34:20 php[100]:   thrown in /usr/share/webapps/tt-rss/classes/pref/prefs.php on line 1027

Apparently the issue was elevated from a warning to an error in PHP 8.0
[1].

[1] https://php.watch/versions/8.0/internal-function-exceptions
2022-07-16 22:50:16 +08:00
Andrew Dolgov 8ef816d8f8
feeds-tree: move external onClick dojo/method to PrefFeedTree class 2022-06-06 09:31:37 +03:00
Andrew Dolgov 6436dd16f9
filter-tree: move external dojo/method to PrefFilterTree class 2022-06-06 09:29:16 +03:00
Andrew Dolgov dd983e5de1 prefs: move external filter tree onload method (which checks for inactive feeds, etc.) to FilterTree class 2022-06-05 11:47:21 +03:00
Andrew Dolgov fc84712135 pref-filters: add a button to hide or show rules in the filter list 2022-06-05 11:41:28 +03:00
Andrew Dolgov 9457bb090a fix PHP8 undefined array key warning when resetting prefs to defaults 2022-06-05 11:14:42 +03:00
David Edler de1e218a83
various fixes vor php 8.1 compatibility
Cherry-picked from https://git-gitea.tt-rss.org/fox/tt-rss/pulls/56,
while excluding changes in vendor/ (causes compatiblity issues with
PHP<8 [1]) and strftime-related ones (already re-applied in
https://git-gitea.tt-rss.org/fox/tt-rss/pulls/66).

[1] https://community.tt-rss.org/t/support-for-php-8-1/5089/9
2022-03-09 00:46:15 +08:00
Andrew Dolgov f7e2f62022 fix Feeds::_get_counters() used improperly as a replacement for
getFeedUnread()
2022-02-20 12:48:38 +03:00
Andrew Dolgov 77f39d65b5 * Feeds::_get_counters - fix retrieving unread for tags
* mark several symbols as @deprecated properly
 * replace uses of (deprecated) getFeedUnread() with Feeds::_get_counters()
2022-02-20 11:04:40 +03:00
Andrew Dolgov 40b2356be2 filters:
* add filter action to ignore feed-provided tags
 * simplify handling of various filter-provided tags
 * bump schema to 146
2021-12-20 07:56:16 +03:00
jbaldus 987870074b Fixes declaration of Pref_Prefs::csrf_ignore to match IHandler::csrf_ignore 2021-12-02 20:57:19 +03:00
Andrew Dolgov a201e10ee0 Revert "various fixes vor php 8.1 compatibility"
This reverts commit 14027ae04e.
2021-12-01 13:37:35 +03:00
David Edler 14027ae04e various fixes vor php 8.1 compatibility 2021-11-30 21:50:09 +01:00
wn_ d532eb773b Switch from null to false as the default for missing bool params. 2021-11-18 18:25:04 +00:00
wn_ 2422aae577 Consistently handle param string to bool conversions in handlers. 2021-11-18 18:09:47 +00:00
wn_ 6d438c5a77 Address PHPStan warning in 'classes/pref/users.php'. 2021-11-14 20:27:17 +00:00
wn_ 5632d75a45 Address PHPStan warning in 'classes/pref/system.php'. 2021-11-14 20:26:21 +00:00
wn_ abab2a94e8 Address PHPStan warning in 'classes/pref/prefs.php'.
Also update 'select_hash' and 'select_tag' values param, which can have int or string keys.
2021-11-14 20:13:09 +00:00
wn_ b8f0627a0e Address PHPStan warning in 'classes/pref/labels.php'. 2021-11-14 20:13:09 +00:00
wn_ 9326ed605f Address PHPStan warning in 'classes/pref/filters.php'. 2021-11-14 17:59:57 +00:00
Andrew Dolgov af2f4460ce * deal with some phpstan warnings in base plugin class
* arguably better hack for incompatible plugins causing E_COMPILE_ERROR
2021-11-14 16:49:10 +03:00
wn_ 5a50c333b2 Address PHPStan warnings in 'classes/pref/filters.php'. 2021-11-14 00:59:19 +00:00
wn_ edd476e7fe minor: correct $cat type in Pref_Feeds#calculate_children_count() 2021-11-13 16:00:59 +00:00
wn_ a18473e4c0 Address PHPStan warnings in 'classes/pref/feeds.php'. 2021-11-13 15:56:31 +00:00
wn_ 5606e38bff Update signature of handler 'csrf_ignore' to include types. 2021-11-12 02:01:31 +00:00
Andrew Dolgov 9e8d69739f add two helper account access levels:
- read only - can't subscribe to more feeds, feed updates are skipped
 - disabled - can't login
define used access levels as UserHelper constants and refactor code to
use them instead of hardcoded numbers
2021-11-10 20:44:51 +03:00
wn_ ac5a4f5937 Address PHPStan warning in 'classes/pref/users.php'.
------ -------------------------------
Line   classes/pref/users.php
------ -------------------------------
170    If condition is always false.
------ -------------------------------
2021-11-01 21:10:27 +00:00
wn_ a38892d5d7 Address PHPStan warning in 'classes/pref/prefs.php'.
------ ------------------------------------------------
Line   classes/pref/prefs.php
------ ------------------------------------------------
1328   Expression on left side of ?? is not nullable.
------ ------------------------------------------------
2021-11-01 21:10:27 +00:00
Philip Klempin aead30a041 Fix undefined array key "output" when adding new label 2021-10-15 23:05:50 +00:00
Andrew Dolgov 36e174750e fix label ordering in feed tree 2021-09-02 08:21:05 +03:00
Andrew Dolgov 5c60254474 Pref_Feeds:calculate_children_count - fix operator precedence 2021-08-23 10:45:34 +03:00
Andrew Dolgov 0808123179 fix broken feed tree generation when categories are disabled 2021-08-18 21:02:58 +03:00
wn_ 23b4152c9e Make prefs feed search case-insensitive.
Previously the search query had to match lower title or feed_url (i.e. searching w/ uppercase wouldn't match).
2021-08-17 23:14:14 +00:00
wn_ 992e9cd9e3 Use ORM more in 'classes/pref/feeds.php'. 2021-08-17 23:03:35 +00:00