mirror of
https://github.com/nextcloud/server.git
synced 2026-05-22 01:55:56 -04:00
Merge pull request #58576 from nextcloud/carl/updater-controller
refactor(updater): Move updater to a Controller
This commit is contained in:
commit
c4e2159284
17 changed files with 220 additions and 194 deletions
|
|
@ -3247,6 +3247,24 @@
|
|||
<code><![CDATA[findMatchingRoute]]></code>
|
||||
</UndefinedInterfaceMethod>
|
||||
</file>
|
||||
<file src="core/Controller/UpdateController.php">
|
||||
<DeprecatedMethod>
|
||||
<code><![CDATA[listen]]></code>
|
||||
<code><![CDATA[listen]]></code>
|
||||
<code><![CDATA[listen]]></code>
|
||||
<code><![CDATA[listen]]></code>
|
||||
<code><![CDATA[listen]]></code>
|
||||
<code><![CDATA[listen]]></code>
|
||||
<code><![CDATA[listen]]></code>
|
||||
<code><![CDATA[listen]]></code>
|
||||
<code><![CDATA[listen]]></code>
|
||||
<code><![CDATA[listen]]></code>
|
||||
<code><![CDATA[listen]]></code>
|
||||
<code><![CDATA[listen]]></code>
|
||||
<code><![CDATA[listen]]></code>
|
||||
<code><![CDATA[listen]]></code>
|
||||
</DeprecatedMethod>
|
||||
</file>
|
||||
<file src="core/Controller/WebAuthnController.php">
|
||||
<DeprecatedMethod>
|
||||
<code><![CDATA[PublicKeyCredentialRequestOptions::createFromString($this->session->get(self::WEBAUTHN_LOGIN))]]></code>
|
||||
|
|
@ -3279,24 +3297,6 @@
|
|||
<code><![CDATA[IToken::PERMANENT_TOKEN]]></code>
|
||||
</DeprecatedClass>
|
||||
</file>
|
||||
<file src="core/ajax/update.php">
|
||||
<DeprecatedMethod>
|
||||
<code><![CDATA[listen]]></code>
|
||||
<code><![CDATA[listen]]></code>
|
||||
<code><![CDATA[listen]]></code>
|
||||
<code><![CDATA[listen]]></code>
|
||||
<code><![CDATA[listen]]></code>
|
||||
<code><![CDATA[listen]]></code>
|
||||
<code><![CDATA[listen]]></code>
|
||||
<code><![CDATA[listen]]></code>
|
||||
<code><![CDATA[listen]]></code>
|
||||
<code><![CDATA[listen]]></code>
|
||||
<code><![CDATA[listen]]></code>
|
||||
<code><![CDATA[listen]]></code>
|
||||
<code><![CDATA[listen]]></code>
|
||||
<code><![CDATA[listen]]></code>
|
||||
</DeprecatedMethod>
|
||||
</file>
|
||||
<file src="core/templates/publicshareauth.php">
|
||||
<DeprecatedMethod>
|
||||
<code><![CDATA[provideInitialState]]></code>
|
||||
|
|
|
|||
178
core/Controller/UpdateController.php
Normal file
178
core/Controller/UpdateController.php
Normal file
|
|
@ -0,0 +1,178 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: 2016-2026 Nextcloud GmbH and Nextcloud contributors
|
||||
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
namespace OC\Core\Controller;
|
||||
|
||||
use OC\Core\Listener\FeedBackHandler;
|
||||
use OC\DB\MigratorExecuteSqlEvent;
|
||||
use OC\Repair\Events\RepairAdvanceEvent;
|
||||
use OC\Repair\Events\RepairErrorEvent;
|
||||
use OC\Repair\Events\RepairFinishEvent;
|
||||
use OC\Repair\Events\RepairInfoEvent;
|
||||
use OC\Repair\Events\RepairStartEvent;
|
||||
use OC\Repair\Events\RepairStepEvent;
|
||||
use OC\Repair\Events\RepairWarningEvent;
|
||||
use OC\Updater;
|
||||
use OCP\AppFramework\Http;
|
||||
use OCP\AppFramework\Http\Attribute\ApiRoute;
|
||||
use OCP\AppFramework\Http\Attribute\OpenAPI;
|
||||
use OCP\AppFramework\Http\Attribute\PublicPage;
|
||||
use OCP\AppFramework\Http\DataResponse;
|
||||
use OCP\EventDispatcher\IEventDispatcher;
|
||||
use OCP\IConfig;
|
||||
use OCP\IEventSourceFactory;
|
||||
use OCP\IL10N;
|
||||
use OCP\IRequest;
|
||||
use OCP\Util;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
#[OpenAPI(scope: OpenApi::SCOPE_IGNORE)]
|
||||
class UpdateController extends \OCP\AppFramework\OCSController {
|
||||
public function __construct(
|
||||
string $appName,
|
||||
IRequest $request,
|
||||
private readonly IEventSourceFactory $eventSourceFactory,
|
||||
private readonly IL10N $l,
|
||||
private readonly IConfig $config,
|
||||
private readonly Updater $updater,
|
||||
private readonly IEventDispatcher $dispatcher,
|
||||
private readonly LoggerInterface $logger,
|
||||
) {
|
||||
parent::__construct($appName, $request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the server via the web interface
|
||||
*
|
||||
* @return DataResponse<Http::STATUS_OK, null, array{}>
|
||||
*
|
||||
* 200: Success
|
||||
*/
|
||||
#[ApiRoute(verb: 'GET', url: '/update', root: '/core')]
|
||||
#[PublicPage]
|
||||
public function update(): DataResponse {
|
||||
if (!str_contains(@ini_get('disable_functions'), 'set_time_limit')) {
|
||||
@set_time_limit(0);
|
||||
}
|
||||
|
||||
$eventSource = $this->eventSourceFactory->create();
|
||||
// need to send an initial message to force-init the event source,
|
||||
// which will then trigger its own CSRF check and produces its own CSRF error
|
||||
// message
|
||||
$eventSource->send('success', $this->l->t('Preparing update'));
|
||||
if (!Util::needUpgrade()) {
|
||||
$eventSource->send('notice', $this->l->t('Already up to date'));
|
||||
$eventSource->send('done', '');
|
||||
$eventSource->close();
|
||||
return new DataResponse(null);
|
||||
}
|
||||
|
||||
if ($this->config->getSystemValueBool('upgrade.disable-web', false)) {
|
||||
$eventSource->send('failure', $this->l->t('Please use the command line updater because updating via browser is disabled in your config.php.'));
|
||||
$eventSource->close();
|
||||
return new DataResponse(null);
|
||||
}
|
||||
|
||||
// if a user is currently logged in, their session must be ignored to
|
||||
// avoid side effects
|
||||
\OC_User::setIncognitoMode(true);
|
||||
|
||||
$incompatibleApps = [];
|
||||
$incompatibleOverwrites = $this->config->getSystemValue('app_install_overwrite', []);
|
||||
|
||||
$this->dispatcher->addListener(
|
||||
MigratorExecuteSqlEvent::class,
|
||||
function (MigratorExecuteSqlEvent $event) use ($eventSource): void {
|
||||
$eventSource->send('success', $this->l->t('[%d / %d]: %s', [$event->getCurrentStep(), $event->getMaxStep(), $event->getSql()]));
|
||||
}
|
||||
);
|
||||
$feedBack = new FeedBackHandler($eventSource, $this->l);
|
||||
$this->dispatcher->addListener(RepairStartEvent::class, $feedBack->handleRepairFeedback(...));
|
||||
$this->dispatcher->addListener(RepairAdvanceEvent::class, $feedBack->handleRepairFeedback(...));
|
||||
$this->dispatcher->addListener(RepairFinishEvent::class, $feedBack->handleRepairFeedback(...));
|
||||
$this->dispatcher->addListener(RepairStepEvent::class, $feedBack->handleRepairFeedback(...));
|
||||
$this->dispatcher->addListener(RepairInfoEvent::class, $feedBack->handleRepairFeedback(...));
|
||||
$this->dispatcher->addListener(RepairWarningEvent::class, $feedBack->handleRepairFeedback(...));
|
||||
$this->dispatcher->addListener(RepairErrorEvent::class, $feedBack->handleRepairFeedback(...));
|
||||
|
||||
$this->updater->listen('\OC\Updater', 'maintenanceEnabled', function () use ($eventSource): void {
|
||||
$eventSource->send('success', $this->l->t('Turned on maintenance mode'));
|
||||
});
|
||||
$this->updater->listen('\OC\Updater', 'maintenanceDisabled', function () use ($eventSource): void {
|
||||
$eventSource->send('success', $this->l->t('Turned off maintenance mode'));
|
||||
});
|
||||
$this->updater->listen('\OC\Updater', 'maintenanceActive', function () use ($eventSource): void {
|
||||
$eventSource->send('notice', $this->l->t('Maintenance mode is kept active'));
|
||||
});
|
||||
$this->updater->listen('\OC\Updater', 'dbUpgradeBefore', function () use ($eventSource): void {
|
||||
$eventSource->send('success', $this->l->t('Updating database schema'));
|
||||
});
|
||||
$this->updater->listen('\OC\Updater', 'dbUpgrade', function () use ($eventSource): void {
|
||||
$eventSource->send('success', $this->l->t('Updated database'));
|
||||
});
|
||||
$this->updater->listen('\OC\Updater', 'upgradeAppStoreApp', function ($app) use ($eventSource): void {
|
||||
$eventSource->send('success', $this->l->t('Update app "%s" from App Store', [$app]));
|
||||
});
|
||||
$this->updater->listen('\OC\Updater', 'appSimulateUpdate', function ($app) use ($eventSource): void {
|
||||
$eventSource->send('success', $this->l->t('Checking whether the database schema for %s can be updated (this can take a long time depending on the database size)', [$app]));
|
||||
});
|
||||
$this->updater->listen('\OC\Updater', 'appUpgrade', function ($app, $version) use ($eventSource): void {
|
||||
$eventSource->send('success', $this->l->t('Updated "%1$s" to %2$s', [$app, $version]));
|
||||
});
|
||||
$this->updater->listen('\OC\Updater', 'incompatibleAppDisabled', function ($app) use (&$incompatibleApps, &$incompatibleOverwrites): void {
|
||||
if (!in_array($app, $incompatibleOverwrites)) {
|
||||
$incompatibleApps[] = $app;
|
||||
}
|
||||
});
|
||||
$this->updater->listen('\OC\Updater', 'failure', function ($message) use ($eventSource): void {
|
||||
$eventSource->send('failure', $message);
|
||||
$this->config->setSystemValue('maintenance', false);
|
||||
});
|
||||
$this->updater->listen('\OC\Updater', 'setDebugLogLevel', function ($logLevel, $logLevelName) use ($eventSource): void {
|
||||
$eventSource->send('success', $this->l->t('Set log level to debug'));
|
||||
});
|
||||
$this->updater->listen('\OC\Updater', 'resetLogLevel', function ($logLevel, $logLevelName) use ($eventSource): void {
|
||||
$eventSource->send('success', $this->l->t('Reset log level'));
|
||||
});
|
||||
$this->updater->listen('\OC\Updater', 'startCheckCodeIntegrity', function () use ($eventSource): void {
|
||||
$eventSource->send('success', $this->l->t('Starting code integrity check'));
|
||||
});
|
||||
$this->updater->listen('\OC\Updater', 'finishedCheckCodeIntegrity', function () use ($eventSource): void {
|
||||
$eventSource->send('success', $this->l->t('Finished code integrity check'));
|
||||
});
|
||||
|
||||
try {
|
||||
$this->updater->upgrade();
|
||||
} catch (\Exception $e) {
|
||||
$this->logger->error(
|
||||
$e->getMessage(),
|
||||
[
|
||||
'exception' => $e,
|
||||
'app' => 'update',
|
||||
]);
|
||||
$eventSource->send('failure', get_class($e) . ': ' . $e->getMessage());
|
||||
$eventSource->close();
|
||||
return new DataResponse(null);
|
||||
}
|
||||
|
||||
$disabledApps = [];
|
||||
foreach ($incompatibleApps as $app) {
|
||||
$disabledApps[$app] = $this->l->t('%s (incompatible)', [$app]);
|
||||
}
|
||||
|
||||
if (!empty($disabledApps)) {
|
||||
$eventSource->send('notice', $this->l->t('The following apps have been disabled: %s', [implode(', ', $disabledApps)]));
|
||||
}
|
||||
|
||||
$eventSource->send('done', '');
|
||||
$eventSource->close();
|
||||
return new DataResponse(null);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,151 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
|
||||
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
use OC\Core\Listener\FeedBackHandler;
|
||||
use OC\DB\MigratorExecuteSqlEvent;
|
||||
use OC\Repair\Events\RepairAdvanceEvent;
|
||||
use OC\Repair\Events\RepairErrorEvent;
|
||||
use OC\Repair\Events\RepairFinishEvent;
|
||||
use OC\Repair\Events\RepairInfoEvent;
|
||||
use OC\Repair\Events\RepairStartEvent;
|
||||
use OC\Repair\Events\RepairStepEvent;
|
||||
use OC\Repair\Events\RepairWarningEvent;
|
||||
use OC\SystemConfig;
|
||||
use OC\Updater;
|
||||
use OCP\EventDispatcher\Event;
|
||||
use OCP\EventDispatcher\IEventDispatcher;
|
||||
use OCP\IConfig;
|
||||
use OCP\IEventSourceFactory;
|
||||
use OCP\IL10N;
|
||||
use OCP\L10N\IFactory;
|
||||
use OCP\Server;
|
||||
use OCP\Util;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
if (!str_contains(@ini_get('disable_functions'), 'set_time_limit')) {
|
||||
@set_time_limit(0);
|
||||
}
|
||||
|
||||
require_once '../../lib/base.php';
|
||||
|
||||
/** @var IL10N $l */
|
||||
$l = Server::get(IFactory::class)->get('core');
|
||||
|
||||
$eventSource = Server::get(IEventSourceFactory::class)->create();
|
||||
// need to send an initial message to force-init the event source,
|
||||
// which will then trigger its own CSRF check and produces its own CSRF error
|
||||
// message
|
||||
$eventSource->send('success', $l->t('Preparing update'));
|
||||
|
||||
if (Util::needUpgrade()) {
|
||||
$config = Server::get(SystemConfig::class);
|
||||
if ($config->getValue('upgrade.disable-web', false)) {
|
||||
$eventSource->send('failure', $l->t('Please use the command line updater because updating via browser is disabled in your config.php.'));
|
||||
$eventSource->close();
|
||||
exit();
|
||||
}
|
||||
|
||||
// if a user is currently logged in, their session must be ignored to
|
||||
// avoid side effects
|
||||
\OC_User::setIncognitoMode(true);
|
||||
|
||||
$config = Server::get(IConfig::class);
|
||||
$updater = Server::get(Updater::class);
|
||||
$incompatibleApps = [];
|
||||
$incompatibleOverwrites = $config->getSystemValue('app_install_overwrite', []);
|
||||
|
||||
/** @var IEventDispatcher $dispatcher */
|
||||
$dispatcher = Server::get(IEventDispatcher::class);
|
||||
$dispatcher->addListener(
|
||||
MigratorExecuteSqlEvent::class,
|
||||
function (MigratorExecuteSqlEvent $event) use ($eventSource, $l): void {
|
||||
$eventSource->send('success', $l->t('[%d / %d]: %s', [$event->getCurrentStep(), $event->getMaxStep(), $event->getSql()]));
|
||||
}
|
||||
);
|
||||
$feedBack = new FeedBackHandler($eventSource, $l);
|
||||
$dispatcher->addListener(RepairStartEvent::class, [$feedBack, 'handleRepairFeedback']);
|
||||
$dispatcher->addListener(RepairAdvanceEvent::class, [$feedBack, 'handleRepairFeedback']);
|
||||
$dispatcher->addListener(RepairFinishEvent::class, [$feedBack, 'handleRepairFeedback']);
|
||||
$dispatcher->addListener(RepairStepEvent::class, [$feedBack, 'handleRepairFeedback']);
|
||||
$dispatcher->addListener(RepairInfoEvent::class, [$feedBack, 'handleRepairFeedback']);
|
||||
$dispatcher->addListener(RepairWarningEvent::class, [$feedBack, 'handleRepairFeedback']);
|
||||
$dispatcher->addListener(RepairErrorEvent::class, [$feedBack, 'handleRepairFeedback']);
|
||||
|
||||
$updater->listen('\OC\Updater', 'maintenanceEnabled', function () use ($eventSource, $l): void {
|
||||
$eventSource->send('success', $l->t('Turned on maintenance mode'));
|
||||
});
|
||||
$updater->listen('\OC\Updater', 'maintenanceDisabled', function () use ($eventSource, $l): void {
|
||||
$eventSource->send('success', $l->t('Turned off maintenance mode'));
|
||||
});
|
||||
$updater->listen('\OC\Updater', 'maintenanceActive', function () use ($eventSource, $l): void {
|
||||
$eventSource->send('notice', $l->t('Maintenance mode is kept active'));
|
||||
});
|
||||
$updater->listen('\OC\Updater', 'dbUpgradeBefore', function () use ($eventSource, $l): void {
|
||||
$eventSource->send('success', $l->t('Updating database schema'));
|
||||
});
|
||||
$updater->listen('\OC\Updater', 'dbUpgrade', function () use ($eventSource, $l): void {
|
||||
$eventSource->send('success', $l->t('Updated database'));
|
||||
});
|
||||
$updater->listen('\OC\Updater', 'upgradeAppStoreApp', function ($app) use ($eventSource, $l): void {
|
||||
$eventSource->send('success', $l->t('Update app "%s" from App Store', [$app]));
|
||||
});
|
||||
$updater->listen('\OC\Updater', 'appSimulateUpdate', function ($app) use ($eventSource, $l): void {
|
||||
$eventSource->send('success', $l->t('Checking whether the database schema for %s can be updated (this can take a long time depending on the database size)', [$app]));
|
||||
});
|
||||
$updater->listen('\OC\Updater', 'appUpgrade', function ($app, $version) use ($eventSource, $l): void {
|
||||
$eventSource->send('success', $l->t('Updated "%1$s" to %2$s', [$app, $version]));
|
||||
});
|
||||
$updater->listen('\OC\Updater', 'incompatibleAppDisabled', function ($app) use (&$incompatibleApps, &$incompatibleOverwrites): void {
|
||||
if (!in_array($app, $incompatibleOverwrites)) {
|
||||
$incompatibleApps[] = $app;
|
||||
}
|
||||
});
|
||||
$updater->listen('\OC\Updater', 'failure', function ($message) use ($eventSource, $config): void {
|
||||
$eventSource->send('failure', $message);
|
||||
$config->setSystemValue('maintenance', false);
|
||||
});
|
||||
$updater->listen('\OC\Updater', 'setDebugLogLevel', function ($logLevel, $logLevelName) use ($eventSource, $l): void {
|
||||
$eventSource->send('success', $l->t('Set log level to debug'));
|
||||
});
|
||||
$updater->listen('\OC\Updater', 'resetLogLevel', function ($logLevel, $logLevelName) use ($eventSource, $l): void {
|
||||
$eventSource->send('success', $l->t('Reset log level'));
|
||||
});
|
||||
$updater->listen('\OC\Updater', 'startCheckCodeIntegrity', function () use ($eventSource, $l): void {
|
||||
$eventSource->send('success', $l->t('Starting code integrity check'));
|
||||
});
|
||||
$updater->listen('\OC\Updater', 'finishedCheckCodeIntegrity', function () use ($eventSource, $l): void {
|
||||
$eventSource->send('success', $l->t('Finished code integrity check'));
|
||||
});
|
||||
|
||||
try {
|
||||
$updater->upgrade();
|
||||
} catch (\Exception $e) {
|
||||
Server::get(LoggerInterface::class)->error(
|
||||
$e->getMessage(),
|
||||
[
|
||||
'exception' => $e,
|
||||
'app' => 'update',
|
||||
]);
|
||||
$eventSource->send('failure', get_class($e) . ': ' . $e->getMessage());
|
||||
$eventSource->close();
|
||||
exit();
|
||||
}
|
||||
|
||||
$disabledApps = [];
|
||||
foreach ($incompatibleApps as $app) {
|
||||
$disabledApps[$app] = $l->t('%s (incompatible)', [$app]);
|
||||
}
|
||||
|
||||
if (!empty($disabledApps)) {
|
||||
$eventSource->send('notice', $l->t('The following apps have been disabled: %s', [implode(', ', $disabledApps)]));
|
||||
}
|
||||
} else {
|
||||
$eventSource->send('notice', $l->t('Already up to date'));
|
||||
}
|
||||
|
||||
$eventSource->send('done', '');
|
||||
$eventSource->close();
|
||||
|
|
@ -10,9 +10,4 @@ use OC\Route\Router;
|
|||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
/** @var Router $this */
|
||||
// Core ajax actions
|
||||
// Routing
|
||||
$this->create('core_ajax_update', '/core/ajax/update.php')
|
||||
->actionInclude('core/ajax/update.php');
|
||||
|
||||
$this->create('heartbeat', '/heartbeat')->get();
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ import {
|
|||
} from '@mdi/js'
|
||||
import { loadState } from '@nextcloud/initial-state'
|
||||
import { t } from '@nextcloud/l10n'
|
||||
import { generateFilePath } from '@nextcloud/router'
|
||||
import { generateOcsUrl } from '@nextcloud/router'
|
||||
import { NcButton, NcIconSvgWrapper, NcLoadingIcon } from '@nextcloud/vue'
|
||||
import { computed, onMounted, onUnmounted, ref } from 'vue'
|
||||
import NcGuestContent from '@nextcloud/vue/components/NcGuestContent'
|
||||
|
|
@ -92,7 +92,7 @@ async function onStartUpdate() {
|
|||
}
|
||||
|
||||
isUpdateRunning.value = true
|
||||
const eventSource = new OCEventSource(generateFilePath('core', '', 'ajax/update.php'))
|
||||
const eventSource = new OCEventSource(generateOcsUrl('/core/update'))
|
||||
eventSource.listen('success', (message) => {
|
||||
messages.value.push({ message, type: 'success' })
|
||||
})
|
||||
|
|
|
|||
2
dist/5037-5037.js
vendored
Normal file
2
dist/5037-5037.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
dist/5037-5037.js.map
vendored
Normal file
1
dist/5037-5037.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
1
dist/5037-5037.js.map.license
vendored
Symbolic link
1
dist/5037-5037.js.map.license
vendored
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
5037-5037.js.license
|
||||
2
dist/9396-9396.js
vendored
2
dist/9396-9396.js
vendored
File diff suppressed because one or more lines are too long
1
dist/9396-9396.js.map
vendored
1
dist/9396-9396.js.map
vendored
File diff suppressed because one or more lines are too long
1
dist/9396-9396.js.map.license
vendored
1
dist/9396-9396.js.map.license
vendored
|
|
@ -1 +0,0 @@
|
|||
9396-9396.js.license
|
||||
4
dist/core-update.js
vendored
4
dist/core-update.js
vendored
|
|
@ -1,2 +1,2 @@
|
|||
(()=>{"use strict";var e,r,t,o={42716(e,r,t){var o=t(21777),a=t(81222),n=t(85471);t.nc=(0,o.aV)();const i=(0,n.$V)(()=>Promise.all([t.e(4208),t.e(9396)]).then(t.bind(t,31098))),l=(0,n.$V)(()=>Promise.all([t.e(4208),t.e(428)]).then(t.bind(t,428))),c=(0,a.C)("core","updaterView");new n.Ay({name:"NextcloudUpdater",render:e=>e("adminCli"===c?l:i)}).$mount("#core-updater")}},a={};function n(e){var r=a[e];if(void 0!==r)return r.exports;var t=a[e]={id:e,loaded:!1,exports:{}};return o[e].call(t.exports,t,t.exports,n),t.loaded=!0,t.exports}n.m=o,e=[],n.O=(r,t,o,a)=>{if(!t){var i=1/0;for(u=0;u<e.length;u++){for(var[t,o,a]=e[u],l=!0,c=0;c<t.length;c++)(!1&a||i>=a)&&Object.keys(n.O).every(e=>n.O[e](t[c]))?t.splice(c--,1):(l=!1,a<i&&(i=a));if(l){e.splice(u--,1);var d=o();void 0!==d&&(r=d)}}return r}a=a||0;for(var u=e.length;u>0&&e[u-1][2]>a;u--)e[u]=e[u-1];e[u]=[t,o,a]},n.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return n.d(r,{a:r}),r},n.d=(e,r)=>{for(var t in r)n.o(r,t)&&!n.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},n.f={},n.e=e=>Promise.all(Object.keys(n.f).reduce((r,t)=>(n.f[t](e,r),r),[])),n.u=e=>e+"-"+e+".js?v="+{428:"2532bb7008a9517fee02",5862:"580b9c2e231a9169a12f",6798:"1a6cf42d93801a926a3d",7471:"b4ac70873a3ab192efd0",9396:"3878274a9f370ac61247"}[e],n.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),r={},t="nextcloud-ui-legacy:",n.l=(e,o,a,i)=>{if(r[e])r[e].push(o);else{var l,c;if(void 0!==a)for(var d=document.getElementsByTagName("script"),u=0;u<d.length;u++){var s=d[u];if(s.getAttribute("src")==e||s.getAttribute("data-webpack")==t+a){l=s;break}}l||(c=!0,(l=document.createElement("script")).charset="utf-8",n.nc&&l.setAttribute("nonce",n.nc),l.setAttribute("data-webpack",t+a),l.src=e),r[e]=[o];var p=(t,o)=>{l.onerror=l.onload=null,clearTimeout(f);var a=r[e];if(delete r[e],l.parentNode&&l.parentNode.removeChild(l),a&&a.forEach(e=>e(o)),t)return t(o)},f=setTimeout(p.bind(null,void 0,{type:"timeout",target:l}),12e4);l.onerror=p.bind(null,l.onerror),l.onload=p.bind(null,l.onload),c&&document.head.appendChild(l)}},n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),n.j=6344,(()=>{var e;globalThis.importScripts&&(e=globalThis.location+"");var r=globalThis.document;if(!e&&r&&(r.currentScript&&"SCRIPT"===r.currentScript.tagName.toUpperCase()&&(e=r.currentScript.src),!e)){var t=r.getElementsByTagName("script");if(t.length)for(var o=t.length-1;o>-1&&(!e||!/^http(s?):/.test(e));)e=t[o--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),n.p=e})(),(()=>{n.b="undefined"!=typeof document&&document.baseURI||self.location.href;var e={6344:0};n.f.j=(r,t)=>{var o=n.o(e,r)?e[r]:void 0;if(0!==o)if(o)t.push(o[2]);else{var a=new Promise((t,a)=>o=e[r]=[t,a]);t.push(o[2]=a);var i=n.p+n.u(r),l=new Error;n.l(i,t=>{if(n.o(e,r)&&(0!==(o=e[r])&&(e[r]=void 0),o)){var a=t&&("load"===t.type?"missing":t.type),i=t&&t.target&&t.target.src;l.message="Loading chunk "+r+" failed.\n("+a+": "+i+")",l.name="ChunkLoadError",l.type=a,l.request=i,o[1](l)}},"chunk-"+r,r)}},n.O.j=r=>0===e[r];var r=(r,t)=>{var o,a,[i,l,c]=t,d=0;if(i.some(r=>0!==e[r])){for(o in l)n.o(l,o)&&(n.m[o]=l[o]);if(c)var u=c(n)}for(r&&r(t);d<i.length;d++)a=i[d],n.o(e,a)&&e[a]&&e[a][0](),e[a]=0;return n.O(u)},t=globalThis.webpackChunknextcloud_ui_legacy=globalThis.webpackChunknextcloud_ui_legacy||[];t.forEach(r.bind(null,0)),t.push=r.bind(null,t.push.bind(t))})(),n.nc=void 0;var i=n.O(void 0,[4208],()=>n(42716));i=n.O(i)})();
|
||||
//# sourceMappingURL=core-update.js.map?v=72a6e6b45d2c6ad2ba27
|
||||
(()=>{"use strict";var e,r,t,o={42716(e,r,t){var o=t(21777),a=t(81222),n=t(85471);t.nc=(0,o.aV)();const i=(0,n.$V)(()=>Promise.all([t.e(4208),t.e(5037)]).then(t.bind(t,34451))),l=(0,n.$V)(()=>Promise.all([t.e(4208),t.e(428)]).then(t.bind(t,428))),c=(0,a.C)("core","updaterView");new n.Ay({name:"NextcloudUpdater",render:e=>e("adminCli"===c?l:i)}).$mount("#core-updater")}},a={};function n(e){var r=a[e];if(void 0!==r)return r.exports;var t=a[e]={id:e,loaded:!1,exports:{}};return o[e].call(t.exports,t,t.exports,n),t.loaded=!0,t.exports}n.m=o,e=[],n.O=(r,t,o,a)=>{if(!t){var i=1/0;for(u=0;u<e.length;u++){for(var[t,o,a]=e[u],l=!0,c=0;c<t.length;c++)(!1&a||i>=a)&&Object.keys(n.O).every(e=>n.O[e](t[c]))?t.splice(c--,1):(l=!1,a<i&&(i=a));if(l){e.splice(u--,1);var d=o();void 0!==d&&(r=d)}}return r}a=a||0;for(var u=e.length;u>0&&e[u-1][2]>a;u--)e[u]=e[u-1];e[u]=[t,o,a]},n.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return n.d(r,{a:r}),r},n.d=(e,r)=>{for(var t in r)n.o(r,t)&&!n.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},n.f={},n.e=e=>Promise.all(Object.keys(n.f).reduce((r,t)=>(n.f[t](e,r),r),[])),n.u=e=>e+"-"+e+".js?v="+{428:"2532bb7008a9517fee02",5037:"2284e1c30b36bc6e3e0a",5862:"580b9c2e231a9169a12f",6798:"1a6cf42d93801a926a3d",7471:"b4ac70873a3ab192efd0"}[e],n.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),r={},t="nextcloud-ui-legacy:",n.l=(e,o,a,i)=>{if(r[e])r[e].push(o);else{var l,c;if(void 0!==a)for(var d=document.getElementsByTagName("script"),u=0;u<d.length;u++){var s=d[u];if(s.getAttribute("src")==e||s.getAttribute("data-webpack")==t+a){l=s;break}}l||(c=!0,(l=document.createElement("script")).charset="utf-8",n.nc&&l.setAttribute("nonce",n.nc),l.setAttribute("data-webpack",t+a),l.src=e),r[e]=[o];var p=(t,o)=>{l.onerror=l.onload=null,clearTimeout(f);var a=r[e];if(delete r[e],l.parentNode&&l.parentNode.removeChild(l),a&&a.forEach(e=>e(o)),t)return t(o)},f=setTimeout(p.bind(null,void 0,{type:"timeout",target:l}),12e4);l.onerror=p.bind(null,l.onerror),l.onload=p.bind(null,l.onload),c&&document.head.appendChild(l)}},n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),n.j=6344,(()=>{var e;globalThis.importScripts&&(e=globalThis.location+"");var r=globalThis.document;if(!e&&r&&(r.currentScript&&"SCRIPT"===r.currentScript.tagName.toUpperCase()&&(e=r.currentScript.src),!e)){var t=r.getElementsByTagName("script");if(t.length)for(var o=t.length-1;o>-1&&(!e||!/^http(s?):/.test(e));)e=t[o--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),n.p=e})(),(()=>{n.b="undefined"!=typeof document&&document.baseURI||self.location.href;var e={6344:0};n.f.j=(r,t)=>{var o=n.o(e,r)?e[r]:void 0;if(0!==o)if(o)t.push(o[2]);else{var a=new Promise((t,a)=>o=e[r]=[t,a]);t.push(o[2]=a);var i=n.p+n.u(r),l=new Error;n.l(i,t=>{if(n.o(e,r)&&(0!==(o=e[r])&&(e[r]=void 0),o)){var a=t&&("load"===t.type?"missing":t.type),i=t&&t.target&&t.target.src;l.message="Loading chunk "+r+" failed.\n("+a+": "+i+")",l.name="ChunkLoadError",l.type=a,l.request=i,o[1](l)}},"chunk-"+r,r)}},n.O.j=r=>0===e[r];var r=(r,t)=>{var o,a,[i,l,c]=t,d=0;if(i.some(r=>0!==e[r])){for(o in l)n.o(l,o)&&(n.m[o]=l[o]);if(c)var u=c(n)}for(r&&r(t);d<i.length;d++)a=i[d],n.o(e,a)&&e[a]&&e[a][0](),e[a]=0;return n.O(u)},t=globalThis.webpackChunknextcloud_ui_legacy=globalThis.webpackChunknextcloud_ui_legacy||[];t.forEach(r.bind(null,0)),t.push=r.bind(null,t.push.bind(t))})(),n.nc=void 0;var i=n.O(void 0,[4208],()=>n(42716));i=n.O(i)})();
|
||||
//# sourceMappingURL=core-update.js.map?v=ef885a45a81346b7bbc6
|
||||
2
dist/core-update.js.map
vendored
2
dist/core-update.js.map
vendored
File diff suppressed because one or more lines are too long
|
|
@ -1485,6 +1485,7 @@ return array(
|
|||
'OC\\Core\\Controller\\TwoFactorChallengeController' => $baseDir . '/core/Controller/TwoFactorChallengeController.php',
|
||||
'OC\\Core\\Controller\\UnifiedSearchController' => $baseDir . '/core/Controller/UnifiedSearchController.php',
|
||||
'OC\\Core\\Controller\\UnsupportedBrowserController' => $baseDir . '/core/Controller/UnsupportedBrowserController.php',
|
||||
'OC\\Core\\Controller\\UpdateController' => $baseDir . '/core/Controller/UpdateController.php',
|
||||
'OC\\Core\\Controller\\UserController' => $baseDir . '/core/Controller/UserController.php',
|
||||
'OC\\Core\\Controller\\WalledGardenController' => $baseDir . '/core/Controller/WalledGardenController.php',
|
||||
'OC\\Core\\Controller\\WebAuthnController' => $baseDir . '/core/Controller/WebAuthnController.php',
|
||||
|
|
|
|||
|
|
@ -1526,6 +1526,7 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2
|
|||
'OC\\Core\\Controller\\TwoFactorChallengeController' => __DIR__ . '/../../..' . '/core/Controller/TwoFactorChallengeController.php',
|
||||
'OC\\Core\\Controller\\UnifiedSearchController' => __DIR__ . '/../../..' . '/core/Controller/UnifiedSearchController.php',
|
||||
'OC\\Core\\Controller\\UnsupportedBrowserController' => __DIR__ . '/../../..' . '/core/Controller/UnsupportedBrowserController.php',
|
||||
'OC\\Core\\Controller\\UpdateController' => __DIR__ . '/../../..' . '/core/Controller/UpdateController.php',
|
||||
'OC\\Core\\Controller\\UserController' => __DIR__ . '/../../..' . '/core/Controller/UserController.php',
|
||||
'OC\\Core\\Controller\\WalledGardenController' => __DIR__ . '/../../..' . '/core/Controller/WalledGardenController.php',
|
||||
'OC\\Core\\Controller\\WebAuthnController' => __DIR__ . '/../../..' . '/core/Controller/WebAuthnController.php',
|
||||
|
|
|
|||
24
ocs/v1.php
24
ocs/v1.php
|
|
@ -28,15 +28,15 @@ use Psr\Log\LoggerInterface;
|
|||
use Symfony\Component\Routing\Exception\MethodNotAllowedException;
|
||||
use Symfony\Component\Routing\Exception\ResourceNotFoundException;
|
||||
|
||||
if (Util::needUpgrade()
|
||||
|| Server::get(IConfig::class)->getSystemValueBool('maintenance')) {
|
||||
$request = Server::get(IRequest::class);
|
||||
|
||||
if ((Util::needUpgrade() || Server::get(IConfig::class)->getSystemValueBool('maintenance')) && $request->getPathInfo() !== '/core/update') {
|
||||
// since the behavior of apps or remotes are unpredictable during
|
||||
// an upgrade, return a 503 directly
|
||||
ApiHelper::respond(503, 'Service unavailable', ['X-Nextcloud-Maintenance-Mode' => '1'], 503);
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Try the appframework routes
|
||||
*/
|
||||
|
|
@ -46,16 +46,18 @@ try {
|
|||
$appManager->loadApps(['authentication']);
|
||||
$appManager->loadApps(['extended_authentication']);
|
||||
|
||||
// load all apps to get all api routes properly setup
|
||||
// FIXME: this should ideally appear after handleLogin but will cause
|
||||
// side effects in existing apps
|
||||
$appManager->loadApps();
|
||||
|
||||
$request = Server::get(IRequest::class);
|
||||
$request->throwDecodingExceptionIfAny();
|
||||
|
||||
if (!Server::get(IUserSession::class)->isLoggedIn()) {
|
||||
OC::handleLogin($request);
|
||||
if ($request->getPathInfo() !== '/core/update') {
|
||||
// load all apps to get all api routes properly setup
|
||||
// FIXME: this should ideally appear after handleLogin but will cause
|
||||
// side effects in existing apps
|
||||
$appManager->loadApps();
|
||||
if (!Server::get(IUserSession::class)->isLoggedIn()) {
|
||||
OC::handleLogin($request);
|
||||
}
|
||||
} else {
|
||||
$appManager->loadApps(['core']);
|
||||
}
|
||||
|
||||
Server::get(Router::class)->match('/ocsapp' . $request->getRawPathInfo());
|
||||
|
|
|
|||
Loading…
Reference in a new issue