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

Config cleanup - OC_Preferences refactoring #12406

Merged
merged 12 commits into from
Dec 9, 2014
Merged

Conversation

MorrisJobke
Copy link
Contributor

cc @icewind1991 @DeepDiver1975 @PVince81 @LukasReschke

  • removal of all OC_Preferences references in core and apps I find in this github org.

@MorrisJobke
Copy link
Contributor Author

ref #12260

@MorrisJobke MorrisJobke added this to the 8.0-current milestone Nov 25, 2014
@MorrisJobke MorrisJobke changed the title drop OC_Preferences::getUsers and getApps More config cleanups Nov 25, 2014
@MorrisJobke
Copy link
Contributor Author

I will tag this a the WIP branch for all of my config related cleanups

@MorrisJobke MorrisJobke changed the title More config cleanups [WIP] More config cleanups Nov 25, 2014
@@ -61,7 +71,7 @@ public function getAppKeys($appName) {
* @param string $value the value that should be stored
*/
public function setAppValue($appName, $key, $value) {
\OCP\Config::setAppValue($appName, $key, $value);
\OC::$server->getAppConfig()->setValue($appName, $key, $value);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inject AppConfig?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Crashes the DI and I need to figure out why.... this is still WIP, but thanks for the comment.

@MorrisJobke MorrisJobke force-pushed the drop-getApps-getUsers branch 3 times, most recently from 7ad355e to 343697e Compare November 30, 2014 17:29
@@ -63,10 +66,10 @@ public function __construct($view, $userId, $client = false) {
$this->client = $client;
$this->userId = $userId;

$appConfig = \OC::$server->getAppConfig();
$this->config = \OC::$server->getConfig();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be injected instead of being grabbed from global OC::

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but there are currently that many occurences of the create logic of this class, that we also could put this in here. Once this is handled by an dependency container we can easiely add the parameter

@DeepDiver1975 DeepDiver1975 changed the title [WIP] More config cleanups More config cleanups Dec 1, 2014
@DeepDiver1975 DeepDiver1975 changed the title More config cleanups [WIP] More config cleanups Dec 1, 2014
@LukasReschke
Copy link
Member

13:53:37 SSSSSSSSSSSSSSSSSSSSSSSSSSSSSS.........................PHP Fatal error:  Call to undefined method OC\Preferences::deleteApp() in /var/jenkins/workspace/pull-request-analyser-ng-simple@6/label/vm-slave-02/tests/lib/preferences.php on line 146

@MorrisJobke
Copy link
Contributor Author

My last task for this PR will be the removal of all OC_Preferences references in core and apps I find in this github org.

@DeepDiver1975
Copy link
Member

My last task for this PR will be the removal of all OC_Preferences references in core and apps I find in this github org.

and fix the unit tests:

Test Result (3 failures / +3)

    Test\TestAllConfig.testDeleteUserValue
    Test\TestAllConfig.testDeleteAllUserValues
    Test\TestAllConfig.testDeleteAppFromAllUsers

@MorrisJobke
Copy link
Contributor Author

Test Result (3 failures / +3) Test\TestAllConfig.testDeleteUserValue Test\TestAllConfig.testDeleteAllUserValues Test\TestAllConfig.testDeleteAppFromAllUsers

They work locally :( Let me have a look at the jenkins output.

@MorrisJobke
Copy link
Contributor Author

hmmm ... why?

Many duplicated lines of code in the tests, because of the limits of the not fully mockable unit tests. Will come later.

* @param string $value
* @param $app
* @param $key
* @param $value
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing type annotations

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh ... they seems to have gone while refactoring. Will add them.

@LukasReschke
Copy link
Member

👍

@MorrisJobke
Copy link
Contributor Author

Just added type annotations for a deprecated interface. So jenkins can be ignored

* introduce SystemConfig to avoid DI circle (used by database connection which is itself needed by AllConfig that itself contains the methods to access the config.php which then would need the database connection - did you get it? ;))
* use DI container and use that method in legacy code paths (for easier refactoring later)
* create and use getSystemConfig instead of query() in DI container
* keep old static methods - mapped to new ones and deprecated
* removed deleteApp, getUsers, getApps because they are unused
* make AllConfig unit tests more robust against not cleaned up environments
* this needs to be properly fixed by a proper organisation of the base.php
* introduced fixDIInit() in AllConfig that moves the injection
  of DatabaseConnection to a later point in time
* problems mostly because of the autoconfig setup
@MorrisJobke
Copy link
Contributor Author

New jenkins PR: #12710

@MorrisJobke
Copy link
Contributor Author

Damn :( Rebase fuckup -.-

* files_encryption
* files_versions
* files_trashbin
* tests
* status.php
* core
* server container
@MorrisJobke
Copy link
Contributor Author

@DeepDiver1975 @LukasReschke Ready for final review. The rebase just required the deletion of settings/ajax/userlist.phpand the adjustment of lib/private/user/user.php as there was code moved to. (both by @LukasReschke user list REST PR)

@scrutinizer-notifier
Copy link

The inspection completed: 214 new issues, 34 updated code elements

@ghost
Copy link

ghost commented Dec 8, 2014

Waiting for jenkins in ... #12714


🚀 Test PASSed. 🚀
Refer to this link for build results (access rights to CI server needed):
https://ci.owncloud.org//job/pull-request-analyser-ng-simple/4070/
🚀 Test PASSed. 🚀

DeepDiver1975 added a commit that referenced this pull request Dec 9, 2014
Config cleanup - OC_Preferences refactoring
@DeepDiver1975 DeepDiver1975 merged commit c36bac3 into master Dec 9, 2014
@DeepDiver1975 DeepDiver1975 deleted the drop-getApps-getUsers branch December 9, 2014 08:36
@lock lock bot locked as resolved and limited conversation to collaborators Aug 15, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants