Commit Graph

339 Commits

Author SHA1 Message Date
Alexandre Alapetite 2d17c020b6
PHPStan 1.11 + minor update dev dependencies (#6459)
* PHPStan 1.11 + minor update dev dependencies
https://github.com/phpstan/phpstan/releases/tag/1.11.0

* Comment style
2024-05-15 08:57:58 +02:00
Alexandre Alapetite 4f57a46075
Auto-update 5038 (#6279)
* Auto-update 5038
https://github.com/FreshRSS/FreshRSS/pull/5038

* PostgreSQL

* Draft for MySQL

* More draft MySQL

* Finalise

* A bit more robust
2024-05-13 12:44:35 +02:00
Alexandre Alapetite 90fbb524ce
Windows: release SQLite (#6285)
* Windows: release SQLite
fix https://github.com/FreshRSS/FreshRSS/issues/6275

* Do not use sharedPdo for deleting user

* Case of same user

* Help PHPStan
2024-04-21 16:25:37 +02:00
Alexandre Alapetite 350edf398c
PHP 8.3 #[\Override] (#6273)
* PHP 8.3 #[\Override]
https://php.watch/versions/8.3/override-attr

With PHPStan `checkMissingOverrideMethodAttribute` https://phpstan.org/config-reference#checkmissingoverridemethodattribute

And modified the call to phpstan-next on the model of https://github.com/FreshRSS/Extensions/pull/228 (more robust than the find method, which gave some strange errors)

* Update extension example accordingly
2024-04-10 15:33:43 +02:00
Alexandre Alapetite 1fb0cdfd06
Unicode preg_split new line (#6247)
fix https://github.com/FreshRSS/FreshRSS/issues/6236
https://php.net/reference.pcre.pattern.modifiers
2024-03-31 18:39:43 +02:00
Alexis Degrugillier 7da0e70a72
Add a way to modify CSP rules within an extension (#6246)
This will allow to change CSP rules to authorize the use of external scripts.
We might need to add some safeguard since it will be virtually possible to
load any script even malicious one.
2024-03-30 18:09:44 +01:00
Alexandre Alapetite 96484d22a1
Minz remove use of deprecated variable (#6132)
and related improvements to clarify inheritance
Follow-up of https://github.com/FreshRSS/FreshRSS/pull/6130
2024-03-01 10:08:05 +01:00
Alexandre Alapetite 39cc1c11ec
New feature: shareable user query (#6052)
* New feature: shareable user query
Share the output of a user query by RSS / HTML / OPML with other people through unique URLs.
Replaces the global admin token, which was the only option (but unsafe) to share RSS outputs with other people.
Also add a new HTML output for people without an RSS reader.

fix https://github.com/FreshRSS/FreshRSS/issues/3066#issuecomment-648977890
fix https://github.com/FreshRSS/FreshRSS/issues/3178#issuecomment-769435504

* Remove unused method

* Fix token saving

* Implement HTML view

* Update i18n for master token

* Revert i18n get_favorite

* Fix missing i18n for user queries from before this PR

* Remove irrelevant tests

* Add link to RSS version

* Fix getGet

* Fix getState

* Fix getSearch

* Alternative getSearch

* Default getOrder

* Explicit default state

* Fix test

* Add OPML sharing

* Remove many redundant SQL queries from original implementation of user queries

* Fix article tags

* Use default user settings

* Prepare public search

* Fixes

* Allow user search on article tags

* Implement user search

* Revert filter bug

* Revert wrong SQL left outer join change

* Implement checkboxes

* Safe check of OPML

* Fix label

* Remove RSS button to favour new sharing method
That sharing button was using a global admin token

* First version of HTTP 304

* Disallow some recusrivity
fix https://github.com/FreshRSS/FreshRSS/issues/6086

* Draft of nav

* Minor httpConditional

* Add support for offset for pagination

* Fix offset pagination

* Fix explicit order ASC

* Add documentation

* Help links i18n

* Note about deprecated master token

* Typo

* Doc about format
2024-02-26 09:01:03 +01:00
Alexandre Alapetite 314077a457
PHPStan prepare exceptions (#6037)
Take advantage of
https://phpstan.org/blog/bring-your-exceptions-under-control

Minimum changes to pass `tooWideThrowType` and `implicitThrows`.

Revert some mistakes from:
https://github.com/FreshRSS/FreshRSS/pull/5504
Preparation needed before new PRs of the same type:
https://github.com/FreshRSS/FreshRSS/pull/5962

Fix several wrong PHPDocs and catches:

> Method ... has ...Exception in PHPDoc @throws tag but it's not thrown.

> Dead catch - ...Exception is never thrown in the try block.
2024-01-15 10:36:30 +01:00
Alexandre Alapetite bf1eda8c05
Fix extensions enableByList (#5979)
fix https://github.com/FreshRSS/FreshRSS/issues/5976
fix https://github.com/YunoHost-Apps/freshrss_ynh/pull/176
2023-12-26 12:17:52 +01:00
Alexandre Alapetite ad990a21a1
Fix extensions getUserConfiguration
fix https://github.com/FreshRSS/FreshRSS/issues/5970
Regression from https://github.com/FreshRSS/FreshRSS/pull/5957
2023-12-23 11:34:18 +01:00
Alexandre Alapetite 6d2e53178b
Typed Minz_Extension (#5957)
Replaces https://github.com/FreshRSS/FreshRSS/pull/5837
The signature of methods supposed to be overriden by existing thid-party extensions cannot be modified
2023-12-22 11:03:47 +01:00
Alexandre Alapetite c7a3281a73
Fix notifications (#5959)
The notification about wrong login was not working. Noticed while working on https://github.com/FreshRSS/FreshRSS/pull/5955
This was due to timing of when the notification is retrieved.
Simplified code to make the logic easier and more robust.
2023-12-22 11:03:32 +01:00
Alexandre Alapetite a80a5f48a1
Pass PHPStan level 8 (#5946)
* Pass PHPStan level 8
And prepare for PHPStan level 9 https://phpstan.org/user-guide/rule-levels

* Revert wrong replace in comment

* Fix PHPStan level 8

* Update PHPStan and other dev dependencies

* Remove obsolete comment

* noVariableVariables and towards bleedingEdge
https://github.com/phpstan/phpstan-strict-rules
https://phpstan.org/blog/what-is-bleeding-edge

* More bleedingEdge

* A bit more PHPStan level 9

* More PHPStan level 9

* Prepare for booleansInConditions
Ignore int and null

* Revert wrong line

* More fixes

* Fix keep_max_n_unread

* Stricter attribute functions

* Stricter callHooks and more PHPStan level 9

* More typing

* A tiny more
2023-12-18 17:59:16 +01:00
Alexandre Alapetite 133892a89e
Better debug SQL error (#5916)
* Better debug SQL error

* Fix check
2023-12-03 22:30:15 +01:00
Alexandre Alapetite 76cbfadcdf
Fix types for extensions (#5901)
* Fix types for extensions
To accompany https://github.com/FreshRSS/Extensions/pull/185

* Avoid bug redeclared function
2023-11-24 14:50:03 +01:00
Alexandre Alapetite 445e49db15
Fix Minz_Extension::getVersion (#5891)
Regression from https://github.com/FreshRSS/FreshRSS/pull/5830
2023-11-17 14:59:21 +01:00
Alexandre Alapetite e70e5542e4
Fix Minz_Session::param visibility (#5889)
Regression from https://github.com/FreshRSS/FreshRSS/pull/5830
2023-11-17 13:47:13 +01:00
Luc SANCHEZ 30c7a61a9b
Use strict_types (#5830)
* Little's optimisations and booleans in conditions

* Apply strict type

* Apply strict type

* Apply strict type

* Fix multiple bugs with PHP 8.2 and 8.3

* Many declares missing, more errors fixed

* Apply strict type

* Another approach

* Stronger typing for Minz_Session

* Fix case of SQLite

---------

Co-authored-by: Luc <sanchezluc+freshrss@gmail.com>
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2023-11-16 22:43:00 +01:00
Alexandre Alapetite a5748ad74f
Fix lang_name (#5798)
fix https://github.com/FreshRSS/FreshRSS/issues/5797
2023-10-31 22:25:43 +01:00
Alexandre Alapetite 06d0099504
Require PHP 7.4+ (#5720)
* Require PHP 7.4+
https://github.com/FreshRSS/FreshRSS/discussions/5474

* Update Docker oldest
Alpine 3.13 with PHP 7.4.26

* Add missing packets to Docker oldest

* Update to typed properties
https://php.net/migration74.new-features#migration74.new-features.core.typed-properties

* More types
2023-10-30 20:47:27 +01:00
Alexandre Alapetite 506fe3f44c
Fix extensions i18en English fallback (#5752)
fix https://github.com/FreshRSS/FreshRSS/issues/5734
fix https://github.com/FreshRSS/FreshRSS/issues/5724
Regression from https://github.com/FreshRSS/FreshRSS/pull/5426
2023-10-27 09:57:39 +02:00
NaeiKinDus ed07055ace
fix(minz): fix malformed HTTP header (#5699) 2023-10-11 22:36:15 +02:00
Sam Cohen 52d87c3eaa
Allow configuration of Base URL via website (#5656)
* Allow configuration of Base URL via website

* Fix alphabetization of CREDITS

* Apply suggestions from code review

* Add Automatic recommendation

---------

Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2023-09-13 22:58:10 +02:00
Luc SANCHEZ 7f9594b8c7
fix many "Only booleans are allowed in an if condition" (#5501)
* fix many "Only booleans are allowed in an if condition"

* Update cli/create-user.php

Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>

* Update cli/i18n/I18nUsageValidator.php

Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>

* Fix several regressions and other minor things

* Fix another regression

* Update lib/http-conditional.php

Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>

---------

Co-authored-by: Luc <sanchezluc+freshrss@gmail.com>
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2023-07-07 21:53:17 +02:00
Alexandre Alapetite 1db606bc1b
New extension hook entry_auto_read (#5505)
* New extension hook entry_auto_read
For extensions to be notified of articles being automatically marked as read for various reasons

* Documentation + entry_auto_unread
2023-07-05 11:00:26 +02:00
Alexandre Alapetite 228d7adfdb
Fix slider views (#5469)
* Fix slider titles
And fix full-page view of category configuration.
FIx https://github.com/FreshRSS/FreshRSS/pull/5449#issuecomment-1590021947

* Fix user queries and user management
Implement https://github.com/FreshRSS/FreshRSS/pull/5469#issuecomment-1591957935
2023-06-15 12:47:47 +02:00
Luc SANCHEZ 8f0a121e6a
phpstan-8 typehinting (#5429)
Co-authored-by: Luc <sanchezluc+freshrss@gmail.com>
2023-05-30 21:34:42 +02:00
maTh eeefbdf9c7
Fixed: i18n extensions: 'en' as fallback (#5426)
* Update Translate.php

* Small improvements

---------

Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2023-05-28 18:02:04 +02:00
Alexandre Alapetite 445cc23abd
PHPStan Level 7 complete (#5406)
* PHPStan Level 7 complete

* Start PHPStan Level 8

* Forgot exclude .phtml
2023-05-22 20:55:59 +02:00
Alexandre Alapetite 2038d50110
PHPStan Level 7 for Minz_Request, FreshRSS_Feed, Minz_Error (#5400)
* PHPStan Level 7 for Minz_Request

* PHPStan Level 7 for FreshRSS_Feed

* PHPStan Level 7 for Minz_Error
2023-05-15 19:26:48 +02:00
Alexandre Alapetite c8d2ead763
Fix logs pagination (#5403)
* Fix logs pagination
Regression from https://github.com/FreshRSS/FreshRSS/pull/5269

* Add better default
2023-05-15 15:21:17 +02:00
Alexandre Alapetite d8c535c25c
PHPStan Level 7 for Share userController logs_pagination (#5393) 2023-05-13 22:47:51 +02:00
Alexis Degrugillier 68766a9857
Link configuration to proper parameter (#5394)
Before, the system configuration was linked to the user parameter while the
user configuration was linked to the system parameter. This was an issue when
trying to retrieve some kind of configuration value in an extension.
Now, the configurations are properly linked to their parameters.
2023-05-12 23:02:25 +02:00
Alexandre Alapetite 6e2f2f1c1e
A few additional PHPStan rules (#5388)
A subset of
https://github.com/phpstan/phpstan-strict-rules
2023-05-11 13:02:04 +02:00
Alexandre Alapetite fe7d9bbcd6
Typed view model classes (#5380)
* Typed view model classes
* Add ability to provide a typed view model class to a controller
* Use `::class` instead of string for referring to classes
* Examplified with `stats` and `javascript` controllers / views (more to do)
* Also useful for extensions (my usecase today), which did not have the ability to define own view model attributes before.

* Typo
2023-05-11 12:53:32 +02:00
maTh 54c8de86c7
docs: language table added (#5375)
* docs: language table added

* Update 05_Configuration.md

* Update 05_Configuration.md

* french docs

* Unicode quote and a few fixes
(Same search&replace aslo applied to a few other files)

---------

Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2023-05-07 21:35:08 +02:00
Alexandre Alapetite 30c69ef147
Use PHPStan dynamicConstantNames (#5370)
https://phpstan.org/config-reference#constants
Avoid a few phpstan-ignore-next-line
2023-05-04 19:47:54 +02:00
Alexandre Alapetite c72914bba2
PHPStan Level 7 for more DAO PDO (#5328)
* PHPStan Level 7 for more DAO PDO
With new function to address common type and check problems

* A bit more

* PHPStan Level 7 for FreshRSS_Entry
2023-04-28 14:01:11 +02:00
Alexandre Alapetite ef82e218ea
PHPStan Level 7 Minz_ActionController and lib_date (#5313) 2023-04-19 09:16:48 +02:00
Alexandre Alapetite f3760f138d
Complete PHPStan Level 6 (#5305)
* Complete PHPStan Level 6
Fix https://github.com/FreshRSS/FreshRSS/issues/4112
And initiate PHPStan Level 7

* PHPStan Level 6 for tests
* Use phpstan/phpstan-phpunit
* Update to PHPStan version 1.10

* Fix mixed bug

* Fix mixed return bug

* Fix paginator bug

* Fix FreshRSS_UserConfiguration

* A couple more Minz_Configuration bug fixes

* A few trivial PHPStan Level 7 fixes

* A few more simple PHPStan Level 7

* More files passing PHPStan Level 7
Add interface to replace removed class from https://github.com/FreshRSS/FreshRSS/pull/5251

* A few more PHPStan Level 7 preparations

* A few last details
2023-04-17 08:30:21 +02:00
Alexandre Alapetite b3121709d6
PHPStan Level 6 FreshRSS_Search FreshRSS_Entry (#5292)
* PHPStan Level 6 FreshRSS_Search FreshRSS_Entry

* Minor fix

* Type fix

* Apply suggestions from code review

Co-authored-by: Luc SANCHEZ <4697568+ColonelMoutarde@users.noreply.github.com>

* Minor types syntax
Compatibility Intelephense

---------

Co-authored-by: Luc SANCHEZ <4697568+ColonelMoutarde@users.noreply.github.com>
2023-04-14 14:23:45 +02:00
Luc SANCHEZ 6e7fa07a39
PHPstan level 6 for Dispatcher.php (#5290)
* PHPstan level 6 for Dispatcher.php

* PHPstan level 6 for Dispatcher.php

* Minor fixes

---------

Co-authored-by: Luc <sanchezluc+freshrss@gmail.com>
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2023-04-12 13:11:28 +02:00
Luc SANCHEZ 594d118bc4
PHPstan level 6 for Migrator.php (#5283)
* PHPstan level 5 for Migrator.php

* PHPstan level 5 for Migrator.php

* Update lib/Minz/Migrator.php

Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>

* Update lib/Minz/Migrator.php

Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>

* Update lib/Minz/Migrator.php

Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>

* Update lib/Minz/Migrator.php

* Update lib/Minz/Migrator.php

* Fix type

---------

Co-authored-by: Luc <sanchezluc+freshrss@gmail.com>
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2023-04-11 13:39:04 +02:00
Luc SANCHEZ 03129a2ee7
PHPStan for Minz_Session class (#5282)
* PHPstan level 8 for Session.php

* PHPstan level 8 for Session.php

* PHPstan level 8 for Session.php

* Update lib/Minz/Session.php

Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>

---------

Co-authored-by: Luc <sanchezluc+freshrss@gmail.com>
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2023-04-10 22:35:40 +02:00
Alexandre Alapetite 743ca371bb
PHPStan Level 6 for more files (#5275)
Contributes to https://github.com/FreshRSS/FreshRSS/issues/4112
2023-04-08 17:37:42 +02:00
Alexandre Alapetite b6ac505f8f
Fix login (#5271)
Fix https://github.com/FreshRSS/FreshRSS/issues/5270
2023-04-07 16:12:03 +02:00
Alexandre Alapetite dbbae15a84
Remove ConfigurationSetter (#5251)
This class has not been maintained for a while. Only a subset of our configuration properties are there, and some code is not relevant anymore. Furthermore, it is relying exclusively on dynamically invoked functions, making it challenging to maintain, in particular to find out what is used and what is not, what is handled and what is not.
It is not well suited for changes in data formats, which have been handled in the Context class instead.
It is also not able to handle configuration properties that are missing.
It is the class with most errors for PHPStan level 6 (179 errors). It is also making intense use of is_callable and call_user_func_array, which are performance killers.
Should the need arrise again to perform validation of our internal configuration files, I suggest an implementation with the opposite approach, namely driven by our code instead of driven by the data.
In summary, at the moment, this class is costly, while not offering many guarantees.
2023-04-07 12:40:43 +02:00
Luc SANCHEZ d23d10bcde
Phpstan Level6 for View.php (#5269)
* Remarque's from Alkarex

* indentation

* indentation

* Apply suggestions from code review

Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>

* Remarque's from Alkarex

* A few improvements

* Remarque's from Alkarex

* Remarque's from Alkarex

* Remarque's from Alkarex

* Remarque's from Alkarex

* Fixes and improvments

* Fix getTagsForEntry

---------

Co-authored-by: Luc <sanchezluc+freshrss@gmail.com>
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2023-04-07 12:32:10 +02:00
Alexandre Alapetite 6c01e4e7d6
Use typed access to request parameters (#5267)
* Use typed access to request parameters
This was a big source of mixed datatypes in many places

* Fix notifications

* Fix bookmarkAction
2023-04-07 00:13:49 +02:00