/** * Execute the controller. * * @return void * * @since 3.1 */ public function execute() { // Get the application /* @var InstallationApplicationWeb $app */ $app = $this->getApplication(); // Check for request forgeries. JSession::checkToken() or $app->sendJsonResponse(new Exception(JText::_('JINVALID_TOKEN'), 403)); // Get the setup model. $model = new InstallationModelSetup(); // Check the form $vars = $model->checkForm('database'); // Determine if the configuration file path is writable. $path = JPATH_CONFIGURATION . '/configuration.php'; $useftp = file_exists($path) ? !is_writable($path) : !is_writable(JPATH_CONFIGURATION . '/'); $r = new stdClass(); $r->view = $useftp ? 'ftp' : 'summary'; // Get the database model. $db = new InstallationModelDatabase(); // Attempt to initialise the database. $return = $db->createDatabase($vars); // Check if the database was initialised if (!$return) { $r->view = 'database'; } $app->sendJsonResponse($r); }
/** * Execute the controller. * * @return void * * @since 3.1 */ public function execute() { // Get the application /* @var InstallationApplicationWeb $app */ $app = $this->getApplication(); // Check for request forgeries. JSession::checkToken() or $app->sendJsonResponse(new Exception(JText::_('JINVALID_TOKEN'), 403)); // Get the setup model. $model = new InstallationModelSetup(); // Check the form $model->checkForm('site'); // Redirect to the page. $r = new stdClass(); $r->view = 'database'; $app->sendJsonResponse($r); }