Skip to content

Commit

Permalink
fix: decomission apps templateeditor and extract
Browse files Browse the repository at this point in the history
  • Loading branch information
DeepDiver1975 committed Jan 31, 2024
1 parent 199492c commit ab40f54
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 9 deletions.
3 changes: 3 additions & 0 deletions changelog/unreleased/41168
@@ -0,0 +1,3 @@
Bugfix: decommission of templateeditor and extract apps

https://github.com/owncloud/core/pull/41168
29 changes: 29 additions & 0 deletions core/Migrations/Version20240131000000.php
@@ -0,0 +1,29 @@
<?php
namespace OC\Core\Migrations;

use OCP\Migration\ISimpleMigration;
use OCP\Migration\IOutput;

/**
* Disable templateeditor and extract apps during the upgrade to 10.14.0
*/
class Version20240131000000 implements ISimpleMigration {
/**
* @param IOutput $out
*/
public function run(IOutput $out) {
if (!\OC::$server->getSystemConfig()->getValue('installed', false)) {
// Do nothing if ownCloud isn't installed yet (initial installation)
return;
}

$appManager = \OC::$server->getAppManager();
$apps_to_disable = ['templateeditor', 'extract'];
foreach ($apps_to_disable as $app) {
if ($appManager->isInstalled($app)) {
$appManager->disableApp($app);
$out->warning("The $app app is deprecated and obsolete. It has been disabled.");
}
}
}
}
16 changes: 16 additions & 0 deletions lib/private/App/AppManager.php
Expand Up @@ -92,6 +92,12 @@ class AppManager implements IAppManager {
*/
private $appDirs = [];

private $outdated_apps = [
'enterprise_key' => 'It is not used from core 10.5.0 onwards.',
'templateeditor' => 'Discontinued - please use a theme to change mail templates.',
'extract' => 'Unmaintained.',
];

/**
* @param IUserSession $userSession
* @param IAppConfig $appConfig
Expand Down Expand Up @@ -263,6 +269,16 @@ public function enableApp($appId) {
if ($this->getAppPath($appId) === false) {
throw new \Exception("$appId can't be enabled since it is not installed.");
}
// disallow activation of outdated apps
// Since core 10.5.0, enterprise_key app is no longer used
// Be sure not to accidentally enable it if it has been
// left behind in an apps dir.
if(isset($this->outdated_apps[$appId])) {
$hint = $this->outdated_apps[$appId];
throw new \Exception(
"App $appId can't be enabled. $hint"
);
}

if (!Installer::isInstalled($appId)) {
Installer::installShippedApp($appId);
Expand Down
9 changes: 0 additions & 9 deletions lib/private/legacy/app.php
Expand Up @@ -384,15 +384,6 @@ public static function isEnabled($app) {
* This function set an app as enabled in appconfig.
*/
public static function enable($app, $groups = null) {
// Since core 10.5.0, enterprise_key app is no longer used
// Be sure not to accidentally enable it if it has been
// left behind in an apps dir.
if ($app === 'enterprise_key') {
throw new \Exception(
"App $app can't be enabled. It is not used from core 10.5.0 onwards."
);
}

self::$enabledAppsCache = []; // flush

// check for required dependencies
Expand Down

0 comments on commit ab40f54

Please sign in to comment.