This commit is contained in:
Git'Fellow 2026-02-03 19:58:11 -01:00 committed by GitHub
commit 7d54748bdb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 25 additions and 0 deletions

View file

@ -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);

View file

@ -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) {

View file

@ -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)) {