diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/App/PlatformRepository.php | 4 | ||||
-rw-r--r-- | lib/private/DB/SchemaWrapper.php | 13 | ||||
-rw-r--r-- | lib/private/Installer.php | 9 | ||||
-rw-r--r-- | lib/private/Log.php | 27 | ||||
-rw-r--r-- | lib/private/legacy/OC_Util.php | 1 | ||||
-rw-r--r-- | lib/public/DB/ISchemaWrapper.php | 15 |
6 files changed, 51 insertions, 18 deletions
diff --git a/lib/private/App/PlatformRepository.php b/lib/private/App/PlatformRepository.php index 816470e1202..5dd312582d6 100644 --- a/lib/private/App/PlatformRepository.php +++ b/lib/private/App/PlatformRepository.php @@ -67,10 +67,6 @@ class PlatformRepository { $prettyVersion = $curlVersion['version']; break; - case 'iconv': - $prettyVersion = ICONV_VERSION; - break; - case 'intl': $name = 'ICU'; if (defined('INTL_ICU_VERSION')) { diff --git a/lib/private/DB/SchemaWrapper.php b/lib/private/DB/SchemaWrapper.php index 20ae5b6faa6..9f7623bac44 100644 --- a/lib/private/DB/SchemaWrapper.php +++ b/lib/private/DB/SchemaWrapper.php @@ -24,6 +24,8 @@ namespace OC\DB; +use Doctrine\DBAL\Exception; +use Doctrine\DBAL\Platforms\AbstractPlatform; use Doctrine\DBAL\Schema\Schema; use OCP\DB\ISchemaWrapper; @@ -130,4 +132,15 @@ class SchemaWrapper implements ISchemaWrapper { public function getTables() { return $this->schema->getTables(); } + + /** + * Gets the DatabasePlatform for the database. + * + * @return AbstractPlatform + * + * @throws Exception + */ + public function getDatabasePlatform() { + return $this->connection->getDatabasePlatform(); + } } diff --git a/lib/private/Installer.php b/lib/private/Installer.php index 65740c32c57..2d09065be5c 100644 --- a/lib/private/Installer.php +++ b/lib/private/Installer.php @@ -159,7 +159,7 @@ class Installer { } } else { $ms = new \OC\DB\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']); @@ -606,6 +606,8 @@ class Installer { $appPath = OC_App::getAppPath($app); \OC_App::registerAutoloading($app, $appPath); + $config = \OC::$server->getConfig(); + if (is_file("$appPath/appinfo/database.xml")) { try { OC_DB::createDbFromStructure("$appPath/appinfo/database.xml"); @@ -617,8 +619,9 @@ class Installer { ); } } else { + $previousVersion = $config->getAppValue($app, 'installed_version', false); $ms = new \OC\DB\MigrationService($app, \OC::$server->get(Connection::class)); - $ms->migrate('latest', true); + $ms->migrate('latest', !$previousVersion); } //run appinfo/install.php @@ -632,8 +635,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']); diff --git a/lib/private/Log.php b/lib/private/Log.php index db86aa8bfe3..3c3f22293d9 100644 --- a/lib/private/Log.php +++ b/lib/private/Log.php @@ -44,6 +44,7 @@ use OCP\ILogger; use OCP\Log\IFileBased; use OCP\Log\IWriter; use OCP\Support\CrashReport\IRegistry; +use function strtr; /** * logging utilities @@ -207,13 +208,7 @@ class Log implements ILogger, IDataLogger { array_walk($context, [$this->normalizer, 'format']); $app = $context['app'] ?? 'no app in context'; - - // interpolate $message as defined in PSR-3 - $replace = []; - foreach ($context as $key => $val) { - $replace['{' . $key . '}'] = $val; - } - $message = strtr($message, $replace); + $message = $this->interpolateMessage($context, $message); try { if ($level >= $minLevel) { @@ -316,7 +311,7 @@ class Log implements ILogger, IDataLogger { $serializer = new ExceptionSerializer($this->config); $data = $serializer->serializeException($exception); - $data['CustomMessage'] = $context['message'] ?? '--'; + $data['CustomMessage'] = $this->interpolateMessage($context, $context['message'] ?? '--'); $minLevel = $this->getLogLevel($context); @@ -377,4 +372,20 @@ class Log implements ILogger, IDataLogger { } throw new \RuntimeException('Log implementation has no path'); } + + /** + * Interpolate $message as defined in PSR-3 + * + * @param array $context + * @param string $message + * + * @return string + */ + private function interpolateMessage(array $context, string $message): string { + $replace = []; + foreach ($context as $key => $val) { + $replace['{' . $key . '}'] = $val; + } + return strtr($message, $replace); + } } diff --git a/lib/private/legacy/OC_Util.php b/lib/private/legacy/OC_Util.php index 64a1083805d..9cf30bb508d 100644 --- a/lib/private/legacy/OC_Util.php +++ b/lib/private/legacy/OC_Util.php @@ -854,7 +854,6 @@ class OC_Util { 'json_encode' => 'JSON', 'gd_info' => 'GD', 'gzencode' => 'zlib', - 'iconv' => 'iconv', 'simplexml_load_string' => 'SimpleXML', 'hash' => 'HASH Message Digest Framework', 'curl_init' => 'cURL', diff --git a/lib/public/DB/ISchemaWrapper.php b/lib/public/DB/ISchemaWrapper.php index 3d58a10d2d2..85b09aee10e 100644 --- a/lib/public/DB/ISchemaWrapper.php +++ b/lib/public/DB/ISchemaWrapper.php @@ -23,6 +23,9 @@ namespace OCP\DB; +use Doctrine\DBAL\Exception; +use Doctrine\DBAL\Platforms\AbstractPlatform; + /** * Interface ISchemaWrapper * @@ -82,7 +85,7 @@ interface ISchemaWrapper { * @since 13.0.0 */ public function getTableNames(); - + /** * Gets all table names * @@ -90,4 +93,14 @@ interface ISchemaWrapper { * @since 13.0.0 */ public function getTableNamesWithoutPrefix(); + + /** + * Gets the DatabasePlatform for the database. + * + * @return AbstractPlatform + * + * @throws Exception + * @since 21.0.8 + */ + public function getDatabasePlatform(); } |