|
iTx Technologies offre gratuitement
|
||
[Vue sommaire] [Imprimer] [Vue textuelle]
1 <?php 2 if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); 3 /********************************************************************************* 4 * SugarCRM is a customer relationship management program developed by 5 * SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc. 6 * 7 * This program is free software; you can redistribute it and/or modify it under 8 * the terms of the GNU General Public License version 3 as published by the 9 * Free Software Foundation with the addition of the following permission added 10 * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK 11 * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY 12 * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS. 13 * 14 * This program is distributed in the hope that it will be useful, but WITHOUT 15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 16 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 17 * details. 18 * 19 * You should have received a copy of the GNU General Public License along with 20 * this program; if not, see http://www.gnu.org/licenses or write to the Free 21 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 22 * 02110-1301 USA. 23 * 24 * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road, 25 * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com. 26 * 27 * The interactive user interfaces in modified source and object code versions 28 * of this program must display Appropriate Legal Notices, as required under 29 * Section 5 of the GNU General Public License version 3. 30 * 31 * In accordance with Section 7(b) of the GNU General Public License version 3, 32 * these Appropriate Legal Notices must retain the display of the "Powered by 33 * SugarCRM" logo. If the display of the logo is not reasonably feasible for 34 * technical reasons, the Appropriate Legal Notices must display the words 35 * "Powered by SugarCRM". 36 ********************************************************************************/ 37 38 39 // This file will load the configuration settings from session data, 40 // write to the config file, and execute any necessary database steps. 41 $GLOBALS['installing'] = true; 42 if( !isset( $install_script ) || !$install_script ){ 43 die($mod_strings['ERR_NO_DIRECT_SCRIPT']); 44 } 45 ini_set("output_buffering","0"); 46 set_time_limit(3600); 47 // flush after each output so the user can see the progress in real-time 48 ob_implicit_flush(); 49 50 51 52 53 54 require_once ('install/install_utils.php'); 55 56 require_once ('modules/TableDictionary.php'); 57 58 59 $trackerManager = TrackerManager::getInstance(); 60 $trackerManager->pause(); 61 62 63 $cache_dir = 'cache/'; 64 $line_entry_format = "     <b>"; 65 $line_exit_format = "...   </b>"; 66 $rel_dictionary = $dictionary; // sourced by modules/TableDictionary.php 67 $render_table_close = ""; 68 $render_table_open = ""; 69 $setup_db_admin_password = $_SESSION['setup_db_admin_password']; 70 $setup_db_admin_user_name = $_SESSION['setup_db_admin_user_name']; 71 $setup_db_create_database = $_SESSION['setup_db_create_database']; 72 $setup_db_create_sugarsales_user = $_SESSION['setup_db_create_sugarsales_user']; 73 $setup_db_database_name = $_SESSION['setup_db_database_name']; 74 $setup_db_drop_tables = $_SESSION['setup_db_drop_tables']; 75 $setup_db_host_instance = $_SESSION['setup_db_host_instance']; 76 $setup_db_host_name = $_SESSION['setup_db_host_name']; 77 $demoData = $_SESSION['demoData']; 78 $setup_db_sugarsales_password = $_SESSION['setup_db_sugarsales_password']; 79 $setup_db_sugarsales_user = $_SESSION['setup_db_sugarsales_user']; 80 $setup_site_admin_password = $_SESSION['setup_site_admin_password']; 81 $setup_site_guid = (isset($_SESSION['setup_site_specify_guid']) && $_SESSION['setup_site_specify_guid'] != '') ? $_SESSION['setup_site_guid'] : ''; 82 $setup_site_url = $_SESSION['setup_site_url']; 83 $parsed_url = parse_url($setup_site_url); 84 $setup_site_host_name = $parsed_url['host']; 85 $setup_site_log_dir = isset($_SESSION['setup_site_custom_log_dir']) ? $_SESSION['setup_site_log_dir'] : '.'; 86 $setup_site_log_file = 'sugarcrm.log'; // may be an option later 87 $setup_site_session_path = isset($_SESSION['setup_site_custom_session_path']) ? $_SESSION['setup_site_session_path'] : ''; 88 $setup_site_log_level ='fatal'; 89 90 sugar_cache_clear('TeamSetsCache'); 91 if ( file_exists($cache_dir .'modules/Teams/TeamSetCache.php') ) { 92 unlink($cache_dir.'modules/Teams/TeamSetCache.php'); 93 } 94 95 sugar_cache_clear('TeamSetsMD5Cache'); 96 if ( file_exists($cache_dir.'modules/Teams/TeamSetMD5Cache.php') ) { 97 unlink($cache_dir.'modules/Teams/TeamSetMD5Cache.php'); 98 } 99 100 $out =<<<EOQ 101 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 102 <html> 103 <head> 104 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 105 <meta http-equiv="Content-Script-Type" content="text/javascript"> 106 <meta http-equiv="Content-Style-Type" content="text/css"> 107 <title>{$mod_strings['LBL_WIZARD_TITLE']} {$mod_strings['LBL_PERFORM_TITLE']}</title> 108 <link REL="SHORTCUT ICON" HREF="$icon"> 109 <link rel="stylesheet" href="$css" type="text/css" /> 110 <script type="text/javascript" src="$common"></script> 111 </head> 112 <body onload="javascript:document.getElementById('defaultFocus').focus();"> 113 <table cellspacing="0" cellpadding="0" border="0" align="center" class="shell"> 114 <tr><td colspan="2" id="help"><a href="{$help_url}" target='_blank'>{$mod_strings['LBL_HELP']} </a></td></tr> 115 <tr> 116 <th width="500"> 117 <p><img src="$sugar_md" alt="SugarCRM" border="0"></p> 118 {$mod_strings['LBL_PERFORM_TITLE']}</th> 119 <th width="200" style="text-align: right;"><a href="http://www.sugarcrm.com" target="_blank"> 120 <IMG src="$loginImage" width="145" height="30" alt="SugarCRM" border="0"></a></th> 121 </tr> 122 <tr> 123 <td colspan="2"> 124 EOQ; 125 echo $out; 126 installLog("calling handleSugarConfig()"); 127 $bottle = handleSugarConfig(); 128 installLog("calling handleLog4Php()"); 129 handleLog4Php(); 130 131 $server_software = $_SERVER["SERVER_SOFTWARE"]; 132 if(strpos($server_software,'Microsoft-IIS') !== false) 133 { 134 installLog("calling handleWebConfig()"); 135 handleWebConfig(); 136 } else { 137 installLog("calling handleHtaccess()"); 138 handleHtaccess(); 139 } 140 141 /////////////////////////////////////////////////////////////////////////////// 142 //// START TABLE STUFF 143 echo "<br>"; 144 echo "<b>{$mod_strings['LBL_PERFORM_TABLES']}</b>"; 145 echo "<br>"; 146 147 // create the SugarCRM database 148 if($setup_db_create_database) { 149 installLog("calling handleDbCreateDatabase()"); 150 handleDbCreateDatabase(); 151 } else { 152 153 // ensure the charset and collation are utf8 154 installLog("calling handleDbCharsetCollation()"); 155 handleDbCharsetCollation(); 156 } 157 158 // create the SugarCRM database user 159 if($setup_db_create_sugarsales_user) 160 handleDbCreateSugarUser(); 161 162 163 foreach( $beanFiles as $bean => $file ){ 164 require_once( $file ); 165 } 166 167 // load up the config_override.php file. 168 // This is used to provide default user settings 169 if( is_file("config_override.php") ){ 170 require_once("config_override.php"); 171 } 172 173 $db = &DBManagerFactory::getInstance(); 174 $startTime = microtime(true); 175 $focus = 0; 176 $processed_tables = array(); // for keeping track of the tables we have worked on 177 $empty = ''; 178 $new_tables = 1; // is there ever a scenario where we DON'T create the admin user? 179 $new_config = 1; 180 $new_report = 1; 181 182 // add non-module Beans to this array to keep the installer from erroring. 183 $nonStandardModules = array ( 184 //'Tracker', 185 ); 186 187 //if working with sql-server create a catalog for full-text indexes. 188 if ($GLOBALS['db']->dbType=='mssql') { 189 $GLOBALS['db']->helper->create_default_full_text_catalog(); 190 } 191 /** 192 * loop through all the Beans and create their tables 193 */ 194 installLog("looping through all the Beans and create their tables"); 195 //start by clearing out the vardefs 196 VardefManager::clearVardef(); 197 foreach( $beanFiles as $bean => $file ) { 198 $doNotInit = array('Scheduler', 'SchedulersJob'); 199 200 if(in_array($bean, $doNotInit)) { 201 $focus = new $bean(false); 202 } else { 203 $focus = new $bean(); 204 } 205 206 $table_name = $focus->table_name; 207 installLog("processing table ".$focus->table_name); 208 // check to see if we have already setup this table 209 if(!in_array($table_name, $processed_tables)) { 210 if(!file_exists("modules/".$focus->module_dir."/vardefs.php")){ 211 continue; 212 } 213 if(!in_array($bean, $nonStandardModules)) { 214 require_once("modules/".$focus->module_dir."/vardefs.php"); // load up $dictionary 215 if($dictionary[$focus->object_name]['table'] == 'does_not_exist') { 216 continue; // support new vardef definitions 217 } 218 } else { 219 continue; //no further processing needed for ignored beans. 220 } 221 222 // table has not been setup...we will do it now and remember that 223 $processed_tables[] = $table_name; 224 225 $focus->db->database = $db->database; // set db connection so we do not need to reconnect 226 227 if($setup_db_drop_tables) { 228 drop_table_install($focus); 229 installLog("dropping table ".$focus->table_name); 230 } 231 232 if(create_table_if_not_exist($focus)) { 233 installLog("creating table ".$focus->table_name); 234 if( $bean == "User" ){ 235 $new_tables = 1; 236 } 237 if($bean == "Administration") 238 $new_config = 1; 239 240 241 242 243 } 244 245 installLog("creating Relationship Meta for ".$focus->getObjectName()); 246 SugarBean::createRelationshipMeta($focus->getObjectName(), $db, $table_name, $empty, $focus->module_dir); 247 echo "."; 248 249 } // end if() 250 251 252 253 254 255 } 256 257 echo "<br>"; 258 //// END TABLE STUFF 259 260 /////////////////////////////////////////////////////////////////////////////// 261 //// START RELATIONSHIP CREATION 262 263 ksort($rel_dictionary); 264 foreach( $rel_dictionary as $rel_name => $rel_data ){ 265 $table = $rel_data['table']; 266 267 if( $setup_db_drop_tables ){ 268 if( $db->tableExists($table) ){ 269 $db->dropTableName($table); 270 } 271 } 272 273 if( !$db->tableExists($table) ){ 274 $db->createTableParams($table, $rel_data['fields'], $rel_data['indices']); 275 } 276 277 SugarBean::createRelationshipMeta($rel_name,$db,$table,$rel_dictionary,''); 278 } 279 280 /////////////////////////////////////////////////////////////////////////////// 281 //// START CREATE DEFAULTS 282 echo "<br>"; 283 echo "<b>{$mod_strings['LBL_PERFORM_CREATE_DEFAULT']}</b><br>"; 284 echo "<br>"; 285 installLog("Begin creating Defaults"); 286 if ($new_config) { 287 installLog("insert defaults into config table"); 288 insert_default_settings(); 289 } 290 291 292 293 294 295 if ($new_tables) { 296 echo $line_entry_format.$mod_strings['LBL_PERFORM_DEFAULT_USERS'].$line_exit_format; 297 installLog($mod_strings['LBL_PERFORM_DEFAULT_USERS']); 298 create_default_users(); 299 echo $mod_strings['LBL_PERFORM_DONE']; 300 } else { 301 echo $line_entry_format.$mod_strings['LBL_PERFORM_ADMIN_PASSWORD'].$line_exit_format; 302 installLog($mod_strings['LBL_PERFORM_ADMIN_PASSWORD']); 303 $db->setUserName($setup_db_sugarsales_user); 304 $db->setUserPassword($setup_db_sugarsales_password); 305 set_admin_password($setup_site_admin_password); 306 echo $mod_strings['LBL_PERFORM_DONE']; 307 } 308 309 310 311 312 313 314 315 316 317 318 319 // default OOB schedulers 320 echo $line_entry_format.$mod_strings['LBL_PERFORM_DEFAULT_SCHEDULER'].$line_exit_format; 321 installLog($mod_strings['LBL_PERFORM_DEFAULT_SCHEDULER']); 322 $scheduler = new Scheduler(); 323 if(isset($sugar_config['demoData']) && $sugar_config['demoData'] != 'no' && $_SESSION['setup_db_type'] == 'mssql') { 324 $db->query('DELETE FROM schedulers'); 325 $db->query('DELETE FROM schedulers_times'); 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 $sched3 = new Scheduler(); 356 $sched3->name = 'Prune the User History Table'; 357 $sched3->job = 'function::trimTracker'; 358 $sched3->date_time_start = create_date(2005,1,1) . ' ' . create_time(0,0,1); 359 $sched3->date_time_end = create_date(2020,12,31) . ' ' . create_time(23,59,59); 360 $sched3->job_interval = '*::*::*::*::*'; 361 $sched3->status = 'Active'; 362 $sched3->created_by = '1'; 363 $sched3->modified_user_id = '1'; 364 $sched3->catch_up = '1'; 365 $sched3->save(); 366 367 $sched4 = new Scheduler(); 368 $sched4->name = 'Check Inbound Mailboxes'; 369 $sched4->job = 'function::pollMonitoredInboxes'; 370 $sched4->date_time_start = create_date(2005,1,1) . ' ' . create_time(0,0,1); 371 $sched4->date_time_end = create_date(2020,12,31) . ' ' . create_time(23,59,59); 372 $sched4->job_interval = '*::*::*::*::*'; 373 $sched4->status = 'Active'; 374 $sched4->created_by = '1'; 375 $sched4->modified_user_id = '1'; 376 $sched4->catch_up = '0'; 377 $sched4->save(); 378 379 $sched5 = new Scheduler(); 380 $sched5->name = 'Run Nightly Process Bounced Campaign Emails'; 381 $sched5->job = 'function::pollMonitoredInboxesForBouncedCampaignEmails'; 382 $sched5->date_time_start = create_date(2005,1,1) . ' ' . create_time(0,0,1); 383 $sched5->date_time_end = create_date(2020,12,31) . ' ' . create_time(23,59,59); 384 $sched5->job_interval = '0::2-6::*::*::*'; 385 $sched5->status = 'Active'; 386 $sched5->created_by = '1'; 387 $sched5->modified_user_id = '1'; 388 $sched5->catch_up = '1'; 389 $sched5->save(); 390 391 $sched6 = new Scheduler(); 392 $sched6->name = 'Run Nightly Mass Email Campaigns'; 393 $sched6->job = 'function::runMassEmailCampaign'; 394 $sched6->date_time_start = create_date(2005,1,1) . ' ' . create_time(0,0,1); 395 $sched6->date_time_end = create_date(2020,12,31) . ' ' . create_time(23,59,59); 396 $sched6->job_interval = '0::2-6::*::*::*'; 397 $sched6->status = 'Active'; 398 $sched6->created_by = '1'; 399 $sched6->modified_user_id = '1'; 400 $sched6->catch_up = '1'; 401 $sched6->save(); 402 403 $sched7 = new Scheduler(); 404 $sched7->name = 'Prune Database on 1st of Month'; 405 $sched7->job = 'function::pruneDatabase'; 406 $sched7->date_time_start = create_date(2005,1,1) . ' ' . create_time(0,0,1); 407 $sched7->date_time_end = create_date(2020,12,31) . ' ' . create_time(23,59,59); 408 $sched7->job_interval = '0::4::1::*::*'; 409 $sched7->status = 'Inactive'; 410 $sched7->created_by = '1'; 411 $sched7->modified_user_id = '1'; 412 $sched7->catch_up = '0'; 413 $sched7->save(); 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 } else { 469 $scheduler->rebuildDefaultSchedulers(); 470 } 471 472 473 474 475 476 477 478 479 echo $mod_strings['LBL_PERFORM_DONE']; 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 /////////////////////////////////////////////////////////////////////////////// 540 //// START DEMO DATA 541 542 // populating the db with seed data 543 installLog("populating the db with seed data"); 544 if( $_SESSION['demoData'] != 'no' ){ 545 set_time_limit( 301 ); 546 547 echo "<br>"; 548 echo "<b>{$mod_strings['LBL_PERFORM_DEMO_DATA']}</b>"; 549 echo "<br><br>"; 550 551 print( $render_table_close ); 552 print( $render_table_open ); 553 554 $current_user = new User(); 555 $current_user->retrieve(1); 556 include ("install/populateSeedData.php"); 557 } 558 559 $endTime = microtime(true); 560 $deltaTime = $endTime - $startTime; 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 /////////////////////////////////////////////////////////////////////////// 578 //// FINALIZE LANG PACK INSTALL 579 if(isset($_SESSION['INSTALLED_LANG_PACKS']) && is_array($_SESSION['INSTALLED_LANG_PACKS']) && !empty($_SESSION['INSTALLED_LANG_PACKS'])) { 580 updateUpgradeHistory(); 581 } 582 583 /////////////////////////////////////////////////////////////////////////// 584 //// HANDLE SUGAR VERSIONS 585 require_once ('modules/Versions/InstallDefaultVersions.php'); 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 /////////////////////////////////////////////////////////////////////////////// 608 //// INSTALL PASSWORD TEMPLATES 609 include ('install/seed_data/Advanced_Password_SeedData.php'); 610 611 /////////////////////////////////////////////////////////////////////////////// 612 //// SETUP DONE 613 installLog("Installation has completed *********"); 614 $memoryUsed = ''; 615 if(function_exists('memory_get_usage')) { 616 $memoryUsed = $mod_strings['LBL_PERFORM_OUTRO_5'].memory_get_usage().$mod_strings['LBL_PERFORM_OUTRO_6']; 617 } 618 619 620 621 622 623 624 625 $errTcpip = ''; 626 $fp = @fsockopen("www.sugarcrm.com", 80, $errno, $errstr, 3); 627 if (!$fp) { 628 $errTcpip = "<p>{$mod_strings['ERR_PERFORM_NO_TCPIP']}</p>"; 629 } 630 if ($fp && (!isset( $_SESSION['oc_install']) || $_SESSION['oc_install'] == false)) { 631 @fclose($fp); 632 if ( $next_step == 9999 ) 633 $next_step = 8; 634 $fpResult =<<<FP 635 <form action="install.php" method="post" name="form" id="form"> 636 <input type="hidden" name="current_step" value="{$next_step}"> 637 <table cellspacing="0" cellpadding="0" border="0" class="stdTable"> 638 <tr> 639 <td> 640 641 </td> 642 <td><input class="button" type="submit" name="goto" value="{$mod_strings['LBL_NEXT']}" id="defaultFocus"/></td> 643 </tr> 644 </table> 645 </form> 646 FP; 647 } else { 648 $fpResult =<<<FP 649 <table cellspacing="0" cellpadding="0" border="0" class="stdTable"> 650 <tr> 651 <td> </td> 652 <td> 653 <form action="index.php" method="post" name="formFinish" id="formFinish"> 654 <input type="hidden" name="default_user_name" value="admin" /> 655 <input class="button" type="submit" name="next" value="{$mod_strings['LBL_PERFORM_FINISH']}" id="defaultFocus"/> 656 </form> 657 </td> 658 </tr> 659 </table> 660 FP; 661 } 662 663 if( isset($_SESSION['setup_site_sugarbeet_automatic_checks']) && $_SESSION['setup_site_sugarbeet_automatic_checks'] == true){ 664 set_CheckUpdates_config_setting('automatic'); 665 }else{ 666 set_CheckUpdates_config_setting('manual'); 667 } 668 if(!empty($_SESSION['setup_system_name'])){ 669 $admin=new Administration(); 670 $admin->saveSetting('system','name',$_SESSION['setup_system_name']); 671 } 672 673 // Bug 28601 - Set the default list of tabs to show 674 $enabled_tabs = array(); 675 $enabled_tabs[] = 'Home'; 676 677 $enabled_tabs[] = 'Dashboard'; 678 $enabled_tabs[] = 'Calendar'; 679 $enabled_tabs[] = 'Activities'; 680 681 682 683 $enabled_tabs[] = 'Leads'; 684 $enabled_tabs[] = 'Contacts'; 685 $enabled_tabs[] = 'Accounts'; 686 $enabled_tabs[] = 'Opportunities'; 687 $enabled_tabs[] = 'Emails'; 688 $enabled_tabs[] = 'Campaigns'; 689 690 691 692 693 $enabled_tabs[] = 'Cases'; 694 $enabled_tabs[] = 'Documents'; 695 696 697 698 699 700 701 702 703 704 705 706 707 708 require_once ('modules/MySettings/TabController.php'); 709 $tabs = new TabController(); 710 $tabs->set_system_tabs($enabled_tabs); 711 712 post_install_modules(); 713 if( count( $bottle ) > 0 ){ 714 foreach( $bottle as $bottle_message ){ 715 $bottleMsg .= "{$bottle_message}\n"; 716 } 717 } else { 718 $bottleMsg = $mod_strings['LBL_PERFORM_SUCCESS']; 719 } 720 721 722 723 $out =<<<EOQ 724 <br><p><b>{$mod_strings['LBL_PERFORM_OUTRO_1']} {$setup_sugar_version} {$mod_strings['LBL_PERFORM_OUTRO_2']}</b></p> 725 726 {$mod_strings['LBL_PERFORM_OUTRO_3']} {$deltaTime} {$mod_strings['LBL_PERFORM_OUTRO_4']}<br /> 727 {$memoryUsed} 728 {$errTcpip} 729 </td> 730 </tr> 731 <tr> 732 <td align="right" colspan="2"> 733 <hr> 734 <table cellspacing="0" cellpadding="0" border="0" class="stdTable"> 735 <tr> 736 <td> 737 {$fpResult} 738 </td> 739 </tr> 740 </table> 741 </td> 742 </tr> 743 </table> 744 </body> 745 </html> 746 <!-- 747 <bottle>{$bottleMsg}</bottle> 748 --> 749 EOQ; 750 751 echo $out; 752 753 754 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
|
|
|
|