Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion lib/private/App/AppManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -1042,6 +1042,27 @@ public function cleanAppId(string $app): string {
return $cleanAppId;
}

/**
* Read app types from info.xml and cache them in the database
*/
public function setAppTypes(string $app, array $appData): void {
if (isset($appData['types'])) {
$appTypes = implode(',', $appData['types']);
} else {
$appTypes = '';
$appData['types'] = [];
}

$this->config->setAppValue($app, 'types', $appTypes);

if ($this->hasProtectedAppType($appData['types'])) {
$enabled = $this->config->getAppValue($app, 'enabled', 'yes');
if ($enabled !== 'yes' && $enabled !== 'no') {
$this->config->setAppValue($app, 'enabled', 'yes');
}
}
}

/**
* Run upgrade tasks for an app after the code has already been updated
*
Expand Down Expand Up @@ -1099,7 +1120,7 @@ public function upgradeApp(string $appId): bool {
$this->config->setAppValue('core', 'public_' . $name, $appId . '/' . $path);
}

\OC_App::setAppTypes($appId);
$this->setAppTypes($appId, $appData);

$version = $this->getAppVersion($appId);
$this->config->setAppValue($appId, 'installed_version', $version);
Expand Down
6 changes: 3 additions & 3 deletions lib/private/Installer.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
namespace OC;

use Doctrine\DBAL\Exception\TableExistsException;
use OC\App\AppManager;
use OC\App\AppStore\AppNotFoundException;
use OC\App\AppStore\Bundles\Bundle;
use OC\App\AppStore\Fetcher\AppFetcher;
Expand All @@ -19,7 +20,6 @@
use OC\DB\MigrationService;
use OC\Files\FilenameValidator;
use OCP\App\AppPathNotFoundException;
use OCP\App\IAppManager;
use OCP\BackgroundJob\IJobList;
use OCP\Files;
use OCP\HintException;
Expand All @@ -46,7 +46,7 @@ public function __construct(
private ITempManager $tempManager,
private LoggerInterface $logger,
private IConfig $config,
private IAppManager $appManager,
private AppManager $appManager,
private IFactory $l10nFactory,
private bool $isCLI,
) {
Expand Down Expand Up @@ -583,7 +583,7 @@ private function installAppLastSteps(string $appPath, array $info, ?IOutput $out
$this->config->setAppValue('core', 'public_' . $name, $info['id'] . '/' . $path);
}

\OC_App::setAppTypes($info['id']);
$this->appManager->setAppTypes($info['id'], $info);

return $info['id'];
}
Expand Down
28 changes: 0 additions & 28 deletions lib/private/legacy/OC_App.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,34 +136,6 @@ public static function isType(string $app, array $types): bool {
return Server::get(IAppManager::class)->isType($app, $types);
}

/**
* read app types from info.xml and cache them in the database
*/
public static function setAppTypes(string $app): void {
$appManager = Server::get(IAppManager::class);
$appData = $appManager->getAppInfo($app);
if (!is_array($appData)) {
return;
}

if (isset($appData['types'])) {
$appTypes = implode(',', $appData['types']);
} else {
$appTypes = '';
$appData['types'] = [];
}

$config = Server::get(IConfig::class);
$config->setAppValue($app, 'types', $appTypes);

if ($appManager->hasProtectedAppType($appData['types'])) {
$enabled = $config->getAppValue($app, 'enabled', 'yes');
if ($enabled !== 'yes' && $enabled !== 'no') {
$config->setAppValue($app, 'enabled', 'yes');
}
}
}

/**
* Returns apps enabled for the current user.
*
Expand Down
Loading