Source for file database.php

Documentation is available at database.php

  1. <?php
  2. /**
  3.  * @package     Joomla.Installation
  4.  * @subpackage  Controller
  5.  *
  6.  * @copyright   Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
  7.  * @license     GNU General Public License version 2 or later; see LICENSE.txt
  8.  */
  9.  
  10. defined('_JEXEC'or die;
  11.  
  12. /**
  13.  * Controller class to initialise the database for the Joomla Installer.
  14.  *
  15.  * @package     Joomla.Installation
  16.  * @subpackage  Controller
  17.  * @since       3.1
  18.  */
  19. {
  20.     /**
  21.      * Execute the controller.
  22.      *
  23.      * @return  void 
  24.      *
  25.      * @since   3.1
  26.      */
  27.     public function execute()
  28.     {
  29.         // Get the application
  30.         /* @var InstallationApplicationWeb $app */
  31.         $app $this->getApplication();
  32.  
  33.         // Check for request forgeries.
  34.         JSession::checkToken(or $app->sendJsonResponse(new Exception(JText::_('JINVALID_TOKEN')403));
  35.  
  36.         // Get the setup model.
  37.         $model new InstallationModelSetup;
  38.  
  39.         // Check the form
  40.         $vars $model->checkForm('database');
  41.  
  42.         // Determine if the configuration file path is writable.
  43.         $path JPATH_CONFIGURATION '/configuration.php';
  44.         $useftp (file_exists($path)) !is_writable($path!is_writable(JPATH_CONFIGURATION '/');
  45.  
  46.         $r new stdClass;
  47.         $r->view $useftp 'ftp' 'summary';
  48.  
  49.         // Get the database model.
  50.         $db new InstallationModelDatabase;
  51.  
  52.         // Attempt to initialise the database.
  53.         $return $db->createDatabase($vars);
  54.  
  55.         // Check if the database was initialised
  56.         if (!$return)
  57.         {
  58.             $r->view 'database';
  59.         }
  60.  
  61.         $app->sendJsonResponse($r);
  62.     }
  63. }

Documentation generated on Tue, 19 Nov 2013 14:57:46 +0100 by phpDocumentor 1.4.3