/** * Installs Craft! * * @param array $inputs * @throws Exception * @throws \Exception * @return void */ public function run($inputs) { craft()->config->maxPowerCaptain(); if (Craft::isInstalled()) { throw new Exception(Craft::t('Craft is already installed.')); } // Set the language to the desired locale craft()->setLanguage($inputs['locale']); $records = $this->findInstallableRecords(); // Start the transaction $transaction = craft()->db->beginTransaction(); try { Craft::log('Installing Craft.'); // Create the tables $this->_createTablesFromRecords($records); $this->_createForeignKeysFromRecords($records); $this->_createContentTable(); $this->_createRelationsTable(); $this->_createShunnedMessagesTable(); $this->_createSearchIndexTable(); $this->_createAndPopulateInfoTable($inputs); $this->_createAssetTransformIndexTable(); $this->_createRackspaceAccessTable(); Craft::log('Committing the transaction.'); $transaction->commit(); } catch (\Exception $e) { $transaction->rollBack(); throw $e; } // Craft, you are installed now. Craft::setIsInstalled(); $this->_populateMigrationTable(); $this->_addLocale($inputs['locale']); $this->_addUser($inputs); if (!craft()->isConsole()) { $this->_logUserIn($inputs); } $this->_saveDefaultMailSettings($inputs['email'], $inputs['siteName']); $this->_createDefaultContent($inputs); Craft::log('Finished installing Craft.'); }