CoreFiles by mySites.guru
database.php64 lines, 1,541 bytes, from Joomla_3.2.1-Stable-Full_Package.zip
Raw History Compare with 3.2.0
md5
503bc07568313b325a9f674bfb98cd1f
sha1
10b17c79b834eb6c18da83c0be1a472b3749dafb
sha256
c0379251457585a1da450c599723deb92629c737fa159d105876b987341ec73c
<?php
/**
 * @package     Joomla.Installation
 * @subpackage  Controller
 *
 * @copyright   Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die;

/**
 * Controller class to initialise the database for the Joomla Installer.
 *
 * @package     Joomla.Installation
 * @subpackage  Controller
 * @since       3.1
 */
class InstallationControllerDatabase extends JControllerBase
{
	/**
	 * 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);
	}
}

The same content is in 7 releases, Joomla 3.1.0 to 3.2.1. See them all, or every version of this file.