/** * Runs the CMF installer */ public function install() { if (strtolower(\Cli::prompt('Install CMF now? WARNING: This will reset the contents of your app folder!', array('y', 'n'))) !== 'y') { return; } // Site title etc Installer::initialSetup(); // Database if (strtolower(\Cli::prompt('Create database now?', array('y', 'n'))) === 'y') { $result = Installer::createDatabase(); if (isset($result['error'])) { \Cli::error('There was an error creating the database: ' . $result['error']); exit; } } // This stuff relies on the database being set up if (Project::databaseExists()) { // Sync models \Cli::write(""); // Just a spacer! Project::sync('default', 'app', true, true); // Super user $hasSuper = Project::hasSuperUser(); if (!$hasSuper || strtolower(\Cli::prompt('Create super user now?', array('y', 'n'))) === 'y') { if (!$hasSuper) { \Cli::write("\nCreating a super user..."); } Project::createSuperUser(); } // Check some DB settings are in place Project::ensureMinimumSettings(); } }