diff options
-rw-r--r-- | apps/files_sharing/lib/External/Scanner.php | 2 | ||||
-rw-r--r-- | apps/settings/lib/Controller/CheckSetupController.php | 73 | ||||
-rw-r--r-- | apps/settings/tests/Controller/CheckSetupControllerTest.php | 15 | ||||
-rw-r--r-- | core/Application.php | 3 | ||||
-rw-r--r-- | core/Command/Db/AddMissingIndices.php | 13 | ||||
-rw-r--r-- | core/Migrations/Version13000Date20170718121200.php | 1 | ||||
-rw-r--r-- | core/js/setupchecks.js | 18 | ||||
-rw-r--r-- | core/js/tests/specs/setupchecksSpec.js | 112 | ||||
-rw-r--r-- | lib/private/Installer.php | 9 |
9 files changed, 103 insertions, 143 deletions
diff --git a/apps/files_sharing/lib/External/Scanner.php b/apps/files_sharing/lib/External/Scanner.php index 8115159d181..54d5a33d517 100644 --- a/apps/files_sharing/lib/External/Scanner.php +++ b/apps/files_sharing/lib/External/Scanner.php @@ -37,7 +37,7 @@ class Scanner extends \OC\Files\Cache\Scanner { /** {@inheritDoc} */ public function scan($path, $recursive = self::SCAN_RECURSIVE, $reuse = -1, $lock = true) { if (!$this->storage->remoteIsOwnCloud()) { - return parent::scan($path, $recursive, $recursive, $lock); + return parent::scan($path, $recursive, $reuse, $lock); } $this->scanAll(); diff --git a/apps/settings/lib/Controller/CheckSetupController.php b/apps/settings/lib/Controller/CheckSetupController.php index f29b585da68..78874fd02b0 100644 --- a/apps/settings/lib/Controller/CheckSetupController.php +++ b/apps/settings/lib/Controller/CheckSetupController.php @@ -25,6 +25,7 @@ * @author timm2k <timm2k@gmx.de> * @author Timo Förster <tfoerster@webfoersterei.de> * @author Valdnet <47037905+Valdnet@users.noreply.github.com> + * @author MichaIng <micha@dietpi.com> * * @license AGPL-3.0 * @@ -238,7 +239,7 @@ class CheckSetupController extends Controller { } /** - * Check if the used SSL lib is outdated. Older OpenSSL and NSS versions do + * Check if the used SSL lib is outdated. Older OpenSSL and NSS versions do * have multiple bugs which likely lead to problems in combination with * functionality required by ownCloud such as SNI. * @@ -450,31 +451,61 @@ Raw output } /** - * Checks whether a PHP opcache is properly set up - * @return bool + * Checks whether a PHP OPcache is properly set up + * @return string[] The list of OPcache setup recommendations */ - protected function isOpcacheProperlySetup() { - if (!$this->iniGetWrapper->getBool('opcache.enable')) { - return false; + protected function getOpcacheSetupRecommendations(): array { + // If the module is not loaded, return directly to skip inapplicable checks + if (!extension_loaded('Zend OPcache')) { + return ['The PHP OPcache module is not loaded. <a target="_blank" rel="noreferrer noopener" class="external" href="' . $this->urlGenerator->linkToDocs('admin-php-opcache') . '">For better performance it is recommended</a> to load it into your PHP installation.']; } - if (!$this->iniGetWrapper->getBool('opcache.save_comments')) { - return false; - } + $recommendations = []; - if ($this->iniGetWrapper->getNumeric('opcache.max_accelerated_files') < 10000) { - return false; + // Check whether Nextcloud is allowed to use the OPcache API + $isPermitted = true; + $permittedPath = $this->iniGetWrapper->getString('opcache.restrict_api'); + if (isset($permittedPath) && $permittedPath !== '' && !str_starts_with(\OC::$SERVERROOT, $permittedPath)) { + $isPermitted = false; } - if ($this->iniGetWrapper->getNumeric('opcache.memory_consumption') < 128) { - return false; - } + if (!$this->iniGetWrapper->getBool('opcache.enable')) { + $recommendations[] = 'OPcache is disabled. For better performance, it is recommended to apply <code>opcache.enable=1</code> to your PHP configuration.'; - if ($this->iniGetWrapper->getNumeric('opcache.interned_strings_buffer') < 8) { - return false; + // Check for saved comments only when OPcache is currently disabled. If it was enabled, opcache.save_comments=0 would break Nextcloud in the first place. + if (!$this->iniGetWrapper->getBool('opcache.save_comments')) { + $recommendations[] = 'OPcache is configured to remove code comments. With OPcache enabled, <code>opcache.save_comments=1</code> must be set for Nextcloud to function.'; + } + + if (!$isPermitted) { + $recommendations[] = 'Nextcloud is not allowed to use the OPcache API. With OPcache enabled, it is highly recommended to include all Nextcloud directories with <code>opcache.restrict_api</code> or unset this setting to disable OPcache API restrictions, to prevent errors during Nextcloud core or app upgrades.'; + } + } elseif (!$isPermitted) { + $recommendations[] = 'Nextcloud is not allowed to use the OPcache API. It is highly recommended to include all Nextcloud directories with <code>opcache.restrict_api</code> or unset this setting to disable OPcache API restrictions, to prevent errors during Nextcloud core or app upgrades.'; + } else { + // Check whether opcache_get_status has been explicitly disabled an in case skip usage based checks + $disabledFunctions = $this->iniGetWrapper->getString('disable_functions'); + if (isset($disabledFunctions) && str_contains($disabledFunctions, 'opcache_get_status')) { + return []; + } + + $status = opcache_get_status(false); + + // Recommend to raise value, if more than 90% of max value is reached + if ($status['opcache_statistics']['num_cached_keys'] / $status['opcache_statistics']['max_cached_keys'] > 0.9) { + $recommendations[] = 'The maximum number of OPcache keys is nearly exceeded. To assure that all scripts can be hold in cache, it is recommended to apply <code>opcache.max_accelerated_files</code> to your PHP configuration with a value higher than <code>' . ($this->iniGetWrapper->getNumeric('opcache.max_accelerated_files') ?: 'currently') . '</code>.'; + } + + if ($status['memory_usage']['used_memory'] / $status['memory_usage']['free_memory'] > 9) { + $recommendations[] = 'The OPcache buffer is nearly full. To assure that all scripts can be hold in cache, it is recommended to apply <code>opcache.memory_consumption</code> to your PHP configuration with a value higher than <code>' . ($this->iniGetWrapper->getNumeric('opcache.memory_consumption') ?: 'currently') . '</code>.'; + } + + if ($status['interned_strings_usage']['used_memory'] / $status['interned_strings_usage']['free_memory'] > 9) { + $recommendations[] = 'The OPcache interned strings buffer is nearly full. To assure that repeating strings can be effectively cached, it is recommended to apply <code>opcache.interned_strings_buffer</code> to your PHP configuration with a value higher than <code>' . ($this->iniGetWrapper->getNumeric('opcache.interned_strings_buffer') ?: 'currently') . '</code>.'; + } } - return true; + return $recommendations; } /** @@ -574,10 +605,6 @@ Raw output return []; } - protected function hasOpcacheLoaded(): bool { - return extension_loaded('Zend OPcache'); - } - private function isTemporaryDirectoryWritable(): bool { try { if (!empty($this->tempManager->getTempBaseDir())) { @@ -791,9 +818,7 @@ Raw output 'isCorrectMemcachedPHPModuleInstalled' => $this->isCorrectMemcachedPHPModuleInstalled(), 'hasPassedCodeIntegrityCheck' => $this->checker->hasPassedCheck(), 'codeIntegrityCheckerDocumentation' => $this->urlGenerator->linkToDocs('admin-code-integrity'), - 'isOpcacheProperlySetup' => $this->isOpcacheProperlySetup(), - 'hasOpcacheLoaded' => $this->hasOpcacheLoaded(), - 'phpOpcacheDocumentation' => $this->urlGenerator->linkToDocs('admin-php-opcache'), + 'OpcacheSetupRecommendations' => $this->getOpcacheSetupRecommendations(), 'isSettimelimitAvailable' => $this->isSettimelimitAvailable(), 'hasFreeTypeSupport' => $this->hasFreeTypeSupport(), 'missingPrimaryKeys' => $this->hasMissingPrimaryKeys(), diff --git a/apps/settings/tests/Controller/CheckSetupControllerTest.php b/apps/settings/tests/Controller/CheckSetupControllerTest.php index 612a04d7d62..d54c1bb226a 100644 --- a/apps/settings/tests/Controller/CheckSetupControllerTest.php +++ b/apps/settings/tests/Controller/CheckSetupControllerTest.php @@ -179,13 +179,12 @@ class CheckSetupControllerTest extends TestCase { 'getSuggestedOverwriteCliURL', 'getCurlVersion', 'isPhpOutdated', - 'isOpcacheProperlySetup', + 'getOpcacheSetupRecommendations', 'hasFreeTypeSupport', 'hasMissingIndexes', 'hasMissingPrimaryKeys', 'isSqliteUsed', 'isPHPMailerUsed', - 'hasOpcacheLoaded', 'getAppDirsWithDifferentOwner', 'hasRecommendedPHPModules', 'hasBigIntConversionPendingColumns', @@ -479,8 +478,8 @@ class CheckSetupControllerTest extends TestCase { ->willReturn(true); $this->checkSetupController ->expects($this->once()) - ->method('isOpcacheProperlySetup') - ->willReturn(false); + ->method('getOpcacheSetupRecommendations') + ->willReturn(['recommendation1', 'recommendation2']); $this->checkSetupController ->method('hasFreeTypeSupport') ->willReturn(false); @@ -507,10 +506,6 @@ class CheckSetupControllerTest extends TestCase { ->willReturn(true); $this->checkSetupController ->expects($this->once()) - ->method('hasOpcacheLoaded') - ->willReturn(true); - $this->checkSetupController - ->expects($this->once()) ->method('hasWorkingFileLocking') ->willReturn(true); $this->checkSetupController @@ -624,9 +619,7 @@ class CheckSetupControllerTest extends TestCase { 'isCorrectMemcachedPHPModuleInstalled' => true, 'hasPassedCodeIntegrityCheck' => true, 'codeIntegrityCheckerDocumentation' => 'http://docs.example.org/server/go.php?to=admin-code-integrity', - 'isOpcacheProperlySetup' => false, - 'hasOpcacheLoaded' => true, - 'phpOpcacheDocumentation' => 'http://docs.example.org/server/go.php?to=admin-php-opcache', + 'OpcacheSetupRecommendations' => ['recommendation1', 'recommendation2'], 'isSettimelimitAvailable' => true, 'hasFreeTypeSupport' => false, 'isSqliteUsed' => false, diff --git a/core/Application.php b/core/Application.php index 4e36d59baac..0f363f8c699 100644 --- a/core/Application.php +++ b/core/Application.php @@ -195,6 +195,9 @@ class Application extends App { if (!$table->hasIndex('properties_path_index')) { $subject->addHintForMissingSubject($table->getName(), 'properties_path_index'); } + if (!$table->hasIndex('properties_pathonly_index')) { + $subject->addHintForMissingSubject($table->getName(), 'properties_pathonly_index'); + } } if ($schema->hasTable('jobs')) { diff --git a/core/Command/Db/AddMissingIndices.php b/core/Command/Db/AddMissingIndices.php index 57fa49149f6..4c86a8705db 100644 --- a/core/Command/Db/AddMissingIndices.php +++ b/core/Command/Db/AddMissingIndices.php @@ -316,11 +316,24 @@ class AddMissingIndices extends Command { $output->writeln('<info>Check indices of the oc_properties table.</info>'); if ($schema->hasTable('properties')) { $table = $schema->getTable('properties'); + $propertiesUpdated = false; + if (!$table->hasIndex('properties_path_index')) { $output->writeln('<info>Adding properties_path_index index to the oc_properties table, this can take some time...</info>'); $table->addIndex(['userid', 'propertypath'], 'properties_path_index'); $this->connection->migrateToSchema($schema->getWrappedSchema()); + $propertiesUpdated = true; + } + if (!$table->hasIndex('properties_pathonly_index')) { + $output->writeln('<info>Adding properties_pathonly_index index to the oc_properties table, this can take some time...</info>'); + + $table->addIndex(['propertypath'], 'properties_pathonly_index'); + $this->connection->migrateToSchema($schema->getWrappedSchema()); + $propertiesUpdated = true; + } + + if ($propertiesUpdated) { $updated = true; $output->writeln('<info>oc_properties table updated successfully.</info>'); } diff --git a/core/Migrations/Version13000Date20170718121200.php b/core/Migrations/Version13000Date20170718121200.php index 3d97ee1de39..02864830b2c 100644 --- a/core/Migrations/Version13000Date20170718121200.php +++ b/core/Migrations/Version13000Date20170718121200.php @@ -363,6 +363,7 @@ class Version13000Date20170718121200 extends SimpleMigrationStep { $table->setPrimaryKey(['id']); $table->addIndex(['userid'], 'property_index'); $table->addIndex(['userid', 'propertypath'], 'properties_path_index'); + $table->addIndex(['propertypath'], 'properties_pathonly_index'); } else { $table = $schema->getTable('properties'); if ($table->hasColumn('propertytype')) { diff --git a/core/js/setupchecks.js b/core/js/setupchecks.js index f5f48fdf384..59411d67b99 100644 --- a/core/js/setupchecks.js +++ b/core/js/setupchecks.js @@ -328,18 +328,16 @@ type: OC.SetupChecks.MESSAGE_TYPE_ERROR }); } - if(!data.hasOpcacheLoaded) { - messages.push({ - msg: t('core', 'The PHP OPcache module is not loaded. {linkstart}For better performance it is recommended ↗{linkend} to load it into your PHP installation.') - .replace('{linkstart}', '<a target="_blank" rel="noreferrer noopener" class="external" href="' + data.phpOpcacheDocumentation + '">') - .replace('{linkend}', '</a>'), - type: OC.SetupChecks.MESSAGE_TYPE_INFO + if(data.OpcacheSetupRecommendations.length > 0) { + var listOfOPcacheRecommendations = ""; + data.OpcacheSetupRecommendations.forEach(function(element){ + listOfOPcacheRecommendations += "<li>" + element + "</li>"; }); - } else if(!data.isOpcacheProperlySetup) { messages.push({ - msg: t('core', 'The PHP OPcache module is not properly configured. {linkstart}For better performance it is recommended ↗{linkend} to use the following settings in the <code>php.ini</code>:') - .replace('{linkstart}', '<a target="_blank" rel="noreferrer noopener" class="external" href="' + data.phpOpcacheDocumentation + '">') - .replace('{linkend}', '</a>') + "<pre><code>opcache.enable=1\nopcache.interned_strings_buffer=8\nopcache.max_accelerated_files=10000\nopcache.memory_consumption=128\nopcache.save_comments=1\nopcache.revalidate_freq=1</code></pre>", + msg: t( + 'core', + 'The PHP OPcache module is not properly configured:' + ) + "<ul>" + listOfOPcacheRecommendations + "</ul>", type: OC.SetupChecks.MESSAGE_TYPE_INFO }); } diff --git a/core/js/tests/specs/setupchecksSpec.js b/core/js/tests/specs/setupchecksSpec.js index 451c49fb2e9..c3e7fab14f1 100644 --- a/core/js/tests/specs/setupchecksSpec.js +++ b/core/js/tests/specs/setupchecksSpec.js @@ -236,8 +236,7 @@ describe('OC.SetupChecks tests', function() { forwardedForHeadersWorking: true, isCorrectMemcachedPHPModuleInstalled: true, hasPassedCodeIntegrityCheck: true, - isOpcacheProperlySetup: true, - hasOpcacheLoaded: true, + OpcacheSetupRecommendations: [], isSettimelimitAvailable: true, hasFreeTypeSupport: true, missingIndexes: [], @@ -294,8 +293,7 @@ describe('OC.SetupChecks tests', function() { forwardedForHeadersWorking: true, isCorrectMemcachedPHPModuleInstalled: true, hasPassedCodeIntegrityCheck: true, - isOpcacheProperlySetup: true, - hasOpcacheLoaded: true, + OpcacheSetupRecommendations: [], isSettimelimitAvailable: true, hasFreeTypeSupport: true, missingIndexes: [], @@ -353,8 +351,7 @@ describe('OC.SetupChecks tests', function() { forwardedForHeadersWorking: true, isCorrectMemcachedPHPModuleInstalled: true, hasPassedCodeIntegrityCheck: true, - isOpcacheProperlySetup: true, - hasOpcacheLoaded: true, + OpcacheSetupRecommendations: [], isSettimelimitAvailable: true, hasFreeTypeSupport: true, missingIndexes: [], @@ -410,8 +407,7 @@ describe('OC.SetupChecks tests', function() { forwardedForHeadersWorking: true, isCorrectMemcachedPHPModuleInstalled: true, hasPassedCodeIntegrityCheck: true, - isOpcacheProperlySetup: true, - hasOpcacheLoaded: true, + OpcacheSetupRecommendations: [], isSettimelimitAvailable: true, hasFreeTypeSupport: true, missingIndexes: [], @@ -465,8 +461,7 @@ describe('OC.SetupChecks tests', function() { forwardedForHeadersWorking: true, isCorrectMemcachedPHPModuleInstalled: false, hasPassedCodeIntegrityCheck: true, - isOpcacheProperlySetup: true, - hasOpcacheLoaded: true, + OpcacheSetupRecommendations: [], isSettimelimitAvailable: true, hasFreeTypeSupport: true, missingIndexes: [], @@ -520,8 +515,7 @@ describe('OC.SetupChecks tests', function() { forwardedForHeadersWorking: true, isCorrectMemcachedPHPModuleInstalled: true, hasPassedCodeIntegrityCheck: true, - isOpcacheProperlySetup: true, - hasOpcacheLoaded: true, + OpcacheSetupRecommendations: [], isSettimelimitAvailable: true, hasFreeTypeSupport: true, missingIndexes: [], @@ -577,8 +571,7 @@ describe('OC.SetupChecks tests', function() { reverseProxyDocs: 'https://docs.nextcloud.com/foo/bar.html', isCorrectMemcachedPHPModuleInstalled: true, hasPassedCodeIntegrityCheck: true, - isOpcacheProperlySetup: true, - hasOpcacheLoaded: true, + OpcacheSetupRecommendations: [], isSettimelimitAvailable: true, hasFreeTypeSupport: true, missingIndexes: [], @@ -632,8 +625,7 @@ describe('OC.SetupChecks tests', function() { reverseProxyDocs: 'https://docs.nextcloud.com/foo/bar.html', isCorrectMemcachedPHPModuleInstalled: true, hasPassedCodeIntegrityCheck: true, - isOpcacheProperlySetup: true, - hasOpcacheLoaded: true, + OpcacheSetupRecommendations: [], isSettimelimitAvailable: false, hasFreeTypeSupport: true, missingIndexes: [], @@ -687,8 +679,7 @@ describe('OC.SetupChecks tests', function() { reverseProxyDocs: 'https://docs.nextcloud.com/foo/bar.html', isCorrectMemcachedPHPModuleInstalled: true, hasPassedCodeIntegrityCheck: true, - isOpcacheProperlySetup: true, - hasOpcacheLoaded: true, + OpcacheSetupRecommendations: [], isSettimelimitAvailable: true, hasFreeTypeSupport: true, missingIndexes: [], @@ -763,8 +754,7 @@ describe('OC.SetupChecks tests', function() { phpSupported: {eol: true, version: '5.4.0'}, isCorrectMemcachedPHPModuleInstalled: true, hasPassedCodeIntegrityCheck: true, - isOpcacheProperlySetup: true, - hasOpcacheLoaded: true, + OpcacheSetupRecommendations: [], isSettimelimitAvailable: true, hasFreeTypeSupport: true, missingIndexes: [], @@ -818,8 +808,7 @@ describe('OC.SetupChecks tests', function() { forwardedForHeadersWorking: true, isCorrectMemcachedPHPModuleInstalled: true, hasPassedCodeIntegrityCheck: true, - isOpcacheProperlySetup: false, - hasOpcacheLoaded: true, + OpcacheSetupRecommendations: ['recommendation1', 'recommendation2'], phpOpcacheDocumentation: 'https://example.org/link/to/doc', isSettimelimitAvailable: true, hasFreeTypeSupport: true, @@ -844,63 +833,7 @@ describe('OC.SetupChecks tests', function() { async.done(function( data, s, x ){ expect(data).toEqual([{ - msg: 'The PHP OPcache module is not properly configured. <a target="_blank" rel="noreferrer noopener" class="external" href="https://example.org/link/to/doc">For better performance it is recommended ↗</a> to use the following settings in the <code>php.ini</code>:' + "<pre><code>opcache.enable=1\nopcache.interned_strings_buffer=8\nopcache.max_accelerated_files=10000\nopcache.memory_consumption=128\nopcache.save_comments=1\nopcache.revalidate_freq=1</code></pre>", - type: OC.SetupChecks.MESSAGE_TYPE_INFO - }]); - done(); - }); - }); - - it('should return an info if server has no opcache at all', function(done) { - var async = OC.SetupChecks.checkSetup(); - - suite.server.requests[0].respond( - 200, - { - 'Content-Type': 'application/json' - }, - JSON.stringify({ - hasFileinfoInstalled: true, - isGetenvServerWorking: true, - isReadOnlyConfig: false, - hasWorkingFileLocking: true, - hasValidTransactionIsolationLevel: true, - suggestedOverwriteCliURL: '', - isRandomnessSecure: true, - securityDocs: 'https://docs.nextcloud.com/myDocs.html', - isFairUseOfFreePushService: true, - serverHasInternetConnectionProblems: false, - isMemcacheConfigured: true, - forwardedForHeadersWorking: true, - isCorrectMemcachedPHPModuleInstalled: true, - hasPassedCodeIntegrityCheck: true, - isOpcacheProperlySetup: true, - hasOpcacheLoaded: false, - phpOpcacheDocumentation: 'https://example.org/link/to/doc', - isSettimelimitAvailable: true, - hasFreeTypeSupport: true, - missingIndexes: [], - missingPrimaryKeys: [], - missingColumns: [], - cronErrors: [], - cronInfo: { - diffInSeconds: 0 - }, - isMemoryLimitSufficient: true, - appDirsWithDifferentOwner: [], - recommendedPHPModules: [], - pendingBigIntConversionColumns: [], - isMysqlUsedWithoutUTF8MB4: false, - isDefaultPhoneRegionSet: true, - isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true, - reverseProxyGeneratedURL: 'https://server', - temporaryDirectoryWritable: true, - }) - ); - - async.done(function( data, s, x ){ - expect(data).toEqual([{ - msg: 'The PHP OPcache module is not loaded. <a target="_blank" rel="noreferrer noopener" class="external" href="https://example.org/link/to/doc">For better performance it is recommended ↗</a> to load it into your PHP installation.', + msg: 'The PHP OPcache module is not properly configured:<ul><li>recommendation1</li><li>recommendation2</li></ul>', type: OC.SetupChecks.MESSAGE_TYPE_INFO }]); done(); @@ -930,8 +863,7 @@ describe('OC.SetupChecks tests', function() { forwardedForHeadersWorking: true, isCorrectMemcachedPHPModuleInstalled: true, hasPassedCodeIntegrityCheck: true, - isOpcacheProperlySetup: true, - hasOpcacheLoaded: true, + OpcacheSetupRecommendations: [], phpOpcacheDocumentation: 'https://example.org/link/to/doc', isSettimelimitAvailable: true, hasFreeTypeSupport: false, @@ -986,8 +918,7 @@ describe('OC.SetupChecks tests', function() { forwardedForHeadersWorking: true, isCorrectMemcachedPHPModuleInstalled: true, hasPassedCodeIntegrityCheck: true, - isOpcacheProperlySetup: true, - hasOpcacheLoaded: true, + OpcacheSetupRecommendations: [], isSettimelimitAvailable: true, hasFreeTypeSupport: true, missingIndexes: [], @@ -1045,8 +976,7 @@ describe('OC.SetupChecks tests', function() { forwardedForHeadersWorking: true, isCorrectMemcachedPHPModuleInstalled: true, hasPassedCodeIntegrityCheck: true, - isOpcacheProperlySetup: true, - hasOpcacheLoaded: true, + OpcacheSetupRecommendations: [], isSettimelimitAvailable: true, hasFreeTypeSupport: true, missingIndexes: [], @@ -1101,8 +1031,7 @@ describe('OC.SetupChecks tests', function() { forwardedForHeadersWorking: true, isCorrectMemcachedPHPModuleInstalled: true, hasPassedCodeIntegrityCheck: true, - isOpcacheProperlySetup: true, - hasOpcacheLoaded: true, + OpcacheSetupRecommendations: [], isSettimelimitAvailable: true, hasFreeTypeSupport: true, missingIndexes: [], @@ -1154,8 +1083,7 @@ describe('OC.SetupChecks tests', function() { forwardedForHeadersWorking: true, isCorrectMemcachedPHPModuleInstalled: true, hasPassedCodeIntegrityCheck: true, - isOpcacheProperlySetup: true, - hasOpcacheLoaded: true, + OpcacheSetupRecommendations: [], isSettimelimitAvailable: true, hasFreeTypeSupport: true, missingIndexes: [], @@ -1209,8 +1137,7 @@ describe('OC.SetupChecks tests', function() { forwardedForHeadersWorking: true, isCorrectMemcachedPHPModuleInstalled: true, hasPassedCodeIntegrityCheck: true, - isOpcacheProperlySetup: true, - hasOpcacheLoaded: true, + OpcacheSetupRecommendations: [], isSettimelimitAvailable: true, hasFreeTypeSupport: true, missingIndexes: [], @@ -1264,8 +1191,7 @@ describe('OC.SetupChecks tests', function() { forwardedForHeadersWorking: true, isCorrectMemcachedPHPModuleInstalled: true, hasPassedCodeIntegrityCheck: true, - isOpcacheProperlySetup: true, - hasOpcacheLoaded: true, + OpcacheSetupRecommendations: [], isSettimelimitAvailable: true, hasFreeTypeSupport: true, missingIndexes: [], diff --git a/lib/private/Installer.php b/lib/private/Installer.php index f3af74167d1..b63619b821c 100644 --- a/lib/private/Installer.php +++ b/lib/private/Installer.php @@ -151,7 +151,7 @@ class Installer { //install the database $ms = new MigrationService($info['id'], \OC::$server->get(Connection::class)); - $ms->migrate('latest', true); + $ms->migrate('latest', !$previousVersion); if ($previousVersion) { OC_App::executeRepairSteps($appId, $info['repair-steps']['post-migration']); @@ -597,8 +597,11 @@ class Installer { $appPath = OC_App::getAppPath($app); \OC_App::registerAutoloading($app, $appPath); + $config = \OC::$server->getConfig(); + $ms = new MigrationService($app, \OC::$server->get(Connection::class)); - $ms->migrate('latest', true); + $previousVersion = $config->getAppValue($app, 'installed_version', false); + $ms->migrate('latest', !$previousVersion); //run appinfo/install.php self::includeAppScript("$appPath/appinfo/install.php"); @@ -611,8 +614,6 @@ class Installer { OC_App::executeRepairSteps($app, $info['repair-steps']['install']); - $config = \OC::$server->getConfig(); - $config->setAppValue($app, 'installed_version', OC_App::getAppVersion($app)); if (array_key_exists('ocsid', $info)) { $config->setAppValue($app, 'ocsid', $info['ocsid']); |