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

Make DI work for all apps #3977

Merged
merged 6 commits into from
Mar 22, 2017
Merged

Make DI work for all apps #3977

merged 6 commits into from
Mar 22, 2017

Conversation

rullzer
Copy link
Member

@rullzer rullzer commented Mar 21, 2017

As stated in #3901 (comment)
appid's don't have to match the namespace.

Work around this

Followup of #3901

@icewind1991 please verify

As stated in #3901 (comment)
appid's don't have to match the namespace.

Work around this

Signed-off-by: Roeland Jago Douma <[email protected]>
@rullzer rullzer added the 3. to review Waiting for reviews label Mar 21, 2017
@rullzer rullzer added this to the Nextcloud 12.0 milestone Mar 21, 2017
@mention-bot
Copy link

@rullzer, thanks for your PR! By analyzing the history of the files in this pull request, we identified @BernhardPosselt, @nickvergessen and @ChristophWurst to be potential reviewers.

@BernhardPosselt
Copy link
Member

Isn't \OC\AppFramework\App::buildAppNamespace supposed to take care of that? see https://github.com/nextcloud/server/blob/master/lib/private/AppFramework/App.php#L56

If there's an issue for an app it should add the namespace to its info.xml

@rullzer
Copy link
Member Author

rullzer commented Mar 21, 2017

@BernhardPosselt I assume you are refering to https://github.com/nextcloud/server/pull/3977/files#diff-954b90756615239eaac02e54722e1f1aR396
yeah there was one issue with a testing code somewhere. I might look into just fixing that code. But not tonight ;)

@rullzer
Copy link
Member Author

rullzer commented Mar 21, 2017

@BernhardPosselt also note that the merged code did not yet get the namespace of the app.

Copy link
Member

@MorrisJobke MorrisJobke left a comment

Choose a reason for hiding this comment

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

I tested it and it works 👍

Copy link
Member

@nickvergessen nickvergessen left a comment

Choose a reason for hiding this comment

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

Fixes activity ocs endpoint again

return parent::query($name);
} else if ($this['AppName'] === 'core' && strpos($name, 'OC\\Core\\') === 0) {
return parent::query($name);
} else if (strpos($name, \OC\AppFramework\App::buildAppNamespace($this['AppName'])) === 0 ||
Copy link
Member

Choose a reason for hiding this comment

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

This breaks for the files app, it will match any classes OCA\Files.
You need to add the trailing slash on buildAppNamespace

Copy link
Member Author

Choose a reason for hiding this comment

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

Aaaah yes....

return parent::query($name);
} else if ($this['AppName'] === 'core' && strpos($name, 'OC\\Core\\') === 0) {
return parent::query($name);
} else if (strpos($name, \OC\AppFramework\App::buildAppNamespace($this['AppName'])) === 0 ||
$this->getFallbackNamespace($name) === \OC\AppFramework\App::buildAppNamespace($this['AppName'])) {
Copy link
Member

Choose a reason for hiding this comment

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

Kill this,
buildAppNamespace already does it:

// if the tag is not found, fall back to uppercasing the first letter
		self::$nameSpaceCache[$appId] = ucfirst($appId);

Copy link
Member Author

Choose a reason for hiding this comment

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

This is needed because else all the unit tests break for the TwoFactor auth from @ChristophWurst (I'll kick him about that next week)

@nickvergessen
Copy link
Member

Also resolved the comment from Bernhard

Signed-off-by: Joas Schilling <[email protected]>
@codecov-io
Copy link

Codecov Report

Merging #3977 into master will increase coverage by 0.04%.
The diff coverage is 100%.

@@             Coverage Diff              @@
##             master    #3977      +/-   ##
============================================
+ Coverage     54.28%   54.33%   +0.04%     
- Complexity    21161    21163       +2     
============================================
  Files          1305     1305              
  Lines         80801    80817      +16     
  Branches       1282     1282              
============================================
+ Hits          43863    43911      +48     
+ Misses        36938    36906      -32
Impacted Files Coverage Δ Complexity Δ
...e/AppFramework/DependencyInjection/DIContainer.php 83.33% <100%> (+0.35%) 25 <7> (ø) ⬇️
lib/private/legacy/app.php 46.92% <100%> (+0.08%) 247 <0> (ø) ⬇️
lib/private/AppFramework/App.php 69.23% <100%> (ø) 19 <0> (ø) ⬇️
lib/private/ServerContainer.php 100% <100%> (ø) 10 <4> (+2) ⬆️
lib/private/Server.php 93.02% <0%> (+0.06%) 120% <0%> (ø) ⬇️
lib/private/Files/Cache/Propagator.php 96.2% <0%> (+1.26%) 16% <0%> (ø) ⬇️
apps/federation/lib/AppInfo/Application.php 66.66% <0%> (+39.39%) 10% <0%> (ø) ⬇️
apps/files/lib/AppInfo/Application.php 100% <0%> (+100%) 2% <0%> (ø) ⬇️
apps/provisioning_api/lib/AppInfo/Application.php 100% <0%> (+100%) 6% <0%> (ø) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d83b15c...9667ac2. Read the comment docs.

@nickvergessen nickvergessen mentioned this pull request Mar 22, 2017
7 tasks
Copy link
Member

@blizzz blizzz left a comment

Choose a reason for hiding this comment

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

Tested, works

@blizzz blizzz merged commit 0b5e181 into master Mar 22, 2017
@blizzz blizzz deleted the di_ng2 branch March 22, 2017 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants