PageRenderTime 91ms CodeModel.GetById 101ms app.highlight 60ms RepoModel.GetById 81ms app.codeStats 0ms

/install.php

https://github.com/BarnetikKoop/SuiteCRM
PHP | 608 lines | 450 code | 73 blank | 85 comment | 121 complexity | 171e19e7a6f323e05926d94480f453e7 MD5 | raw file
  1<?php
  2 if(!defined('sugarEntry'))define('sugarEntry', true);
  3/*********************************************************************************
  4 * SugarCRM Community Edition is a customer relationship management program developed by
  5 * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
  6
  7 * SuiteCRM is an extension to SugarCRM Community Edition developed by Salesagility Ltd.
  8 * Copyright (C) 2011 - 2014 Salesagility Ltd.
  9 *
 10 * This program is free software; you can redistribute it and/or modify it under
 11 * the terms of the GNU Affero General Public License version 3 as published by the
 12 * Free Software Foundation with the addition of the following permission added
 13 * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
 14 * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
 15 * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
 16 *
 17 * This program is distributed in the hope that it will be useful, but WITHOUT
 18 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 19 * FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more
 20 * details.
 21 *
 22 * You should have received a copy of the GNU Affero General Public License along with
 23 * this program; if not, see http://www.gnu.org/licenses or write to the Free
 24 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 25 * 02110-1301 USA.
 26 *
 27 * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
 28 * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
 29 *
 30 * The interactive user interfaces in modified source and object code versions
 31 * of this program must display Appropriate Legal Notices, as required under
 32 * Section 5 of the GNU Affero General Public License version 3.
 33 *
 34 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
 35 * these Appropriate Legal Notices must retain the display of the "Powered by
 36 * SugarCRM" logo and "Supercharged by SuiteCRM" logo. If the display of the logos is not
 37 * reasonably feasible for  technical reasons, the Appropriate Legal Notices must
 38 * display the words  "Powered by SugarCRM" and "Supercharged by SuiteCRM".
 39 ********************************************************************************/
 40
 41//session_destroy();
 42if (version_compare(phpversion(),'5.2.0') < 0) {
 43	$msg = 'Minimum PHP version required is 5.2.0.  You are using PHP version  '. phpversion();
 44    die($msg);
 45}
 46$session_id = session_id();
 47if(empty($session_id)){
 48	@session_start();
 49}
 50$GLOBALS['installing'] = true;
 51define('SUGARCRM_IS_INSTALLING', $GLOBALS['installing']);
 52$GLOBALS['sql_queries'] = 0;
 53require_once('include/SugarLogger/LoggerManager.php');
 54require_once('sugar_version.php');
 55require_once('suitecrm_version.php');
 56require_once('include/utils.php');
 57require_once('install/install_utils.php');
 58require_once('install/install_defaults.php');
 59require_once('include/TimeDate.php');
 60require_once('include/Localization/Localization.php');
 61require_once('include/SugarTheme/SugarTheme.php');
 62require_once('include/utils/LogicHook.php');
 63require_once('data/SugarBean.php');
 64require_once('include/entryPoint.php');
 65//check to see if the script files need to be rebuilt, add needed variables to request array
 66$_REQUEST['root_directory'] = getcwd();
 67$_REQUEST['js_rebuild_concat'] = 'rebuild';
 68if(isset($_REQUEST['goto']) && $_REQUEST['goto'] != 'SilentInstall') {
 69    require_once('jssource/minify.php');
 70}
 71
 72$timedate = TimeDate::getInstance();
 73// cn: set php.ini settings at entry points
 74setPhpIniSettings();
 75$locale = new Localization();
 76
 77if(get_magic_quotes_gpc() == 1) {
 78   $_REQUEST = array_map("stripslashes_checkstrings", $_REQUEST);
 79   $_POST = array_map("stripslashes_checkstrings", $_POST);
 80   $_GET = array_map("stripslashes_checkstrings", $_GET);
 81}
 82
 83
 84$GLOBALS['log'] = LoggerManager::getLogger('SugarCRM');
 85$setup_sugar_version = $suitecrm_version;
 86$install_script = true;
 87
 88///////////////////////////////////////////////////////////////////////////////
 89//// INSTALL RESOURCE SETUP
 90$css = 'install/install.css';
 91$icon = 'include/images/sugar_icon.ico';
 92$sugar_md = 'include/images/sugar_md_open.png';
 93$loginImage = 'include/images/sugarcrm_login.png';
 94$common = 'install/installCommon.js';
 95
 96///////////////////////////////////////////////////////////////////////////////
 97////	INSTALLER LANGUAGE
 98function getSupportedInstallLanguages(){
 99	$supportedLanguages = array(
100	'en_us'	=> 'English (US)',
101	);
102	if(file_exists('install/lang.config.php')){
103		include('install/lang.config.php');
104		if(!empty($config['languages'])){
105
106			foreach($config['languages'] as $k=>$v){
107				if(file_exists('install/language/' . $k . '.lang.php')){
108					$supportedLanguages[$k] = $v;
109				}
110			}
111		}
112	}
113	return $supportedLanguages;
114}
115$supportedLanguages = getSupportedInstallLanguages();
116
117// after install language is selected, use that pack
118$default_lang = 'en_us';
119if(!isset($_POST['language']) && (!isset($_SESSION['language']) && empty($_SESSION['language']))) {
120	if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) && !empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
121		$lang = parseAcceptLanguage();
122		if(isset($supportedLanguages[$lang])) {
123			$_POST['language'] = $lang;
124		} else {
125			$_POST['language'] = $default_lang;
126	    }
127	}
128}
129
130if(isset($_POST['language'])) {
131	$_SESSION['language'] = str_replace('-','_',$_POST['language']);
132}
133
134$current_language = isset($_SESSION['language']) ? $_SESSION['language'] : $default_lang;
135
136if(file_exists("install/language/{$current_language}.lang.php")) {
137	require_once("install/language/{$current_language}.lang.php");
138} else {
139	require_once("install/language/{$default_lang}.lang.php");
140}
141
142if($current_language != 'en_us') {
143	$my_mod_strings = $mod_strings;
144	include('install/language/en_us.lang.php');
145	$mod_strings = sugarLangArrayMerge($mod_strings, $my_mod_strings);
146}
147////	END INSTALLER LANGUAGE
148///////////////////////////////////////////////////////////////////////////////
149
150//get the url for the helper link
151$help_url = get_help_button_url();
152
153//if this license print, then redirect and exit,
154if(isset($_REQUEST['page']) && $_REQUEST['page'] == 'licensePrint')
155{
156    include('install/licensePrint.php');
157    exit ();
158}
159
160if(isset($_REQUEST['sugar_body_only']) && $_REQUEST['sugar_body_only'] == "1") {
161//if this is a system check, then just run the check and return,
162//this is an ajax call and there is no need for further processing
163if(isset($_REQUEST['checkInstallSystem']) && ($_REQUEST['checkInstallSystem'])){
164    require_once('install/installSystemCheck.php');
165    echo runCheck($install_script, $mod_strings);
166    return;
167}
168
169//if this is a DB Settings check, then just run the check and return,
170//this is an ajax call and there is no need for further processing
171if(isset($_REQUEST['checkDBSettings']) && ($_REQUEST['checkDBSettings'])){
172    require_once('install/checkDBSettings.php');
173    echo checkDBSettings();
174    return;
175}
176}
177
178//maintaining the install_type if earlier set to custom
179if(isset($_REQUEST['install_type']) && $_REQUEST['install_type'] == 'custom'){
180	$_SESSION['install_type'] = $_REQUEST['install_type'];
181}
182
183//set the default settings into session
184foreach($installer_defaults as $key =>$val){
185    if(!isset($_SESSION[$key])){
186        $_SESSION[$key] = $val;
187    }
188}
189
190// always perform
191clean_special_arguments();
192print_debug_comment();
193$next_clicked = false;
194$next_step = 0;
195
196// use a simple array to map out the steps of the installer page flow
197$workflow = array(  'welcome.php',
198                    'ready.php',
199                    'license.php',
200                    'installType.php',
201);
202$workflow[] =  'systemOptions.php';
203$workflow[] = 'dbConfig_a.php';
204//$workflow[] = 'dbConfig_b.php';
205
206//define web root, which will be used as default for site_url
207if($_SERVER['SERVER_PORT']=='80'){
208    $web_root = $_SERVER['SERVER_NAME'].$_SERVER['PHP_SELF'];
209}else{
210    $web_root = $_SERVER['SERVER_NAME'].':'.$_SERVER['SERVER_PORT'].$_SERVER['PHP_SELF'];
211}
212$web_root = str_replace("/install.php", "", $web_root);
213$web_root = "http://$web_root";
214
215if (!isset($_SESSION['oc_install']) || $_SESSION['oc_install'] == false) {
216    $workflow[] = 'siteConfig_a.php';
217    if (isset($_SESSION['install_type']) && !empty($_SESSION['install_type']) &&
218         $_SESSION['install_type'] == 'custom') {
219            $workflow[] = 'siteConfig_b.php';
220    }
221} else {
222    if (is_readable('config.php')) {
223        require_once ('config.php');
224    }
225}
226
227if(empty($sugar_config['cache_dir']) && !empty($_SESSION['cache_dir'])) {
228    $sugar_config['cache_dir'] = $_SESSION['cache_dir'];
229}
230
231// set the form's php var to the loaded config's var else default to sane settings
232if(!isset($_SESSION['setup_site_url'])  || empty($_SESSION['setup_site_url'])) {
233    if(isset($sugar_config['site_url']) && !empty($sugar_config['site_url'])) {
234        $_SESSION['setup_site_url']= $sugar_config['site_url'];
235    } else {
236        $_SESSION['setup_site_url']= $web_root;
237    }
238}
239
240if (!isset($_SESSION['setup_system_name']) || empty($_SESSION['setup_system_name'])) {
241    $_SESSION['setup_system_name'] = 'SugarCRM';
242}
243if (!isset($_SESSION['setup_site_session_path']) || empty($_SESSION['setup_site_session_path'])) {
244    $_SESSION['setup_site_session_path'] = (isset($sugar_config['session_dir'])) ? $sugar_config['session_dir'] : '';
245}
246if (!isset($_SESSION['setup_site_log_dir']) || empty($_SESSION['setup_site_log_dir'])) {
247    $_SESSION['setup_site_log_dir'] = (isset($sugar_config['log_dir'])) ? $sugar_config['log_dir'] : '.';
248}
249if (!isset($_SESSION['setup_site_guid']) || empty($_SESSION['setup_site_guid'])) {
250    $_SESSION['setup_site_guid'] = (isset($sugar_config['unique_key'])) ? $sugar_config['unique_key'] : '';
251}
252if (!isset($_SESSION['cache_dir']) || empty($_SESSION['cache_dir'])) {
253    $_SESSION['cache_dir'] = isset($sugar_config['cache_dir']) ? $sugar_config['cache_dir'] : 'cache/';
254}
255
256  $workflow[] = 'confirmSettings.php';
257  $workflow[] = 'performSetup.php';
258
259  if(!isset($_SESSION['oc_install']) ||  $_SESSION['oc_install'] == false){
260    if(isset($_SESSION['install_type'])  && !empty($_SESSION['install_type'])  && $_SESSION['install_type']=='custom'){
261        //$workflow[] = 'download_patches.php';
262        $workflow[] = 'download_modules.php';
263    }
264  }
265
266    //$workflow[] = 'register.php';
267    $workflow[] = 'complete_install.php';
268
269
270// increment/decrement the workflow pointer
271if(!empty($_REQUEST['goto'])) {
272    switch($_REQUEST['goto']) {
273        case $mod_strings['LBL_CHECKSYS_RECHECK']:
274            $next_step = $_REQUEST['current_step'];
275            break;
276        case $mod_strings['LBL_BACK']:
277            $next_step = $_REQUEST['current_step'] - 1;
278            break;
279        case $mod_strings['LBL_NEXT']:
280        case $mod_strings['LBL_START']:
281            $next_step = $_REQUEST['current_step'] + 1;
282            $next_clicked = true;
283            break;
284        case 'SilentInstall':
285            $next_step = 9999;
286            break;
287		case 'oc_convert':
288            $next_step = 9191;
289            break;
290    }
291}
292// Add check here to see if a silent install config file exists; if so then launch silent installer
293elseif ( is_file('config_si.php') && empty($sugar_config['installer_locked'])) {
294
295$langHeader = get_language_header();
296
297    echo <<<EOHTML
298<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
299<html {$langHeader}>
300<head>
301   <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
302   <meta http-equiv="Content-Style-Type" content="text/css">
303   <meta http-equiv="Refresh" content="1; url=install.php?goto=SilentInstall&cli=true">
304   <title>{$mod_strings['LBL_WIZARD_TITLE']} {$mod_strings['LBL_TITLE_WELCOME']} {$setup_sugar_version} {$mod_strings['LBL_WELCOME_SETUP_WIZARD']}</title>
305   <link REL="SHORTCUT ICON" HREF="{$icon}">
306   <link rel="stylesheet" href="{$css}" type="text/css">
307</head>
308<body>
309    <table cellspacing="0" cellpadding="0" border="0" align="center" class="shell">
310    <tr>
311        <td colspan="2" id="help"><a href="{$help_url}" target='_blank'>{$mod_strings['LBL_HELP']} </a></td></tr>
312    <tr>
313      <th width="500">
314		<p>
315		<img src="{$sugar_md}" alt="SugarCRM" border="0">
316		</p>
317		{$mod_strings['LBL_TITLE_WELCOME']} {$setup_sugar_version} {$mod_strings['LBL_WELCOME_SETUP_WIZARD']}</th>
318
319      <th width="200" height="30" style="text-align: right;"><a href="http://www.sugarcrm.com" target="_blank"><IMG src="{$loginImage}" alt="SugarCRM" border="0"></a>
320      </th>
321    </tr>
322    <tr>
323      <td colspan="2"  id="ready_image"><IMG src="include/images/install_themes.jpg" width="698" height="247" alt="Sugar Themes" border="0"></td>
324    </tr>
325
326    <tr>
327      <td colspan="2" id="ready">{$mod_strings['LBL_LAUNCHING_SILENT_INSTALL']} </td>
328    </tr>
329    </table>
330</body>
331</html>
332EOHTML;
333    die();
334}
335
336
337
338    $exclude_files = array('complete_install.php','register.php','download_modules.php');
339
340if(isset($next_step) && isset($workflow[$next_step]) && !in_array($workflow[$next_step],$exclude_files) && isset($sugar_config['installer_locked']) && $sugar_config['installer_locked'] == true) {
341    $the_file = 'installDisabled.php';
342	$disabled_title = $mod_strings['LBL_DISABLED_DESCRIPTION'];
343	$disabled_title_2 = $mod_strings['LBL_DISABLED_TITLE_2'];
344	$disabled_text =<<<EOQ
345		<p>{$mod_strings['LBL_DISABLED_DESCRIPTION']}</p>
346		<pre>
347			'installer_locked' => false,
348		</pre>
349		<p>{$mod_strings['LBL_DISABLED_DESCRIPTION_2']}</p>
350
351		<p>{$mod_strings['LBL_DISABLED_HELP_1']} <a href="{$mod_strings['LBL_DISABLED_HELP_LNK']}" target="_blank">{$mod_strings['LBL_DISABLED_HELP_2']}</a>.</p>
352EOQ;
353}
354else{
355$validation_errors = array();
356// process the data posted
357if($next_clicked) {
358	// store the submitted data because the 'Next' button was clicked
359    switch($workflow[trim($_REQUEST['current_step'])]) {
360        case 'welcome.php':
361        	$_SESSION['language'] = $_REQUEST['language'];
362   			$_SESSION['setup_site_admin_user_name'] = 'admin';
363        break;
364      case 'license.php':
365                $_SESSION['setup_license_accept']   = get_boolean_from_request('setup_license_accept');
366                $_SESSION['license_submitted']      = true;
367
368
369           // eventually default all vars here, with overrides from config.php
370            if(is_readable('config.php')) {
371            	global $sugar_config;
372                include_once('config.php');
373            }
374
375            $default_db_type = 'mysql';
376
377            if(!isset($_SESSION['setup_db_type'])) {
378                $_SESSION['setup_db_type'] = empty($sugar_config['dbconfig']['db_type']) ? $default_db_type : $sugar_config['dbconfig']['db_type'];
379            }
380
381            break;
382        case 'installType.php':
383            $_SESSION['install_type']   = $_REQUEST['install_type'];
384            if(isset($_REQUEST['setup_license_key']) && !empty($_REQUEST['setup_license_key'])){
385                $_SESSION['setup_license_key']  = $_REQUEST['setup_license_key'];
386            }
387            $_SESSION['licenseKey_submitted']      = true;
388
389
390
391            break;
392
393        case 'systemOptions.php':
394            if(isset($_REQUEST['setup_db_type'])) {
395              $_SESSION['setup_db_type'] = $_REQUEST['setup_db_type'];
396            }
397            $validation_errors = validate_systemOptions();
398            if(count($validation_errors) > 0) {
399                $next_step--;
400            }
401            break;
402
403        case 'dbConfig_a.php':
404            //validation is now done through ajax call to checkDBSettings.php
405            if(isset($_REQUEST['setup_db_drop_tables'])){
406                $_SESSION['setup_db_drop_tables'] = $_REQUEST['setup_db_drop_tables'];
407                if($_SESSION['setup_db_drop_tables']=== true || $_SESSION['setup_db_drop_tables'] == 'true'){
408                    $_SESSION['setup_db_create_database'] = false;
409                }
410            }
411            break;
412
413        case 'siteConfig_a.php':
414            if(isset($_REQUEST['setup_site_url'])){$_SESSION['setup_site_url']          = $_REQUEST['setup_site_url'];}
415            if(isset($_REQUEST['setup_system_name'])){$_SESSION['setup_system_name']    = $_REQUEST['setup_system_name'];}
416            if(isset($_REQUEST['setup_db_collation'])) {
417                $_SESSION['setup_db_options']['collation'] = $_REQUEST['setup_db_collation'];
418            }
419            $_SESSION['setup_site_admin_user_name']             = $_REQUEST['setup_site_admin_user_name'];
420            $_SESSION['setup_site_admin_password']              = $_REQUEST['setup_site_admin_password'];
421            $_SESSION['setup_site_admin_password_retype']       = $_REQUEST['setup_site_admin_password_retype'];
422            $_SESSION['siteConfig_submitted']               = true;
423
424            $validation_errors = array();
425            $validation_errors = validate_siteConfig('a');
426            if(count($validation_errors) > 0) {
427                $next_step--;
428            }
429            break;
430        case 'siteConfig_b.php':
431            $_SESSION['setup_site_sugarbeet_automatic_checks'] = get_boolean_from_request('setup_site_sugarbeet_automatic_checks');
432
433            $_SESSION['setup_site_custom_session_path']     = get_boolean_from_request('setup_site_custom_session_path');
434            if($_SESSION['setup_site_custom_session_path']){
435                $_SESSION['setup_site_session_path']            = $_REQUEST['setup_site_session_path'];
436            }else{
437                $_SESSION['setup_site_session_path'] = '';
438            }
439
440            $_SESSION['setup_site_custom_log_dir']          = get_boolean_from_request('setup_site_custom_log_dir');
441            if($_SESSION['setup_site_custom_log_dir']){
442                $_SESSION['setup_site_log_dir']                 = $_REQUEST['setup_site_log_dir'];
443            }else{
444                $_SESSION['setup_site_log_dir'] = '.';
445            }
446
447            $_SESSION['setup_site_specify_guid']            = get_boolean_from_request('setup_site_specify_guid');
448            if($_SESSION['setup_site_specify_guid']){
449                $_SESSION['setup_site_guid']                    = $_REQUEST['setup_site_guid'];
450            }else{
451                $_SESSION['setup_site_guid'] = '';
452            }
453            $_SESSION['siteConfig_submitted']               = true;
454            if(isset($_REQUEST['setup_site_sugarbeet_anonymous_stats'])){
455                $_SESSION['setup_site_sugarbeet_anonymous_stats'] = get_boolean_from_request('setup_site_sugarbeet_anonymous_stats');
456            }else{
457                $_SESSION['setup_site_sugarbeet_anonymous_stats'] = 0;
458            }
459
460            $validation_errors = array();
461            $validation_errors = validate_siteConfig('b');
462            if(count($validation_errors) > 0) {
463                $next_step--;
464            }
465            break;
466}
467    }
468
469if($next_step == 9999) {
470    $the_file = 'SilentInstall';
471}else if($next_step == 9191) {
472	$_SESSION['oc_server_url']	= $_REQUEST['oc_server_url'];
473    $_SESSION['oc_username']    = $_REQUEST['oc_username'];
474    $_SESSION['oc_password']   	= $_REQUEST['oc_password'];
475    $the_file = 'oc_convert.php';
476}
477else{
478        $the_file = $workflow[$next_step];
479
480}
481
482switch($the_file) {
483    case 'welcome.php':
484    case 'license.php':
485			//
486			// Check to see if session variables are working properly
487			//
488			$_SESSION['test_session'] = 'sessions are available';
489        @session_write_close();
490			unset($_SESSION['test_session']);
491        @session_start();
492
493			if(!isset($_SESSION['test_session']))
494			{
495                $the_file = 'installDisabled.php';
496				// PHP.ini location -
497				$phpIniLocation = get_cfg_var("cfg_file_path");
498				$disabled_title = $mod_strings['LBL_SESSION_ERR_TITLE'];
499				$disabled_title_2 = $mod_strings['LBL_SESSION_ERR_TITLE'];
500				$disabled_text = $mod_strings['LBL_SESSION_ERR_DESCRIPTION']."<pre>{$phpIniLocation}</pre>";
501            break;
502			}
503        // check to see if installer has been disabled
504        if(is_readable('config.php') && (filesize('config.php') > 0)) {
505            include_once('config.php');
506
507            if(!isset($sugar_config['installer_locked']) || $sugar_config['installer_locked'] == true) {
508                $the_file = 'installDisabled.php';
509				$disabled_title = $mod_strings['LBL_DISABLED_DESCRIPTION'];
510				$disabled_title_2 = $mod_strings['LBL_DISABLED_TITLE_2'];
511				$disabled_text =<<<EOQ
512					<p>{$mod_strings['LBL_DISABLED_DESCRIPTION']}</p>
513					<pre>
514						'installer_locked' => false,
515					</pre>
516					<p>{$mod_strings['LBL_DISABLED_DESCRIPTION_2']}</p>
517
518					<p>{$mod_strings['LBL_DISABLED_HELP_1']} <a href="{$mod_strings['LBL_DISABLED_HELP_LNK']}" target="_blank">{$mod_strings['LBL_DISABLED_HELP_2']}</a>.</p>
519EOQ;
520		             //if this is an offline client installation but the conversion did not succeed,
521		            //then try to convert again
522					if(isset($sugar_config['disc_client']) && $sugar_config['disc_client'] == true && isset($sugar_config['oc_converted']) && $sugar_config['oc_converted'] == false) {
523			          header('Location: index.php?entryPoint=oc_convert&first_time=true');
524						exit ();
525		            }
526            }
527        }
528        break;
529    case 'register.php':
530    case 'complete_install.php':
531        session_unset();
532        break;
533    case 'SilentInstall':
534        $si_errors = false;
535        pullSilentInstallVarsIntoSession();
536        $validation_errors = validate_dbConfig('a');
537        if(count($validation_errors) > 0) {
538            $the_file = 'dbConfig_a.php';
539            $si_errors = true;
540        }
541        $validation_errors = validate_siteConfig('a');
542        if(count($validation_errors) > 0) {
543            $the_file = 'siteConfig_a.php';
544            $si_errors = true;
545        }
546        $validation_errors = validate_siteConfig('b');
547        if(count($validation_errors) > 0) {
548            $the_file = 'siteConfig_b.php';
549            $si_errors = true;
550        }
551
552        if(!$si_errors){
553            $the_file = 'performSetup.php';
554        }
555        require_once('jssource/minify.php');
556        //since this is a SilentInstall we still need to make sure that
557        //the appropriate files are writable
558        // config.php
559        make_writable('./config.php');
560
561        // custom dir
562        make_writable('./custom');
563
564        // modules dir
565        recursive_make_writable('./modules');
566
567        // cache dir
568        create_writable_dir(sugar_cached('custom_fields'));
569        create_writable_dir(sugar_cached('dyn_lay'));
570        create_writable_dir(sugar_cached('images'));
571        create_writable_dir(sugar_cached('modules'));
572        create_writable_dir(sugar_cached('layout'));
573        create_writable_dir(sugar_cached('pdf'));
574        create_writable_dir(sugar_cached('upload/import'));
575        create_writable_dir(sugar_cached('xml'));
576        create_writable_dir(sugar_cached('include/javascript'));
577        recursive_make_writable(sugar_cached('modules'));
578
579        // check whether we're getting this request from a command line tool
580        // we want to output brief messages if we're outputting to a command line tool
581        $cli_mode = false;
582        if(isset($_REQUEST['cli']) && ($_REQUEST['cli'] == 'true')) {
583            $_SESSION['cli'] = true;
584            // if we have errors, just shoot them back now
585            if(count($validation_errors) > 0) {
586                foreach($validation_errors as $error) {
587                    print($mod_strings['ERR_ERROR_GENERAL']."\n");
588                    print("    " . $error . "\n");
589                    print("Exit 1\n");
590                    exit(1);
591                }
592            }
593        }
594        break;
595	}
596}
597
598
599$the_file = clean_string($the_file, 'FILE');
600
601installerHook('pre_installFileRequire', array('the_file' => $the_file));
602
603// change to require to get a good file load error message if the file is not available.
604require('install/' . $the_file);
605
606installerHook('post_installFileRequire', array('the_file' => $the_file));
607
608?>