Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow options to be provided to Doctrine #40449

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

summersab
Copy link
Contributor

Summary

This allows additional options, configurations, and middlewares to be provided to Doctrine when the DB connection is established.

NOTES

  • Two new optional settings were created in config.php: dbconnectionparams and dbconfigurationparams. I had considered appending these to the existing dbdriveroptions, but these settings are distinctly different. So, I created new settings.
  • In OC\AppFramework\App:
    • The method getAppIdForClass() was incomplete. The function isn't used by anything else, at present
    • The method registerAppClass was added to allow app classes to be registered prior to actually loading the apps. This is because custom classes must be provided when defining middlewares, custom loggers, etc, but any classes provided by an app aren't available when the DB connection is established. This allows an app's classes to be registered in an out-of-band way
    • A modified version of OC\App\AppManager::getAppInfo was added instead of using the existing class and method. This is because the DB connection must exist in order to load the AppManager, leading to a race condition.
    • Code was added to OC\DB\ConnectionFactory in order to load the options from config.php, ensure that any custom classes are loaded (using the previously-mentioned methods), and apply the options provided.

TODO

  • ...

Checklist

lib/private/AppFramework/App.php Fixed Show fixed Hide fixed
lib/private/AppFramework/App.php Fixed Show fixed Hide fixed
switch ($param) {
case "sqllogger":
\OC::$server->get(App::class)::registerAppClass($value);
$configuration->setSQLLogger(new $value());

Check failure

Code scanning / Psalm

TaintedCallable Error

Detected tainted text
switch ($param) {
case "sqllogger":
\OC::$server->get(App::class)::registerAppClass($value);
$configuration->setSQLLogger(new $value());

Check failure

Code scanning / Psalm

TaintedCallable Error

Detected tainted text
break;
case "resultcache":
\OC::$server->get(App::class)::registerAppClass($value);
$configuration->setResultCache(new $value());

Check failure

Code scanning / Psalm

TaintedCallable Error

Detected tainted text
break;
case "resultcache":
\OC::$server->get(App::class)::registerAppClass($value);
$configuration->setResultCache(new $value());

Check failure

Code scanning / Psalm

TaintedCallable Error

Detected tainted text

foreach ($value as $middleware) {
\OC::$server->get(App::class)::registerAppClass($middleware);
array_push($middlewares, new $middleware());

Check failure

Code scanning / Psalm

TaintedCallable Error

Detected tainted text
Signed-off-by: Andrew Summers <18727110+summersab@users.noreply.github.com>

Fix issues with return type for `OC_App::findAppInDirectories`
@solracsf solracsf added this to the Nextcloud 28 milestone Nov 21, 2023
@blizzz blizzz mentioned this pull request Nov 22, 2023
5 tasks
@blizzz blizzz modified the milestones: Nextcloud 28, Nextcloud 29 Nov 23, 2023
This was referenced Mar 12, 2024
@Altahrim Altahrim mentioned this pull request Mar 20, 2024
@skjnldsv skjnldsv modified the milestones: Nextcloud 29, Nextcloud 30 Mar 28, 2024
@skjnldsv skjnldsv modified the milestones: Nextcloud 30, Nextcloud 31 Aug 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow additional config parameters for Doctrine
5 participants