From 586c685057015bf8835aad6d3f9be1b6b86831eb Mon Sep 17 00:00:00 2001 From: Richard Fath Date: Sun, 1 May 2022 13:55:00 +0200 Subject: [PATCH] Fix merge conflict from rebase --- administrator/components/com_admin/script.php | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/administrator/components/com_admin/script.php b/administrator/components/com_admin/script.php index 20e681e37eff4..6d92718d24487 100644 --- a/administrator/components/com_admin/script.php +++ b/administrator/components/com_admin/script.php @@ -108,6 +108,7 @@ public function update($installer) $this->updateAssets($installer); $this->clearStatsCache(); $this->convertTablesToUtf8mb4(true); + $this->addUserAuthProviderColumn(); $this->cleanJoomlaCache(); } @@ -1571,4 +1572,40 @@ function ($template) use ($db) ['atum', 'cassiopeia'] ); } + + /** + * Add the user Auth Provider Column as it could be present from 3.10 already + * + * @return void + * + * @since 4.1.1 + */ + protected function addUserAuthProviderColumn(): void + { + $db = Factory::getContainer()->get('DatabaseDriver'); + + // Check if the column already exists + $fields = $db->getTableColumns('#__users'); + + // Column exists, skip + if (isset($fields['authProvider'])) + { + return; + } + + $query = 'ALTER TABLE ' . $db->quoteName('#__users') + . ' ADD COLUMN ' . $db->quoteName('authProvider') . ' varchar(100) DEFAULT ' . $db->quote('') . ' NOT NULL'; + + // Add column + try + { + $db->setQuery($query)->execute(); + } + catch (Exception $e) + { + echo Text::sprintf('JLIB_DATABASE_ERROR_FUNCTION_FAILED', $e->getCode(), $e->getMessage()) . '
'; + + return; + } + } }