Make it possible to disable apps via the console, which are not enabled for the current user
This commit is contained in:
parent
d2285113a8
commit
78a02d1b2f
2 changed files with 16 additions and 3 deletions
|
@ -23,12 +23,25 @@
|
|||
|
||||
namespace OC\Core\Command\App;
|
||||
|
||||
use OCP\App\IAppManager;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class Disable extends Command {
|
||||
|
||||
/** @var IAppManager */
|
||||
protected $manager;
|
||||
|
||||
/**
|
||||
* @param IAppManager $manager
|
||||
*/
|
||||
public function __construct(IAppManager $manager) {
|
||||
parent::__construct();
|
||||
$this->manager = $manager;
|
||||
}
|
||||
|
||||
protected function configure() {
|
||||
$this
|
||||
->setName('app:disable')
|
||||
|
@ -42,9 +55,9 @@ class Disable extends Command {
|
|||
|
||||
protected function execute(InputInterface $input, OutputInterface $output) {
|
||||
$appId = $input->getArgument('app-id');
|
||||
if (\OC_App::isEnabled($appId)) {
|
||||
if ($this->manager->isInstalled($appId)) {
|
||||
try {
|
||||
\OC_App::disable($appId);
|
||||
$this->manager->disableApp($appId);
|
||||
$output->writeln($appId . ' disabled');
|
||||
} catch(\Exception $e) {
|
||||
$output->writeln($e->getMessage());
|
||||
|
|
|
@ -44,7 +44,7 @@ $application->add(new \OC\Core\Command\Integrity\SignCore(
|
|||
));
|
||||
|
||||
if (\OC::$server->getConfig()->getSystemValue('installed', false)) {
|
||||
$application->add(new OC\Core\Command\App\Disable());
|
||||
$application->add(new OC\Core\Command\App\Disable(\OC::$server->getAppManager()));
|
||||
$application->add(new OC\Core\Command\App\Enable());
|
||||
$application->add(new OC\Core\Command\App\GetPath());
|
||||
$application->add(new OC\Core\Command\App\ListApps(\OC::$server->getAppManager()));
|
||||
|
|
Loading…
Reference in a new issue