aboutsummaryrefslogtreecommitdiff
path: root/lib/Minz/Extension.php
AgeCommit message (Collapse)Author
2025-04-07Secure serving of user files from extensions (#7495)Gravatar Alexandre Alapetite
* Secure serving of user files from extensions fix https://github.com/FreshRSS/FreshRSS/issues/4930 * More fixes * Typo
2025-04-01Catch extension exceptions in override (#7475)Gravatar Alexandre Alapetite
* Catch extension exceptions in override https://github.com/FreshRSS/Extensions/pull/300#issuecomment-2768578464 * Fix error message
2024-12-27PHPStan 2.0 (#7131)Gravatar Alexandre Alapetite
* PHPStan 2.0 fix https://github.com/FreshRSS/FreshRSS/issues/6989 https://github.com/phpstan/phpstan/releases/tag/2.0.0 https://github.com/phpstan/phpstan/blob/2.0.x/UPGRADING.md * More * More * Done * fix i18n CLI * Restore a PHPStan Next test For work towards PHPStan Level 10 * 4 more on Level 10 * fix getTagsForEntry * API at Level 10 * More Level 10 * Finish Minz at Level 10 * Finish CLI at Level 10 * Finish Controllers at Level 10 * More Level 10 * More * Pass bleedingEdge * Clean PHPStan options and add TODOs * Level 10 for main config * More * Consitency array vs. list * Sanitize themes get_infos * Simplify TagDAO->getTagsForEntries() * Finish reportAnyTypeWideningInVarTag * Prepare checkBenevolentUnionTypes and checkImplicitMixed * Fixes * Refix * Another fix * Casing of __METHOD__ constant
2024-09-06Upgrade to PHP 8.1 (#6711)Gravatar Alexandre Alapetite
* Upgrade to PHP 8.1 As discussed in https://github.com/FreshRSS/FreshRSS/discussions/5474 https://www.php.net/releases/8.0/en.php https://www.php.net/releases/8.1/en.php Upgrade to available native type declarations https://php.net/language.types.declarations Upgrade to https://phpunit.de/announcements/phpunit-10.html which requires PHP 8.1+ (good timing, as version 9 was not maintained anymore) Upgrade `:oldest` Docker dev image to oldest Alpine version supporting PHP 8.1: Alpine 3.16, which includes PHP 8.1.22. * Include 6736 https://github.com/FreshRSS/FreshRSS/pull/6736
2024-08-01Minor update whitespace PHPCS rules (#6666)Gravatar Alexandre Alapetite
* 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-06-05Add core extensions: UserCSS, UserJS (#6267)Gravatar hkcomori
* Copy CustomCSS and CustomJS Original: FreshRSS/Extensions@9f21984 * Rename CustomCSS -> UserCSS * Rename CustomJS -> UserJS * Change metadata The name is used for the directory where the configuration is stored and should not contain spaces. Since the name was changed, I reset the version number and changed to semantic versioning. * Change data directory Changed the location of the configuration file to the user data directory, because it is not `static`. That way, the user's configurations are gathered in the user directory, which makes it easier to backup them. * Edit documentations Remove procedures to install the extension because it is no longer necessary. * Fix wrong variables in the configuration page Remove permission error indication because the storage location is now in the user data directory managed by the application. * Remove the `xExtension-` prefix for core extensions * Set version to 1.0.0 for UserCSS, UserJS * Refactoring * Remove unused variables * Remove version 0.0.1 in Changelog Version 0.0.1 will not be merged, so only version 1.0.0 will remain. * public getFileUrl * Revert more protected * Use entrypoint for extension user path instead of name * Add space to extension name * Add `#[\Override]` * Add explains of User CSS and User JS to docs * Remove README of User CSS and User JS * Add migration code for extension user path --------- Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2024-03-30Add a way to modify CSP rules within an extension (#6246)Gravatar Alexis Degrugillier
This will allow to change CSP rules to authorize the use of external scripts. We might need to add some safeguard since it will be virtually possible to load any script even malicious one.
2023-12-23Fix extensions getUserConfigurationGravatar Alexandre Alapetite
fix https://github.com/FreshRSS/FreshRSS/issues/5970 Regression from https://github.com/FreshRSS/FreshRSS/pull/5957
2023-12-22Typed Minz_Extension (#5957)Gravatar Alexandre Alapetite
Replaces https://github.com/FreshRSS/FreshRSS/pull/5837 The signature of methods supposed to be overriden by existing thid-party extensions cannot be modified
2023-12-18Pass PHPStan level 8 (#5946)Gravatar Alexandre Alapetite
* Pass PHPStan level 8 And prepare for PHPStan level 9 https://phpstan.org/user-guide/rule-levels * Revert wrong replace in comment * Fix PHPStan level 8 * Update PHPStan and other dev dependencies * Remove obsolete comment * noVariableVariables and towards bleedingEdge https://github.com/phpstan/phpstan-strict-rules https://phpstan.org/blog/what-is-bleeding-edge * More bleedingEdge * A bit more PHPStan level 9 * More PHPStan level 9 * Prepare for booleansInConditions Ignore int and null * Revert wrong line * More fixes * Fix keep_max_n_unread * Stricter attribute functions * Stricter callHooks and more PHPStan level 9 * More typing * A tiny more
2023-11-24Fix types for extensions (#5901)Gravatar Alexandre Alapetite
* Fix types for extensions To accompany https://github.com/FreshRSS/Extensions/pull/185 * Avoid bug redeclared function
2023-11-17Fix Minz_Extension::getVersion (#5891)Gravatar Alexandre Alapetite
Regression from https://github.com/FreshRSS/FreshRSS/pull/5830
2023-11-16Use strict_types (#5830)Gravatar Luc SANCHEZ
* Little's optimisations and booleans in conditions * Apply strict type * Apply strict type * Apply strict type * Fix multiple bugs with PHP 8.2 and 8.3 * Many declares missing, more errors fixed * Apply strict type * Another approach * Stronger typing for Minz_Session * Fix case of SQLite --------- Co-authored-by: Luc <sanchezluc+freshrss@gmail.com> Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2023-10-30Require PHP 7.4+ (#5720)Gravatar Alexandre Alapetite
* Require PHP 7.4+ https://github.com/FreshRSS/FreshRSS/discussions/5474 * Update Docker oldest Alpine 3.13 with PHP 7.4.26 * Add missing packets to Docker oldest * Update to typed properties https://php.net/migration74.new-features#migration74.new-features.core.typed-properties * More types
2023-05-12Link configuration to proper parameter (#5394)Gravatar Alexis Degrugillier
Before, the system configuration was linked to the user parameter while the user configuration was linked to the system parameter. This was an issue when trying to retrieve some kind of configuration value in an extension. Now, the configurations are properly linked to their parameters.
2023-05-11A few additional PHPStan rules (#5388)Gravatar Alexandre Alapetite
A subset of https://github.com/phpstan/phpstan-strict-rules
2023-04-17Complete PHPStan Level 6 (#5305)Gravatar Alexandre Alapetite
* Complete PHPStan Level 6 Fix https://github.com/FreshRSS/FreshRSS/issues/4112 And initiate PHPStan Level 7 * PHPStan Level 6 for tests * Use phpstan/phpstan-phpunit * Update to PHPStan version 1.10 * Fix mixed bug * Fix mixed return bug * Fix paginator bug * Fix FreshRSS_UserConfiguration * A couple more Minz_Configuration bug fixes * A few trivial PHPStan Level 7 fixes * A few more simple PHPStan Level 7 * More files passing PHPStan Level 7 Add interface to replace removed class from https://github.com/FreshRSS/FreshRSS/pull/5251 * A few more PHPStan Level 7 preparations * A few last details
2023-04-04Fix extensions in actualize_script (#5243)Gravatar Alexandre Alapetite
* Fix extension freshrss_user_maintenance in actualize_script Follow-up of https://github.com/FreshRSS/FreshRSS/pull/3440 The hook was called before registering all the extensions for the current user * PHPStan Level 6 for extensions And remove 5-year old legacy format of enabled extensions < FreshRSS 1.11.1 * Fix multiple bugs in extensions * Minor typing * Don't change signature of methods supposed to be overridden * PHPStan Level 9 and compatibility Intelliphense * Set as final the methods not supposed to be overriden
2023-03-29Simplify extension method (#5234)Gravatar Alexandre Alapetite
One parameter was not used Furthermore, that unused parameter was preventing simpler calls (i.e. without a dedicated extension class). Now it is possible to register a call back with a lamda: ```php Minz_ExtensionManager::addHook('feed_before_actualize', function () { // Hello }); ```
2023-03-26Modernize Constants and use new constant for string 'currentUser' (#5089)Gravatar Luc SANCHEZ
* Modernize Constants and use new constant 'currentUser' * Add FreshRSS_Context::currentUser() function and use * Add FreshRSS_Context::currentUser() function and use * Add FreshRSS_Context::currentUser() function and use * Add FreshRSS_Context::currentUser() function and use * Add FreshRSS_Context::currentUser() function and use * Update app/Controllers/userController.php * Update app/Controllers/userController.php * Update app/Controllers/userController.php * Update app/Models/Auth.php * Update p/api/greader.php * Update p/api/greader.php * Update p/api/greader.php * Update app/Models/Context.php * Update app/Models/LogDAO.php * Update lib/Minz/Log.php * Update p/api/greader.php * Update app/layout/header.phtml * Update app/views/helpers/export/articles.phtml * Update cli/do-install.php * Remarque's from Alkarex * Remarque's from Alkarex * Refactor using new Minz_User class * Consistent naming of public constants --------- Co-authored-by: Luc <sanchezluc+freshrss@gmail.com> Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2022-01-04PHPStan level 5 (#4110)Gravatar Alexandre Alapetite
* 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-01Fix most PHPDocs errors (#4107)Gravatar Alexandre Alapetite
Contributes to https://github.com/FreshRSS/FreshRSS/issues/4103 https://phpstan.org/writing-php-code/phpdoc-types
2021-07-11Add system configuration for extension (#3626)Gravatar Alexis Degrugillier
Before, only the user configuration was supported by extensions. But it was limiting if one has to create a system extension with configuration. Now, both user and system configuration are supported.
2021-05-08Fix several comments syntaxes (#3615)Gravatar Alexandre Alapetite
Mainly wrong `@return` types in comments
2021-02-26Add support for extension user files (#3433)Gravatar Alexis Degrugillier
Extension user files can be stored easily in the user folder instead of the static folder.
2021-02-08Fix configuration local cache (#3431)Gravatar Alexis Degrugillier
Before, setting values did not refresh the configuration cache. Thus generating some weird behavior when configuring extensions. Now, the cache is updated with the most recent values when the configuration is modified.
2021-02-05Add a method to retrieve a configuration value (#3422)Gravatar Alexis Degrugillier
This will simplify extension code by removing a lot of logic from the extension itself when it's not needed. I've tested it on one of my extension with all the other recent extension modifications and I could remove half of the code needed before.
2021-02-02Fix user configuration in extension (#3412)Gravatar Alexis Degrugillier
Before, only one extension could be configured at a time. Thus we were loosing the configuration for other extensions when saving. Now, each extension can be saved without overriding data. See #3397
2021-02-02Add comprehensive user configuration in extensions (#3397)Gravatar Alexis Degrugillier
Before, the extension configuration was handled by its author. There was discrepancies between extensions on how the configuration was stored. Now, we could rely on a single way of storing configuration. This won't invalidate how the extensions are storing their configuration but will allow authors to focus on what is important.
2021-01-07Change base extension class type (#3333)Gravatar Alexis Degrugillier
Before, there were some guidelines on how to use the extension class and how to extend it. Those guidelines were defined as comments. Now, those guidelines are enforced by the code itself. There is no need for those comments anymore.
2015-07-13Fix broken links for extension script/style filesGravatar Marien Fressinaud
Fix https://github.com/FreshRSS/FreshRSS/issues/862
2015-01-15Avoid "PHP Strict Standards" errorGravatar Marien Fressinaud
A "Only variables should be passed by reference" error was raised in the extension->getFileUrl() method.
2015-01-14Fix extension API (coding style)Gravatar Marien Fressinaud
is_enabled() becomes isEnabled(). Sorry for this coding style mistake :s
2015-01-14Add mechanism at (un)install of an extensionGravatar Marien Fressinaud
Test if the install or uninstall has been successfully performed. If these methods return true, all is ok but if a string is returned, the string must explain the problem. This problem is stored in log file. A feedback is given to explain to check log file. This commit fix a problem in the english translation of feedback.sub.feed.internal_problem.
2015-01-08Call handleConfigureAction() even for GET requestsGravatar Marien Fressinaud
See https://github.com/FreshRSS/FreshRSS/issues/252
2014-12-18Update Minz_TranslationGravatar Marien Fressinaud
- Give possibility to register new i18n files - Add a extension->registerTranslates() method - extensions can define new strings or override previous ones Fix https://github.com/FreshRSS/FreshRSS/issues/731
2014-12-18Fix php interpretation in configure.phtml fileGravatar Marien Fressinaud
See https://github.com/FreshRSS/FreshRSS/issues/252
2014-12-08Add behaviour to configure action (extensions)Gravatar Marien Fressinaud
- Put extension configure view in dir_ext/configure.phtml - Handle POST action in Extension->handleConfigureAction() method See https://github.com/FreshRSS/FreshRSS/issues/252
2014-12-06Add a first draft for hooksGravatar Marien Fressinaud
- New Extension->registerHook($hook_name, $hook_function) method to register a new hook - Only one hook works for the moment: entry_before_insert - ExtensionManager::callHook will need to evolve based on future hooks See https://github.com/FreshRSS/FreshRSS/issues/252
2014-12-06Separate views registration from controllers one.Gravatar Marien Fressinaud
- Add an Extension->registerViews() method. - Views are first searched in extension paths, then in APP_PATH. - It gives a way to override easily existing controllers / views. - Change include into an include_once in Dispatcher for new controllers. See https://github.com/FreshRSS/FreshRSS/issues/252
2014-12-05Extensions can define new viewsGravatar Marien Fressinaud
- View base pathname is set to the extension directory - An extension can now override an existing controller / view See https://github.com/FreshRSS/FreshRSS/issues/252
2014-12-05Give possibility to register a new Controller.Gravatar Marien Fressinaud
- Add a Extension->registerController(name) method - Controllers must be written in extension_dir/controllers/nameController.php - Controllers must be named as FreshExtension_name_Controller - Controllers must extend Minz_ActionController See https://github.com/FreshRSS/FreshRSS/issues/252
2014-12-05First draft for listing and manipulate extensionsGravatar Marien Fressinaud
See https://github.com/FreshRSS/FreshRSS/issues/252
2014-12-05Fix security hole from ext.php script.Gravatar Marien Fressinaud
Now, ext.php can only serve file under a EXTENSIONS_PATH/ext_dir/static/ directory. A 400 Bad Request error will be returned for other files. See https://github.com/FreshRSS/FreshRSS/issues/252 And https://github.com/FreshRSS/FreshRSS/commit/f9b037742a0aeb49cab86782d1a59913c2de47b
2014-12-04Update ext.php to serve any file from extensionsGravatar Marien Fressinaud
Add an extension->getFileUrl() method to facilitate url generation
2014-12-04First draft for the new extension featureGravatar Marien Fressinaud
- Only system extensions can be loaded for the moment by adding them in the config.php file. - Remove previous system (it will be added properly in the new system in the next step).