Source for file configuration.php
Documentation is available at configuration.php
* @package Joomla.Installation
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
* Configuration setup model for the Joomla Core Installer.
* @package Joomla.Installation
* Method to setup the configuration file
* @param array $options The session options
* @return boolean True on success
public function setup($options)
// Get the options as an object for easier handling.
// Attempt to create the root user.
// Attempt to create the root user.
if (!$this->_createRootUser($options))
* Method to create the configuration file
* @param array $options The session options
* @return boolean True on success
// Create a new registry to build the configuration options.
$registry->set('offline', $options->site_offline);
$registry->set('offline_message', JText::_('INSTL_STD_OFFLINE_MSG'));
$registry->set('display_offline_message', 1);
$registry->set('offline_image', '');
$registry->set('sitename', $options->site_name);
$registry->set('editor', 'tinymce');
$registry->set('captcha', '0');
$registry->set('list_limit', 20);
$registry->set('access', 1);
$registry->set('debug', 0);
$registry->set('debug_lang', 0);
$registry->set('dbtype', $options->db_type);
$registry->set('host', $options->db_host);
$registry->set('user', $options->db_user);
$registry->set('password', $options->db_pass);
$registry->set('db', $options->db_name);
$registry->set('dbprefix', $options->db_prefix);
$registry->set('live_site', '');
$registry->set('gzip', 0);
$registry->set('error_reporting', 'default');
$registry->set('helpurl', 'http://help.joomla.org/proxy/index.php?option=com_help&keyref=Help{major}{minor}:{keyref}');
$registry->set('ftp_host', isset
($options->ftp_host) ?
$options->ftp_host :
'');
$registry->set('ftp_port', isset
($options->ftp_host) ?
$options->ftp_port :
'');
$registry->set('ftp_user', (isset
($options->ftp_save) &&
$options->ftp_save && isset
($options->ftp_user)) ?
$options->ftp_user :
'');
$registry->set('ftp_pass', (isset
($options->ftp_save) &&
$options->ftp_save && isset
($options->ftp_pass)) ?
$options->ftp_pass :
'');
$registry->set('ftp_root', (isset
($options->ftp_save) &&
$options->ftp_save && isset
($options->ftp_root)) ?
$options->ftp_root :
'');
$registry->set('ftp_enable', isset
($options->ftp_host) ?
$options->ftp_enable :
'');
$registry->set('offset', 'UTC');
$registry->set('mailonline', 1);
$registry->set('mailer', 'mail');
$registry->set('mailfrom', $options->admin_email);
$registry->set('fromname', $options->site_name);
$registry->set('sendmail', '/usr/sbin/sendmail');
$registry->set('smtpauth', 0);
$registry->set('smtpuser', '');
$registry->set('smtppass', '');
$registry->set('smtphost', 'localhost');
$registry->set('smtpsecure', 'none');
$registry->set('smtpport', '25');
$registry->set('caching', 0);
$registry->set('cache_handler', 'file');
$registry->set('cachetime', 15);
$registry->set('MetaDesc', $options->site_metadesc);
$registry->set('MetaKeys', '');
$registry->set('MetaTitle', 1);
$registry->set('MetaAuthor', 1);
$registry->set('MetaVersion', 0);
$registry->set('robots', '');
$registry->set('sef', 1);
$registry->set('sef_rewrite', 0);
$registry->set('sef_suffix', 0);
$registry->set('unicodeslugs', 0);
$registry->set('feed_limit', 10);
$registry->set('lifetime', 15);
$registry->set('session_handler', 'database');
// Generate the configuration class string buffer.
$buffer =
$registry->toString('PHP', array('class' =>
'JConfig', 'closingtag' =>
false));
// Build the configuration file path.
// Determine if the configuration file path is writable.
* If the file exists but isn't writable OR if the file doesn't exist and the parent directory
* is not writable we need to use FTP
// Enable/Disable override
if (!isset
($options->ftpEnable) ||
($options->ftpEnable !=
1))
// Connect the FTP client
$ftp->login($options->ftp_user, $options->ftp_pass);
// Translate path for the FTP account
// Use FTP write buffer to file
if (!$ftp->write($file, $buffer))
// Set the config string to the session.
$session->set('setup.config', $buffer);
$session->set('setup.config', null);
// Set the config string to the session.
$session->set('setup.config', $buffer);
* Method to create the root user for the site
* @param object $options The session options
* @return boolean True on success
private function _createRootUser($options)
/* @var InstallationApplicationWeb $app */
// Get a database object.
catch
(RuntimeException $e)
$app->enqueueMessage(JText::sprintf('INSTL_ERROR_CONNECT_DB', $e->getMessage()), 'notice');
//$cryptpass = JUserHelper::getCryptedPassword($options->admin_password, $salt, 'sha256') . ':' . $salt;
// Take the admin user id
// We don't need the randUserId in the session any longer, let's remove it
$installdate =
date('Y-m-d H:i:s');
$nullDate =
$db->getNullDate();
$query =
$db->getQuery(true)
->select($db->quoteName('id'))
->from($db->quoteName('#__users'))
->where($db->quoteName('id') .
' = ' .
$db->quote($userId));
->update($db->quoteName('#__users'))
->set($db->quoteName('name') .
' = ' .
$db->quote('Super User'))
->set($db->quoteName('username') .
' = ' .
$db->quote($options->admin_user))
->set($db->quoteName('email') .
' = ' .
$db->quote($options->admin_email))
->set($db->quoteName('password') .
' = ' .
$db->quote($cryptpass))
->set($db->quoteName('block') .
' = 0')
->set($db->quoteName('sendEmail') .
' = 1')
->set($db->quoteName('registerDate') .
' = ' .
$db->quote($installdate))
->set($db->quoteName('lastvisitDate') .
' = ' .
$db->quote($nullDate))
->set($db->quoteName('activation') .
' = ' .
$db->quote('0'))
->set($db->quoteName('params') .
' = ' .
$db->quote(''))
->where($db->quoteName('id') .
' = ' .
$db->quote($userId));
$columns =
array($db->quoteName('id'), $db->quoteName('name'), $db->quoteName('username'),
$db->quoteName('email'), $db->quoteName('password'),
$db->quoteName('sendEmail'), $db->quoteName('registerDate'),
$db->quoteName('lastvisitDate'), $db->quoteName('activation'), $db->quoteName('params'));
->insert('#__users', true)
$db->quote($userId) .
', ' .
$db->quote('Super User') .
', ' .
$db->quote($options->admin_user) .
', ' .
$db->quote($options->admin_email) .
', ' .
$db->quote($cryptpass) .
', ' .
$db->quote('0') .
', ' .
$db->quote('1') .
', ' .
$db->quote($installdate) .
', ' .
$db->quote($nullDate) .
', ' .
$db->quote('0') .
', ' .
$db->quote('')
catch
(RuntimeException $e)
$app->enqueueMessage($e->getMessage(), 'notice');
// Map the super admin to the Super Admin Group
->select($db->quoteName('user_id'))
->from($db->quoteName('#__user_usergroup_map'))
->where($db->quoteName('user_id') .
' = ' .
$db->quote($userId));
->update($db->quoteName('#__user_usergroup_map'))
->set($db->quoteName('user_id') .
' = ' .
$db->quote($userId))
->set($db->quoteName('group_id') .
' = 8');
->insert($db->quoteName('#__user_usergroup_map'), false)
->columns(array($db->quoteName('user_id'), $db->quoteName('group_id')))
->values($db->quote($userId) .
', 8');
catch
(RuntimeException $e)
$app->enqueueMessage($e->getMessage(), 'notice');
Documentation generated on Tue, 19 Nov 2013 14:56:31 +0100 by phpDocumentor 1.4.3