diff --git a/installation/controller/install/database.php b/installation/controller/install/database.php index 981c78871ea62..d122b0c019375 100644 --- a/installation/controller/install/database.php +++ b/installation/controller/install/database.php @@ -42,7 +42,7 @@ public function execute() $db = new InstallationModelDatabase; // Attempt to create the database tables. - $return = $db->createTables($options); + $return = $db->installCmsData($options); $r = new stdClass; $r->view = 'install'; diff --git a/installation/model/database.php b/installation/model/database.php index c00a1b250fa40..7e54994235b70 100644 --- a/installation/model/database.php +++ b/installation/model/database.php @@ -761,7 +761,7 @@ public function installSampleData($options) } /** - * Method to update the user id of the sample data content to the new rand user id. + * Sample data tables and data post install process. * * @param JDatabaseDriver $db Database connector object $db*. * @@ -770,6 +770,62 @@ public function installSampleData($options) * @since 3.1 */ protected function postInstallSampleData($db) + { + // Update the sample data user ids. + $this->updateUserIds($db); + } + + /** + * Method to install the cms data. + * + * @param array $options The options array. + * + * @return boolean True on success. + * + * @since __DEPLOY_VERSION__ + */ + public function installCmsData($options) + { + // Attempt to create the database tables. + if (!$this->createTables($options)) + { + return false; + } + + if (!$db = $this->initialise($options)) + { + return false; + } + + // Run Cms data post install to update user ids. + return $this->postInstallCmsData($db); + } + + /** + * Cms tables and data post install process. + * + * @param JDatabaseDriver $db Database connector object $db*. + * + * @return void + * + * @since __DEPLOY_VERSION__ + */ + protected function postInstallCmsData($db) + { + // Update the sample data user ids. + $this->updateUserIds($db); + } + + /** + * Method to update the user id of sql data content to the new rand user id. + * + * @param JDatabaseDriver $db Database connector object $db*. + * + * @return boolean True on success. + * + * @since __DEPLOY_VERSION__ + */ + protected function updateUserIds($db) { // Create the ID for the root user. $userId = self::getUserId(); @@ -777,13 +833,13 @@ protected function postInstallSampleData($db) // Update all created_by field of the tables with the random user id // categories (created_user_id), contact_details, content, newsfeeds. $updates_array = array( - 'categories' => 'created_user_id', + 'categories' => 'created_user_id', 'contact_details' => 'created_by', - 'content' => 'created_by', - 'newsfeeds' => 'created_by', - 'tags' => 'created_user_id', - 'ucm_content' => 'core_created_user_id', - 'ucm_history' => 'editor_user_id' + 'content' => 'created_by', + 'newsfeeds' => 'created_by', + 'tags' => 'created_user_id', + 'ucm_content' => 'core_created_user_id', + 'ucm_history' => 'editor_user_id', ); foreach ($updates_array as $table => $field)