Before, we had 5 classes in the ModelPdo file. It was bad for 2 reasons.
The first reason is that it is considered bad practice to have multiple
class in one file. This is especially true when using autoloading. On top
of that it is less readable considering the size of the file. The second
reason is that so far we were lucky. Everytime we needed to access the
database, it was through the ModelPdo class which loads all the other
classes. If we want to access directly the connection, it wont be loaded.
On top of that, the system is configured to work on a single database,
but as we have every connection definition in a single file, all classes
were loaded at the same time. Thus using memory and processing time for
nothing.
Now, we have a file for each class. To work with autoloading, classes
were slightly renamed to match autoloading rules.
* bump default logout from 30 to 365 days
* * Change cookie duration to constant
* Change cookie duration to three months
* use class
* use 90 days (otherwise login form says 91.3 days)
* change class
* also this works now
Co-authored-by: Martin Rys <martin@rys.pw>
Co-authored-by: Frans de Jonge <fransdejonge@gmail.com>
Fix warning about session already started during install.
Refactor more code to use the same approach than in main FreshRSS.
Did not address all read accesses (not important) but did cover all
write accesses (important)
* feature(normal) - Remember opened categories in the left menu
Session storage based implementation to remember opened categories in left menu
Issue Ref: #2248
* lib_phpQuery updates
* Updates covering feedback points and functionality fixes
* Feedback updates
* Revert "lib_phpQuery updates"
This reverts commit dcd23b9418.
* First review
Change variable name to "remember" instead of "open".
Start using localStorage instead of sessionStorage.
Simplify code.
* Simplify remember categories init function
Replace 'session' with 'local' in function names and comment
Set open categories CSS as same as when category is opened in 'active' unfold mode
* Remove URLSearchParams check in remember categories init function
* Delete open categories on login and logout
* JSHint check fix
* Second review
* Make new mode the default for new users
* Always open active category
* Reduce / simplify code
* i18n French
* Revert default value
Wait a bit more for this decision / change
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
* Add DE Translation
* i18n update for German
* i18n update for German
* i18n update for German
* Fix ignore
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
* Minz allow parallel sessions
#fix https://github.com/FreshRSS/FreshRSS/issues/3093
* Array optimisation
* Array optimisation missing
* Reduce direct access to $_SESSION except in install process
* Fix session start headers warning
* Use cookie only the first time the session is started:
`PHP Warning: session_start(): Cannot start session when headers
already sent in /var/www/FreshRSS/lib/Minz/Session.php on line 39`
* New concept of volatile session for API calls
Optimisation: do not use cookies or local storage at all for API calls
without a Web session
Fix warning:
```
PHP Warning: session_destroy(): Trying to destroy uninitialized session
in Unknown on line 0
```
* Only call Minz_Session::init once in our index
It was called twice (once indirectly via FreshRSS->init())
* Whitespace
* Mutex for notifications
Implement mutex for notifications
https://github.com/FreshRSS/FreshRSS/pull/3208#discussion_r499509809
* Typo
* Install script is not ready for using Minz_Session
* Use of existing tag name via input field
Use existing tag name, when tag name is typed into tag list's text field
* Indentation mistake
Just an indentation correction
* Final correction
Missed line 35.
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)
Before, the sorting was not human readable. Lower-cased feed names were
displayed after upper-cased feed names.
Now, the sorting is human readable. The sorting is done without taking into
account the name case.
See #3128
When the user do not want to use a shortcut, he can let the shortcut value
empty. This will save an empty configuration thus disabling the shortcut.
The load default action allows to use default shortcut only for disabled
shortcuts.
See #3110
* Add a Minz_Migrator class
Until now, we updated the database structure somewhere in the code but
it wasn't always consistent and somehow complicated to find. Also, this
code was always checked for nothing.
The Migrator aims to improve and ease the creation of migrations. It
should improve the way we apply the updates, making the update server
almost useless.
References:
- example of migration (before Migrator): cc0db9af4f (diff-11a53443fa81512b128c66b065df0679R10)
- update server: https://github.com/FreshRSS/update.freshrss.org
- PR moving the code of the update server to the core: https://github.com/FreshRSS/FreshRSS/pull/1760
* Automatically apply migrations
For now, administrators are used to have nothing to do during an update
else than getting the new code. I suggest to keep this behaviour and
automatically apply migrations if we detect new ones.
Another solution would be to create a CLI command and ask admins to call
it after getting the new code. It could hide migrations errors to end
users, but admin can forget to apply migrations since there are not used
to it.
* Add documentation for Minz Migrator
* Execute migrations even if next ones are applied
* Change mechanism to prevent multiple update at once
* Use mkdir to create the lock and to test it exists
Reference: https://stackoverflow.com/a/731634
* Append .lock to applied_migrations_path
There are no needs to define another file to serve as a lock.
* Change migrations naming convention
* Apply suggestions from code review
Co-Authored-By: Alexandre Alapetite <alexandre@alapetite.fr>
* Perform a low-cost migration versions comparaison
* Clarify version numbers concerning the migration system
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
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"]
```