0byt3m1n1
Path:
/
data
/
applications
/
aps
/
joomla
/
4.3.1
/
standard
/
scripts
/
[
Home
]
File: configure
<?php ini_set('include_path', '.'); require_once('env-parser.php'); require_once('file-util.php'); require_once('db-util.php'); require_once('app-util.php'); require_once('upgrade-app.php'); require_once('custom.php'); require_once('update_manifest_cache.php'); $config_files = array( '/' => array( array('configuration.php.in', 'configuration.php'), array('user.ini', '.user.ini') ), '/cgi-bin' => array() ); $reconfig_files = array( '/' => array( array('configuration.php.in', 'configuration.php') ), '/cgi-bin' => array() ); $upgrade_files = $config_files; $schema_files = get_localized_schema_files(); $reconf_schema_files = array('reconfigure.sql' => 'main'); $remove_schema_files = array('remove.sql' => 'main'); $psa_params = array(); $db_ids = array('main'); $web_ids = array('administrator', 'backups', 'components', 'language', 'modules', 'templates', 'cache', 'cache', 'components', 'images', 'banners', 'stories', 'language', 'modules', 'plugins', 'templates', 'tmp', 'configuration.php', '/'); $settings_params = array('admin_name', 'admin_email', 'title', 'smtp_port', 'smtp_host', 'sample_data'); $settings_enum_params = array( 'locale' => array( 'da-DK' => 'da-DK', 'de-DE' => 'de-DE', 'en-GB' => 'en-GB', 'es-ES' => 'es-ES', 'fr-FR' => 'fr-FR', 'it-IT' => 'it-IT', 'ja-JP' => 'ja-JP', 'nb-NO' => 'nb-NO', 'nl-NL' => 'nl-NL', 'pl-PL' => 'pl-PL', 'ru-RU' => 'ru-RU', 'zh-TW' => 'zh-TW', 'zh-CN' => 'zh-CN' )); $crypt_settings_params = array('admin_password'); $psa_modify_hash = get_psa_modify_hash($psa_params); $db_modify_hash = get_db_modify_hash($db_ids); $web_modify_hash = get_web_modify_hash($web_ids); $settings_modify_hash = get_settings_modify_hash($settings_params); if (strlen($settings_modify_hash['@@SMTP_HOST@@']) > 0 && $settings_modify_hash['@@SMTP_HOST@@'] != 'example.com') { $settings_modify_hash['@@MAILER@@'] = 'smtp'; } else { $settings_modify_hash['@@MAILER@@'] = 'mail'; } $settings_enum_modify_hash = get_settings_enum_modify_hash($settings_enum_params); $crypt_settings_modify_hash = get_crypt_settings_modify_hash($crypt_settings_params); $additional_modify_hash = get_additional_modify_hash(); $additional_modify_hash['@@JOOMLA_VERSION_ID@@'] = '4.3.1-2023-05-02'; if (count($argv) < 2) { print "Usage: configure (install | upgrade <version> | configure | remove)\n"; exit(1); } $command = $argv[1]; if ($command != 'install') { //get dbprefix $db_modify_hash['@@DB_MAIN_PREFIX@@'] = get_table_prefix($db_modify_hash,$psa_modify_hash); } if ($command == 'upgrade' || $command == 'configure') { // Preserve all settings except ones that we change (ones defined in metadata) $old_config = $psa_modify_hash['@@ROOT_DIR@@'] . '/configuration.php'; if (file_exists($old_config)) { $meta_settings = array('dbtype', 'host', 'user', 'password', 'db', 'dbprefix', 'mailfrom', 'log_path', 'tmp_path', 'smtpport', 'smtphost', 'mailer'); $old_content = read_file($old_config); if (preg_match('/class JConfig /', $old_content)) { rebuild_config_file( $old_config, 'configuration.php.in', $psa_modify_hash['@@ROOT_DIR@@'] . '/tmp/configuration2.php.in', $meta_settings ); $reconfig_files = array( '/' => array(array($psa_modify_hash['@@ROOT_DIR@@'] . '/tmp/configuration2.php.in', 'configuration.php')), '/cgi-bin' => array() ); $upgrade_files = array( '/' => array(array($psa_modify_hash['@@ROOT_DIR@@'] . '/tmp/configuration2.php.in', 'configuration.php')), '/cgi-bin' => array() ); } } } if ($command == 'upgrade') { if ($argv[2] && $argv[3]) { upgrade_app($argv[2], $argv[3], $upgrade_files, $db_ids, $psa_modify_hash, $db_modify_hash, $settings_modify_hash, $crypt_settings_modify_hash, $settings_enum_modify_hash, $additional_modify_hash); install_extra_component($psa_modify_hash['@@ROOT_DIR@@'], $settings_enum_modify_hash['@@LOCALE@@'], $db_modify_hash['@@DB_MAIN_PREFIX@@']); /* /* removing 1.7.x.sql files to avoid error message in Extensions -> Database /* If these files present, there is 2 messages of kind: /* "Table 'jos_content' does not have column 'title_alias' with type 'VARCHAR(255)'. (From file 1.7.3-2011-10-15.sql.)" */ removeJoomla17UpgradeScripts($psa_modify_hash['@@ROOT_DIR@@']); exit(0); } else { print "Error: upgrade version or release not specified.\n"; exit(1); } } if ($command == 'install') { if ($db_modify_hash['@@DB_MAIN_PREFIX@@'] == '') { $db_modify_hash['@@DB_MAIN_PREFIX@@'] = 'jos_'; } $joomla_path = $psa_modify_hash["@@ROOT_DIR@@"]; /** * * Connect to 'atl4vuxbuild01' using SSH protocol and execute the official Joomla cli installer * * NOTE: This entire script is invoked by IQJPS in the following way * '/bin/su -s /bin/bash {user_id} -c "source /etc/profile && {$cmd}' therefore certain considerations * must be taken into account as the {user_id} has restricted access. See comments * * */ $ssh_cmd = "/usr/bin/ssh -i /prov_control/.ssh/aps-key " . // Use a ssh key in an NFS volume to be available to all hostprov server and 444 file permissions to allow customer user_id to read and use it. "root@atl4vuxbuild01.registeredsite.com -o StrictHostKeyChecking=no " . // StrictHostKeyChecking=no do not force to strictly check known_host keys "\"cd " . $joomla_path . " && /usr/bin/php80 installation/joomla.php install " . "--site-name '" . ($settings_modify_hash["@@TITLE@@"] ? $settings_modify_hash["@@TITLE@@"] : 'A Joomla Site') . "' " . "--admin-user SuperUser " . "--admin-username '" . fetch_env_var('SETTINGS_admin_name') . "' " . "--admin-password '" . fetch_env_var('SETTINGS_admin_password') . "' " . "--admin-email '" . fetch_env_var('SETTINGS_admin_email') . "' " . "--db-type " . $db_modify_hash["@@DB_MAIN_TYPE@@"] . " " . "--db-host " . $db_modify_hash["@@DB_MAIN_HOST@@"] . " " . "--db-user " . $db_modify_hash["@@DB_MAIN_LOGIN@@"] . " " . "--db-pass '" . $db_modify_hash["@@DB_MAIN_PASSWORD@@"] . "' " . "--db-name " . $db_modify_hash["@@DB_MAIN_NAME@@"] . " " . "--db-prefix " . $db_modify_hash["@@DB_MAIN_PREFIX@@"] . " " . "--quiet " . "--no-interaction \" " . "2>&1 | tee /var/tmp/joomla.log | grep -v \.ssh;" . // Redirects std_err to std_out to catch, grep and filter the possible known_hosts error "echo -n \${PIPESTATUS[0]}"; // Echoes the status code of the install command (the first part of the pipe) to catch it from the prov server running the event // Execute the Joomla installation exec($ssh_cmd, $output, $result_code); // Get the last lin of the output where the result code of the install should be. Make sure to clear it up and return an int value $joomla_install_result = intval(trim(end($output))); exit($joomla_install_result); } if ($command == 'remove') { remove_app($remove_schema_files, $db_ids, $psa_modify_hash, $db_modify_hash, $settings_modify_hash, $crypt_settings_modify_hash, $settings_enum_modify_hash, $additional_modify_hash); exit(0); } if ($command == 'configure') { if (getJoomlaAdminUserId($db_modify_hash['@@DB_MAIN_PREFIX@@']) == 42) { $reconf_schema_files = array('reconfigure_admin_id42.sql' => 'main'); } else { $reconf_schema_files = array('reconfigure.sql' => 'main'); } configure($reconfig_files, $reconf_schema_files, $db_ids, $psa_modify_hash, $db_modify_hash, $settings_modify_hash, $crypt_settings_modify_hash, $settings_enum_modify_hash, $additional_modify_hash); install_component($settings_enum_modify_hash['@@LOCALE@@'] . '_joomla_lang_full.zip', $psa_modify_hash['@@ROOT_DIR@@']); exit(0); } print "Error: unknown command $command.\n"; exit(1);