mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
feat(lexicon): migrate keys on app update
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
This commit is contained in:
parent
d5e487078a
commit
3d3c77b774
3 changed files with 14 additions and 11 deletions
|
|
@ -28,6 +28,7 @@ use OCP\INavigationManager;
|
|||
use OCP\IURLGenerator;
|
||||
use OCP\IUser;
|
||||
use OCP\IUserSession;
|
||||
use OCP\Server;
|
||||
use OCP\ServerVersion;
|
||||
use OCP\Settings\IManager as ISettingsManager;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
|
@ -88,7 +89,7 @@ class AppManager implements IAppManager {
|
|||
|
||||
private function getNavigationManager(): INavigationManager {
|
||||
if ($this->navigationManager === null) {
|
||||
$this->navigationManager = \OCP\Server::get(INavigationManager::class);
|
||||
$this->navigationManager = Server::get(INavigationManager::class);
|
||||
}
|
||||
return $this->navigationManager;
|
||||
}
|
||||
|
|
@ -114,7 +115,7 @@ class AppManager implements IAppManager {
|
|||
if (!$this->config->getSystemValueBool('installed', false)) {
|
||||
throw new \Exception('Nextcloud is not installed yet, AppConfig is not available');
|
||||
}
|
||||
$this->appConfig = \OCP\Server::get(AppConfig::class);
|
||||
$this->appConfig = Server::get(AppConfig::class);
|
||||
return $this->appConfig;
|
||||
}
|
||||
|
||||
|
|
@ -125,7 +126,7 @@ class AppManager implements IAppManager {
|
|||
if (!$this->config->getSystemValueBool('installed', false)) {
|
||||
throw new \Exception('Nextcloud is not installed yet, AppConfig is not available');
|
||||
}
|
||||
$this->urlGenerator = \OCP\Server::get(IURLGenerator::class);
|
||||
$this->urlGenerator = Server::get(IURLGenerator::class);
|
||||
return $this->urlGenerator;
|
||||
}
|
||||
|
||||
|
|
@ -460,7 +461,7 @@ class AppManager implements IAppManager {
|
|||
]);
|
||||
}
|
||||
|
||||
$coordinator = \OCP\Server::get(Coordinator::class);
|
||||
$coordinator = Server::get(Coordinator::class);
|
||||
$coordinator->bootApp($app);
|
||||
|
||||
$eventLogger->start("bootstrap:load_app:$app:info", "Load info.xml for $app and register any services defined in it");
|
||||
|
|
@ -570,7 +571,7 @@ class AppManager implements IAppManager {
|
|||
));
|
||||
$this->clearAppsCache();
|
||||
|
||||
\OCP\Server::get(ConfigManager::class)->migrateConfigLexiconKeys($appId);
|
||||
Server::get(ConfigManager::class)->migrateConfigLexiconKeys($appId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -630,7 +631,7 @@ class AppManager implements IAppManager {
|
|||
));
|
||||
$this->clearAppsCache();
|
||||
|
||||
\OCP\Server::get(ConfigManager::class)->migrateConfigLexiconKeys($appId);
|
||||
Server::get(ConfigManager::class)->migrateConfigLexiconKeys($appId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ declare(strict_types=1);
|
|||
use OC\App\DependencyAnalyzer;
|
||||
use OC\App\Platform;
|
||||
use OC\AppFramework\Bootstrap\Coordinator;
|
||||
use OC\Config\ConfigManager;
|
||||
use OC\DB\MigrationService;
|
||||
use OC\Installer;
|
||||
use OC\Repair;
|
||||
|
|
@ -714,6 +715,9 @@ class OC_App {
|
|||
$version = \OCP\Server::get(\OCP\App\IAppManager::class)->getAppVersion($appId);
|
||||
\OC::$server->getConfig()->setAppValue($appId, 'installed_version', $version);
|
||||
|
||||
// migrate eventual new config keys in the process
|
||||
Server::get(ConfigManager::class)->migrateConfigLexiconKeys($appId);
|
||||
|
||||
\OC::$server->get(IEventDispatcher::class)->dispatchTyped(new AppUpdateEvent($appId));
|
||||
\OC::$server->get(IEventDispatcher::class)->dispatch(ManagerEvent::EVENT_APP_UPDATE, new ManagerEvent(
|
||||
ManagerEvent::EVENT_APP_UPDATE, $appId
|
||||
|
|
|
|||
|
|
@ -16,15 +16,13 @@ use OCP\EventDispatcher\Event;
|
|||
* @since 27.0.0
|
||||
*/
|
||||
class AppUpdateEvent extends Event {
|
||||
private string $appId;
|
||||
|
||||
/**
|
||||
* @since 27.0.0
|
||||
*/
|
||||
public function __construct(string $appId) {
|
||||
public function __construct(
|
||||
private readonly string $appId,
|
||||
) {
|
||||
parent::__construct();
|
||||
|
||||
$this->appId = $appId;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue