75 Commits

Author SHA1 Message Date
Alexandre Alapetite
1a3912f25a Improve configuration checks (#8334)
Add a distinction between recommended and required extensions.
Add check for recommended php-intl extension as follow-up of https://github.com/FreshRSS/FreshRSS/pull/8329#issuecomment-3677686581
Improve related checks such as ZIP.
Reduce duplicated translations and tests.
2025-12-21 19:26:08 +01:00
Alexandre Alapetite
a7579e0cf5 Catch lack of exec function for git update (#8228) 2025-11-20 22:16:22 +01:00
Alexandre Alapetite
a18c35046d Housekeeping lib_rss.php (#8193)
* Housekeeping lib_rss.php
`lib_rss.php` had become much too large, especially after https://github.com/FreshRSS/FreshRSS/pull/7924
Moved most functions to other places.
Mostly no change of code otherwise (see comments).

* Extension: composer run-script phpstan-third-party
2025-11-11 08:17:12 +01:00
maTh
2bcc090622 configurable notification timeout (#7942)
Ref #7931
Ref #5466
Ref #6409

added configuration in "Display"
<img width="636" height="167" alt="grafik" src="https://github.com/user-attachments/assets/7bbc9f26-d91b-4dd2-b715-1d3f9b7a9ad3" />

* i18n: fr

* Update app/i18n/pl/conf.php

Co-authored-by: Inverle <inverle@proton.me>

* make fix-all

* max()

* Minor whitespace
(I am not a fan of excessive vertical indenting)

---------

Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
Co-authored-by: Inverle <inverle@proton.me>
2025-10-01 10:48:07 +02:00
Alexis Degrugillier
72884813e1 Add hook enums (#8036)
- add an enum to handle hook types (enum are available since PHP 8.1)
- change hook calls from string value to enum value
2025-09-30 22:59:41 +02:00
Inverle
f2c6942a60 Move update one step before (#7989)
Closes https://github.com/FreshRSS/FreshRSS/issues/7897
2025-09-21 12:40:40 +02:00
Alexis Degrugillier
23ba48c71f Change how files are included (#7916)
1. `include`, `include_once`, `require` and `require_once` are expressions not functions, parentheses are not necessary.
2. to move up the directory tree, it's better to use the `dirname` function instead of relying on `/..`.
2025-09-05 15:56:46 +02:00
Alexandre Alapetite
ddb9e91bf2 Fix some PHP 8.5 deprecations (#7826)
https://github.com/php/php-src/blob/php-8.5.0beta1/NEWS
https://php.net/function.curl-close
> This function has no effect. Prior to PHP 8.0.0, this function was used to close the resource.
2025-08-15 09:36:45 +02:00
Inverle
3ce64d271b Implement sudo mode / reauthentication (#7753)
* Implement sudo mode / reauthentication

* i18n: fr

* generate flags

* Improvements

* Remove HMAC check
* Don't require reauth to access logs when signed in as admin
* Notify user of bad login via notification instead

---------

Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2025-07-31 13:53:14 +02:00
Alexandre Alapetite
b1d24fbdb7 PHPStan 2.0 (#7131)
* PHPStan 2.0
fix https://github.com/FreshRSS/FreshRSS/issues/6989
https://github.com/phpstan/phpstan/releases/tag/2.0.0
https://github.com/phpstan/phpstan/blob/2.0.x/UPGRADING.md

* More

* More

* Done

* fix i18n CLI

* Restore a PHPStan Next test
For work towards PHPStan Level 10

* 4 more on Level 10

* fix getTagsForEntry

* API at Level 10

* More Level 10

* Finish Minz at Level 10

* Finish CLI at Level 10

* Finish Controllers at Level 10

* More Level 10

* More

* Pass bleedingEdge

* Clean PHPStan options and add TODOs

* Level 10 for main config

* More

* Consitency array vs. list

* Sanitize themes get_infos

* Simplify TagDAO->getTagsForEntries()

* Finish reportAnyTypeWideningInVarTag

* Prepare checkBenevolentUnionTypes and checkImplicitMixed

* Fixes

* Refix

* Another fix

* Casing of __METHOD__ constant
2024-12-27 12:12:49 +01:00
Luc SANCHEZ
15745d42b7 Upgrade code to php 8.1 (#6748)
* revert
Fix code indentation
Fix code

Upgrade code to php 8.1

* fix remarques

* code review

* code review

* code review

* Apply suggestions from code review

* code review

* Fixes

* Many remainging updates of array syntax

* Lost case 'reading-list'

* Uneeded PHPDoc

---------

Co-authored-by: Luc Sanchez <l.sanchez-prestataire@alptis.fr>
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2024-11-28 17:11:04 +01:00
Alexandre Alapetite
a81656c3ed Upgrade to PHP 8.1 (#6711)
* Upgrade to PHP 8.1
As discussed in https://github.com/FreshRSS/FreshRSS/discussions/5474

https://www.php.net/releases/8.0/en.php
https://www.php.net/releases/8.1/en.php

Upgrade to available native type declarations
https://php.net/language.types.declarations

Upgrade to https://phpunit.de/announcements/phpunit-10.html which requires PHP 8.1+ (good timing, as version 9 was not maintained anymore)

Upgrade `:oldest` Docker dev image to oldest Alpine version supporting PHP 8.1: Alpine 3.16, which includes PHP 8.1.22.

* Include 6736
https://github.com/FreshRSS/FreshRSS/pull/6736
2024-09-06 09:06:46 +02:00
Alexandre Alapetite
aa2be914d7 Fix update git version (#6513)
fix https://github.com/FreshRSS/FreshRSS/issues/6512
Compatibility with git older than 2.37
2024-05-29 23:01:14 +02:00
Alexandre Alapetite
7593e0815b Better git error messages (#6496)
* Better git error messages
fix https://github.com/FreshRSS/FreshRSS/discussions/5174
fix https://github.com/FreshRSS/FreshRSS/issues/6483

* Avoid dependency on `which`
2024-05-26 17:47:52 +02:00
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
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
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
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
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
Luc SANCHEZ
f8f163d054 Chore/processing of depreciations and updating code to php72 minimum (#5504)
* processing of depreciations and updating of code to php7.2 minimum

* Autoformat many strange array indenting
And revert a few unwanted changes

---------

Co-authored-by: Luc <sanchezluc+freshrss@gmail.com>
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2023-07-07 22:36:27 +02:00
maTh
3d9e0c47ec Improved: update page (#5420)
* prependTitle()

* do not need the "damn" in the alert

* update page layout improved

* release channel

* i18n labels

* add log messages while updating

* Delete updatee.php

* Update updateController.php

* Update updateController.php

* Update updateController.php

* Update updateController.php

* add getCurrentGitBranch()

* Update updateController.php

* state2 buttons

* i18n

* loading

* Update feedback.php

* Update feedback.php

* Update feedback.php

* Update extra.js

* Apply suggestions from code review

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

* Update updateController.php

* Update terminology

* update button is now armed

---------

Co-authored-by: Luc SANCHEZ <4697568+ColonelMoutarde@users.noreply.github.com>
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2023-06-13 22:39:33 +02:00
Luc SANCHEZ
9172b65cdb phpstan level 7 for updateController.php (#5376)
* phpstan level 7 for updateController.php

* phpstan level 7 for updateController.php

* Minor array syntax

---------

Co-authored-by: Luc <sanchezluc+freshrss@gmail.com>
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2023-05-07 21:34:49 +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
Alexandre Alapetite
2118448133 PHPStan level 6 for more files (#5264)
7 more files passing (see phpstan-next.txt)
2023-04-05 23:26:38 +02:00
Alexandre Alapetite
36aa0122e1 Fix extensions in actualize_script (#5243)
* Fix extension freshrss_user_maintenance in actualize_script
Follow-up of https://github.com/FreshRSS/FreshRSS/pull/3440

The hook was called before registering all the extensions for the current user

* PHPStan Level 6 for extensions
And remove 5-year old legacy format of enabled extensions < FreshRSS 1.11.1

* Fix multiple bugs in extensions

* Minor typing

* Don't change signature of methods supposed to be overridden

* PHPStan Level 9 and compatibility Intelliphense

* Set as final the methods not supposed to be overriden
2023-04-04 10:23:26 +02:00
Alexandre Alapetite
1d9d4e3e3c Update dev dependencies (#4993)
Related to https://github.com/FreshRSS/FreshRSS/pull/4991
Required a few changes in code to pass the tests
2023-01-09 12:59:30 +01:00
Alexandre Alapetite
42eeb402ad Fix type hints regressions (#4855)
Fix regressions from https://github.com/FreshRSS/FreshRSS/pull/4561

Example:

```
PHP Fatal error:  Uncaught TypeError: Argument 1 passed to checkToken() must be an instance of FreshRSS_UserConfiguration, instance of Minz_Configuration given, called in /var/www/FreshRSS/p/api/greader.php on line 1091 and defined in /var/www/FreshRSS/p/api/greader.php:223
Stack trace:
#0 /var/www/FreshRSS/p/api/greader.php(1091): checkToken()
#1 {main}
  thrown in /var/www/FreshRSS/p/api/greader.php on line 223
```

Improvement of https://github.com/FreshRSS/FreshRSS/pull/4110
2022-11-15 15:42:26 +01:00
Alexandre Alapetite
8864d514c8 NFS-friendly is_writable() checks (#4780)
#fix https://github.com/FreshRSS/FreshRSS/issues/4779
2022-11-14 14:57:45 +01:00
Alexandre Alapetite
f56d1274c6 Fix opcache bug during Web update (#4629)
#fix https://github.com/FreshRSS/FreshRSS/issues/4624
#fix https://github.com/FreshRSS/FreshRSS/issues/4605
2022-09-20 10:36:07 +02:00
Alexandre Alapetite
f988b996ab Fix update URL (#4399)
#fix https://github.com/FreshRSS/FreshRSS/issues/4395 maybe
2022-06-02 08:40:18 +02:00
maTh
b127777887 class constant (#4194) 2022-02-04 15:47:54 +01:00
Alexandre Alapetite
1acd3ab09b Use typographic quotes (#4133)
* Use typographic quotes

* A few fixes

* Fix

* Fix not saved

* Implement feedback

* Detail

* Revert spoken English fixes
Left for a future dedicated discussion

* More reverts

* Final reverts

* Final minor
2022-01-08 21:58:55 +01:00
Alexandre Alapetite
1335a0e3cf PHPStan level 5 (#4110)
* Fix most PHPDocs errors
Contributes to https://github.com/FreshRSS/FreshRSS/issues/4103
https://phpstan.org/writing-php-code/phpdoc-types

* Avoid func_get_args
Use variadic syntax instead https://php.net/manual/functions.arguments#functions.variable-arg-list
And avoid dynamic functions names when possible to more easily identify calls and unused functions.
Contributes to https://github.com/FreshRSS/FreshRSS/issues/4103

* PHPStan level 3

* PHPStand level 4

* Update default to PHPStan level 4

* Towards level 5

* Fix level 4 regression

* Towards level 5

* Pass PHPStan level 5

* Towards level 6

* Remove erronenous regression from changelog
https://github.com/FreshRSS/FreshRSS/pull/4116
2022-01-04 13:59:09 +01:00
Alexandre Alapetite
77e9877316 Add PHPStan (#4021)
* Add PHPStan
#fix https://github.com/FreshRSS/FreshRSS/issues/4016
https://phpstan.org/

```sh
composer run-script phpstan
```

* More fixes

* Fix global variables

* Add .phtml

* Fix merge
https://github.com/FreshRSS/FreshRSS/pull/4090

* Fix more warnings

* Fix view errors and enable in CI

* ReturnTypeWillChange

* Dynamic view type

* Fix Minz static/self bug
2021-12-31 17:00:51 +01:00
Alexandre Alapetite
c5ca737062 Git 2.21 compatiblity (#3669)
#fix https://github.com/FreshRSS/FreshRSS/issues/3665
`git branch --show-current` requires git 2.22+
https://stackoverflow.com/questions/1417957/show-just-the-current-branch-in-git
2021-06-07 23:10:25 +02:00
Alexandre Alapetite
54e0a6e553 Fix git update error message (#3645)
#fix https://github.com/FreshRSS/FreshRSS/issues/3644
2021-05-30 12:05:50 +02:00
Alexandre Alapetite
319d7dc185 Minor whitespace (#3639)
Spotted in https://github.com/FreshRSS/FreshRSS/issues/3638
2021-05-26 19:54:47 +02:00
Alexandre Alapetite
97ba6261a8 git update auto change to edge branch (#3589)
* git update auto change to edge branch
For existing installations using automatic git update, checkout *edge* branch if it was still using *master* or *dev*.

* One more prune

* Fix several small issues

* theirs does not work here

* Use migration mechanism

* Better handling of Migration errors

* Test details

* Fix tests

* Do not use new migration system for now
2021-05-15 21:33:43 +02:00
berumuron
cc6c529562 tec: Remove data/do-install.txt (#3555)
* Remove file data/do-install.txt

This file was painful during update because we had to remember to delete
it each time. It added a security issue by allowing an attacker to
reinstall FreshRSS during the update process.

The (more powerful) file data/applied_migrations.txt has been introduced
in 8619cf6fa to replace do-install.txt. We had to wait for at least one
release in order to make sure existing instances of FreshRSS created the
migration file. It should be ok now.

* Replace i18n install.not_deleted key

* Update documentation to update FreshRSS
2021-03-26 19:41:33 +01:00
Alexandre Alapetite
947e918f05 Travis: Enforce phpcs line length + whitespace (#3488)
* Update Travis line length

* Also check whitespace in CSS files

* Fix line length ext.php

* More syntax, string templates

* Fix exclude-pattern

* Test JS files as well
2021-02-28 12:26:24 +01:00
Alexandre Alapetite
2495172a05 Better git fetch (#2626)
Related to https://github.com/FreshRSS/FreshRSS/pull/2625

If for some reasons branches have diverged:, e.g.:

```
$ git status -sb --porcelain remote
## dev...origin/dev [ahead 4, behind 1]
```
2019-11-04 18:05:20 +01:00
Alexandre Alapetite
c277e15141 Git fetch+reset instead of clean+fetch+merge (#2625)
Fix https://github.com/FreshRSS/FreshRSS/issues/2619
Avoid potentially dangerous git clean, and use more robust fetch + reset
strategy instead
2019-11-02 13:38:04 +01:00
Marien Fressinaud
de26531178 tec: Provide a Minz_Mailer class (#2476)
* Add Minz_View::_path method (replace change_view)

The `_path` method is more powerful since it allows to choose the file
extension. It is also Minz_Request-agnostic, which is useful to reuse
the Minz_View class in other places.

`change_view` is now deprecated and a warning is logged if we use it.

* Provide a Minz_Mailer to send emails

It uses PHPMailer under the hood and only supports PHP >= 5.5
2019-08-15 17:19:12 +02:00
Alexis Degrugillier
0eea6d5ab5 Revert "Update git command (#2331)"
This reverts commit afd1a8784c.
2019-04-03 17:38:17 +02:00
Alexis Degrugillier
afd1a8784c Update git command (#2331)
I removed an unnecessary option and rewrote a short option
to use the long option. I find it's easier to understand
long options when you don't type them.
2019-04-03 08:02:43 +02:00
Alexandre Alapetite
83756c657f 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
2018-09-30 18:04:49 +02:00
Kevin Papst
8abfe1cf28 Update panel shows latest version message as success (#1701)
show latest version message as success, FIXES #1586
2017-12-02 13:45:26 +01:00
Alexandre Alapetite
20d1301b46 Do not require write access to check new version
Do not require write access to check if new ZIP version is available
https://github.com/FreshRSS/FreshRSS/issues/1450
2017-05-25 14:27:31 +02:00
Marien Fressinaud
9ce0bca45f fix: Fix update via ZIP archive
Code from the update server was not loaded anymore before the update
process. This commit brings back missing `require`.
2017-04-15 21:18:43 +02:00
Dennis Schwerdel
59d6f3593c Add config option to disable and hide self-update 2017-02-23 21:22:56 +01:00