-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
add occ app:install command #5644
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
Conversation
core/Command/App/Install.php
Outdated
| */ | ||
| public function completeArgumentValues($argumentName, CompletionContext $context) { | ||
| if ($argumentName === 'app-id') { | ||
| $allApps = \OC_App::getAllApps(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the apps you want to install are not available locally, you can also not autocomplete them.
I'd just delete the complete* methods and the implements CompletionAwareInterface
|
But nice otherwise |
core/Command/App/Install.php
Outdated
| $installer->downloadApp($appId); | ||
| $result = $installer->installApp($appId); | ||
| } catch(Exception $e) { | ||
| $output->writeln('Error: ' . $ex->getMessage()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be $e (see line above)
Codecov Report
@@ Coverage Diff @@
## master #5644 +/- ##
=========================================
Coverage ? 54.49%
Complexity ? 21309
=========================================
Files ? 1309
Lines ? 82358
Branches ? 1327
=========================================
Hits ? 44884
Misses ? 37474
Partials ? 0
|
core/Command/App/Install.php
Outdated
|
|
||
| class Install extends Command { | ||
|
|
||
| public function __construct() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unused and thus can be removed.
| } | ||
|
|
||
| try { | ||
| $installer = new Installer( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nickvergessen do we have DI for commands? I'd prefer injecting an object over building it manually. This approach could fail as soon as the constructor parameters of change. Or maybe we could at least query the class from the DI container and have it constructed automatically.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have "semi-injection": https://github.com/nextcloud/server/blob/master/core/register_command.php#L63
So you can build it outside. Not sure if you can do \OC::$server->query(Installer::class) there thou.
| @@ -0,0 +1,77 @@ | |||
| <?php | |||
| /** | |||
| * @copyright Copyright (c) 2016, ownCloud, Inc. | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's about the copyright header? How should it look like?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the logic is yours add yourself
If it code from oc leave as is
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's more or less from app.php#L363, so I leave it for now.
|
Would it be possible to add a switch for enable like |
|
Tested and it gives me this: Used this file: https://raw.githubusercontent.com/nextcloud/server/add-occ-app-install/core/register_command.php |
|
Sorry, it works. But still would be nice with |
|
👍 from me. |
|
Also, would it be possible to backport to 12? |
You know we don't backport features ;) |
Oh right, don't know why I forgot about that. |
I think this would duplicate the code of the |
|
@nickvergessen @juliushaertl Does this look OK to you? I tested and it works in current state. |
I think a simple enable flag (yes|no) would be okay, if you want to enable it for a group the second call is fine I'd say... |
rullzer
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can probabaly use some polishing later on. But awesome stuff!
daa6d9d to
ebb137b
Compare
|
@juliushaertl And what about you? :) |
|
There is only one thing missing: the sign-off. See https://github.com/nextcloud/server/blob/master/CONTRIBUTING.md#sign-your-work how to do it. It's basically one line in the commit message of every commit. |
|
That's right, I only signed-off the first commit. What's the best practice for such an case? Rebase and sign-off, or add sign-off to every commit? |
95953da to
9edfa93
Compare
It doesn't 😢 |
Because your master is 18 days old 😉 Also update master and then rebase again ;) |
core/Command/App/Install.php
Outdated
| ); | ||
| $installer->downloadApp($appId); | ||
| $result = $installer->installApp($appId); | ||
| } catch(Exception $e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Phan CI job says no:
core/Command/App/Install.php:63 PhanUndeclaredClassCatch Catching undeclared class \OC\Core\Command\App\Exception
core/Command/App/Install.php:64 PhanUndeclaredClassMethod Call to method getMessage from undeclared class \OC\Core\Command\App\Exception
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess adding a leading \ fixes it 😉
db76747 to
2cb7214
Compare
|
@sualko Still failing. :/ |
|
I know and it gets annoying, because those tests fail with messages like the following: Those are not very helpful and for me it looks like there is a more general issue in the test setup, because if you look at the commit history of the master branch there are only ❌. |
|
@MorrisJobke Are tests broken? |
We are still struggling with the docker setup. Sorry for this. I try to get this resolved as soon as possible. |
Still needs this, then more tests should pass ;) |
|
@nickvergessen I did this and some more tests succeeded, but the next test run failed with a message that I should run the command again. To my surprise the command removed the lines again. My conclusion is, that I will wait for Morris ok to rerun those tests. |
|
As of now it looks like the tests are actually broken. Somehow the class can't be loaded. Could you please run |
Signed-off-by: Klaus Herberth <[email protected]>
|
There are no changes to commit after running |
2cb7214 to
3e62a25
Compare
|
Signed-off-by: sualko <[email protected]>
Signed-off-by: sualko <[email protected]>
Okay ... then my diff was out of date, because now the changes to the composer files are shown. Sorry for the hassle then. And sorry for the CI mess. We are currently recovering from the long backlog. |
No, it was my fail. I don't know why, but the namespace was missing. After adding it, the autoloaderchecker did his job. |
|
Ignore the 3 drone timeouts ... those are due to a bit overload on that system as of now. Should be fixed soon. |
Yaay! |
fix #1599
This new command downloads the specific app from the app store, but doesn't enable it.