39 Commits

Author SHA1 Message Date
Federico Scodelaro
673067a52d Last user modified (#7886)
* feat: Add user modified functionality

Closes https://github.com/FreshRSS/FreshRSS/issues/7862

Changes proposed in this pull request:

This is an implementation of the proposed feature. It allows entries to have a new field that will be updated whenever an item is marked as read/unread or bookmark/removed from bookmarks. And a new sort criteria to sort by it.

How to test the feature manually:

1. Mark items from a feed as read/unread
2. Mark items from a feed as bookmark / remove bookmark
3. Sort by the new criteria

* feat: Add sort functionality
* feat: Add sort nav button
* fix: Use correct migrations
* fix: Add internationalization
* fix: Linter errors
* chore: PR comments

* Update app/i18n/fr/index.php
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>

* Update app/i18n/pl/index.php
Co-authored-by: Inverle <inverle@proton.me>

* Update app/i18n/nl/index.php
Co-authored-by: Frans de Jonge <fransdejonge@gmail.com>

* make fix-all
* Fixes
* More fixes sort
* Fix wrong index
* Fix unneeded column
* Fix auto-create indexes
* Some copilot suggestions
* One more fix
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>

---------

Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
Co-authored-by: Inverle <inverle@proton.me>
Co-authored-by: Frans de Jonge <fransdejonge@gmail.com>
2025-10-11 00:43:38 +02:00
Alexandre Alapetite
b034ce2ccb SQL test if minor update is needed (#6692)
* SQL test if minor update is needed
fix https://github.com/FreshRSS/FreshRSS/issues/6592

* Minor syntax
2024-08-04 19:42:01 +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
ad8bae5aca Rework SQL field length (#5788)
* SQL auto-update field length
Follow-up of https://github.com/FreshRSS/FreshRSS/pull/5756
Only for PostgreSQL and MySQL / MariaDB. Not possible for SQLite

* Account for MySQL 65535
Partial revert of https://github.com/FreshRSS/FreshRSS/pull/5756
> The maximum row size for the used table type, not counting BLOBs, is 65535. This includes storage overhead.
2023-10-31 02:01:50 +01:00
Alexandre Alapetite
21a279179a Ready for year 2038 (#5570)
* Ready for year 2038
Fix https://github.com/FreshRSS/FreshRSS/discussions/5569
Requires PHP on a 64-bit platform to take advantage of it.
https://en.wikipedia.org/wiki/Year_2038_problem

* Allows dates past 2038
Rework of https://github.com/FreshRSS/FreshRSS/pull/3259
https://github.com/FreshRSS/FreshRSS/issues/3258

* Auto alter columns

* Changelog
2023-10-30 21:10:09 +01:00
Alexandre Alapetite
0324df6f88 SQL increase length of VARCHAR fields (#5756)
* SQL increase length of VARCHAR fields
Increase length of all fields, keeping the limits for:
* Unique indexes on UTF-8: 191 bytes for MySQL;
* Unique indexes on ASCII: 767 bytes for MySQL;
* Max URL for external tools: 32768 characters;
* Max VARCHAR: 65535 bytes for MySQL;
Follow-up of https://github.com/FreshRSS/FreshRSS/pull/5038
Fix https://github.com/FreshRSS/FreshRSS/issues/4986

* Fix length test
2023-10-30 20:47:50 +01:00
Alexandre Alapetite
f050a94b48 SQL: clean old auto-updates (#5649)
Should help with some DB lock issues.

Complete https://github.com/FreshRSS/FreshRSS/pull/3558 after https://github.com/FreshRSS/FreshRSS/pull/5625 already cherry-picked from it.

* Removed auto-update of MySQL GUID case sensitivity
https://github.com/FreshRSS/FreshRSS/pull/2078
  * Contributed to a DB lock in https://github.com/FreshRSS/FreshRSS/issues/5008

Also removed the following non-problematic auto-updates, simply because they were older than the above ones
* Auto-create custom labels (1.12.0) https://github.com/FreshRSS/FreshRSS/pull/2027
* Auto-add JSON column for feeds (1.11.0) https://github.com/FreshRSS/FreshRSS/pull/1838
* Auto-create temporary tables (1.7.0) https://github.com/FreshRSS/FreshRSS/pull/1470
2023-09-12 10:43:14 +02:00
Alexandre Alapetite
2f02754522 Increase max feed URL length and drop unicity (#5038)
* Increase max feed URL length and drop unicity
#fix https://github.com/FreshRSS/FreshRSS/issues/4338
Drop the unicity constraint on our feed URL. In practice, this did not add much value as identical feeds could have different URLs. And it generated several problems, for instance during renaming or automatic redirections such as from HTTP to HTTPS, with collisions for which we dot not have any elegant handling.
I have kept a high limit of 32768 because cURL does not seem to have any limit except memory, which might lead to memory problems. This is the highest server-side value reported by https://www.sistrix.com/ask-sistrix/technical-seo/site-structure/url-length-how-long-can-a-url-be

* Same for Web site URL
For consistency
2023-01-26 08:13:38 +01:00
Alexandre Alapetite
0866fdaee8 Add database field attributes for entries (#4444)
* Add database field attributes for entries
Just like we already have for categories, feeds, etc.
No core use yet, but allows in particular extensions to save per-entry data

* Fix PHPStand

* Fix wrong variable
2022-07-19 15:17:08 +02:00
Alexandre Alapetite
509c8cae63 Dynamic OPML (#4407)
* Dynamic OPML draft
#fix https://github.com/FreshRSS/FreshRSS/issues/4191

* Export dynamic OPML
http://opml.org/spec2.opml#1629043127000

* Restart with simpler approach

* Minor revert

* Export dynamic OPML also for single feeds

* Special category type for importing dynamic OPML

* Parameter for excludeMutedFeeds

* Details

* More draft

* i18n

* Fix update

* Draft manual import working

* Working manual refresh

* Draft automatic update

* Working Web refresh + fixes

* Import/export dynamic OPML settings

* Annoying numerous lines in SQL logs

* Fix minor JavaScript error

* Fix auto adding new columns

* Add require

* Add missing 🗲

* Missing space

* Disable adding new feeds to dynamic categories

* Link from import

* i18n typo

* Improve theme icon function

* Fix pink-dark
2022-07-04 09:53:26 +02:00
Alexandre Alapetite
9d1930d9ad Allow many (20k+) feeds (#4347)
* Allow many (20k+) feeds
Fix errors such as `SQL error listWhereRaw: ERROR: value "42926" is out of range for type smallint`
Start of UI performance improvements accordingly.
2022-05-09 15:59:21 +02:00
Alexandre Alapetite
fd945ffb93 Fix XPath context for tags (#4246)
#fix https://github.com/FreshRSS/FreshRSS/issues/4245
Follow-up of https://github.com/FreshRSS/FreshRSS/pull/4220
2022-03-02 17:44:52 +01:00
Alexandre Alapetite
1fe66ad020 Implement Web scraping "HTML + XPath" (#4220)
* More PHP type hints for Fever
Follow-up of https://github.com/FreshRSS/FreshRSS/pull/4201
Related to https://github.com/FreshRSS/FreshRSS/issues/4200

* Detail

* Draft

* Progress

* More draft

* Fix thumbnail PHP type hint
https://github.com/FreshRSS/FreshRSS/issues/4215

* More types

* A bit more

* Refactor FreshRSS_Entry::fromArray

* Progress

* Starts to work

* Categories

* Fonctional

* Layout update

* Fix relative URLs

* Cache system

* Forgotten files

* Remove a debug line

* Automatic form validation of XPath expressions

* data-leave-validation

* Fix reload action

* Simpler examples

* Fix column type for PostgreSQL

* Enforce HTTP encoding

* Readme

* Fix get full content

* target="_blank"

* gitignore

* htmlspecialchars_utf8

* Implement HTML <base>
And fix/revert `xml:base` support in SimplePie e49c578817

* SimplePie upstream PR merged
https://github.com/simplepie/simplepie/pull/723
2022-02-28 20:22:43 +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
7819a43197 Default or custom OPML (#2627)
* Default or custom OPML

Fix https://github.com/FreshRSS/FreshRSS/issues/2075
Replaces https://github.com/FreshRSS/FreshRSS/pull/2515
https://github.com/FreshRSS/FreshRSS/issues/2514

Uses the local ./data/opml.xml if it exists, otherwise
./opml.default.xml

* Better message

* Move to controller
2019-11-04 17:45:15 +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
be4c942cb3 SQL allow recreating existing user (#2555)
* SQL allow recreating existing user

Taking advantage of https://github.com/FreshRSS/FreshRSS/pull/2554
In a case when FreshRSS data is lost, but database data still intact (in
particular MySQL or PostgreSQL), this patch allows recreating previous
users without error

* Better error retrieval

Especially when error occur during the prepare statement
2019-10-06 00:14:19 +02:00
Alexandre Alapetite
61724c651b PostgreSQL 9.5+ (#2554)
Needed for `CREATE  INDEX IF NOT EXISTS` syntax.
Supported as back as Ubuntu 16.04 LTS.
Similar version checks than for the PHP version bump
https://github.com/FreshRSS/FreshRSS/pull/2495
https://www.postgresql.org/docs/9.5/sql-createindex.html
https://www.postgresql.org/docs/9.5/release-9-5.html
2019-10-05 15:48:25 +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
7b4cd3abae add: Allow admins to configure default feeds (#2515)
* Homogenize SQL_INSERT_FEEDS across database types

* Extract default feeds into system configuration

* Adapt default feeds init during installation
2019-09-11 18:40:17 +02:00
Alexandre Alapetite
6a686daafa Allow dot in username (#2062)
* Allow dot in username

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

* Missing quotes for special chars in PostgreSQL
2018-10-24 13:07:39 +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
Alexandre Alapetite
e98e40b7b4 Fix check default category, and PostgreSQL seq bug (#1907)
checkDefault() was broken as it was not necessarily creating the default
category with the right ID.
PostgreSQL required additional care.
https://github.com/FreshRSS/FreshRSS/issues/1890#issuecomment-392869777
https://github.com/FreshRSS/FreshRSS/pull/1322
https://github.com/FreshRSS/FreshRSS/issues/1312#issuecomment-254009397
2018-05-29 23:55:31 +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
Alexis Degrugillier
8c2113f9e6 Add mute strategy configuration (#1750) 2018-01-01 20:34:06 +01:00
Alexandre Alapetite
5d54e47ff4 Fix DROP tables for deferred insertion
https://github.com/FreshRSS/FreshRSS/pull/1470
2017-04-10 00:43:18 +02:00
Alexandre Alapetite
bc580c5905 SQL index auto added
At the same time as the new temp table
2017-03-26 22:08:17 +02:00
Alexandre Alapetite
e956aee53d More defered insertion. New SQL index
New index entry_feed_read_index
TODO: Auto add this index to existing version
2017-03-26 14:07:06 +02:00
Alexandre Alapetite
22b41f3bfc Candidate implementation of defered insertion
https://github.com/FreshRSS/FreshRSS/issues/530
2017-03-26 00:01:11 +01:00
Alexandre Alapetite
1182129ce5 CLI option no-default-feeds
https://github.com/FreshRSS/FreshRSS/issues/1095
2016-10-24 20:29:08 +02:00
Alexandre Alapetite
f1eaf02a0c PostgreSQL workaround for SERIAL strange behaviour
http://stackoverflow.com/questions/18389537/does-postgresql-serial-work-differently
2016-10-15 23:09:21 +02:00
Alexandre Alapetite
34e38e3a97 SQL DROP TABLE
https://github.com/FreshRSS/FreshRSS/issues/1320
2016-10-15 20:01:48 +02:00
Alexandre Alapetite
c24d60372a PostgreSQL emulate "INSERT IGNORE"
Would have liked to use UPSERT, but it is first available from
PostgreSQL 9.5.
2016-10-15 00:49:10 +02:00
Alexandre Alapetite
0eb7a717e6 PostgreSQL avoid duplicate category 1
https://github.com/FreshRSS/FreshRSS/issues/1312
2016-10-15 00:04:51 +02:00
Alexandre Alapetite
9b22272eee PostgreSQL multiuser bug
https://github.com/FreshRSS/FreshRSS/pull/1195
2016-10-01 20:54:08 +02:00
Alexandre Alapetite
e979b67ceb PostgreSQL uppercase keywords 2016-10-01 09:34:09 +02:00
Alexandre Alapetite
c16a973d45 PostgreSQL schema update 2016-10-01 09:24:46 +02:00
Alexandre Alapetite
c25fdbcc09 More PostgreSQL 2016-08-23 00:02:54 +02:00
Alexandre Alapetite
7c1b5e322c PostgreSQL draft
https://github.com/FreshRSS/FreshRSS/issues/416
Based on @Damstre work https://github.com/FreshRSS/FreshRSS/pull/1071
Not tested
2016-08-02 22:49:35 +02:00