Commit Graph

175 Commits

Author SHA1 Message Date
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
3f6aa42b81 Fix most PHPDocs errors (#4107)
Contributes to https://github.com/FreshRSS/FreshRSS/issues/4103
https://phpstan.org/writing-php-code/phpdoc-types
2022-01-01 11:26:56 +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
a2ab9cf83a Minz request avoid custom methods (#4020)
Take advantage of PHP7+ null-coalescing operator `??` to make code more standard, shorter, and faster instead of custom function with no extra functionality.

Allows code to be better tested and fix two PHPstan errors:

```
 ------ -----------------------------------------
  Line   app/Controllers/configureController.php
 ------ -----------------------------------------
  410    Cannot unset offset 'rid' on string.
 ------ -----------------------------------------

 ------ ------------------------------------
  Line   lib/Minz/FrontController.php
 ------ ------------------------------------
  70     Cannot unset offset 'c' on string.
  71     Cannot unset offset 'a' on string.
 ------ ------------------------------------
```

https://github.com/FreshRSS/FreshRSS/issues/4016
2021-12-02 23:25:07 +01:00
Alexandre Alapetite
a7aca6c0ab Improved feed action filters (#3303)
* Re-order some feed options
* Option to auto mark as read existing titles
* Option to keep at max n unread articles per feed
2021-09-19 10:56:38 +02:00
Alexandre Alapetite
ee2d2db780 Fallback for feeds with empty title (#3787)
* Fallback for feeds with empty title
Address a part of https://github.com/FreshRSS/FreshRSS/issues/3776 for existing feeds

* Also strip www prefix

* Reuse fallback logic
2021-08-22 13:33:58 +02:00
Alexandre Alapetite
607f7e7254 Fix several comments syntaxes (#3615)
Mainly wrong `@return` types in comments
2021-05-08 10:27:18 +02:00
Alexandre Alapetite
a65097f1b3 Make SSL options available to non-admins (#3612)
#fix https://github.com/FreshRSS/FreshRSS/issues/3611
2021-05-07 17:21:16 +02:00
Alexandre Alapetite
83a352e4bf Removed unused variable (#3587)
From https://github.com/FreshRSS/FreshRSS/pull/2335
2021-04-17 18:11:03 +02:00
Alexandre Alapetite
eeff1a17b0 Suport standard HTTP 410 Gone (#3561)
When a feed returns an HTTP 410 Gone, mute the corresponding feed, i.e. stop refreshing it.
Example of such feed, Les Décodeurs (Libération) https://rss.liberation.fr/rss/100893/
2021-03-26 19:13:23 +01:00
Alexandre Alapetite
90a0028d49 Fix DB lock bug during refresh (MariaDB) (#3559)
#fix https://github.com/FreshRSS/FreshRSS/issues/3552
2021-03-23 22:31:48 +01:00
Alexandre Alapetite
e2533bd946 Fix undefined variable & dead code when adding feed (#3546)
Related to https://github.com/FreshRSS/FreshRSS/issues/3537
2021-03-21 12:23:32 +01:00
Jules-Bertholet
800a42172d Add an option to set a custom user agent to retrieve individual feeds (#3494)
* Add an option to set a custom user agent to retrieve individual feeds

This allows retrieving the original RSS feed when websites use services like FeedBurner.

* Use !== instead of != in subscriptionController.php

* Add proxy and user-agent to subscription/add

Co-authored-by: Georgelemental <georgelemental@gmail.com>
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2021-03-09 20:51:09 +01:00
Alexandre Alapetite
ef4a826e34 Reload full content when changed (#3506)
* Reload full content when changed
If an article is changed, reload also its full content when applicable.

* Compute hash before getting full content

* Revert mix two PRs

* Update app/Controllers/feedController.php
2021-03-09 08:41:01 +01:00
Alexandre Alapetite
b10cd770ee SQLite: fix updateEntry (#3461)
* Draft of fix for updateEntry

#fix https://github.com/FreshRSS/FreshRSS/issues/3130

* Fix for SQLite

* Update app/Models/EntryDAO.php

Fixed in https://github.com/FreshRSS/FreshRSS/pull/3500

* Unbuffered streaming only for MySQL
2021-03-07 17:34:47 +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
ee7938ed5f Do not import feed causing DB error (#3347)
* Do not import feed causing DB error

The DB error might be that the new feed tries to redirect to an already
existing feed, in which case
#fix https://github.com/FreshRSS/FreshRSS/issues/3339

* Add feed bug
2021-01-09 20:51:33 +01:00
Alexandre Alapetite
7652369359 Minz: Attach a notification to a request (#3208)
* Minz: Attach a notification to a request

Notifications should be attached to a request, not to a global session.
Fix
https://github.com/FreshRSS/FreshRSS/pull/3096#issuecomment-654891906
Prepare https://github.com/FreshRSS/FreshRSS/pull/3096

* Rename array

* Avoid string constants

Implement
https://github.com/FreshRSS/FreshRSS/pull/3208#issuecomment-703243863

* Improved logic

* Simplify storage

https://github.com/FreshRSS/FreshRSS/pull/3208#discussion_r499511213

* Fix notification bug in configuration/system
2020-10-05 19:03:33 +02:00
Alexandre Alapetite
48345403df Trim whitespace for feed passwords (#3158)
We output a space by default in the user interface for setting feed
passwords, in order to prevent aggressive password autocompletion
https://github.com/FreshRSS/FreshRSS/pull/881
However, user might not always override this white space when entering
the password. So here we trim.
(I believe legitimate leading / trailing spaces in passwords are
sufficiently rare not to be a problem)
2020-08-29 12:16:20 +02:00
Alexandre Alapetite
051f1649f7 FeedMe table manage feeds + fix warning addFeed (#3075)
FeedMe is able to add/remove subscriptions.

Fix minor bug introduced by
https://github.com/FreshRSS/FreshRSS/pull/1731
If the category ID is provided, we must first search for the existing
category before trying to add a category with the provided name.
Fix:

```
SQL error addCategory: ["23000",19,"UNIQUE constraint failed:
category.name"]
```
2020-06-21 10:30:12 +02:00
Alexandre Alapetite
b9d2e6457a Fetch feed name / website / description if empty (#3071)
#fix https://github.com/FreshRSS/FreshRSS/issues/3067
2020-06-20 16:54:03 +02:00
Alexis Degrugillier
d4554fa087 Change add feed action (#3027)
* Docker Alpine 3.12 (#3025)

https://alpinelinux.org/posts/Alpine-3.12.0-released.html
With PHP 7.3.18 (from 7.3.17) (and Apache 2.4.43 unchanged).
No other significant change spotted

* Ensure feed attributes are used before load

Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2020-06-05 10:09:31 +02:00
Alexandre Alapetite
857f588790 Fix fetch preview (#2993)
* Fix fetch preview

#fix https://github.com/FreshRSS/FreshRSS/issues/2923
In MariaDB / MySQL, we cannot start a new query if we have not consumed
the previous buffered query fully.

* Fix for reload

* Typo in comment
2020-05-21 20:55:06 +02:00
Alexandre Alapetite
83b5944dcb Stream instead of memory copy of SimplePie entries (#2972)
* Stream instead of memory copy of SimplePie entries

https://github.com/FreshRSS/FreshRSS/issues/2952

* Undo lines delete

* Typo

* Remove unaccessible code

https://github.com/FreshRSS/FreshRSS/pull/2972/files#r425624163

* Back-compatibility for Feed->entries

https://github.com/FreshRSS/FreshRSS/pull/2972/files#r425631913
2020-05-17 00:04:51 +02:00
Alexandre Alapetite
aea3806590 Attempt to reduce max memory usage during actualize (#2955)
* Attempt to reduce max memory usage during actualize

#Fix https://github.com/FreshRSS/FreshRSS/issues/2952

* Use memory_get_peak_usage
2020-05-10 21:34:12 +02:00
Alexandre Alapetite
dba40e5870 WebSub move fixes (#2922)
Small fixes related to when WebSub changes address:
* When unsubscribing, one must use the current/old address, not the
newly found selfUrl;
* This change
https://github.com/FreshRSS/FreshRSS/pull/2659#discussion_r347263068 was
wrong, so reverted to the first version. We must obey the rules also for
feeds for which the initial WebSub enabling is not finished, otherwise
we never have a chance to redirect the feed to the proper selfUrl.
2020-04-24 16:29:19 +02:00
Alexandre Alapetite
946d9f5535 Reduce DB locks (#2899)
Do not lock the DB to update it when there is nothing to commit.
This should reduce the risk of seeing some `database is locked` errors.
2020-04-14 00:09:13 +02:00
Alexandre Alapetite
656b61ff29 Fix fetch content for complex HEAD (#2867)
* Fix contentSelectorPreviewAction

Was not compatible with https://github.com/FreshRSS/FreshRSS/pull/2588

* Fix lib_phpQuery for <head ...>

#fix https://github.com/FreshRSS/FreshRSS/issues/2864
* Replace split() by explode() for PHP7 compatibility
https://php.net/str-split
* Fix for document with a `<head>` tag more complicated, like `<head
profile="http://www.w3.org/1999/xhtml/vocab">`
2020-04-01 02:09:08 +02:00
Julien-Pierre Avérous
d30ac40772 Enhance content path feature (#2778)
- Add a maintenance section to be able to clear cache and force reload a feed.
- Add an icon next to path field to show a pop-up with the result of the content path.

Co-authored-by: Frans de Jonge <fransdejonge@gmail.com>
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
Co-authored-by: Marien Fressinaud <dev@marienfressinaud.fr>
2020-02-13 18:22:35 +01:00
Clemens Neubauer
08c6a1bdc1 Extend hooks (#2704)
It adds two new hooks to have more options for influencing with extensions.
2019-12-07 12:59:53 +01:00
Alexandre Alapetite
bb5d15f7c6 Do not obbey rel=self if WebSub is disabled (#2659)
* Do not obbey rel=self if WebSub is disabled

https://github.com/FreshRSS/FreshRSS/issues/2654

* Correct variable

https://github.com/FreshRSS/FreshRSS/pull/2659#discussion_r347552063

* Update app/Controllers/feedController.php
2019-11-21 16:23:20 +01: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
e3e5954394 PDO refactoring for code simplification (#2522)
* PDO refactor

* Automatic prefix when using the syntax `_tableName`
* Uniformity: MySQL is now PDO::ATTR_EMULATE_PREPARES = false just like SQLite and PostgreSQL, with consequences such as only one statement per query
* Use PDO methods exec(), query(), prepare() + execute() in a more efficient way
* Remove auto-update SQL code for versions older than FreshRSS 1.5 (3 years old)
* The name of the default category is set in PHP instead of in the DB (simplies SQL and allows changing the name according to the FreshRSS language)
* Rename `->bd` to `->pdo` (less of a frenshism, and more informative)
* Fix some requests, which were not compatible with MySQL prepared statements

* Whitespace

* Fix syntax for PostgreSQL sequences

+ MySQL install

* Minor formatting

* Fix lastInsertId for PostgreSQL

* Use PHP 5.6+ const

Take advantage of https://github.com/FreshRSS/FreshRSS/pull/2527
https://www.php.net/manual/en/migration56.new-features.php

* A bit of forgotten PHP 5.6 simplification for cURL

* Forgotten $s

* Mini fix custom user config

https://github.com/FreshRSS/FreshRSS/pull/2490/files#r326290346

* More work on install.php but not finished

* install.php working

* More cleaning of PDO in install

* Even more simplification

Take advantage of PDO->exec() to run multiple statements

* Disallow changing the name of the default category

https://github.com/FreshRSS/FreshRSS/pull/2522#discussion_r326967724
2019-09-29 16:22:50 +02:00
Marien Fressinaud
49e1a2c579 Allow to change the view layout (#2467)
The `_useLayout` function is marked as deprecated, replaced by a more
powerful `_layout` function.
2019-08-02 11:40:57 +02:00
Alexander Steinhöfer
0904f159b3 Configurable amount of feeds that gets refreshed.
Enhanced actualizeFeed with a maxFeeds-Parameter, so that a
user can control how many feeds he wants to refresh instead
of being force to choose between "10 or all".
2019-04-29 09:59:18 +02:00
Alexandre Alapetite
1804c0e0bc Filter actions (#2275)
* Draft of filter actions

* Travis

* Implement UI + finish logic

* Travis
2019-03-23 22:52:47 +01:00
Alexandre Alapetite
834ffacce2 No old ID (#2276)
* No old ID

https://github.com/FreshRSS/FreshRSS/issues/2273

* PostgreSQL insert or ignore
2019-03-19 20:14:31 +01:00
Alexandre Alapetite
2856f7b8b4 Revert wrong boolean 2019-03-02 21:06:56 +01:00
Alexandre Alapetite
7d76acad04 Re-introduce Travis workaround 2019-03-02 20:56:03 +01:00
Alexandre Alapetite
f1978da394 Boolean error 2019-03-02 20:43:51 +01:00
Alexandre Alapetite
2b2d9583cd Fix mark_updated_article_unread
https://github.com/FreshRSS/FreshRSS/issues/2200
2019-03-02 20:39:18 +01:00
Alexandre Alapetite
512d047f02 Update naming to WebSub (#2184)
Instead of PubSubHubbub / PuSH
2018-12-16 17:02:03 +01:00
Alexandre Alapetite
c57aade0f2 Introduce a routine for minor DB maintenance (#2080) 2018-10-26 21:05:00 +02:00
Alexandre Alapetite
8ee8a573f1 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
2018-09-29 20:47:17 +02:00
ColonelMoutarde
7072c091a7 better rand() (#1978)
http://php.net/manual/en/function.mt-rand.php

from php Doc

"Many random number generators of older libcs have dubious or unknown characteristics and are slow. The mt_rand() function is a drop-in replacement for the older rand(). It uses a random number generator with known characteristics using the » Mersenne Twister, which will produce random numbers four times faster than what the average libc rand() provides. "
2018-08-23 19:56:48 +02:00
Alexandre Alapetite
99dfdbc10d Avoid feed credentials in logs (#1949)
* Avoid feed credentials in logs

Related to https://github.com/FreshRSS/FreshRSS/pull/1891

* Changelog 1949
2018-07-08 11:29:05 +02:00
Alexandre Alapetite
031acde003 Fix extension hook for updated articles (#1932)
* Fix extension hook for updated articles

https://github.com/FreshRSS/FreshRSS/issues/1926

* Enable extensions during PubSubHubbub

* A little array protection

* Changelog 1926

https://github.com/FreshRSS/FreshRSS/issues/1926
https://github.com/FreshRSS/FreshRSS/pull/1932

* Add null check
2018-06-13 09:27:02 +02:00
Alexandre Alapetite
b552abb332 JSON column for feeds (#1838)
* Draft of JSON column for feeds
https://github.com/FreshRSS/FreshRSS/issues/1654

* Add some per-feed options
  * Feed cURL timeout
  * Mark updated articles as read https://github.com/FreshRSS/FreshRSS/issues/891
  * Mark as read upon reception https://github.com/FreshRSS/FreshRSS/issues/1702
  * Ignore SSL (unsafe) https://github.com/FreshRSS/FreshRSS/issues/1811

* Try PHPCS workaround
While waiting for a better syntax support
2018-05-01 17:02:11 +02:00
Alexandre Alapetite
16d4d5185e Fix mute feeds
https://github.com/FreshRSS/FreshRSS/issues/1844
2018-03-25 10:34:46 +02:00