24 Commits

Author SHA1 Message Date
Alexandre Alapetite
833007f586 Upgrade to PHP_CodeSniffer 4 (#7993)
https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki/Version-4.0-User-Upgrade-Guide
A couple of rules have changed name. Exclusion paths have slightly changed behaviour.
Main change is that it was unhappy with our i18n header comments, so minor edit there, since that rule kind of makes sense the rest of the time
2025-09-22 22:02:59 +02:00
Alexandre Alapetite
b552d9f4bc Fix PHPCS ControlSignature (#6896)
Regression from https://github.com/FreshRSS/FreshRSS/pull/6666
We were not checking anymore for whitespace rules in e.g. `if (true) {`
2024-10-15 10:56:33 +02:00
Artur Weigandt
882deab455 Allow SimplePie updates with composer (#4374)
* rename lib/SimplePie to lib/CustomSimplePie

* add test for autoloading SimplePie with PSR-0

* install SimplePie 1.6.0

* Add SimplePie CHANGELOG.md, ignore irrelevant files

* remove unmodified custom classes

* rename all customized SimplePie classes

* Add autoloading for SimplePie PSR-0 and CustomSimplePie classes

* let CustomSimplePie extends SimplePie, remove unchanged code

* let CustomSimplePieMisc extends SimplePie\Misc, remove unchanged code

* Add tests for autoloading

* let CustomSimplePieContentTypeSniffer extends Sniffer, remove unchanged code

* remove unchanged CustomSimplePieEnclosure class

The fixed typos are commited to SimplePie
See 133eac158c

* let CustomSimplePieFile extends SimplePie\File, remove unchanged code

* let CustomSimplePieParser extends SimplePie\Parser, remove unchanged code

* let CustomSimplePieSanitize extends SimplePie\Sanitize, remove unchanged code

* let CustomSimplePieHttpParser extends SimplePie\HTTP\Parser, remove unchanged code

* Remove CustomSimplePie

* Switch SimplePie repo to https://github.com/FreshRSS/simplepie.git

* move to latest branch, update all SimplePie source files

* Use namespaced SimplePie classes, remove SimplePie library folder

* Update to latest SimplePie version with FreshRSS modifications

* Bump SimplePie
Tests expected to fail due to missing a backport of functionalities

* Add fork-specific readme

* Re-implement initial syslog SimplePie GET
https://github.com/FreshRSS/FreshRSS/pull/815
Lacks https://github.com/FreshRSS/FreshRSS/pull/6061

* Closer backport of syslog SimplePie GET
https://github.com/FreshRSS/FreshRSS/pull/6061
But the requests logs will be in the wrong order in case of redirections

* Fixes

* lib update

* SimplePie include a few more files

* Try with cache-hash branch

* Point to newer commit

* Point to newer commit

* Finalise logs

* Finalise

* Bump SimplePie commit

* Bump SimplePie commit

* Readme SimplePie fork

* Bump SimplePie commit

* Better logging

* Bump SimplePie commit

* Reworked approach to work with SimplePie cache
Simpler FreshRSS patches

* Bump SimplePie commit
https://github.com/FreshRSS/simplepie/pull/22

* Simplepie846
https://github.com/FreshRSS/simplepie/pull/23
And additional fixes

* Remove log

* Cherry pick relevant unmerged SimplePie PRs

---------

Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2024-09-14 23:11:10 +02:00
Alexandre Alapetite
d2247221bb Minor update whitespace PHPCS rules (#6666)
* Minor update whitespace PHPCS rules
To simplify our configuration, apply more rules, and be clearer about what is added or removed compared with PSR12.
Does not change our current conventions, but just a bit more consistent.

* Forgotten *.phtml

* Sort exclusion patterns + add a few for Extensions repo

* Relaxed some rules
2024-08-01 20:31:40 +02: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
berumuron
daaa391e33 tec: Update the lib_opml (#4403)
* fix: Fix undefined GLOB_BRACE on Alpine

The manual states that:

> Note: The GLOB_BRACE flag is not available on some non GNU systems,
> like Solaris or Alpine Linux.

This generated an error on Alpine.

Reference: https://www.php.net/manual/function.glob.php

* fix: List details of feeds for OPML exportation

The details are necessary to export the XPath information, the CSS full
content path and read actions filters.

* Update LibOpml to 0.4.0

* Refactor OPML importation to be more robust

First, it fixes two regressions introduced by the update of lib_opml:

- title attribute is used when text attribute is missing;
- the OPML category attribute is used as a fallback for feeds categories.

In a related way, if also fixes a problem when a feed had both a parent
category outline and a category attribute. Before, it only considered the
attribute as its category, but now it considers the parent outline.

Then, it counts category limit correctly by not increasing
`$nb_categories` if the category already exists.

* Exclude lib_opml from the CodeSniffer

* Fix variable names when logging some errors

* Fix catch of LibOpml Exception

* Make sure to declare the category

* Exclude lib_opml from PHPStan analyze

* Disable markdownlint for lib_opml

* Fix typos

* Use auto-loading and allow updates via Composer

* Fix broken links to lib_opml

* Bring back the ability to import the OPML frss:opmlUrl attribute

* Refactor the logs of OPML errors

* Update lib_opml to the version 0.5.0

Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2023-01-18 10:12:21 +01:00
Alexandre Alapetite
f2fe9e2ff3 Exclude .git folder (#4824) 2022-11-06 19:05:09 -05:00
Artur Weigandt
d6fd78b968 Allow CssXPath updates with composer (#4368)
* Install CssXPath with composer

* Fix code style in tests

* fix pathnames for tests and linting

* add irrelevant files to .gitignore

* Alphabetic order

* let composer sort the packages alphabetically

Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2022-05-16 12:04:43 +02:00
Artur Weigandt
5110d1db3e Update to PHPMailer 6.6.0 with composer (#4329)
* Install PHPMailer 6.5.1 with composer

* Fix folder name for phpmailer

* Update PHPMailer to v6.6.0, add LICENSE and README.md

* remove composer and autoload.php after install/update

* Fix path to PHPMailer for PHPStan

* Remove lib/composer.lock, lock PHPMailer at version 6.6.0

* Improve PSR-4 autoloading for PHPMailer

* Markdownlint ignore

* Delete some obvious comments

* ignores

* Support composer update --no-autoloader

* Automatic cleaning
With rules based on https://github.com/PHPMailer/PHPMailer/blob/master/README.md#minimal-installation

* Readme gitignore hint

Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2022-05-14 23:38:16 +02:00
Alexandre Alapetite
ae54a590b9 Replace lib_phpQuery by PhpGt/CssXPath (#4261)
https://github.com/PhpGt/CssXPath
2022-03-16 15:10:41 +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
Frans de Jonge
d339b6dd45 [CI] PHPCS: check for opening brace on same line (#4122)
* [CI] PHPCS: check for opening brace on same line

* make fix-all

* Minor comments

Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2022-01-05 00:52:24 +01:00
Alexandre Alapetite
9ca49408e0 GitHub Action automatic tests (#3920)
* PHP lint + phpunit + Manipulate translations + phpcs
* eslint + markdownlint + rtlcss + stylelint
* shellcheck + shfmt + hadolint
2021-10-24 00:14:12 +02:00
maTh
02641de32e Stats: replace flotr2 with chart.js (#3858)
* include Chart.js

* page: main statistics. Flotr.js replaced with Chart.js

* main stats + repartition

* Delete: repartition.js + stats.js

* delete flotr2

* add libs in README

* polish

* code polish

* fixed amount of week days and months

* added manget link for LibreJS

* added: @license-end

* phpcbf + jshint formatting

* delete old code

* fix stats

* fix Comments

* finally I found the issue and fixed its best

* fix the month stats

* Whitespace fixes

* Remove flotr2

* Rename to chart.min.js

* Remove console.log

Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2021-10-16 12:00:07 +02: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
Marien Fressinaud
97881628eb tec: Add a make lint command in the Makefile (#2996) 2020-05-25 19:06:23 +02:00
Alexandre Alapetite
7a5236de3f Take advantage of PHP 5.4+ short echo (#2585)
* Take advantage of PHP 5.4+ short echo

https://php.net/migration54.new-features thanks to
https://github.com/FreshRSS/FreshRSS/pull/2495

Use `<?=  ?>` instead of `<?php echo; ?>`
10kB of code saved :-)

Done with regular expression:
```
<\?php echo (.+?);? *\?>
<?= \1 ?>
```

* Try Travis fix

https://github.com/squizlabs/PHP_CodeSniffer/issues/2045#issuecomment-395238272
2019-10-23 11:18:20 +02:00
Alexis Degrugillier
cc0db9af4f Feature/new archiving (#2335)
* Change archiving config page layout

I've changed some wording and moved actions into a
maintenance section.

* Update purge action

Now we have more control on the purge action. The configuration allows
us to choose what to keep and what to discard in a more precise way.
At the moment, the configuration applies for all feeds.

* Add purge configuration on feed level

Now the extend purge configuration is available on feed level.
It is stored as attributes and will be used in the purge action.

* Update purge action

Now the purge action uses the feed configuration if it exists and
defaults on user configuration if not.

* Add empty option in period list

* Fix configuration warnings

* Add archiving configuration on categories

See #2369

* Add user info back

* Add explanations in UI

* Fixes for SQLite + error + misc.

* Fix invalid feed reference

* Short array syntax

Only for new code, so far

* Fix prefix error

* Query performance, default values

Work in progress

* Fix default values and confirm before leaving

Form cancel and confirm changes before leaving were broken.
And start taking advantage of the short echo syntax `<?= ?>` as we have
moved to PHP 5.4+

* More work

* Tuning SQL

* Fix MariaDB + performance issue

* SQL performance

* Fix SQLite bug

* Fix some attributes JSON encoding bugs

Especially for SQLite export/import

* More uniform, fix bugs

More uniform between global, category, feed settings

* Drop special cases for old articles during refresh

Instead will use lastSeen date with the new archiving logic.
This was generating problems anyway
https://github.com/FreshRSS/FreshRSS/issues/2154

* Draft drop index keep_history

Not needed anymore

* MySQL typo

Now properly tested with MySQL, PostgreSQL, SQLite

* More work for legacy values

Important to avoid overriding user's preference and risking deleting
data erroneously

* Fix PHP 7.3 / 7.4 warnings

@aledeg "Trying to use values of type null, bool, int, float or resource
as an array (such as $null["key"]) will now generate a notice. "
https://php.net/migration74.incompatible

* Reintroduce min articles and take care of legacy parameters

* A few changes forgotten

* Draft of migration + DROP of feed.keep_history

* Fix several errors

And give up using const for SQL to allow multiple database types (and we
cannot redefine a const)

* Add keep_min to categories + factorise archiving logic

* Legacy fix

* Fix bug yield from

* Minor: Use JSON_UNESCAPED_SLASHE for attributes

And make more uniform

* Fix sign and missing variable

* Fine tune the logic
2019-10-23 00:52:15 +02:00
Alexandre Alapetite
e761202f8a Remove JSON.php fallback (#2528)
After moving to PHP 5.6+ https://github.com/FreshRSS/FreshRSS/pull/2527
it should not be necessary to have the JSON.php fallback anymore, which
was mainly there due to an obscure licensing issue 6 years ago in Debian
https://wiki.debian.org/qa.debian.org/jsonevil , which broke Ubuntu
13.10 https://github.com/FreshRSS/FreshRSS/issues/306
2019-09-18 17:18:36 +02:00
Alexandre Alapetite
fd33d92d41 Require PHP 5.5+ (#2495)
* Require PHP 5.5+

https://github.com/FreshRSS/FreshRSS/issues/2469#issuecomment-522255093
I think it would be reasonable to require PHP 5.5+ for the core of
FreshRSS after all.

As Frenzie said, WordPress currently requires PHP 5.6.20+, and it is the
most popular PHP application.

We would loose about 20% of the PHP servers according to
https://w3techs.com/technologies/details/pl-php/5/all but I expect this
number to drop fast after the release of CentOS 8 (CentOS accounts for
17% of Linux servers
https://w3techs.com/technologies/details/os-linux/all/all ).

Distributions:
* no impact on Ubuntu, Fedora, Alpine, OpenWRT, FreeBSD, OpenSuze,
Mageia, as all active versions have PHP > 7
* no impact on OpenSuze, Synology, as all active versions have PHP > 5.5
* we drop Debian 8 Jessie (-2020) - we keep supporting Debian 9 Stretch
(2017-06) - current is Debian 10 Buster
* we drop Red Hat 7 (-2024) - we keep supporting RHEL 8 (2019-05)
* we drop CentOS 7 (-2024) - we will support CentOS 8 (to be released
soonish)

When dropping older versions, I can better like when it is for a good
reason, and there is actually one with PHP 5.5, namely generators
(yield) https://php.net/language.generators.overview which I consider
using.

* Version note for JSON.php

* hex2bin

* Update .travis.yml

Co-Authored-By: Frans de Jonge <fransdejonge@gmail.com>
2019-08-20 14:55:43 +02: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
Frans de Jonge
9fab63765e [CI] Add PHP 7.3 to Travis configuration (#2317)
This also requires an update of phpcs, since the old version won't run on PHP 7.3.

By setting setting the tab-width to 40 it works around the behavior introduced in https://github.com/squizlabs/PHP_CodeSniffer/pull/1404 which erroneously interprets positioning spaces as indentation. ("If the line started with tabs, but had spaces after that, no error was thrown at all.")

That makes any line lengths checks ineffective, but I think line length checks aren't very useful anyway. They're basically just a (very!) rough indication that you might want to consider some refactoring.
2019-04-01 23:49:32 +02:00
Nicola Spanti
942508d879 Minor changes (#1747) 2017-12-21 17:20:52 +01:00
Frans de Jonge
4e174ed9dd [ci] Add Travis (#1619)
* [ci] Add Travis

* Exclude some libs

* Semi-auto whitespace fixes

* line length in SQLite

* Exclude tests from line length

* Feed.php line length

* Feed.php: get rid of unnecessary concat

* Feed.php: line length

* bootstrap.php: no newline at end of file

* Allow concatenating across multiple lines

* Add Travis badge

* do-install line length

* update-or-create-user line length

* cli/create-user line length

* tests/app/Models/SearchTest.php fix indentation

* tests/app/Models/UserQueryTest.php fix indentation

* tests/app/Models/CategoryTest.php fix indentation

* [fix] PHP 5.3 on precise

* cli/do-install no spaces

* cli/list-users line length

* cli/reconfigure line length

* empty catch statements

* api/index line length nonsense

* spaces before semicolon

* app/Models/EntryDAO bunch of indentation

* extra blank lines

* spaces before comma in function call

* testing tabwidth

* increase to 10

* comment out tabwidth line

* try older phpcs version 3.0.0RC4

* line length exception for app/install.php

* proper spaces

* stray spaces in i18n

* Minz/ModelPdo line length

* Minz whitespace

* greader line length

* greader elseif placement

* app/Models/Feed.php spacing in function argument

* ignore php 5.3

* app/Models/ConfigurationSetter.php stray whitespace

* EntryDAOSQLite line length

* I vote for higher max line length =P

* ignore SQL

* remove classname complaint

* line length/more legible SQL

* ignore line length nonsense

* greader line length

* feedController issues

* uppercase TRUE, FALSE, NULL

* revert

* importExportController lowercase null

* Share.php default value not necessary because ! is_array () a few lines down

* CategoryDAO constants should be UPPERCASE

* EntryDAO reduce line length

* contentious autofix

* Allow failures on all versions of PHP except 7.1 because reasons
2017-09-22 12:13:46 +02:00