Commit Graph

97 Commits

Author SHA1 Message Date
Alexandre Alapetite
e750448f5b Consistent entry ID type (32-bit compatibility) (#5213)
* Remove FreshRSS_Searchable for better types
The interface was not used, and it was preventing more precise types for the different `searchById()` methods, as they each have different input and output types.

* Consistent entry ID
Entry IDs (which are 64-bit integers) must be processed as string to be compatible with 32-bit platforms

* Fix type

* A few more related types

* PHPStan level 6

* Some more casts needed

* String cast for htmlspecialchars
2023-03-22 09:57:31 +01:00
Luc SANCHEZ
247215ffaa Typehint some Controllers (#5106)
* Typehint to Controllers

* Remarque's from Alkarex

* Remarque's from Alkarex

* Remarque's from Alkarex

* Remarque's from Alkarex

* Remarque's from Alkarex

* Remarque's from Alkarex

---------

Co-authored-by: Luc <sanchezluc+freshrss@gmail.com>
2023-03-21 18:57:57 +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
82ac1d1e67 Refactor entry-to-GReader API format (#4490)
* Refactor entry to GReader API format
Some code was copied in two locations and not completely uniform.
Cleaning of related variables and functions (e.g. better types for entries and categories as objects vs. as IDs).
Usecase: I need to call the same GReader-compatible serialization from an extension

* Fixed some edge cases

* Keep summary instead of content
`summary` and `content` seems to be used interchangeably in the Google Reader API. We have been using `summary` for our client API and  `content` in our export/import, so stick to that.
2022-08-08 12:04:02 +02: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
05ca0517bb Compat import JSON milliseconds (#4186)
#fix https://github.com/FreshRSS/FreshRSS/issues/4185
2022-02-01 00:03:51 +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
Thomas Renes
916df412f5 Fix various typos and spelling errors in documentation, comments and code. (#4134) 2022-01-08 16:25:17 +01:00
Luc SANCHEZ
ed19445f74 Optimise Minz_ModelPdo::class (#4119)
* - Fix typo,
- remove unnecessary null in property,
- remove unused property,
- add phpDoc,
- add ext PDO in composer.json,
- use strict comparison,
- indentation

* Translate

* Update lib/Minz/ModelPdo.php

Co-authored-by: Frans de Jonge <fransdejonge@gmail.com>

* The code is more explicite

* Fix phpstan

* Fix phpstan expect one

* Fix phpstan

* Return in back...

* make fix-all

* Fix exception and more types

* Fix more types

* Remove ext- in composer.json

Co-authored-by: Luc SANCHEZ <l.sanchez-ext@ubitransport.com>
Co-authored-by: Frans de Jonge <fransdejonge@gmail.com>
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2022-01-07 10:05:09 +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
de40f3ad56 Fix TT-RSS import (#3553) 2021-03-24 19:04:51 +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
Alexis Degrugillier
fd80387541 Change zip handling methods (#3470)
Before, we were using zip function but they are marked as deprecated as of
PHP 8.0. It's not safe to use them anymore since they can be removed at any
given time.
Now, we are using the ZipArchive class to handle our zip methods. It's safe
to use it since it's available for PHP 5.2 and higher.

See #3460
2021-02-21 00:51:53 +01:00
Alexandre Alapetite
4a87f34bcf API implement OPML import/export (#3424)
#fix https://github.com/FreshRSS/FreshRSS/issues/3421
2021-02-06 12:43:30 +01:00
Alexandre Alapetite
4f74215199 Better OPML import of feeds in multiple categories (#3286)
#fix https://github.com/FreshRSS/FreshRSS/issues/3284
Helps https://github.com/FreshRSS/FreshRSS/issues/1989

In OPMLs files in which feeds are listed several times, favour the
version in a category instead of in no category.
2020-12-26 17:23:23 +01:00
Marien Fressinaud
15505a0377 tec: Refactor the export feature (#3045)
Even if the issue #3035 seemed pretty simple at a first glance, it was
more complicated than I expected. Because we send CSP headers AFTER
running the controller actions, it means we can't "echo" any content
from the controller. It's in fact a good practice, but it was easier at
the time we developed the feature.

To fix that, the only thing I had to do was to move the `print()` and
`readfile()` function into the view. The problem was that we needed to
output the content from the CLI too. Then, things became more
complicated. I decided to extract the export-related methods in a
`FreshRSS_Export_Service` class, in order to use it from both the
controller and the CLI. It was an opportunity to refactor the whole
feature in order to make it a bit more linear and easy to read.

Reference: https://github.com/FreshRSS/FreshRSS/issues/3035
2020-06-13 19:36:24 +02:00
Marien Fressinaud
8f188ffa84 Fix filenames for files exported with CLI (#2932)
Filenames were created with the username of the current user. However,
when we export the files with the CLI, the current user is "_".

This commit makes the username always required in the `exportFile`
method so we make sure to always manipulate a real value. Consequently,
the filenames can be formatted correctly.

Obviously, this has absolutely no impacts since the CLI doesn't consider
the HTTP headers. It just makes things a bit more clear. It's a first
step to remove the concept of "default user".
2020-04-30 12:11:51 +02:00
Alexandre Alapetite
077e3cff45 Increase import size (#2563)
* Increase import size

This is merely a temporary workaround to allow at least some medium size
imports
https://framateam.org/freshrss/pl/7wbt4tcyetrfmris9xdcbq7uuw
The import module should be rewritten to process files one by one and as
data streams instead of loading multiple copies of the whole dataset in
memory as is the case now :-(
https://github.com/FreshRSS/FreshRSS/issues/1890
Note that the new SQLite export/import is distinct from this case.

* Use parameter
2019-10-08 20:52:03 +02:00
Alexandre Alapetite
c76a318193 CLI to export/import any database to/from SQLite (#2496)
* CLI to export/import any database to/from SQLite

Require PHP 5.5+ https://github.com/FreshRSS/FreshRSS/pull/2495

* Travis

* Execution rights

* Fix wrong static fields

* Fix MySQL bad default buffering

https://stackoverflow.com/questions/6895098/pdo-mysql-memory-consumption-with-large-result-set/6935271#6935271
https://php.net/manual/ref.pdo-mysql

* Fix count on progression

* Avoid static DB information

To ease working with two DBs at the same time

* Less static, simplify

Needs some testing

* Small corrections

* Special case for SQLite to SQLite

* Modify special case for SQLite

* Remove special case for SQLite

More uniform logic for the 3 databases.
Fix wrong DROP TABLE for SQLite.

* Drop indexes

* Revert "Drop indexes"

This reverts commit f28d2bae09.

* Fix deletion

* Fix classic export

* Update cli/README.md

Co-Authored-By: Marien Fressinaud <dev@marienfressinaud.fr>

* Addressing part of review

* Remove goto 😢

* Travis

* Comment for SQLite case

* Fix missing fields when inserting
2019-09-15 21:36:53 +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
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
7902d10b3a Import FeedBin (#2228)
* Import FeedBin

https://github.com/FreshRSS/FreshRSS/issues/2227
And more tolerant import

* Mute import fake feed + Changelog

* strtotime for published dates in string
2019-01-26 12:55:12 +01:00
Alexandre Alapetite
f1ac6dd550 Export/import articles read/unread state (#2226) 2019-01-24 20:44:45 +01:00
Alexandre Alapetite
f0684d7018 Fix import labels (#2225)
All labelled articles were wrongly marked as starred.
2019-01-24 19:54:34 +01:00
Alexandre Alapetite
743c1b740b Export labels (#2217)
* Export labels

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

* Small fixes

* Backport code from 1.14.0

4888f919f1

* More fixes
2019-01-16 22:26:43 +01:00
Alexandre Alapetite
f26b8f3f31 PHP 7.1 tempnam warning fix (#2134)
And suggested dir was wrong.

https://bugs.php.net/bug.php?id=69489
```
<b>Notice</b>:  tempnam(): file created in the system's temporary
directory in
<b>/var/www/html/FreshRSS/app/Controllers/importExportController.php</b>
on line <b>800</b><br />
```
2018-11-18 11:34:40 +01:00
Alexandre Alapetite
55d7115926 Add username in configuration menu and exports (#2133)
* Add username in configuration menu

https://github.com/FreshRSS/FreshRSS/pull/2099#issuecomment-435944803

* Add username to exported files
2018-11-18 11:32:13 +01:00
Alexandre Alapetite
cf899d8d25 TT-RSS import (#2099)
* TT-RSS import

Import of Tiny Tiny RSS favourites
https://github.com/FreshRSS/FreshRSS/issues/2018#issuecomment-432710462

* Fallback feed_url

* Simpler JSON

* TT-RSS import custom labels

* Fix syntax
2018-11-05 18:10:38 +01:00
Alexandre Alapetite
1801f44bfc Fix import: invalid variable scope (#1901)
* Fix import: invalid variable scope

https://github.com/FreshRSS/FreshRSS/issues/1890
https://github.com/FreshRSS/FreshRSS/pull/1315

* Changelog 1890

https://github.com/FreshRSS/FreshRSS/issues/1890
https://github.com/FreshRSS/FreshRSS/pull/1901
2018-05-28 23:33:48 +02:00
Alexandre Alapetite
28db5dd285 Fix SQL constraint insert into entrytmp table
https://github.com/FreshRSS/FreshRSS/issues/1614
2017-09-23 12:32:35 +02: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
Alexandre Alapetite
5541e39512 More defered insertion 2017-03-27 21:26:38 +02:00
Alexandre Alapetite
fbdc22f75a Merge branch 'FreshRSS/dev' into defered-insertion 2017-03-26 19:36:44 +02:00
Alexandre Alapetite
7a6751b50d PDO fix PHP 7.1
http://php.net/manual/migration71.changed-functions.php#migration71.changed-functions.pdo
2017-03-26 18:48:34 +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
568b737b6c Function to disable MySQL buffering for large exports 2016-11-15 21:38:18 +01:00
Alexandre Alapetite
f59de4e2b6 Stream JSON export
Avoid large in-memory copies
https://github.com/FreshRSS/FreshRSS/issues/1372
2016-11-15 20:43:06 +01:00
Alexandre Alapetite
7dc9862596 Fix OPML import bug 2016-10-25 00:10:49 +02:00
Alexandre Alapetite
fcb9280fc8 CLI export
ZIP export, OPML export.
Corrected height of feeds select in Pafat theme.
https://github.com/FreshRSS/FreshRSS/pull/1338
https://github.com/FreshRSS/FreshRSS/issues/1039
https://github.com/FreshRSS/FreshRSS/issues/1277
2016-10-23 13:37:48 +02:00
Alexandre Alapetite
1b8eb6c7e7 CLI import ZIP/OPML/JSON for user
https://github.com/FreshRSS/FreshRSS/issues/1095
https://github.com/FreshRSS/FreshRSS/issues/851
2016-10-23 01:46:14 +02:00
Alexandre Alapetite
7f2b0439ec Extract function safe_ascii() 2016-10-20 01:38:23 +02:00
Alexandre Alapetite
1893fc61e0 guid and urls should not contain low/high characters
It looks like SimplePie does not always filter everything
Having a character not in latin1 would create MySQL collate errors
2016-10-20 01:19:59 +02:00
Alexandre Alapetite
50f1e027e3 Fix import bug 2016-10-15 14:18:23 +02:00
Alexandre Alapetite
a0127d980c Fix bug JSON import duplicates
https://github.com/FreshRSS/FreshRSS/issues/1312
2016-10-15 01:27:39 +02:00
Alexandre Alapetite
c4b43316c7 Export files with date 2016-10-01 20:22:34 +02:00
Alexandre Alapetite
079150eee4 Updated log visibility
In particular, ensure that ERROR is only used for errors that may affect
FreshRSS integrity, and ensure that feed errors are visible also in
production, i.e. visibility of WARNING
https://github.com/FreshRSS/FreshRSS/issues/885
https://github.com/FreshRSS/FreshRSS/issues/884
2015-07-03 23:47:18 +02:00
Alexandre Alapetite
711530a512 SQL: detection of updates, and preparation for better burge
https://github.com/FreshRSS/FreshRSS/issues/798
https://github.com/FreshRSS/FreshRSS/issues/493
SQLite not yet tested. Only MySQL tested so far.
2015-04-04 22:39:31 +02:00
Marien Fressinaud
c741fba06c Update lib_opml.php
- lib_opml was not in its newest version
- FRSS supports OPML file without text attributes

Fix https://github.com/FreshRSS/FreshRSS/issues/758
2015-01-21 10:50:53 +01:00