|
1
|
|
|
<?php |
|
2
|
|
|
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
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 [email protected]. |
|
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
|
|
|
function installStatus($msg, $cmd = null, $overwrite = false, $before = '[ok]<br>') { |
|
42
|
|
|
$fname = 'install/status.json'; |
|
43
|
|
|
if(!$overwrite && file_exists($fname)) { |
|
44
|
|
|
$stat = json_decode(file_get_contents($fname)); |
|
45
|
|
|
//$msg = json_encode($stat); |
|
46
|
|
|
$msg = $stat->message . $before . $msg; |
|
47
|
|
|
} |
|
48
|
|
|
file_put_contents($fname, json_encode(array( |
|
49
|
|
|
'message' => $msg, |
|
50
|
|
|
'command' => $cmd, |
|
51
|
|
|
))); |
|
52
|
|
|
} |
|
53
|
|
|
installStatus($mod_strings['LBL_START'], null, true, ''); |
|
54
|
|
|
|
|
55
|
|
|
// This file will load the configuration settings from session data, |
|
56
|
|
|
// write to the config file, and execute any necessary database steps. |
|
57
|
|
|
$GLOBALS['installing'] = true; |
|
58
|
|
|
if( !isset( $install_script ) || !$install_script ){ |
|
59
|
|
|
die($mod_strings['ERR_NO_DIRECT_SCRIPT']); |
|
60
|
|
|
} |
|
61
|
|
|
ini_set("output_buffering","0"); |
|
62
|
|
|
set_time_limit(3600); |
|
63
|
|
|
// flush after each output so the user can see the progress in real-time |
|
64
|
|
|
ob_implicit_flush(); |
|
65
|
|
|
|
|
66
|
|
|
|
|
67
|
|
|
require_once('install/install_utils.php'); |
|
68
|
|
|
|
|
69
|
|
|
require_once('modules/TableDictionary.php'); |
|
70
|
|
|
|
|
71
|
|
|
|
|
72
|
|
|
$trackerManager = TrackerManager::getInstance(); |
|
73
|
|
|
$trackerManager->pause(); |
|
74
|
|
|
|
|
75
|
|
|
|
|
76
|
|
|
$cache_dir = sugar_cached(""); |
|
77
|
|
|
$line_entry_format = "     <b>"; |
|
78
|
|
|
$line_exit_format = "...   </b>"; |
|
79
|
|
|
$rel_dictionary = $dictionary; // sourced by modules/TableDictionary.php |
|
80
|
|
|
$render_table_close = ""; |
|
81
|
|
|
$render_table_open = ""; |
|
82
|
|
|
$setup_db_admin_password = $_SESSION['setup_db_admin_password']; |
|
83
|
|
|
$setup_db_admin_user_name = $_SESSION['setup_db_admin_user_name']; |
|
84
|
|
|
$setup_db_create_database = $_SESSION['setup_db_create_database']; |
|
85
|
|
|
$setup_db_create_sugarsales_user = $_SESSION['setup_db_create_sugarsales_user']; |
|
86
|
|
|
$setup_db_database_name = $_SESSION['setup_db_database_name']; |
|
87
|
|
|
$setup_db_drop_tables = $_SESSION['setup_db_drop_tables']; |
|
88
|
|
|
$setup_db_host_instance = $_SESSION['setup_db_host_instance']; |
|
89
|
|
|
$setup_db_port_num = $_SESSION['setup_db_port_num']; |
|
90
|
|
|
$setup_db_host_name = $_SESSION['setup_db_host_name']; |
|
91
|
|
|
$demoData = $_SESSION['demoData']; |
|
92
|
|
|
$setup_db_sugarsales_password = $_SESSION['setup_db_sugarsales_password']; |
|
93
|
|
|
$setup_db_sugarsales_user = $_SESSION['setup_db_sugarsales_user']; |
|
94
|
|
|
$setup_site_admin_user_name = $_SESSION['setup_site_admin_user_name']; |
|
95
|
|
|
$setup_site_admin_password = $_SESSION['setup_site_admin_password']; |
|
96
|
|
|
$setup_site_guid = (isset($_SESSION['setup_site_specify_guid']) && $_SESSION['setup_site_specify_guid'] != '') ? $_SESSION['setup_site_guid'] : ''; |
|
97
|
|
|
$setup_site_url = $_SESSION['setup_site_url']; |
|
98
|
|
|
$parsed_url = parse_url($setup_site_url); |
|
99
|
|
|
$setup_site_host_name = $parsed_url['host']; |
|
100
|
|
|
$setup_site_log_dir = isset($_SESSION['setup_site_custom_log_dir']) ? $_SESSION['setup_site_log_dir'] : '.'; |
|
101
|
|
|
$setup_site_log_file = 'suitecrm.log'; // may be an option later |
|
102
|
|
|
$setup_site_session_path = isset($_SESSION['setup_site_custom_session_path']) ? $_SESSION['setup_site_session_path'] : ''; |
|
103
|
|
|
$setup_site_log_level ='fatal'; |
|
104
|
|
|
|
|
105
|
|
|
/*sugar_cache_clear('TeamSetsCache'); |
|
106
|
|
|
if ( file_exists($cache_dir .'modules/Teams/TeamSetCache.php') ) { |
|
107
|
|
|
unlink($cache_dir.'modules/Teams/TeamSetCache.php'); |
|
108
|
|
|
} |
|
109
|
|
|
|
|
110
|
|
|
sugar_cache_clear('TeamSetsMD5Cache'); |
|
111
|
|
|
if ( file_exists($cache_dir.'modules/Teams/TeamSetMD5Cache.php') ) { |
|
112
|
|
|
unlink($cache_dir.'modules/Teams/TeamSetMD5Cache.php'); |
|
113
|
|
|
}*/ |
|
114
|
|
|
$langHeader = get_language_header(); |
|
115
|
|
|
$out =<<<EOQ |
|
116
|
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
|
117
|
|
|
<!DOCTYPE HTML> |
|
118
|
|
|
<html {$langHeader}> |
|
119
|
|
|
<head> |
|
120
|
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
|
121
|
|
|
<meta http-equiv="Content-Script-Type" content="text/javascript"> |
|
122
|
|
|
<meta http-equiv="Content-Style-Type" content="text/css"> |
|
123
|
|
|
<title>{$mod_strings['LBL_WIZARD_TITLE']} {$mod_strings['LBL_PERFORM_TITLE']}</title> |
|
124
|
|
|
<link REL="SHORTCUT ICON" HREF="$icon"> |
|
125
|
|
|
<!-- <link rel="stylesheet" href="$css" type="text/css" /> --> |
|
126
|
|
|
<script type="text/javascript" src="$common"></script> |
|
127
|
|
|
<link rel="stylesheet" href="install/install2.css" type="text/css" /> |
|
128
|
|
|
<script type="text/javascript" src="install/installCommon.js"></script> |
|
129
|
|
|
<script type="text/javascript" src="install/siteConfig.js"></script> |
|
130
|
|
|
<link rel='stylesheet' type='text/css' href='include/javascript/yui/build/container/assets/container.css' /> |
|
131
|
|
|
<link rel="stylesheet" href="themes/Suite7/css/fontello.css"> |
|
132
|
|
|
<link rel="stylesheet" href="themes/Suite7/css/animation.css"><!--[if IE 7]><link rel="stylesheet" href="css/fontello-ie7.css"><![endif]--> |
|
133
|
|
|
</head> |
|
134
|
|
|
<body onload="javascript:document.getElementById('button_next2').focus();"> |
|
135
|
|
|
<!--SuiteCRM installer--> |
|
136
|
|
|
<div id="install_container"> |
|
137
|
|
|
<div id="install_box"> |
|
138
|
|
|
<header id="install_header"> |
|
139
|
|
|
<div id="steps"> |
|
140
|
|
|
<p>{$mod_strings['LBL_STEP2']}</p> |
|
141
|
|
|
<i class="icon-progress-0" id="complete"></i> |
|
142
|
|
|
<i class="icon-progress-1" id="complete"></i> |
|
143
|
|
|
<i class="icon-progress-2"></i> |
|
144
|
|
|
</div> |
|
145
|
|
|
<div class="install_img"><a href="https://suitecrm.com" target="_blank"><img src="{$sugar_md}" alt="SuiteCRM"></a></div> |
|
146
|
|
|
</header> |
|
147
|
|
|
EOQ; |
|
148
|
|
|
echo $out; |
|
149
|
|
|
installStatus($mod_strings['STAT_CONFIGURATION'], null, false, ''); |
|
150
|
|
|
installLog("calling handleSugarConfig()"); |
|
151
|
|
|
$bottle = handleSugarConfig(); |
|
152
|
|
|
//installLog("calling handleLog4Php()"); |
|
153
|
|
|
//handleLog4Php(); |
|
154
|
|
|
|
|
155
|
|
|
$server_software = $_SERVER["SERVER_SOFTWARE"]; |
|
156
|
|
|
if(strpos($server_software,'Microsoft-IIS') !== false) |
|
157
|
|
|
{ |
|
158
|
|
|
installLog("calling handleWebConfig()"); |
|
159
|
|
|
handleWebConfig(); |
|
160
|
|
|
} else { |
|
161
|
|
|
installLog("calling handleHtaccess()"); |
|
162
|
|
|
handleHtaccess(); |
|
163
|
|
|
} |
|
164
|
|
|
|
|
165
|
|
|
/////////////////////////////////////////////////////////////////////////////// |
|
166
|
|
|
//// START TABLE STUFF |
|
167
|
|
|
echo "<br>"; |
|
168
|
|
|
echo "<b>{$mod_strings['LBL_PERFORM_TABLES']}</b>"; |
|
169
|
|
|
echo "<br>"; |
|
170
|
|
|
|
|
171
|
|
|
// create the SugarCRM database |
|
172
|
|
|
if($setup_db_create_database) { |
|
173
|
|
|
installLog("calling handleDbCreateDatabase()"); |
|
174
|
|
|
installerHook('pre_handleDbCreateDatabase'); |
|
175
|
|
|
handleDbCreateDatabase(); |
|
176
|
|
|
installerHook('post_handleDbCreateDatabase'); |
|
177
|
|
|
} else { |
|
178
|
|
|
|
|
179
|
|
|
// ensure the charset and collation are utf8 |
|
180
|
|
|
installLog("calling handleDbCharsetCollation()"); |
|
181
|
|
|
installerHook('pre_handleDbCharsetCollation'); |
|
182
|
|
|
handleDbCharsetCollation(); |
|
183
|
|
|
installerHook('post_handleDbCharsetCollation'); |
|
184
|
|
|
} |
|
185
|
|
|
|
|
186
|
|
|
//Suite rebuild exts |
|
187
|
|
|
/*require_once('ModuleInstall/ModuleInstaller.php'); |
|
188
|
|
|
$ModuleInstaller = new ModuleInstaller(); |
|
189
|
|
|
$ModuleInstaller->silent=true; |
|
190
|
|
|
$ModuleInstaller->rebuild_modules(); |
|
191
|
|
|
$ModuleInstaller->rebuild_languages( array ('en_us' => 'English (US)',)); |
|
192
|
|
|
$ModuleInstaller->rebuild_extensions(); |
|
193
|
|
|
$ModuleInstaller->rebuild_tabledictionary();*/ |
|
194
|
|
|
|
|
195
|
|
|
// create the SugarCRM database user |
|
196
|
|
|
if($setup_db_create_sugarsales_user){ |
|
197
|
|
|
installerHook('pre_handleDbCreateSugarUser'); |
|
198
|
|
|
handleDbCreateSugarUser(); |
|
199
|
|
|
installerHook('post_handleDbCreateSugarUser'); |
|
200
|
|
|
} |
|
201
|
|
|
|
|
202
|
|
|
foreach( $beanFiles as $bean => $file ){ |
|
203
|
|
|
require_once( $file ); |
|
204
|
|
|
} |
|
205
|
|
|
echo "<br>"; |
|
206
|
|
|
// load up the config_override.php file. |
|
207
|
|
|
// This is used to provide default user settings |
|
208
|
|
|
if( is_file("config_override.php") ){ |
|
209
|
|
|
require_once("config_override.php"); |
|
210
|
|
|
} |
|
211
|
|
|
|
|
212
|
|
|
$db = DBManagerFactory::getInstance(); |
|
213
|
|
|
$startTime = microtime(true); |
|
214
|
|
|
$focus = 0; |
|
215
|
|
|
$processed_tables = array(); // for keeping track of the tables we have worked on |
|
216
|
|
|
$empty = ''; |
|
217
|
|
|
$new_tables = 1; // is there ever a scenario where we DON'T create the admin user? |
|
218
|
|
|
$new_config = 1; |
|
219
|
|
|
$new_report = 1; |
|
220
|
|
|
|
|
221
|
|
|
// add non-module Beans to this array to keep the installer from erroring. |
|
222
|
|
|
$nonStandardModules = array ( |
|
223
|
|
|
//'Tracker', |
|
224
|
|
|
); |
|
225
|
|
|
|
|
226
|
|
|
|
|
227
|
|
|
/** |
|
228
|
|
|
* loop through all the Beans and create their tables |
|
229
|
|
|
*/ |
|
230
|
|
|
installStatus($mod_strings['STAT_CREATE_DB']); |
|
231
|
|
|
installLog("looping through all the Beans and create their tables"); |
|
232
|
|
|
//start by clearing out the vardefs |
|
233
|
|
|
VardefManager::clearVardef(); |
|
234
|
|
|
installerHook('pre_createAllModuleTables'); |
|
235
|
|
|
|
|
236
|
|
|
|
|
237
|
|
|
foreach( $beanFiles as $bean => $file ) { |
|
238
|
|
|
$doNotInit = array('Scheduler', 'SchedulersJob', 'ProjectTask','jjwg_Maps','jjwg_Address_Cache','jjwg_Areas','jjwg_Markers'); |
|
239
|
|
|
|
|
240
|
|
|
if(in_array($bean, $doNotInit)) { |
|
241
|
|
|
$focus = new $bean(false); |
|
242
|
|
|
} else { |
|
243
|
|
|
$focus = new $bean(); |
|
244
|
|
|
} |
|
245
|
|
|
|
|
246
|
|
|
if ( $bean == 'Configurator' ) |
|
247
|
|
|
continue; |
|
248
|
|
|
|
|
249
|
|
|
$table_name = $focus->table_name; |
|
250
|
|
|
//installStatus(sprintf($mod_strings['STAT_CREATE_DB_TABLE'], $focus->table_name )); |
|
251
|
|
|
installLog("processing table ".$focus->table_name); |
|
252
|
|
|
// check to see if we have already setup this table |
|
253
|
|
|
if(!in_array($table_name, $processed_tables)) { |
|
254
|
|
|
if(!file_exists("modules/".$focus->module_dir."/vardefs.php")){ |
|
255
|
|
|
continue; |
|
256
|
|
|
} |
|
257
|
|
|
if(!in_array($bean, $nonStandardModules)) { |
|
258
|
|
|
require_once("modules/".$focus->module_dir."/vardefs.php"); // load up $dictionary |
|
259
|
|
|
if($dictionary[$focus->object_name]['table'] == 'does_not_exist') { |
|
260
|
|
|
continue; // support new vardef definitions |
|
261
|
|
|
} |
|
262
|
|
|
} else { |
|
263
|
|
|
continue; //no further processing needed for ignored beans. |
|
264
|
|
|
} |
|
265
|
|
|
|
|
266
|
|
|
// table has not been setup...we will do it now and remember that |
|
267
|
|
|
$processed_tables[] = $table_name; |
|
268
|
|
|
|
|
269
|
|
|
$focus->db->database = $db->database; // set db connection so we do not need to reconnect |
|
270
|
|
|
|
|
271
|
|
|
if($setup_db_drop_tables) { |
|
272
|
|
|
drop_table_install($focus); |
|
273
|
|
|
installLog("dropping table ".$focus->table_name); |
|
274
|
|
|
} |
|
275
|
|
|
|
|
276
|
|
|
if(create_table_if_not_exist($focus)) { |
|
277
|
|
|
installLog("creating table ".$focus->table_name); |
|
278
|
|
|
if( $bean == "User" ){ |
|
279
|
|
|
$new_tables = 1; |
|
280
|
|
|
} |
|
281
|
|
|
if($bean == "Administration") |
|
282
|
|
|
$new_config = 1; |
|
283
|
|
|
|
|
284
|
|
|
|
|
285
|
|
|
} |
|
286
|
|
|
|
|
287
|
|
|
installLog("creating Relationship Meta for ".$focus->getObjectName()); |
|
288
|
|
|
installerHook('pre_createModuleTable', array('module' => $focus->getObjectName())); |
|
289
|
|
|
SugarBean::createRelationshipMeta($focus->getObjectName(), $db, $table_name, $empty, $focus->module_dir); |
|
290
|
|
|
installerHook('post_createModuleTable', array('module' => $focus->getObjectName())); |
|
291
|
|
|
echo "."; |
|
292
|
|
|
|
|
293
|
|
|
} // end if() |
|
294
|
|
|
} |
|
295
|
|
|
|
|
296
|
|
|
|
|
297
|
|
|
installerHook('post_createAllModuleTables'); |
|
298
|
|
|
|
|
299
|
|
|
echo "<br>"; |
|
300
|
|
|
//// END TABLE STUFF |
|
301
|
|
|
|
|
302
|
|
|
/////////////////////////////////////////////////////////////////////////////// |
|
303
|
|
|
//// START RELATIONSHIP CREATION |
|
304
|
|
|
|
|
305
|
|
|
ksort($rel_dictionary); |
|
306
|
|
|
foreach( $rel_dictionary as $rel_name => $rel_data ){ |
|
307
|
|
|
$table = $rel_data['table']; |
|
308
|
|
|
|
|
309
|
|
|
if( $setup_db_drop_tables ){ |
|
310
|
|
|
if( $db->tableExists($table) ){ |
|
311
|
|
|
$db->dropTableName($table); |
|
312
|
|
|
} |
|
313
|
|
|
} |
|
314
|
|
|
|
|
315
|
|
|
if( !$db->tableExists($table) ){ |
|
316
|
|
|
$db->createTableParams($table, $rel_data['fields'], $rel_data['indices']); |
|
317
|
|
|
} |
|
318
|
|
|
|
|
319
|
|
|
SugarBean::createRelationshipMeta($rel_name,$db,$table,$rel_dictionary,''); |
|
320
|
|
|
} |
|
321
|
|
|
|
|
322
|
|
|
/////////////////////////////////////////////////////////////////////////////// |
|
323
|
|
|
//// START CREATE DEFAULTS |
|
324
|
|
|
echo "<br>"; |
|
325
|
|
|
echo "<b>{$mod_strings['LBL_PERFORM_CREATE_DEFAULT']}</b><br>"; |
|
326
|
|
|
echo "<br>"; |
|
327
|
|
|
installStatus($mod_strings['STAT_CREATE_DEFAULT_SETTINGS']); |
|
328
|
|
|
installLog("Begin creating Defaults"); |
|
329
|
|
|
installerHook('pre_createDefaultSettings'); |
|
330
|
|
|
if ($new_config) { |
|
331
|
|
|
installLog("insert defaults into config table"); |
|
332
|
|
|
insert_default_settings(); |
|
333
|
|
|
} |
|
334
|
|
|
installerHook('post_createDefaultSettings'); |
|
335
|
|
|
|
|
336
|
|
|
|
|
337
|
|
|
|
|
338
|
|
|
|
|
339
|
|
|
|
|
340
|
|
|
installerHook('pre_createUsers'); |
|
341
|
|
|
if ($new_tables) { |
|
342
|
|
|
echo $line_entry_format.$mod_strings['LBL_PERFORM_DEFAULT_USERS'].$line_exit_format; |
|
343
|
|
|
installLog($mod_strings['LBL_PERFORM_DEFAULT_USERS']); |
|
344
|
|
|
create_default_users(); |
|
345
|
|
|
echo $mod_strings['LBL_PERFORM_DONE']; |
|
346
|
|
|
} else { |
|
347
|
|
|
echo $line_entry_format.$mod_strings['LBL_PERFORM_ADMIN_PASSWORD'].$line_exit_format; |
|
348
|
|
|
installLog($mod_strings['LBL_PERFORM_ADMIN_PASSWORD']); |
|
349
|
|
|
$db->setUserName($setup_db_sugarsales_user); |
|
350
|
|
|
$db->setUserPassword($setup_db_sugarsales_password); |
|
351
|
|
|
set_admin_password($setup_site_admin_password); |
|
352
|
|
|
echo $mod_strings['LBL_PERFORM_DONE']; |
|
353
|
|
|
} |
|
354
|
|
|
installerHook('post_createUsers'); |
|
355
|
|
|
|
|
356
|
|
|
|
|
357
|
|
|
|
|
358
|
|
|
|
|
359
|
|
|
// default OOB schedulers |
|
360
|
|
|
|
|
361
|
|
|
echo $line_entry_format.$mod_strings['LBL_PERFORM_DEFAULT_SCHEDULER'].$line_exit_format; |
|
362
|
|
|
installLog($mod_strings['LBL_PERFORM_DEFAULT_SCHEDULER']); |
|
363
|
|
|
$scheduler = new Scheduler(); |
|
364
|
|
|
installerHook('pre_createDefaultSchedulers'); |
|
365
|
|
|
$scheduler->rebuildDefaultSchedulers(); |
|
366
|
|
|
installerHook('post_createDefaultSchedulers'); |
|
367
|
|
|
|
|
368
|
|
|
|
|
369
|
|
|
echo $mod_strings['LBL_PERFORM_DONE']; |
|
370
|
|
|
|
|
371
|
|
|
|
|
372
|
|
|
|
|
373
|
|
|
// Enable Sugar Feeds and add all feeds by default |
|
374
|
|
|
installLog("Enable SugarFeeds"); |
|
375
|
|
|
enableSugarFeeds(); |
|
376
|
|
|
|
|
377
|
|
|
/////////////////////////////////////////////////////////////////////////// |
|
378
|
|
|
//// FINALIZE LANG PACK INSTALL |
|
379
|
|
|
if(isset($_SESSION['INSTALLED_LANG_PACKS']) && is_array($_SESSION['INSTALLED_LANG_PACKS']) && !empty($_SESSION['INSTALLED_LANG_PACKS'])) { |
|
380
|
|
|
updateUpgradeHistory(); |
|
381
|
|
|
} |
|
382
|
|
|
|
|
383
|
|
|
|
|
384
|
|
|
//require_once('modules/Connectors/InstallDefaultConnectors.php'); |
|
385
|
|
|
|
|
386
|
|
|
/////////////////////////////////////////////////////////////////////////////// |
|
387
|
|
|
//// INSTALL PASSWORD TEMPLATES |
|
388
|
|
|
include('install/seed_data/Advanced_Password_SeedData.php'); |
|
389
|
|
|
|
|
390
|
|
|
/////////////////////////////////////////////////////////////////////////////// |
|
391
|
|
|
//// SETUP DONE |
|
392
|
|
|
installLog("Installation has completed *********"); |
|
393
|
|
|
|
|
394
|
|
|
$memoryUsed = ''; |
|
395
|
|
|
if (function_exists('memory_get_usage')) { |
|
396
|
|
|
$memoryUsed = $mod_strings['LBL_PERFORM_OUTRO_5'] . memory_get_usage() . $mod_strings['LBL_PERFORM_OUTRO_6']; |
|
397
|
|
|
} |
|
398
|
|
|
|
|
399
|
|
|
|
|
400
|
|
|
$errTcpip = ''; |
|
401
|
|
|
$fp = @fsockopen("www.suitecrm.com", 80, $errno, $errstr, 3); |
|
402
|
|
|
if (!$fp) { |
|
403
|
|
|
$errTcpip = "<p>{$mod_strings['ERR_PERFORM_NO_TCPIP']}</p>"; |
|
404
|
|
|
} |
|
405
|
|
|
if ($fp && (!isset($_SESSION['oc_install']) || $_SESSION['oc_install'] == false)) { |
|
406
|
|
|
@fclose($fp); |
|
|
|
|
|
|
407
|
|
|
if ($next_step == 9999) |
|
408
|
|
|
$next_step = 8; |
|
409
|
|
|
$fpResult = <<<FP |
|
410
|
|
|
<form action="install.php" method="post" name="form" id="form"> |
|
411
|
|
|
<input type="hidden" name="current_step" value="{$next_step}"> |
|
412
|
|
|
<input class="button" type="submit" name="goto" value="{$mod_strings['LBL_NEXT']}" id="button_next2"/> |
|
413
|
|
|
</form> |
|
414
|
|
|
FP; |
|
415
|
|
|
} else { |
|
416
|
|
|
$fpResult = <<<FP |
|
417
|
|
|
<form action="index.php" method="post" name="formFinish" id="formFinish"> |
|
418
|
|
|
<input type="hidden" name="default_user_name" value="admin" /> |
|
419
|
|
|
<input class="button" type="submit" name="next" value="{$mod_strings['LBL_PERFORM_FINISH']}" id="button_next2"/> |
|
420
|
|
|
</form> |
|
421
|
|
|
FP; |
|
422
|
|
|
} |
|
423
|
|
|
|
|
424
|
|
|
if( isset($_SESSION['setup_site_sugarbeet_automatic_checks']) && $_SESSION['setup_site_sugarbeet_automatic_checks'] == true){ |
|
425
|
|
|
set_CheckUpdates_config_setting('automatic'); |
|
426
|
|
|
}else{ |
|
427
|
|
|
set_CheckUpdates_config_setting('manual'); |
|
428
|
|
|
} |
|
429
|
|
|
if(!empty($_SESSION['setup_system_name'])){ |
|
430
|
|
|
$admin=new Administration(); |
|
431
|
|
|
$admin->saveSetting('system','name',$_SESSION['setup_system_name']); |
|
432
|
|
|
} |
|
433
|
|
|
|
|
434
|
|
|
// Bug 28601 - Set the default list of tabs to show |
|
435
|
|
|
$enabled_tabs = array(); |
|
436
|
|
|
$enabled_tabs[] = 'Home'; |
|
437
|
|
|
$enabled_tabs[] = 'Accounts'; |
|
438
|
|
|
$enabled_tabs[] = 'Contacts'; |
|
439
|
|
|
$enabled_tabs[] = 'Opportunities'; |
|
440
|
|
|
$enabled_tabs[] = 'Leads'; |
|
441
|
|
|
$enabled_tabs[] = 'AOS_Quotes'; |
|
442
|
|
|
$enabled_tabs[] = 'Calendar'; |
|
443
|
|
|
$enabled_tabs[] = 'Documents'; |
|
444
|
|
|
$enabled_tabs[] = 'Emails'; |
|
445
|
|
|
$enabled_tabs[] = 'Campaigns'; |
|
446
|
|
|
$enabled_tabs[] = 'Calls'; |
|
447
|
|
|
$enabled_tabs[] = 'Meetings'; |
|
448
|
|
|
$enabled_tabs[] = 'Tasks'; |
|
449
|
|
|
$enabled_tabs[] = 'Notes'; |
|
450
|
|
|
$enabled_tabs[] = 'AOS_Invoices'; |
|
451
|
|
|
$enabled_tabs[] = 'AOS_Contracts'; |
|
452
|
|
|
$enabled_tabs[] = 'Cases'; |
|
453
|
|
|
$enabled_tabs[] = 'Prospects'; |
|
454
|
|
|
$enabled_tabs[] = 'ProspectLists'; |
|
455
|
|
|
$enabled_tabs[] = 'Project'; |
|
456
|
|
|
$enabled_tabs[] = 'AM_ProjectTemplates'; |
|
457
|
|
|
$enabled_tabs[] = 'AM_TaskTemplates'; |
|
458
|
|
|
$enabled_tabs[] = 'FP_events'; |
|
459
|
|
|
$enabled_tabs[] = 'FP_Event_Locations'; |
|
460
|
|
|
$enabled_tabs[] = 'AOS_Products'; |
|
461
|
|
|
$enabled_tabs[] = 'AOS_Product_Categories'; |
|
462
|
|
|
$enabled_tabs[] = 'AOS_PDF_Templates'; |
|
463
|
|
|
$enabled_tabs[] = 'jjwg_Maps'; |
|
464
|
|
|
$enabled_tabs[] = 'jjwg_Markers'; |
|
465
|
|
|
$enabled_tabs[] = 'jjwg_Areas'; |
|
466
|
|
|
$enabled_tabs[] = 'jjwg_Address_Cache'; |
|
467
|
|
|
$enabled_tabs[] = 'AOR_Reports'; |
|
468
|
|
|
$enabled_tabs[] = 'AOW_WorkFlow'; |
|
469
|
|
|
$enabled_tabs[] = 'AOK_KnowledgeBase'; |
|
470
|
|
|
$enabled_tabs[] = 'AOK_Knowledge_Base_Categories'; |
|
471
|
|
|
|
|
472
|
|
|
installerHook('pre_setSystemTabs'); |
|
473
|
|
|
require_once('modules/MySettings/TabController.php'); |
|
474
|
|
|
$tabs = new TabController(); |
|
475
|
|
|
$tabs->set_system_tabs($enabled_tabs); |
|
476
|
|
|
installerHook('post_setSystemTabs'); |
|
477
|
|
|
include_once('install/suite_install/suite_install.php'); |
|
478
|
|
|
|
|
479
|
|
|
post_install_modules(); |
|
480
|
|
|
|
|
481
|
|
|
//Call rebuildSprites |
|
482
|
|
|
/*if(function_exists('imagecreatetruecolor')) |
|
483
|
|
|
{ |
|
484
|
|
|
require_once('modules/UpgradeWizard/uw_utils.php'); |
|
485
|
|
|
rebuildSprites(true); |
|
486
|
|
|
}*/ |
|
487
|
|
|
|
|
488
|
|
|
/////////////////////////////////////////////////////////////////////////////// |
|
489
|
|
|
//// START DEMO DATA |
|
490
|
|
|
|
|
491
|
|
|
// populating the db with seed data |
|
492
|
|
|
installLog("populating the db with seed data"); |
|
493
|
|
|
if( $_SESSION['demoData'] != 'no' ){ |
|
494
|
|
|
installerHook('pre_installDemoData'); |
|
495
|
|
|
set_time_limit( 301 ); |
|
496
|
|
|
|
|
497
|
|
|
echo "<br>"; |
|
498
|
|
|
echo "<b>{$mod_strings['LBL_PERFORM_DEMO_DATA']}</b>"; |
|
499
|
|
|
echo "<br><br>"; |
|
500
|
|
|
|
|
501
|
|
|
print( $render_table_close ); |
|
502
|
|
|
print( $render_table_open ); |
|
503
|
|
|
|
|
504
|
|
|
global $current_user; |
|
505
|
|
|
$current_user = new User(); |
|
506
|
|
|
$current_user->retrieve(1); |
|
507
|
|
|
include("install/populateSeedData.php"); |
|
508
|
|
|
installerHook('post_installDemoData'); |
|
509
|
|
|
} |
|
510
|
|
|
|
|
511
|
|
|
///////////////////////////////////////////////////////////// |
|
512
|
|
|
//// Store information by installConfig.php form |
|
513
|
|
|
|
|
514
|
|
|
// save current superglobals and vars |
|
515
|
|
|
$varStack['GLOBALS'] = $GLOBALS; |
|
516
|
|
|
$varStack['defined_vars'] = get_defined_vars(); |
|
517
|
|
|
|
|
518
|
|
|
// restore previously posted form |
|
519
|
|
|
$_REQUEST = array_merge($_REQUEST, $_SESSION); |
|
520
|
|
|
$_POST = array_merge($_POST, $_SESSION); |
|
521
|
|
|
|
|
522
|
|
|
|
|
523
|
|
|
installStatus($mod_strings['STAT_INSTALL_FINISH']); |
|
524
|
|
|
installLog('Save configuration settings..'); |
|
525
|
|
|
|
|
526
|
|
|
// <-------------------------------------------------------- |
|
527
|
|
|
// from ConfigurationConroller->action_saveadminwizard() |
|
528
|
|
|
// ----------------------------------------------------------> |
|
529
|
|
|
|
|
530
|
|
|
installLog('save locale'); |
|
531
|
|
|
|
|
532
|
|
|
|
|
533
|
|
|
|
|
534
|
|
|
|
|
535
|
|
|
//global $current_user; |
|
536
|
|
|
installLog('new Administration'); |
|
537
|
|
|
$focus = new Administration(); |
|
538
|
|
|
installLog('retrieveSettings'); |
|
539
|
|
|
//$focus->retrieveSettings(); |
|
540
|
|
|
// switch off the adminwizard (mark that we have got past this point) |
|
541
|
|
|
installLog('AdminWizard OFF'); |
|
542
|
|
|
$focus->saveSetting('system','adminwizard',1); |
|
543
|
|
|
|
|
544
|
|
|
installLog('saveConfig'); |
|
545
|
|
|
$focus->saveConfig(); |
|
546
|
|
|
|
|
547
|
|
|
installLog('new Configurator'); |
|
548
|
|
|
$configurator = new Configurator(); |
|
549
|
|
|
installLog('populateFromPost'); |
|
550
|
|
|
$configurator->populateFromPost(); |
|
551
|
|
|
|
|
552
|
|
|
|
|
553
|
|
|
|
|
554
|
|
|
|
|
555
|
|
|
installLog('handleOverride'); |
|
556
|
|
|
// add local settings to config overrides |
|
557
|
|
|
if(!empty($_SESSION['default_date_format'])) $sugar_config['default_date_format'] = $_SESSION['default_date_format']; |
|
558
|
|
|
if(!empty($_SESSION['default_time_format'])) $sugar_config['default_time_format'] = $_SESSION['default_time_format']; |
|
559
|
|
|
if(!empty($_SESSION['default_language'])) $sugar_config['default_language'] = $_SESSION['default_language']; |
|
560
|
|
|
if(!empty($_SESSION['default_locale_name_format'])) $sugar_config['default_locale_name_format'] = $_SESSION['default_locale_name_format']; |
|
561
|
|
|
//$configurator->handleOverride(); |
|
562
|
|
|
|
|
563
|
|
|
|
|
564
|
|
|
installLog('saveConfig'); |
|
565
|
|
|
$configurator->saveConfig(); |
|
566
|
|
|
|
|
567
|
|
|
|
|
568
|
|
|
|
|
569
|
|
|
|
|
570
|
|
|
|
|
571
|
|
|
|
|
572
|
|
|
|
|
573
|
|
|
|
|
574
|
|
|
// Bug 37310 - Delete any existing currency that matches the one we've just set the default to during the admin wizard |
|
575
|
|
|
installLog('new Currency'); |
|
576
|
|
|
$currency = new Currency; |
|
577
|
|
|
installLog('retrieve'); |
|
578
|
|
|
$currency->retrieve($currency->retrieve_id_by_name($_REQUEST['default_currency_name'])); |
|
579
|
|
|
if ( !empty($currency->id) |
|
580
|
|
|
&& $currency->symbol == $_REQUEST['default_currency_symbol'] |
|
581
|
|
|
&& $currency->iso4217 == $_REQUEST['default_currency_iso4217'] ) { |
|
582
|
|
|
$currency->deleted = 1; |
|
583
|
|
|
installLog('DBG: save currency'); |
|
584
|
|
|
$currency->save(); |
|
585
|
|
|
} |
|
586
|
|
|
|
|
587
|
|
|
|
|
588
|
|
|
installLog('Save user settings..'); |
|
589
|
|
|
|
|
590
|
|
|
// <------------------------------------------------ |
|
591
|
|
|
// from UsersController->action_saveuserwizard() |
|
592
|
|
|
// ----------------------------------------------------------> |
|
593
|
|
|
|
|
594
|
|
|
|
|
595
|
|
|
// set all of these default parameters since the Users save action will undo the defaults otherwise |
|
596
|
|
|
|
|
597
|
|
|
// load admin |
|
598
|
|
|
$current_user = new User(); |
|
599
|
|
|
$current_user->retrieve(1); |
|
600
|
|
|
$current_user->is_admin = '1'; |
|
601
|
|
|
$sugar_config = get_sugar_config_defaults(); |
|
602
|
|
|
|
|
603
|
|
|
// set local settings - if neccessary you can set here more fields as named in User module / EditView form... |
|
604
|
|
|
if(isset($_REQUEST['timezone']) && $_REQUEST['timezone']) { |
|
605
|
|
|
$current_user->setPreference('timezone', $_REQUEST['timezone']); |
|
606
|
|
|
} |
|
607
|
|
|
|
|
608
|
|
|
//$_POST[''] = $_REQUEST['default_locale_name_format']; |
|
609
|
|
|
$_POST['dateformat'] = $_REQUEST['default_date_format']; |
|
610
|
|
|
//$_POST[''] = $_REQUEST['default_time_format']; |
|
611
|
|
|
//$_POST[''] = $_REQUEST['default_language']; |
|
612
|
|
|
//$_POST[''] = $_REQUEST['default_currency_name']; |
|
613
|
|
|
//$_POST[''] = $_REQUEST['default_currency_symbol']; |
|
614
|
|
|
//$_POST[''] = $_REQUEST['default_currency_iso4217']; |
|
615
|
|
|
//$_POST[''] = $_REQUEST['setup_site_session_path']; |
|
616
|
|
|
//$_POST[''] = $_REQUEST['setup_site_log_dir']; |
|
617
|
|
|
//$_POST[''] = $_REQUEST['setup_site_guid']; |
|
618
|
|
|
//$_POST[''] = $_REQUEST['default_email_charset']; |
|
619
|
|
|
//$_POST[''] = $_REQUEST['default_export_charset']; |
|
620
|
|
|
//$_POST[''] = $_REQUEST['export_delimiter']; |
|
621
|
|
|
|
|
622
|
|
|
$_POST['record'] = $current_user->id; |
|
623
|
|
|
$_POST['is_admin'] = ( $current_user->is_admin ? 'on' : '' ); |
|
624
|
|
|
$_POST['use_real_names'] = true; |
|
625
|
|
|
$_POST['reminder_checked'] = '1'; |
|
626
|
|
|
$_POST['reminder_time'] = 1800; |
|
627
|
|
|
$_POST['email_reminder_time'] = 3600; |
|
628
|
|
|
$_POST['mailmerge_on'] = 'on'; |
|
629
|
|
|
$_POST['receive_notifications'] = $current_user->receive_notifications; |
|
630
|
|
|
installLog('DBG: SugarThemeRegistry::getDefault'); |
|
631
|
|
|
$_POST['user_theme'] = (string) SugarThemeRegistry::getDefault(); |
|
632
|
|
|
|
|
633
|
|
|
// save and redirect to new view |
|
634
|
|
|
$_REQUEST['return_module'] = 'Home'; |
|
635
|
|
|
$_REQUEST['return_action'] = 'index'; |
|
636
|
|
|
installLog('DBG: require modules/Users/Save.php'); |
|
637
|
|
|
require('modules/Users/Save.php'); |
|
638
|
|
|
|
|
639
|
|
|
// restore superglobals and vars |
|
640
|
|
|
$GLOBALS = $varStack['GLOBALS']; |
|
641
|
|
|
foreach($varStack['defined_vars'] as $__key => $__value) $$__key = $__value; |
|
642
|
|
|
|
|
643
|
|
|
|
|
644
|
|
|
|
|
645
|
|
|
$endTime = microtime(true); |
|
646
|
|
|
$deltaTime = $endTime - $startTime; |
|
647
|
|
|
|
|
648
|
|
|
if( count( $bottle ) > 0 ){ |
|
649
|
|
|
foreach( $bottle as $bottle_message ){ |
|
650
|
|
|
$bottleMsg .= "{$bottle_message}\n"; |
|
651
|
|
|
} |
|
652
|
|
|
} else { |
|
653
|
|
|
$bottleMsg = $mod_strings['LBL_PERFORM_SUCCESS']; |
|
654
|
|
|
} |
|
655
|
|
|
installerHook('post_installModules'); |
|
656
|
|
|
|
|
657
|
|
|
$out =<<<EOQ |
|
658
|
|
|
<br><p><b>{$mod_strings['LBL_PERFORM_OUTRO_1']} {$setup_sugar_version} {$mod_strings['LBL_PERFORM_OUTRO_2']}</b></p> |
|
659
|
|
|
|
|
660
|
|
|
{$mod_strings['LBL_PERFORM_OUTRO_3']} {$deltaTime} {$mod_strings['LBL_PERFORM_OUTRO_4']}<br /> |
|
661
|
|
|
<p><b>{$memoryUsed}</b></p> |
|
662
|
|
|
<p><b>{$errTcpip}</b></p> |
|
663
|
|
|
<p><b>{$fpResult}</b></p> |
|
664
|
|
|
</div> |
|
665
|
|
|
<footer id="install_footer"> |
|
666
|
|
|
<p id="footer_links"><a href="https://suitecrm.com" target="_blank">Visit suitecrm.com</a> | <a href="https://suitecrm.com/index.php?option=com_kunena&view=category&Itemid=1137&layout=list" target="_blank">Support Forums</a> | <a href="https://suitecrm.com/wiki/index.php/Installation" target="_blank">Installation Guide</a> | <a href="LICENSE.txt" target="_blank">License</a> |
|
667
|
|
|
</footer> |
|
668
|
|
|
</div> |
|
669
|
|
|
</body> |
|
670
|
|
|
</html> |
|
671
|
|
|
<!-- |
|
672
|
|
|
<bottle>{$bottleMsg}</bottle> |
|
673
|
|
|
--> |
|
674
|
|
|
EOQ; |
|
675
|
|
|
|
|
676
|
|
|
echo $out; |
|
677
|
|
|
|
|
678
|
|
|
$loginURL = str_replace('install.php', 'index.php', "//$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"); |
|
679
|
|
|
installStatus(sprintf($mod_strings['STAT_INSTALL_FINISH_LOGIN'], $loginURL ) , array('function' => 'redirect', 'arguments' => $loginURL) ); |
|
680
|
|
|
|
|
681
|
|
|
?> |
|
682
|
|
|
|
If you suppress an error, we recommend checking for the error condition explicitly: