diff --git a/libraries/classmap.php b/libraries/classmap.php index fd5677709f942..b433e29d0b720 100644 --- a/libraries/classmap.php +++ b/libraries/classmap.php @@ -131,3 +131,9 @@ JLoader::registerAlias('JPathway', '\\Joomla\\CMS\\Pathway\\Pathway', '4.0'); JLoader::registerAlias('JPathwaySite', '\\Joomla\\CMS\\Pathway\\SitePathway', '4.0'); + +JLoader::registerAlias('JSchemaChangeitem', '\\Joomla\\CMS\\Schema\\ChangeItem', '4.0'); +JLoader::registerAlias('JSchemaChangeset', '\\Joomla\\CMS\\Schema\\ChangeSet', '4.0'); +JLoader::registerAlias('JSchemaChangeitemMysql', '\\Joomla\\CMS\\Schema\\ChangeItem\\MysqlChangeItem', '4.0'); +JLoader::registerAlias('JSchemaChangeitemPostgresql', '\\Joomla\\CMS\\Schema\\ChangeItem\\PostgresqlChangeItem', '4.0'); +JLoader::registerAlias('JSchemaChangeitemSqlsrv', '\\Joomla\\CMS\\Schema\\ChangeItem\\SqlsrvChangeItem', '4.0'); diff --git a/libraries/cms/schema/changeitem.php b/libraries/src/Joomla/CMS/Schema/ChangeItem.php similarity index 79% rename from libraries/cms/schema/changeitem.php rename to libraries/src/Joomla/CMS/Schema/ChangeItem.php index 7beb0636af3dc..670dc23acbd0d 100644 --- a/libraries/cms/schema/changeitem.php +++ b/libraries/src/Joomla/CMS/Schema/ChangeItem.php @@ -1,12 +1,13 @@ db->loadObject(); } - catch (RuntimeException $e) + catch (\RuntimeException $e) { $rows = false; // Still render the error message from the Exception object - JFactory::getApplication()->enqueueMessage($e->getMessage(), 'error'); + \JFactory::getApplication()->enqueueMessage($e->getMessage(), 'error'); } if ($rows !== false) diff --git a/libraries/cms/schema/changeitem/mysql.php b/libraries/src/Joomla/CMS/Schema/ChangeItem/MysqlChangeItem.php similarity index 96% rename from libraries/cms/schema/changeitem/mysql.php rename to libraries/src/Joomla/CMS/Schema/ChangeItem/MysqlChangeItem.php index 1bb3ddf89c6dc..83e67af49e7f0 100644 --- a/libraries/cms/schema/changeitem/mysql.php +++ b/libraries/src/Joomla/CMS/Schema/ChangeItem/MysqlChangeItem.php @@ -1,20 +1,23 @@ `. * - * @param JDatabaseDriver $db The current database object - * @param string $folder The full path to the folder containing the update queries + * @param \JDatabaseDriver $db The current database object + * @param string $folder The full path to the folder containing the update queries * * @since 2.5 */ @@ -71,7 +72,7 @@ public function __construct($db, $folder = null) foreach ($updateQueries as $obj) { - $changeItem = JSchemaChangeitem::getInstance($db, $obj->file, $obj->updateQuery); + $changeItem = ChangeItem::getInstance($db, $obj->file, $obj->updateQuery); if ($changeItem->queryType === 'UTF8CNV') { @@ -80,9 +81,9 @@ public function __construct($db, $folder = null) { $this->db->setQuery($changeItem->updateQuery)->execute(); } - catch (RuntimeException $e) + catch (\RuntimeException $e) { - JFactory::getApplication()->enqueueMessage($e->getMessage(), 'error'); + \JFactory::getApplication()->enqueueMessage($e->getMessage(), 'error'); } } else @@ -96,7 +97,7 @@ public function __construct($db, $folder = null) if ($this->db->getServerType() == 'mysql') { // Let the update query be something harmless which should always succeed - $tmpSchemaChangeItem = JSchemaChangeitem::getInstance( + $tmpSchemaChangeItem = ChangeItem::getInstance( $db, 'database.php', 'UPDATE ' . $this->db->quoteName('#__utf8_conversion') @@ -132,12 +133,12 @@ public function __construct($db, $folder = null) } /** - * Returns a reference to the JSchemaChangeset object, only creating it if it doesn't already exist. + * Returns a reference to the ChangeSet object, only creating it if it doesn't already exist. * - * @param JDatabaseDriver $db The current database object - * @param string $folder The full path to the folder containing the update queries + * @param \JDatabaseDriver $db The current database object + * @param string $folder The full path to the folder containing the update queries * - * @return JSchemaChangeset + * @return ChangeSet * * @since 2.5 */ @@ -145,7 +146,7 @@ public static function getInstance($db, $folder = null) { if (!is_object(static::$instance)) { - static::$instance = new JSchemaChangeset($db, $folder); + static::$instance = new ChangeSet($db, $folder); } return static::$instance; @@ -239,7 +240,7 @@ public function getStatus() public function getSchema() { $updateFiles = $this->getUpdateFiles(); - $result = new SplFileInfo(array_pop($updateFiles)); + $result = new \SplFileInfo(array_pop($updateFiles)); return $result->getBasename('.sql'); } @@ -268,7 +269,7 @@ private function getUpdateFiles() $this->folder = JPATH_ADMINISTRATOR . '/components/com_admin/sql/updates/'; } - return JFolder::files( + return \JFolder::files( $this->folder . '/' . $sqlFolder, '\.sql$', 1, true, array('.svn', 'CVS', '.DS_Store', '__MACOSX'), array('^\..*', '.*~'), true ); } @@ -278,7 +279,7 @@ private function getUpdateFiles() * * @param array $sqlfiles Array of .sql update filenames. * - * @return array Array of stdClass objects where: + * @return array Array of \stdClass objects where: * file=filename, * update_query = text of SQL update query * @@ -294,11 +295,11 @@ private function getUpdateQueries(array $sqlfiles) $buffer = file_get_contents($file); // Create an array of queries from the sql file - $queries = JDatabaseDriver::splitSql($buffer); + $queries = \JDatabaseDriver::splitSql($buffer); foreach ($queries as $query) { - $fileQueries = new stdClass; + $fileQueries = new \stdClass; $fileQueries->file = $file; $fileQueries->updateQuery = $query; $result[] = $fileQueries;