migrate therinaldos.com data
Build & Deploy to DigitalOcean Space / build (push) Failing after 2m38s

This commit is contained in:
2024-05-05 15:50:45 -04:00
commit ef1ff240d4
23182 changed files with 3801898 additions and 0 deletions
+101
View File
@@ -0,0 +1,101 @@
<?php
/**
* @copyright Copyright (c) 2016, ownCloud, Inc.
*
* @author Daniel Kesselberg <mail@danielkesselberg.de>
* @author Joas Schilling <coding@schilljs.com>
* @author John Molakvoæ <skjnldsv@protonmail.com>
* @author Robin Appelman <robin@icewind.nl>
*
* @license AGPL-3.0
*
* This code is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License, version 3,
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
namespace OC\Core\Command\App;
use OCP\App\IAppManager;
use Stecman\Component\Symfony\Console\BashCompletion\Completion\CompletionAwareInterface;
use Stecman\Component\Symfony\Console\BashCompletion\CompletionContext;
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 implements CompletionAwareInterface {
protected int $exitCode = 0;
public function __construct(
protected IAppManager $appManager,
) {
parent::__construct();
}
protected function configure(): void {
$this
->setName('app:disable')
->setDescription('disable an app')
->addArgument(
'app-id',
InputArgument::REQUIRED | InputArgument::IS_ARRAY,
'disable the specified app'
);
}
protected function execute(InputInterface $input, OutputInterface $output): int {
$appIds = $input->getArgument('app-id');
foreach ($appIds as $appId) {
$this->disableApp($appId, $output);
}
return $this->exitCode;
}
private function disableApp(string $appId, OutputInterface $output): void {
if ($this->appManager->isInstalled($appId) === false) {
$output->writeln('No such app enabled: ' . $appId);
return;
}
try {
$this->appManager->disableApp($appId);
$appVersion = $this->appManager->getAppVersion($appId);
$output->writeln($appId . ' ' . $appVersion . ' disabled');
} catch (\Exception $e) {
$output->writeln($e->getMessage());
$this->exitCode = 2;
}
}
/**
* @param string $optionName
* @param CompletionContext $context
* @return string[]
*/
public function completeOptionValues($optionName, CompletionContext $context) {
return [];
}
/**
* @param string $argumentName
* @param CompletionContext $context
* @return string[]
*/
public function completeArgumentValues($argumentName, CompletionContext $context) {
if ($argumentName === 'app-id') {
return array_diff(\OC_App::getEnabledApps(true, true), $this->appManager->getAlwaysEnabledApps());
}
return [];
}
}
+170
View File
@@ -0,0 +1,170 @@
<?php
/**
* @copyright Copyright (c) 2016, ownCloud, Inc.
*
* @author Daniel Kesselberg <mail@danielkesselberg.de>
* @author Joas Schilling <coding@schilljs.com>
* @author John Molakvoæ <skjnldsv@protonmail.com>
* @author Robin Appelman <robin@icewind.nl>
* @author Sander Ruitenbeek <s.ruitenbeek@getgoing.nl>
*
* @license AGPL-3.0
*
* This code is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License, version 3,
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
namespace OC\Core\Command\App;
use OC\Installer;
use OCP\App\AppPathNotFoundException;
use OCP\App\IAppManager;
use OCP\IGroup;
use OCP\IGroupManager;
use Stecman\Component\Symfony\Console\BashCompletion\Completion\CompletionAwareInterface;
use Stecman\Component\Symfony\Console\BashCompletion\CompletionContext;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
class Enable extends Command implements CompletionAwareInterface {
protected int $exitCode = 0;
public function __construct(
protected IAppManager $appManager,
protected IGroupManager $groupManager,
) {
parent::__construct();
}
protected function configure(): void {
$this
->setName('app:enable')
->setDescription('enable an app')
->addArgument(
'app-id',
InputArgument::REQUIRED | InputArgument::IS_ARRAY,
'enable the specified app'
)
->addOption(
'groups',
'g',
InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY,
'enable the app only for a list of groups'
)
->addOption(
'force',
'f',
InputOption::VALUE_NONE,
'enable the app regardless of the Nextcloud version requirement'
);
}
protected function execute(InputInterface $input, OutputInterface $output): int {
$appIds = $input->getArgument('app-id');
$groups = $this->resolveGroupIds($input->getOption('groups'));
$forceEnable = (bool) $input->getOption('force');
foreach ($appIds as $appId) {
$this->enableApp($appId, $groups, $forceEnable, $output);
}
return $this->exitCode;
}
/**
* @param string $appId
* @param array $groupIds
* @param bool $forceEnable
* @param OutputInterface $output
*/
private function enableApp(string $appId, array $groupIds, bool $forceEnable, OutputInterface $output): void {
$groupNames = array_map(function (IGroup $group) {
return $group->getDisplayName();
}, $groupIds);
if ($this->appManager->isInstalled($appId) && $groupIds === []) {
$output->writeln($appId . ' already enabled');
return;
}
try {
/** @var Installer $installer */
$installer = \OC::$server->query(Installer::class);
if (false === $installer->isDownloaded($appId)) {
$installer->downloadApp($appId);
}
$installer->installApp($appId, $forceEnable);
$appVersion = $this->appManager->getAppVersion($appId);
if ($groupIds === []) {
$this->appManager->enableApp($appId, $forceEnable);
$output->writeln($appId . ' ' . $appVersion . ' enabled');
} else {
$this->appManager->enableAppForGroups($appId, $groupIds, $forceEnable);
$output->writeln($appId . ' ' . $appVersion . ' enabled for groups: ' . implode(', ', $groupNames));
}
} catch (AppPathNotFoundException $e) {
$output->writeln($appId . ' not found');
$this->exitCode = 1;
} catch (\Exception $e) {
$output->writeln($e->getMessage());
$this->exitCode = 1;
}
}
/**
* @param array $groupIds
* @return array
*/
private function resolveGroupIds(array $groupIds): array {
$groups = [];
foreach ($groupIds as $groupId) {
$group = $this->groupManager->get($groupId);
if ($group instanceof IGroup) {
$groups[] = $group;
}
}
return $groups;
}
/**
* @param string $optionName
* @param CompletionContext $context
* @return string[]
*/
public function completeOptionValues($optionName, CompletionContext $context) {
if ($optionName === 'groups') {
return array_map(function (IGroup $group) {
return $group->getGID();
}, $this->groupManager->search($context->getCurrentWord()));
}
return [];
}
/**
* @param string $argumentName
* @param CompletionContext $context
* @return string[]
*/
public function completeArgumentValues($argumentName, CompletionContext $context) {
if ($argumentName === 'app-id') {
$allApps = \OC_App::getAllApps();
return array_diff($allApps, \OC_App::getEnabledApps(true, true));
}
return [];
}
}
+76
View File
@@ -0,0 +1,76 @@
<?php
/**
* @copyright Copyright (c) 2016, ownCloud, Inc.
*
* @author Joas Schilling <coding@schilljs.com>
* @author Victor Dubiniuk <dubiniuk@owncloud.com>
*
* @license AGPL-3.0
*
* This code is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License, version 3,
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
namespace OC\Core\Command\App;
use OC\Core\Command\Base;
use Stecman\Component\Symfony\Console\BashCompletion\CompletionContext;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class GetPath extends Base {
protected function configure() {
parent::configure();
$this
->setName('app:getpath')
->setDescription('Get an absolute path to the app directory')
->addArgument(
'app',
InputArgument::REQUIRED,
'Name of the app'
)
;
}
/**
* Executes the current command.
*
* @param InputInterface $input An InputInterface instance
* @param OutputInterface $output An OutputInterface instance
* @return int 0 if everything went fine, or an error code
*/
protected function execute(InputInterface $input, OutputInterface $output): int {
$appName = $input->getArgument('app');
$path = \OC_App::getAppPath($appName);
if ($path !== false) {
$output->writeln($path);
return 0;
}
// App not found, exit with non-zero
return 1;
}
/**
* @param string $argumentName
* @param CompletionContext $context
* @return string[]
*/
public function completeArgumentValues($argumentName, CompletionContext $context) {
if ($argumentName === 'app') {
return \OC_App::getAllApps();
}
return [];
}
}
+104
View File
@@ -0,0 +1,104 @@
<?php
/**
* @copyright Copyright (c) 2016, ownCloud, Inc.
*
* @author Christoph Wurst <christoph@winzerhof-wurst.at>
* @author Joas Schilling <coding@schilljs.com>
* @author John Molakvoæ <skjnldsv@protonmail.com>
* @author Maxopoly <max@dermax.org>
* @author Morris Jobke <hey@morrisjobke.de>
* @author Roeland Jago Douma <roeland@famdouma.nl>
* @author sualko <klaus@jsxc.org>
*
* @license AGPL-3.0
*
* This code is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License, version 3,
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
namespace OC\Core\Command\App;
use OC\Installer;
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\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
class Install extends Command {
protected function configure() {
$this
->setName('app:install')
->setDescription('install an app')
->addArgument(
'app-id',
InputArgument::REQUIRED,
'install the specified app'
)
->addOption(
'keep-disabled',
null,
InputOption::VALUE_NONE,
'don\'t enable the app afterwards'
)
->addOption(
'force',
'f',
InputOption::VALUE_NONE,
'install the app regardless of the Nextcloud version requirement'
)
->addOption(
'allow-unstable',
null,
InputOption::VALUE_NONE,
'allow installing an unstable releases'
)
;
}
protected function execute(InputInterface $input, OutputInterface $output): int {
$appId = $input->getArgument('app-id');
$forceEnable = (bool) $input->getOption('force');
if (\OC_App::getAppPath($appId)) {
$output->writeln($appId . ' already installed');
return 1;
}
try {
/** @var Installer $installer */
$installer = \OC::$server->query(Installer::class);
$installer->downloadApp($appId, $input->getOption('allow-unstable'));
$result = $installer->installApp($appId, $forceEnable);
} catch (\Exception $e) {
$output->writeln('Error: ' . $e->getMessage());
return 1;
}
if ($result === false) {
$output->writeln($appId . ' couldn\'t be installed');
return 1;
}
$appVersion = \OCP\Server::get(IAppManager::class)->getAppVersion($appId);
$output->writeln($appId . ' ' . $appVersion . ' installed');
if (!$input->getOption('keep-disabled')) {
$appClass = new \OC_App();
$appClass->enable($appId);
$output->writeln($appId . ' enabled');
}
return 0;
}
}
+137
View File
@@ -0,0 +1,137 @@
<?php
/**
* @copyright Copyright (c) 2016, ownCloud, Inc.
*
* @author Christoph Wurst <christoph@winzerhof-wurst.at>
* @author Joas Schilling <coding@schilljs.com>
* @author Morris Jobke <hey@morrisjobke.de>
* @author Robin Appelman <robin@icewind.nl>
* @author Victor Dubiniuk <dubiniuk@owncloud.com>
*
* @license AGPL-3.0
*
* This code is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License, version 3,
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
namespace OC\Core\Command\App;
use OC\Core\Command\Base;
use OCP\App\IAppManager;
use Stecman\Component\Symfony\Console\BashCompletion\CompletionContext;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
class ListApps extends Base {
public function __construct(
protected IAppManager $manager,
) {
parent::__construct();
}
protected function configure() {
parent::configure();
$this
->setName('app:list')
->setDescription('List all available apps')
->addOption(
'shipped',
null,
InputOption::VALUE_REQUIRED,
'true - limit to shipped apps only, false - limit to non-shipped apps only'
)
;
}
protected function execute(InputInterface $input, OutputInterface $output): int {
if ($input->getOption('shipped') === 'true' || $input->getOption('shipped') === 'false') {
$shippedFilter = $input->getOption('shipped') === 'true';
} else {
$shippedFilter = null;
}
$apps = \OC_App::getAllApps();
$enabledApps = $disabledApps = [];
$versions = \OC_App::getAppVersions();
//sort enabled apps above disabled apps
foreach ($apps as $app) {
if ($shippedFilter !== null && $this->manager->isShipped($app) !== $shippedFilter) {
continue;
}
if ($this->manager->isInstalled($app)) {
$enabledApps[] = $app;
} else {
$disabledApps[] = $app;
}
}
$apps = ['enabled' => [], 'disabled' => []];
sort($enabledApps);
foreach ($enabledApps as $app) {
$apps['enabled'][$app] = $versions[$app] ?? true;
}
sort($disabledApps);
foreach ($disabledApps as $app) {
$apps['disabled'][$app] = $this->manager->getAppVersion($app) . (isset($versions[$app]) ? ' (installed ' . $versions[$app] . ')' : '');
}
$this->writeAppList($input, $output, $apps);
return 0;
}
/**
* @param InputInterface $input
* @param OutputInterface $output
* @param array $items
*/
protected function writeAppList(InputInterface $input, OutputInterface $output, $items) {
switch ($input->getOption('output')) {
case self::OUTPUT_FORMAT_PLAIN:
$output->writeln('Enabled:');
parent::writeArrayInOutputFormat($input, $output, $items['enabled']);
$output->writeln('Disabled:');
parent::writeArrayInOutputFormat($input, $output, $items['disabled']);
break;
default:
parent::writeArrayInOutputFormat($input, $output, $items);
break;
}
}
/**
* @param string $optionName
* @param CompletionContext $context
* @return array
*/
public function completeOptionValues($optionName, CompletionContext $context) {
if ($optionName === 'shipped') {
return ['true', 'false'];
}
return [];
}
/**
* @param string $argumentName
* @param CompletionContext $context
* @return string[]
*/
public function completeArgumentValues($argumentName, CompletionContext $context) {
return [];
}
}
+142
View File
@@ -0,0 +1,142 @@
<?php
/**
* @copyright Copyright (c) 2018, Patrik Kernstock <info@pkern.at>
*
* @author Christoph Wurst <christoph@winzerhof-wurst.at>
* @author Joas Schilling <coding@schilljs.com>
* @author John Molakvoæ <skjnldsv@protonmail.com>
* @author Patrik Kernstock <info@pkern.at>
* @author Roeland Jago Douma <roeland@famdouma.nl>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
namespace OC\Core\Command\App;
use OC\Installer;
use OCP\App\IAppManager;
use Psr\Log\LoggerInterface;
use Stecman\Component\Symfony\Console\BashCompletion\Completion\CompletionAwareInterface;
use Stecman\Component\Symfony\Console\BashCompletion\CompletionContext;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Throwable;
class Remove extends Command implements CompletionAwareInterface {
public function __construct(
protected IAppManager $manager,
private Installer $installer,
private LoggerInterface $logger,
) {
parent::__construct();
}
protected function configure() {
$this
->setName('app:remove')
->setDescription('remove an app')
->addArgument(
'app-id',
InputArgument::REQUIRED,
'remove the specified app'
)
->addOption(
'keep-data',
null,
InputOption::VALUE_NONE,
'keep app data and do not remove them'
);
}
protected function execute(InputInterface $input, OutputInterface $output): int {
$appId = $input->getArgument('app-id');
// Check if the app is installed
if (!\OC_App::getAppPath($appId)) {
$output->writeln($appId . ' is not installed');
return 1;
}
// Removing shipped apps is not possible, therefore we pre-check that
// before trying to remove it
if ($this->manager->isShipped($appId)) {
$output->writeln($appId . ' could not be removed as it is a shipped app');
return 1;
}
// If we want to keep the data of the app, we simply don't disable it here.
// App uninstall tasks are being executed when disabled. More info: PR #11627.
if (!$input->getOption('keep-data')) {
try {
$this->manager->disableApp($appId);
$output->writeln($appId . ' disabled');
} catch (Throwable $e) {
$output->writeln('<error>Error: ' . $e->getMessage() . '</error>');
$this->logger->error($e->getMessage(), [
'app' => 'CLI',
'exception' => $e,
]);
return 1;
}
}
// Let's try to remove the app...
try {
$result = $this->installer->removeApp($appId);
} catch (Throwable $e) {
$output->writeln('<error>Error: ' . $e->getMessage() . '</error>');
$this->logger->error($e->getMessage(), [
'app' => 'CLI',
'exception' => $e,
]);
return 1;
}
if ($result === false) {
$output->writeln($appId . ' could not be removed');
return 1;
}
$appVersion = $this->manager->getAppVersion($appId);
$output->writeln($appId . ' ' . $appVersion . ' removed');
return 0;
}
/**
* @param string $optionName
* @param CompletionContext $context
* @return string[]
*/
public function completeOptionValues($optionName, CompletionContext $context) {
return [];
}
/**
* @param string $argumentName
* @param CompletionContext $context
* @return string[]
*/
public function completeArgumentValues($argumentName, CompletionContext $context) {
if ($argumentName === 'app-id') {
return \OC_App::getAllApps();
}
return [];
}
}
+126
View File
@@ -0,0 +1,126 @@
<?php
/**
* @copyright Copyright (c) 2018, michag86 (michag86@arcor.de)
*
* @author Christoph Wurst <christoph@winzerhof-wurst.at>
* @author Joas Schilling <coding@schilljs.com>
* @author John Molakvoæ <skjnldsv@protonmail.com>
* @author michag86 <micha_g@arcor.de>
* @author Morris Jobke <hey@morrisjobke.de>
* @author Roeland Jago Douma <roeland@famdouma.nl>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
namespace OC\Core\Command\App;
use OC\Installer;
use OCP\App\IAppManager;
use Psr\Log\LoggerInterface;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
class Update extends Command {
public function __construct(
protected IAppManager $manager,
private Installer $installer,
private LoggerInterface $logger,
) {
parent::__construct();
}
protected function configure() {
$this
->setName('app:update')
->setDescription('update an app or all apps')
->addArgument(
'app-id',
InputArgument::OPTIONAL,
'update the specified app'
)
->addOption(
'all',
null,
InputOption::VALUE_NONE,
'update all updatable apps'
)
->addOption(
'showonly',
null,
InputOption::VALUE_NONE,
'show update(s) without updating'
)
->addOption(
'allow-unstable',
null,
InputOption::VALUE_NONE,
'allow updating to unstable releases'
)
;
}
protected function execute(InputInterface $input, OutputInterface $output): int {
$singleAppId = $input->getArgument('app-id');
if ($singleAppId) {
$apps = [$singleAppId];
try {
$this->manager->getAppPath($singleAppId);
} catch (\OCP\App\AppPathNotFoundException $e) {
$output->writeln($singleAppId . ' not installed');
return 1;
}
} elseif ($input->getOption('all') || $input->getOption('showonly')) {
$apps = \OC_App::getAllApps();
} else {
$output->writeln("<error>Please specify an app to update or \"--all\" to update all updatable apps\"</error>");
return 1;
}
$return = 0;
foreach ($apps as $appId) {
$newVersion = $this->installer->isUpdateAvailable($appId, $input->getOption('allow-unstable'));
if ($newVersion) {
$output->writeln($appId . ' new version available: ' . $newVersion);
if (!$input->getOption('showonly')) {
try {
$result = $this->installer->updateAppstoreApp($appId, $input->getOption('allow-unstable'));
} catch (\Exception $e) {
$this->logger->error('Failure during update of app "' . $appId . '"', [
'app' => 'app:update',
'exception' => $e,
]);
$output->writeln('Error: ' . $e->getMessage());
$return = 1;
}
if ($result === false) {
$output->writeln($appId . ' couldn\'t be updated');
$return = 1;
} elseif ($result === true) {
$output->writeln($appId . ' updated');
}
}
}
}
return $return;
}
}