Merge pull request #20602 from owncloud/fix-installed-apps
Always installed apps includes the hardcoded ones from shipped.json
This commit is contained in:
commit
8fe878afe9
|
@ -77,6 +77,12 @@ class AppManager implements IAppManager {
|
||||||
private function getInstalledAppsValues() {
|
private function getInstalledAppsValues() {
|
||||||
if (!$this->installedAppsCache) {
|
if (!$this->installedAppsCache) {
|
||||||
$values = $this->appConfig->getValues(false, 'enabled');
|
$values = $this->appConfig->getValues(false, 'enabled');
|
||||||
|
|
||||||
|
$alwaysEnabledApps = $this->getAlwaysEnabledApps();
|
||||||
|
foreach($alwaysEnabledApps as $appId) {
|
||||||
|
$values[$appId] = 'yes';
|
||||||
|
}
|
||||||
|
|
||||||
$this->installedAppsCache = array_filter($values, function ($value) {
|
$this->installedAppsCache = array_filter($values, function ($value) {
|
||||||
return $value !== 'no';
|
return $value !== 'no';
|
||||||
});
|
});
|
||||||
|
|
|
@ -306,6 +306,7 @@ class Test_App extends \Test\TestCase {
|
||||||
'app3',
|
'app3',
|
||||||
'appforgroup1',
|
'appforgroup1',
|
||||||
'appforgroup12',
|
'appforgroup12',
|
||||||
|
'dav',
|
||||||
),
|
),
|
||||||
false
|
false
|
||||||
),
|
),
|
||||||
|
@ -318,6 +319,7 @@ class Test_App extends \Test\TestCase {
|
||||||
'app3',
|
'app3',
|
||||||
'appforgroup12',
|
'appforgroup12',
|
||||||
'appforgroup2',
|
'appforgroup2',
|
||||||
|
'dav',
|
||||||
),
|
),
|
||||||
false
|
false
|
||||||
),
|
),
|
||||||
|
@ -331,6 +333,7 @@ class Test_App extends \Test\TestCase {
|
||||||
'appforgroup1',
|
'appforgroup1',
|
||||||
'appforgroup12',
|
'appforgroup12',
|
||||||
'appforgroup2',
|
'appforgroup2',
|
||||||
|
'dav',
|
||||||
),
|
),
|
||||||
false
|
false
|
||||||
),
|
),
|
||||||
|
@ -344,6 +347,7 @@ class Test_App extends \Test\TestCase {
|
||||||
'appforgroup1',
|
'appforgroup1',
|
||||||
'appforgroup12',
|
'appforgroup12',
|
||||||
'appforgroup2',
|
'appforgroup2',
|
||||||
|
'dav',
|
||||||
),
|
),
|
||||||
false,
|
false,
|
||||||
),
|
),
|
||||||
|
@ -357,6 +361,7 @@ class Test_App extends \Test\TestCase {
|
||||||
'appforgroup1',
|
'appforgroup1',
|
||||||
'appforgroup12',
|
'appforgroup12',
|
||||||
'appforgroup2',
|
'appforgroup2',
|
||||||
|
'dav',
|
||||||
),
|
),
|
||||||
true,
|
true,
|
||||||
),
|
),
|
||||||
|
@ -434,11 +439,11 @@ class Test_App extends \Test\TestCase {
|
||||||
);
|
);
|
||||||
|
|
||||||
$apps = \OC_App::getEnabledApps(true);
|
$apps = \OC_App::getEnabledApps(true);
|
||||||
$this->assertEquals(array('files', 'app3'), $apps);
|
$this->assertEquals(array('files', 'app3', 'dav'), $apps);
|
||||||
|
|
||||||
// mock should not be called again here
|
// mock should not be called again here
|
||||||
$apps = \OC_App::getEnabledApps(false);
|
$apps = \OC_App::getEnabledApps(false);
|
||||||
$this->assertEquals(array('files', 'app3'), $apps);
|
$this->assertEquals(array('files', 'app3', 'dav'), $apps);
|
||||||
|
|
||||||
$this->restoreAppConfig();
|
$this->restoreAppConfig();
|
||||||
\OC_User::setUserId(null);
|
\OC_User::setUserId(null);
|
||||||
|
|
|
@ -188,7 +188,7 @@ class Manager extends \PHPUnit_Framework_TestCase {
|
||||||
$this->appConfig->setValue('test1', 'enabled', 'yes');
|
$this->appConfig->setValue('test1', 'enabled', 'yes');
|
||||||
$this->appConfig->setValue('test2', 'enabled', 'no');
|
$this->appConfig->setValue('test2', 'enabled', 'no');
|
||||||
$this->appConfig->setValue('test3', 'enabled', '["foo"]');
|
$this->appConfig->setValue('test3', 'enabled', '["foo"]');
|
||||||
$this->assertEquals(['test1', 'test3'], $this->manager->getInstalledApps());
|
$this->assertEquals(['dav', 'files', 'test1', 'test3'], $this->manager->getInstalledApps());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetAppsForUser() {
|
public function testGetAppsForUser() {
|
||||||
|
@ -202,7 +202,7 @@ class Manager extends \PHPUnit_Framework_TestCase {
|
||||||
$this->appConfig->setValue('test2', 'enabled', 'no');
|
$this->appConfig->setValue('test2', 'enabled', 'no');
|
||||||
$this->appConfig->setValue('test3', 'enabled', '["foo"]');
|
$this->appConfig->setValue('test3', 'enabled', '["foo"]');
|
||||||
$this->appConfig->setValue('test4', 'enabled', '["asd"]');
|
$this->appConfig->setValue('test4', 'enabled', '["asd"]');
|
||||||
$this->assertEquals(['test1', 'test3'], $this->manager->getEnabledAppsForUser($user));
|
$this->assertEquals(['dav', 'files', 'test1', 'test3'], $this->manager->getEnabledAppsForUser($user));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetAppsNeedingUpgrade() {
|
public function testGetAppsNeedingUpgrade() {
|
||||||
|
@ -212,6 +212,8 @@ class Manager extends \PHPUnit_Framework_TestCase {
|
||||||
->getMock();
|
->getMock();
|
||||||
|
|
||||||
$appInfos = [
|
$appInfos = [
|
||||||
|
'dav' => ['id' => 'dav'],
|
||||||
|
'files' => ['id' => 'files'],
|
||||||
'test1' => ['id' => 'test1', 'version' => '1.0.1', 'requiremax' => '9.0.0'],
|
'test1' => ['id' => 'test1', 'version' => '1.0.1', 'requiremax' => '9.0.0'],
|
||||||
'test2' => ['id' => 'test2', 'version' => '1.0.0', 'requiremin' => '8.2.0'],
|
'test2' => ['id' => 'test2', 'version' => '1.0.0', 'requiremin' => '8.2.0'],
|
||||||
'test3' => ['id' => 'test3', 'version' => '1.2.4', 'requiremin' => '9.0.0'],
|
'test3' => ['id' => 'test3', 'version' => '1.2.4', 'requiremin' => '9.0.0'],
|
||||||
|
@ -250,6 +252,8 @@ class Manager extends \PHPUnit_Framework_TestCase {
|
||||||
->getMock();
|
->getMock();
|
||||||
|
|
||||||
$appInfos = [
|
$appInfos = [
|
||||||
|
'dav' => ['id' => 'dav'],
|
||||||
|
'files' => ['id' => 'files'],
|
||||||
'test1' => ['id' => 'test1', 'version' => '1.0.1', 'requiremax' => '8.0.0'],
|
'test1' => ['id' => 'test1', 'version' => '1.0.1', 'requiremax' => '8.0.0'],
|
||||||
'test2' => ['id' => 'test2', 'version' => '1.0.0', 'requiremin' => '8.2.0'],
|
'test2' => ['id' => 'test2', 'version' => '1.0.0', 'requiremin' => '8.2.0'],
|
||||||
'test3' => ['id' => 'test3', 'version' => '1.2.4', 'requiremin' => '9.0.0'],
|
'test3' => ['id' => 'test3', 'version' => '1.2.4', 'requiremin' => '9.0.0'],
|
||||||
|
|
Loading…
Reference in New Issue