mirror of
https://github.com/nextcloud/server.git
synced 2026-02-03 20:41:22 -05:00
Merge 3040762a2b into d09b8c99de
This commit is contained in:
commit
7d54748bdb
3 changed files with 25 additions and 0 deletions
|
|
@ -658,6 +658,12 @@ class AppSettingsController extends Controller {
|
|||
public function updateApp(string $appId): JSONResponse {
|
||||
$appId = $this->appManager->cleanAppId($appId);
|
||||
|
||||
// Don't try to update locked apps
|
||||
$appsLocked = $this->config->getSystemValue('apps_locked', []);
|
||||
if (in_array($appId, $appsLocked, true)) {
|
||||
return new JSONResponse(['data' => ['message' => $this->l10n->t('App is locked, update skipped.')]], Http::STATUS_FORBIDDEN);
|
||||
}
|
||||
|
||||
$this->config->setSystemValue('maintenance', true);
|
||||
try {
|
||||
$result = $this->installer->updateAppstoreApp($appId);
|
||||
|
|
|
|||
|
|
@ -11,6 +11,8 @@ namespace OC\Core\Command\App;
|
|||
use OC\Installer;
|
||||
use OCP\App\AppPathNotFoundException;
|
||||
use OCP\App\IAppManager;
|
||||
use OCP\IConfig;
|
||||
use OCP\Server;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
|
|
@ -77,6 +79,10 @@ class Update extends Command {
|
|||
}
|
||||
|
||||
$return = 0;
|
||||
|
||||
$config = Server::get(IConfig::class);
|
||||
$appsLocked = $config->getSystemValue('apps_locked', []);
|
||||
|
||||
foreach ($apps as $appId) {
|
||||
$newVersion = $this->installer->isUpdateAvailable($appId, $input->getOption('allow-unstable'));
|
||||
if ($newVersion) {
|
||||
|
|
@ -84,6 +90,12 @@ class Update extends Command {
|
|||
$output->writeln($appId . ' new version available: ' . $newVersion);
|
||||
|
||||
if (!$input->getOption('showonly')) {
|
||||
// Don't try to update locked apps
|
||||
if (in_array($appId, $appsLocked, true)) {
|
||||
$output->writeln('Update skipped for locked app ' . $appId);
|
||||
continue;
|
||||
}
|
||||
|
||||
try {
|
||||
$result = $this->installer->updateAppstoreApp($appId, $input->getOption('allow-unstable'));
|
||||
} catch (\Exception $e) {
|
||||
|
|
|
|||
|
|
@ -373,7 +373,14 @@ class Updater extends BasicEmitter {
|
|||
* @throws \Exception
|
||||
*/
|
||||
private function upgradeAppStoreApps(array $apps, array $previousEnableStates = []): void {
|
||||
$appsLocked = $this->config->getSystemValue('apps_locked', []);
|
||||
|
||||
foreach ($apps as $app) {
|
||||
// Don't try to update locked apps
|
||||
if (in_array($app, $appsLocked, true)) {
|
||||
$this->log->info('Update skipped for locked app' . $app, ['app' => 'updater']);
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
$this->emit('\OC\Updater', 'checkAppStoreAppBefore', [$app]);
|
||||
if ($this->installer->isUpdateAvailable($app)) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue