Completed
Push — develop ( edae1e...431cf5 )
by Adam
20:48
created
modules/UpgradeWizard/systemCheckJson.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -45,25 +45,25 @@  discard block
 block discarded – undo
45 45
  * Reserved. Contributor(s): ______________________________________..
46 46
  * *******************************************************************************/
47 47
 
48
-if(ob_get_level() < 1)
48
+if (ob_get_level() < 1)
49 49
 	ob_start();
50 50
 ob_implicit_flush(1);
51 51
 
52 52
 // load the generated persistence file if found
53 53
 $persistence = array();
54
-if(file_exists($persist = sugar_cached('/modules/UpgradeWizard/_persistence.php'))) {
54
+if (file_exists($persist = sugar_cached('/modules/UpgradeWizard/_persistence.php'))) {
55 55
 	require_once $persist;
56 56
 }
57 57
 require_once('modules/UpgradeWizard/uw_utils.php');
58 58
 
59
-switch($_REQUEST['systemCheckStep']) {
59
+switch ($_REQUEST['systemCheckStep']) {
60 60
 	case 'find_all_files':
61 61
 		ob_end_flush();
62 62
 		$persistence['files_to_check'] = getFilesForPermsCheck();
63 63
         break;
64 64
 
65 65
 	case 'check_found_files':
66
-		if(empty($persistence['files_to_check'])) {
66
+		if (empty($persistence['files_to_check'])) {
67 67
 			logThis('*** ERROR: could not find persistent array of files to check');
68 68
 			echo $mod_strings['ERR_UW_NO_FILES'];
69 69
 		} else {
Please login to merge, or discard this patch.
modules/UpgradeWizard/silentUpgrade_step2.php 1 patch
Spacing   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -42,40 +42,40 @@  discard block
 block discarded – undo
42 42
 //// php.exe -f silentUpgrade.php [Path to Upgrade Package zip] [Path to Log file] [Path to Instance]
43 43
 //// See below the Usage for more details.
44 44
 /////////////////////////////////////////////////////////////////////////////////////////
45
-ini_set('memory_limit',-1);
45
+ini_set('memory_limit', -1);
46 46
 ///////////////////////////////////////////////////////////////////////////////
47 47
 ////	UTILITIES THAT MUST BE LOCAL :(
48 48
  //Bug 24890, 24892. default_permissions not written to config.php. Following function checks and if
49 49
  //no found then adds default_permissions to the config file.
50
- function checkConfigForPermissions(){
51
-     if(file_exists(getcwd().'/config.php')){
50
+ function checkConfigForPermissions() {
51
+     if (file_exists(getcwd().'/config.php')) {
52 52
          require(getcwd().'/config.php');
53 53
      }
54 54
      global $sugar_config;
55
-     if(!isset($sugar_config['default_permissions'])){
56
-             $sugar_config['default_permissions'] = array (
55
+     if (!isset($sugar_config['default_permissions'])) {
56
+             $sugar_config['default_permissions'] = array(
57 57
                      'dir_mode' => 02770,
58 58
                      'file_mode' => 0660,
59 59
                      'user' => '',
60 60
                      'group' => '',
61 61
              );
62 62
          ksort($sugar_config);
63
-         if(is_writable('config.php') && write_array_to_file("sugar_config", $sugar_config,'config.php')) {
63
+         if (is_writable('config.php') && write_array_to_file("sugar_config", $sugar_config, 'config.php')) {
64 64
         	//writing to the file
65 65
  		}
66 66
      }
67 67
 }
68 68
 
69
-function checkLoggerSettings(){
70
-	if(file_exists(getcwd().'/config.php')){
69
+function checkLoggerSettings() {
70
+	if (file_exists(getcwd().'/config.php')) {
71 71
          require(getcwd().'/config.php');
72 72
      }
73 73
     global $sugar_config;
74
-	if(!isset($sugar_config['logger'])){
75
-	    $sugar_config['logger'] =array (
74
+	if (!isset($sugar_config['logger'])) {
75
+	    $sugar_config['logger'] = array(
76 76
 			'level'=>'fatal',
77 77
 		    'file' =>
78
-		     array (
78
+		     array(
79 79
 		      'ext' => '.log',
80 80
 		      'name' => 'sugarcrm',
81 81
 		      'dateFormat' => '%c',
@@ -85,23 +85,23 @@  discard block
 block discarded – undo
85 85
 		    ),
86 86
 		  );
87 87
 		 ksort($sugar_config);
88
-         if(is_writable('config.php') && write_array_to_file("sugar_config", $sugar_config,'config.php')) {
88
+         if (is_writable('config.php') && write_array_to_file("sugar_config", $sugar_config, 'config.php')) {
89 89
         	//writing to the file
90 90
  		}
91 91
 	 }
92 92
 }
93 93
 
94
-function checkResourceSettings(){
95
-	if(file_exists(getcwd().'/config.php')){
94
+function checkResourceSettings() {
95
+	if (file_exists(getcwd().'/config.php')) {
96 96
          require(getcwd().'/config.php');
97 97
      }
98 98
     global $sugar_config;
99
-	if(!isset($sugar_config['resource_management'])){
99
+	if (!isset($sugar_config['resource_management'])) {
100 100
 	  $sugar_config['resource_management'] =
101
-		  array (
101
+		  array(
102 102
 		    'special_query_limit' => 50000,
103 103
 		    'special_query_modules' =>
104
-		    array (
104
+		    array(
105 105
 		      0 => 'Reports',
106 106
 		      1 => 'Export',
107 107
 		      2 => 'Import',
@@ -111,18 +111,18 @@  discard block
 block discarded – undo
111 111
 		    'default_limit' => 1000,
112 112
 		  );
113 113
 		 ksort($sugar_config);
114
-         if(is_writable('config.php') && write_array_to_file("sugar_config", $sugar_config,'config.php')) {
114
+         if (is_writable('config.php') && write_array_to_file("sugar_config", $sugar_config, 'config.php')) {
115 115
         	//writing to the file
116 116
  		}
117 117
 	}
118 118
 }
119 119
 
120 120
 
121
-function verifyArguments($argv,$usage_regular){
121
+function verifyArguments($argv, $usage_regular) {
122 122
     $upgradeType = '';
123 123
     $cwd = getcwd(); // default to current, assumed to be in a valid SugarCRM root dir.
124
-    if(isset($argv[3])) {
125
-        if(is_dir($argv[3])) {
124
+    if (isset($argv[3])) {
125
+        if (is_dir($argv[3])) {
126 126
             $cwd = $argv[3];
127 127
             chdir($cwd);
128 128
         } else {
@@ -133,18 +133,18 @@  discard block
 block discarded – undo
133 133
     }
134 134
 
135 135
     //check if this is an instance
136
-    if(is_file("{$cwd}/include/entryPoint.php")) {
136
+    if (is_file("{$cwd}/include/entryPoint.php")) {
137 137
         //this should be a regular sugar install
138 138
         $upgradeType = constant('SUGARCRM_INSTALL');
139 139
         //check if this is a valid zip file
140
-        if(!is_file($argv[1])) { // valid zip?
140
+        if (!is_file($argv[1])) { // valid zip?
141 141
             echo "*******************************************************************************\n";
142 142
             echo "*** ERROR: First argument must be a full path to the patch file. Got [ {$argv[1]} ].\n";
143 143
             echo $usage_regular;
144 144
             echo "FAILURE\n";
145 145
             exit(1);
146 146
         }
147
-        if(count($argv) < 5) {
147
+        if (count($argv) < 5) {
148 148
             echo "*******************************************************************************\n";
149 149
             echo "*** ERROR: Missing required parameters.  Received ".count($argv)." argument(s), require 5.\n";
150 150
             echo $usage_regular;
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
         exit(1);
160 160
     }
161 161
 
162
-    if(isset($argv[7]) && file_exists($argv[7].'SugarTemplateUtilties.php')){
162
+    if (isset($argv[7]) && file_exists($argv[7].'SugarTemplateUtilties.php')) {
163 163
         require_once($argv[7].'SugarTemplateUtilties.php');
164 164
     }
165 165
 
@@ -185,8 +185,8 @@  discard block
 block discarded – undo
185 185
 //End of #52872
186 186
 
187 187
 // only run from command line
188
-if(isset($_SERVER['HTTP_USER_AGENT'])) {
189
-	fwrite(STDERR,'This utility may only be run from the command line or command prompt.');
188
+if (isset($_SERVER['HTTP_USER_AGENT'])) {
189
+	fwrite(STDERR, 'This utility may only be run from the command line or command prompt.');
190 190
 	exit(1);
191 191
 }
192 192
 //Clean_string cleans out any file  passed in as a parameter
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 
196 196
 ///////////////////////////////////////////////////////////////////////////////
197 197
 ////	USAGE
198
-$usage_regular =<<<eoq2
198
+$usage_regular = <<<eoq2
199 199
 Usage: php.exe -f silentUpgrade.php [upgradeZipFile] [logFile] [pathToSugarInstance] [admin-user]
200 200
 
201 201
 On Command Prompt Change directory to where silentUpgrade.php resides. Then type path to
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 
218 218
 ///////////////////////////////////////////////////////////////////////////////
219 219
 ////	STANDARD REQUIRED SUGAR INCLUDES AND PRESETS
220
-if(!defined('sugarEntry')) define('sugarEntry', true);
220
+if (!defined('sugarEntry')) define('sugarEntry', true);
221 221
 
222 222
 $_SESSION = array();
223 223
 $_SESSION['schema_change'] = 'sugar'; // we force-run all SQL
@@ -234,10 +234,10 @@  discard block
 block discarded – undo
234 234
 global $cwd;
235 235
 $cwd = getcwd(); // default to current, assumed to be in a valid SugarCRM root dir.
236 236
 
237
-$upgradeType = verifyArguments($argv,$usage_regular);
237
+$upgradeType = verifyArguments($argv, $usage_regular);
238 238
 
239
-$path			= $argv[2]; // custom log file, if blank will use ./upgradeWizard.log
240
-$subdirs		= array('full', 'langpack', 'module', 'patch', 'theme', 'temp');
239
+$path = $argv[2]; // custom log file, if blank will use ./upgradeWizard.log
240
+$subdirs = array('full', 'langpack', 'module', 'patch', 'theme', 'temp');
241 241
 
242 242
 require_once('include/entryPoint.php');
243 243
 require_once('modules/UpgradeWizard/uw_utils.php');
@@ -249,8 +249,8 @@  discard block
 block discarded – undo
249 249
 $errors = array();
250 250
 
251 251
 	require('config.php');
252
-	if(isset($argv[3])) {
253
-		if(is_dir($argv[3])) {
252
+	if (isset($argv[3])) {
253
+		if (is_dir($argv[3])) {
254 254
 			$cwd = $argv[3];
255 255
 			chdir($cwd);
256 256
 		}
@@ -261,36 +261,36 @@  discard block
 block discarded – undo
261 261
 	global $sugar_config;
262 262
 	$configOptions = $sugar_config['dbconfig'];
263 263
 
264
-    $GLOBALS['log']	= LoggerManager::getLogger('SugarCRM');
265
-	$patchName		= basename($argv[1]);
266
-	$zip_from_dir	= substr($patchName, 0, strlen($patchName) - 4); // patch folder name (minus ".zip")
267
-	$path			= $argv[2]; // custom log file, if blank will use ./upgradeWizard.log
268
-    $db				= &DBManagerFactory::getInstance();
269
-	$UWstrings		= return_module_language('en_us', 'UpgradeWizard', true);
270
-	$adminStrings	= return_module_language('en_us', 'Administration', true);
264
+    $GLOBALS['log'] = LoggerManager::getLogger('SugarCRM');
265
+	$patchName = basename($argv[1]);
266
+	$zip_from_dir = substr($patchName, 0, strlen($patchName) - 4); // patch folder name (minus ".zip")
267
+	$path = $argv[2]; // custom log file, if blank will use ./upgradeWizard.log
268
+    $db = &DBManagerFactory::getInstance();
269
+	$UWstrings = return_module_language('en_us', 'UpgradeWizard', true);
270
+	$adminStrings = return_module_language('en_us', 'Administration', true);
271 271
     $app_list_strings = return_app_list_strings_language('en_us');
272
-	$mod_strings	= array_merge($adminStrings, $UWstrings);
273
-	$subdirs		= array('full', 'langpack', 'module', 'patch', 'theme', 'temp');
272
+	$mod_strings = array_merge($adminStrings, $UWstrings);
273
+	$subdirs = array('full', 'langpack', 'module', 'patch', 'theme', 'temp');
274 274
 	global $unzip_dir;
275 275
     $license_accepted = false;
276
-    if(isset($argv[5]) && (strtolower($argv[5])=='yes' || strtolower($argv[5])=='y')){
276
+    if (isset($argv[5]) && (strtolower($argv[5]) == 'yes' || strtolower($argv[5]) == 'y')) {
277 277
     	$license_accepted = true;
278 278
 	 }
279 279
 	//////////////////////////////////////////////////////////////////////////////
280 280
 	//Adding admin user to the silent upgrade
281 281
 
282 282
 	$current_user = new User();
283
-	if(isset($argv[4])) {
283
+	if (isset($argv[4])) {
284 284
 	   //if being used for internal upgrades avoid admin user verification
285 285
 	   $user_name = $argv[4];
286
-	   $q = "select id from users where user_name = '" . $user_name . "' and is_admin=1";
286
+	   $q = "select id from users where user_name = '".$user_name."' and is_admin=1";
287 287
 	   $result = $GLOBALS['db']->query($q, false);
288 288
 	   $logged_user = $GLOBALS['db']->fetchByAssoc($result);
289
-	   if(isset($logged_user['id']) && $logged_user['id'] != null){
289
+	   if (isset($logged_user['id']) && $logged_user['id'] != null) {
290 290
 		//do nothing
291 291
 	    $current_user->retrieve($logged_user['id']);
292 292
 	   }
293
-	   else{
293
+	   else {
294 294
 	   	echo "Not an admin user in users table. Please provide an admin user\n";
295 295
 		exit(1);
296 296
 	   }
@@ -314,8 +314,8 @@  discard block
 block discarded – undo
314 314
 $_SESSION['zip_from_dir'] = $zip_from_dir;
315 315
 
316 316
 mkdir_recursive($unzip_dir);
317
-if(!is_dir($unzip_dir)) {
318
-	fwrite(STDERR,"\n{$unzip_dir} is not an available directory\nFAILURE\n");
317
+if (!is_dir($unzip_dir)) {
318
+	fwrite(STDERR, "\n{$unzip_dir} is not an available directory\nFAILURE\n");
319 319
     exit(1);
320 320
 }
321 321
 unzip($argv[1], $unzip_dir);
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
 ///////////////////////////////////////////////////////////////////////////////
326 326
 
327 327
 
328
-if(function_exists('set_upgrade_vars')){
328
+if (function_exists('set_upgrade_vars')) {
329 329
 	set_upgrade_vars();
330 330
 }
331 331
 
@@ -349,18 +349,18 @@  discard block
 block discarded – undo
349 349
 upgrade_custom_relationships();
350 350
 
351 351
 logThis('Upgrading user preferences start .', $path);
352
-if(function_exists('upgradeUserPreferences')){
352
+if (function_exists('upgradeUserPreferences')) {
353 353
    upgradeUserPreferences();
354 354
 }
355 355
 logThis('Upgrading user preferences finish .', $path);
356 356
 
357 357
 // clear out the theme cache
358
-if(is_dir($GLOBALS['sugar_config']['cache_dir'].'themes')){
358
+if (is_dir($GLOBALS['sugar_config']['cache_dir'].'themes')) {
359 359
     $allModFiles = array();
360
-    $allModFiles = findAllFiles($GLOBALS['sugar_config']['cache_dir'].'themes',$allModFiles);
361
-    foreach($allModFiles as $file){
360
+    $allModFiles = findAllFiles($GLOBALS['sugar_config']['cache_dir'].'themes', $allModFiles);
361
+    foreach ($allModFiles as $file) {
362 362
         //$file_md5_ref = str_replace(clean_path(getcwd()),'',$file);
363
-        if(file_exists($file)){
363
+        if (file_exists($file)) {
364 364
             unlink($file);
365 365
         }
366 366
     }
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
 require_once('jssource/minify.php');
373 373
 
374 374
 //Add the cache cleaning here.
375
-if(function_exists('deleteCache'))
375
+if (function_exists('deleteCache'))
376 376
 {
377 377
 	logThis('Call deleteCache', $path);
378 378
 	@deleteCache();
@@ -411,35 +411,35 @@  discard block
 block discarded – undo
411 411
 $rac->clearVardefs();
412 412
 $rac->rebuildExtensions();
413 413
 //bug: 44431 - defensive check to ensure the method exists since upgrades to 6.2.0 may not have this method define yet.
414
-if(method_exists($rac, 'clearExternalAPICache'))
414
+if (method_exists($rac, 'clearExternalAPICache'))
415 415
 {
416 416
     $rac->clearExternalAPICache();
417 417
 }
418 418
 
419 419
 $repairedTables = array();
420 420
 foreach ($beanFiles as $bean => $file) {
421
-	if(file_exists($file)){
421
+	if (file_exists($file)) {
422 422
 		unset($GLOBALS['dictionary'][$bean]);
423 423
 		require_once($file);
424
-		$focus = new $bean ();
425
-		if(empty($focus->table_name) || isset($repairedTables[$focus->table_name])) {
424
+		$focus = new $bean();
425
+		if (empty($focus->table_name) || isset($repairedTables[$focus->table_name])) {
426 426
 		   continue;
427 427
 		}
428 428
 
429 429
 		if (($focus instanceOf SugarBean)) {
430
-			if(!isset($repairedTables[$focus->table_name]))
430
+			if (!isset($repairedTables[$focus->table_name]))
431 431
 			{
432 432
 				$sql = $GLOBALS['db']->repairTable($focus, true);
433
-                if(trim($sql) != '')
433
+                if (trim($sql) != '')
434 434
                 {
435
-				    logThis('Running sql:' . $sql, $path);
435
+				    logThis('Running sql:'.$sql, $path);
436 436
                 }
437 437
 				$repairedTables[$focus->table_name] = true;
438 438
 			}
439 439
 
440 440
 			//Check to see if we need to create the audit table
441
-		    if($focus->is_AuditEnabled() && !$focus->db->tableExists($focus->get_audit_table_name())){
442
-               logThis('Creating audit table:' . $focus->get_audit_table_name(), $path);
441
+		    if ($focus->is_AuditEnabled() && !$focus->db->tableExists($focus->get_audit_table_name())) {
442
+               logThis('Creating audit table:'.$focus->get_audit_table_name(), $path);
443 443
 		       $focus->create_audit_table();
444 444
             }
445 445
 		}
@@ -451,14 +451,14 @@  discard block
 block discarded – undo
451 451
 foreach ($dictionary as $meta) {
452 452
 	$tablename = $meta['table'];
453 453
 
454
-	if(isset($repairedTables[$tablename])) {
454
+	if (isset($repairedTables[$tablename])) {
455 455
 	   continue;
456 456
 	}
457 457
 
458 458
 	$fielddefs = $meta['fields'];
459 459
 	$indices = $meta['indices'];
460 460
 	$sql = $GLOBALS['db']->repairTableParams($tablename, $fielddefs, $indices, true);
461
-	if(!empty($sql)) {
461
+	if (!empty($sql)) {
462 462
 	    logThis($sql, $path);
463 463
 	    $repairedTables[$tablename] = true;
464 464
 	}
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
 logThis('End rebuild relationships.', $path);
473 473
 
474 474
 include("$unzip_dir/manifest.php");
475
-$ce_to_pro_ent = isset($manifest['name']) && ($manifest['name'] == 'SugarCE to SugarPro' || $manifest['name'] == 'SugarCE to SugarEnt'  || $manifest['name'] == 'SugarCE to SugarCorp' || $manifest['name'] == 'SugarCE to SugarUlt');
475
+$ce_to_pro_ent = isset($manifest['name']) && ($manifest['name'] == 'SugarCE to SugarPro' || $manifest['name'] == 'SugarCE to SugarEnt' || $manifest['name'] == 'SugarCE to SugarCorp' || $manifest['name'] == 'SugarCE to SugarUlt');
476 476
 $sugar_version = getSilentUpgradeVar('origVersion');
477 477
 if (!$sugar_version)
478 478
 {
@@ -481,15 +481,15 @@  discard block
 block discarded – undo
481 481
 }
482 482
 
483 483
 
484
-if($ce_to_pro_ent) {
484
+if ($ce_to_pro_ent) {
485 485
 	//add the global team if it does not exist
486 486
 	$globalteam = new Team();
487 487
 	$globalteam->retrieve('1');
488 488
 	require_once($unzip_dir.'/'.$zip_from_dir.'/modules/Administration/language/en_us.lang.php');
489
-	if(isset($globalteam->name)){
489
+	if (isset($globalteam->name)) {
490 490
 		echo 'Global '.$mod_strings['LBL_UPGRADE_TEAM_EXISTS'].'<br>';
491 491
 		logThis(" Finish Building Global Team", $path);
492
-	}else{
492
+	} else {
493 493
 		$globalteam->create_team("Global", $mod_strings['LBL_GLOBAL_TEAM_DESC'], $globalteam->global_team);
494 494
 	}
495 495
 
@@ -506,7 +506,7 @@  discard block
 block discarded – undo
506 506
         include('modules/Administration/upgradeTeams.php');
507 507
         logThis(" Finish modules/Administration/upgradeTeams.php", $path);
508 508
 
509
-    if(check_FTS()){
509
+    if (check_FTS()) {
510 510
     	$GLOBALS['db']->full_text_indexing_setup();
511 511
     }
512 512
 }
@@ -523,12 +523,12 @@  discard block
 block discarded – undo
523 523
 
524 524
 
525 525
 //Unlink files that have been removed
526
-if(function_exists('unlinkUpgradeFiles'))
526
+if (function_exists('unlinkUpgradeFiles'))
527 527
 {
528 528
 	unlinkUpgradeFiles($sugar_version);
529 529
 }
530 530
 
531
-if(function_exists('rebuildSprites') && function_exists('imagecreatetruecolor'))
531
+if (function_exists('rebuildSprites') && function_exists('imagecreatetruecolor'))
532 532
 {
533 533
     rebuildSprites(true);
534 534
 }
@@ -541,8 +541,8 @@  discard block
 block discarded – undo
541 541
 
542 542
 ///////////////////////////////////////////////////////////////////////////////
543 543
 ////	TAKE OUT TRASH
544
-if(empty($errors)) {
545
-	set_upgrade_progress('end','in_progress','unlinkingfiles','in_progress');
544
+if (empty($errors)) {
545
+	set_upgrade_progress('end', 'in_progress', 'unlinkingfiles', 'in_progress');
546 546
 	logThis('Taking out the trash, unlinking temp files.', $path);
547 547
 	unlinkUWTempFiles();
548 548
 	removeSilentUpgradeVarsCache();
@@ -556,8 +556,8 @@  discard block
 block discarded – undo
556 556
 ob_end_clean();
557 557
 logThis("**** Potential PHP generated error messages: {$phpErrors}", $path);
558 558
 
559
-if(count($errors) > 0) {
560
-	foreach($errors as $error) {
559
+if (count($errors) > 0) {
560
+	foreach ($errors as $error) {
561 561
 		logThis("****** SilentUpgrade ERROR: {$error}", $path);
562 562
 	}
563 563
 	echo "FAILED\n";
Please login to merge, or discard this patch.
modules/UpgradeWizard/preflightJson.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -45,19 +45,19 @@  discard block
 block discarded – undo
45 45
  * Reserved. Contributor(s): ______________________________________..
46 46
  * *******************************************************************************/
47 47
 
48
-if(ob_get_level() < 1)
48
+if (ob_get_level() < 1)
49 49
 	ob_start();
50 50
 ob_implicit_flush(1);
51 51
 
52 52
 // load the generated persistence file if found
53 53
 $persistence = array();
54
-if(file_exists($persist = sugar_cached('/modules/UpgradeWizard/_persistence.php'))) {
54
+if (file_exists($persist = sugar_cached('/modules/UpgradeWizard/_persistence.php'))) {
55 55
 	require_once $persist;
56 56
 }
57 57
 require_once('modules/UpgradeWizard/uw_utils.php');
58 58
 require_once('include/utils/zip_utils.php');
59 59
 
60
-switch($_REQUEST['preflightStep']) {
60
+switch ($_REQUEST['preflightStep']) {
61 61
 	case 'find_upgrade_files':
62 62
 		logThis('preflightJson finding upgrade files');
63 63
 		ob_end_flush();
Please login to merge, or discard this patch.
modules/UpgradeWizard/UploadFileCheck.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -50,13 +50,13 @@  discard block
 block discarded – undo
50 50
 
51 51
 $json = getJSONobj();
52 52
 $file_name = $json->decode(html_entity_decode($_REQUEST['file_name']));
53
- if(isset($file_name['jsonObject']) && $file_name['jsonObject'] != null){
53
+ if (isset($file_name['jsonObject']) && $file_name['jsonObject'] != null) {
54 54
 	$file_name = $file_name['jsonObject'];
55 55
   }
56 56
 
57 57
 $filesize = '';
58
-if(file_exists($file_name)){
59
-    $filesize =filesize($file_name);
58
+if (file_exists($file_name)) {
59
+    $filesize = filesize($file_name);
60 60
 }
61 61
 
62 62
 
@@ -72,9 +72,9 @@  discard block
 block discarded – undo
72 72
 //get the file size defined in php.ini
73 73
 //$uploadSizeIni = substr(ini_get("upload_max_filesize"), 0, strlen( ini_get("upload_max_filesize")) - 1);
74 74
 //$GLOBALS['log']->fatal('Upload php setting Size '.return_bytes(ini_get("upload_max_filesize")));
75
-if($filesize != null){
76
-	if(($filesize > return_bytes(ini_get("upload_max_filesize"))) || ($filesize > return_bytes(ini_get("post_max_size")))){
77
-		$response=$filesize;
75
+if ($filesize != null) {
76
+	if (($filesize > return_bytes(ini_get("upload_max_filesize"))) || ($filesize > return_bytes(ini_get("post_max_size")))) {
77
+		$response = $filesize;
78 78
 		//$response= "<script>alert('File size is bigger than the max_upload-size setting in php.ini. Upgrade attempt will fail. Increase the upload_max_size in php.ini to greater than ')</script>";
79 79
 	}
80 80
 }
Please login to merge, or discard this patch.
modules/UpgradeWizard/upgradeTimeCounter.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
  }
73 73
 */
74 74
 
75
- $_SESSION['totalUpgradeTime'] = $_SESSION['totalUpgradeTime']+$_REQUEST['upgradeStepTime'];
75
+ $_SESSION['totalUpgradeTime'] = $_SESSION['totalUpgradeTime'] + $_REQUEST['upgradeStepTime'];
76 76
  $response = $_SESSION['totalUpgradeTime'];
77 77
 
78 78
 $GLOBALS['log']->fatal('TOTAL TIME .....'.$_SESSION['totalUpgradeTime']);
Please login to merge, or discard this patch.
modules/UpgradeWizard/UpgradeRemoval.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -77,26 +77,26 @@  discard block
 block discarded – undo
77 77
  * 
78 78
  * @param mixed $files 
79 79
  */
80
-public function processFilesToRemove($files=array())
80
+public function processFilesToRemove($files = array())
81 81
 {
82
-	if(empty($files) || !is_array($files))
82
+	if (empty($files) || !is_array($files))
83 83
 	{
84 84
 		return;
85 85
 	}	
86 86
 	
87 87
 	require_once('include/dir_inc.php');
88 88
 	
89
-	if(!file_exists('custom/backup'))
89
+	if (!file_exists('custom/backup'))
90 90
 	{
91 91
 	   mkdir_recursive('custom/backup');
92 92
 	}
93 93
 	
94
-	foreach($files as $file)
94
+	foreach ($files as $file)
95 95
 	{		
96
-		if(file_exists($file))
96
+		if (file_exists($file))
97 97
 		{
98 98
 			$this->backup($file);   
99
-			if(is_dir($file))
99
+			if (is_dir($file))
100 100
 			{
101 101
 			  rmdir_recursive($file);	
102 102
 			} else {
@@ -118,16 +118,16 @@  discard block
 block discarded – undo
118 118
 	$basename = basename($file);
119 119
 	$basepath = str_replace($basename, '', $file);
120 120
 
121
-	if(!empty($basepath) && !file_exists('custom/backup/' . $basepath))
121
+	if (!empty($basepath) && !file_exists('custom/backup/'.$basepath))
122 122
 	{
123
-	   mkdir_recursive('custom/backup/' . $basepath);
123
+	   mkdir_recursive('custom/backup/'.$basepath);
124 124
 	}
125 125
 	
126
-	if(is_dir($file))
126
+	if (is_dir($file))
127 127
 	{
128
-    	copy_recursive($file, 'custom/backup/' . $file);	
128
+    	copy_recursive($file, 'custom/backup/'.$file);	
129 129
 	} else {
130
-		copy($file, 'custom/backup/' . $file);
130
+		copy($file, 'custom/backup/'.$file);
131 131
 	}
132 132
 }
133 133
 
Please login to merge, or discard this patch.
modules/UpgradeWizard/silentUpgrade.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -34,25 +34,25 @@  discard block
 block discarded – undo
34 34
  * "Powered by SugarCRM".
35 35
  ********************************************************************************/
36 36
 
37
-function build_argument_string($arguments=array()) {
38
-   if(!is_array($arguments)) {
37
+function build_argument_string($arguments = array()) {
38
+   if (!is_array($arguments)) {
39 39
    	  return '';
40 40
    }
41 41
 
42 42
    $argument_string = '';
43 43
    $count = 0;
44
-   foreach($arguments as $arg) {
45
-   	   if($count != 0)
44
+   foreach ($arguments as $arg) {
45
+   	   if ($count != 0)
46 46
    	   {
47 47
    	   	  //If current directory or parent directory is specified, substitute with full path
48
-   	   	  if($arg == '.')
48
+   	   	  if ($arg == '.')
49 49
    	   	  {
50 50
    	   	  	 $arg = getcwd();
51 51
    	   	  } else if ($arg == '..') {
52 52
    	   	  	 $dir = getcwd();
53 53
 			 $arg = substr($dir, 0, strrpos($dir, DIRECTORY_SEPARATOR));
54 54
    	   	  }
55
-          $argument_string .= ' ' . escapeshellarg($arg);
55
+          $argument_string .= ' '.escapeshellarg($arg);
56 56
    	   }
57 57
    	   $count++;
58 58
    }
@@ -69,12 +69,12 @@  discard block
 block discarded – undo
69 69
 
70 70
 $php_path = '';
71 71
 $run_dce_upgrade = false;
72
-if(isset($argv[3]) && is_dir($argv[3]) && file_exists($argv[3]."/ini_setup.php")) {
72
+if (isset($argv[3]) && is_dir($argv[3]) && file_exists($argv[3]."/ini_setup.php")) {
73 73
                 //this is a dce call, set the dce flag
74 74
                 chdir($argv[3]);
75 75
                 $run_dce_upgrade = true;
76 76
                 //set the php path if found
77
-                if(is_file($argv[7].'dce_config.php')){
77
+                if (is_file($argv[7].'dce_config.php')) {
78 78
                    include($argv[7].'dce_config.php');
79 79
                    $php_path = $dce_config['client_php_path'].'/';
80 80
                 }
@@ -82,34 +82,34 @@  discard block
 block discarded – undo
82 82
 
83 83
 $php_file = $argv[0];
84 84
 $p_info = pathinfo($php_file);
85
-$php_dir = (isset($p_info['dirname']) && $p_info['dirname'] != '.') ?  $p_info['dirname'] . '/' : '';
85
+$php_dir = (isset($p_info['dirname']) && $p_info['dirname'] != '.') ? $p_info['dirname'].'/' : '';
86 86
 
87
-$step1 = $php_path."php -f {$php_dir}silentUpgrade_step1.php " . build_argument_string($argv);
87
+$step1 = $php_path."php -f {$php_dir}silentUpgrade_step1.php ".build_argument_string($argv);
88 88
 passthru($step1, $output);
89
-if($output != 0) {
89
+if ($output != 0) {
90 90
     echo "***************         step1 failed         ***************: $output\n";
91 91
 }
92 92
 $has_error = $output == 0 ? false : true;
93 93
 
94
-if(!$has_error) {
95
-	if($run_dce_upgrade) {
96
-		$step2 = $php_path."php -f {$php_dir}silentUpgrade_dce_step1.php " . build_argument_string($argv);
94
+if (!$has_error) {
95
+	if ($run_dce_upgrade) {
96
+		$step2 = $php_path."php -f {$php_dir}silentUpgrade_dce_step1.php ".build_argument_string($argv);
97 97
 		passthru($step2, $output);
98 98
 	} else {
99
-		$step2 = "php -f {$php_dir}silentUpgrade_step2.php " . build_argument_string($argv);
99
+		$step2 = "php -f {$php_dir}silentUpgrade_step2.php ".build_argument_string($argv);
100 100
 		passthru($step2, $output);
101 101
 	}
102 102
 }
103 103
 
104
-if($run_dce_upgrade) {
104
+if ($run_dce_upgrade) {
105 105
 	$has_error = $output == 0 ? false : true;
106
-	if(!$has_error) {
107
-	   $step3 = $php_path."php -f {$php_dir}silentUpgrade_dce_step2.php " . build_argument_string($argv);
106
+	if (!$has_error) {
107
+	   $step3 = $php_path."php -f {$php_dir}silentUpgrade_dce_step2.php ".build_argument_string($argv);
108 108
 	   passthru($step3, $output);
109 109
 	}
110 110
 }
111 111
 
112
-if($output != 0) {
112
+if ($output != 0) {
113 113
    echo "***************         silentupgrade failed         ***************: $output\n";
114 114
 }
115 115
 exit($output);
Please login to merge, or discard this patch.
modules/AOR_Reports/vardefs.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -41,9 +41,9 @@  discard block
 block discarded – undo
41 41
 	'table'=>'aor_reports',
42 42
 	'audited'=>true,
43 43
 	'duplicate_merge'=>true,
44
-	'fields'=>array (
44
+	'fields'=>array(
45 45
 	  'report_module' => 
46
-	  array (
46
+	  array(
47 47
 		'required' => true,
48 48
 		'name' => 'report_module',
49 49
 		'vname' => 'LBL_REPORT_MODULE',
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	  ),
69 69
 
70 70
 	'graphs_per_row' =>
71
-	array (
71
+	array(
72 72
 		'required' => true,
73 73
 		'name' => 'graphs_per_row',
74 74
 		'vname' => 'LBL_GRAPHS_PER_ROW',
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	),
80 80
 
81 81
     'field_lines' =>
82
-    array (
82
+    array(
83 83
         'required' => false,
84 84
         'name' => 'field_lines',
85 85
         'vname' => 'LBL_FIELD_LINES',
@@ -92,14 +92,14 @@  discard block
 block discarded – undo
92 92
         'audited' => false,
93 93
         'reportable' => false,
94 94
         'function' =>
95
-        array (
95
+        array(
96 96
             'name' => 'display_field_lines',
97 97
             'returns' => 'html',
98 98
             'include' => 'modules/AOR_Fields/fieldLines.php'
99 99
         ),
100 100
     ),
101 101
     'condition_lines' =>
102
-    array (
102
+    array(
103 103
         'required' => false,
104 104
         'name' => 'condition_lines',
105 105
         'vname' => 'LBL_CONDITION_LINES',
@@ -112,14 +112,14 @@  discard block
 block discarded – undo
112 112
         'audited' => false,
113 113
         'reportable' => false,
114 114
         'function' =>
115
-        array (
115
+        array(
116 116
             'name' => 'display_condition_lines',
117 117
             'returns' => 'html',
118 118
             'include' => 'modules/AOR_Conditions/conditionLines.php'
119 119
         ),
120 120
     ),
121 121
   'aor_fields' =>
122
-  array (
122
+  array(
123 123
     'name' => 'aor_fields',
124 124
     'type' => 'link',
125 125
     'relationship' => 'aor_reports_aor_fields',
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
     'id_name' => 'aor_report_id',
130 130
   ),
131 131
   'aor_conditions' =>
132
-  array (
132
+  array(
133 133
      'name' => 'aor_conditions',
134 134
      'type' => 'link',
135 135
      'relationship' => 'aor_reports_aor_conditions',
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
      'source'=>'non-db',
139 139
   ),
140 140
   'aor_charts' =>
141
-      array (
141
+      array(
142 142
         'name' => 'aor_charts',
143 143
         'type' => 'link',
144 144
         'relationship' => 'aor_charts_aor_reports',
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
         'vname' => 'LBL_AOR_CHARTS',
148 148
       ),
149 149
   'aor_scheduled_reports' =>
150
-    array (
150
+    array(
151 151
         'name' => 'aor_scheduled_reports',
152 152
         'type' => 'link',
153 153
         'relationship' => 'aor_scheduled_reports_aor_reports',
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
     ),
158 158
 
159 159
 ),
160
-'relationships'=>array (
160
+'relationships'=>array(
161 161
     'aor_reports_aor_fields' =>
162 162
     array(
163 163
         'lhs_module'=> 'AOR_Reports',
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
         'rhs_key' => 'aor_report_id',
179 179
         'relationship_type'=>'one-to-many',
180 180
     ),
181
-    "aor_scheduled_reports_aor_reports" => array (
181
+    "aor_scheduled_reports_aor_reports" => array(
182 182
         'lhs_module'=> 'AOR_Reports',
183 183
         'lhs_table'=> 'aor_reports',
184 184
         'lhs_key' => 'id',
@@ -192,8 +192,8 @@  discard block
 block discarded – undo
192 192
 	'unified_search'=>true,
193 193
 );
194 194
 
195
-if (!class_exists('VardefManager')){
195
+if (!class_exists('VardefManager')) {
196 196
         require_once('include/SugarObjects/VardefManager.php');
197 197
 }
198
-VardefManager::createVardef('AOR_Reports','AOR_Report', array('basic','assignable','security_groups'));
198
+VardefManager::createVardef('AOR_Reports', 'AOR_Report', array('basic', 'assignable', 'security_groups'));
199 199
 
Please login to merge, or discard this patch.
modules/AOR_Reports/metadata/editviewdefs.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -23,21 +23,21 @@  discard block
 block discarded – undo
23 23
  */
24 24
 
25 25
 $viewdefs ['AOR_Reports'] =
26
-array (
26
+array(
27 27
   'EditView' => 
28
-  array (
28
+  array(
29 29
     'templateMeta' => 
30
-    array (
30
+    array(
31 31
       'maxColumns' => '2',
32 32
       'widths' => 
33
-      array (
33
+      array(
34 34
         0 => 
35
-        array (
35
+        array(
36 36
           'label' => '10',
37 37
           'field' => '30',
38 38
         ),
39 39
         1 => 
40
-        array (
40
+        array(
41 41
           'label' => '10',
42 42
           'field' => '30',
43 43
         ),
@@ -49,18 +49,18 @@  discard block
 block discarded – undo
49 49
         ),
50 50
     ),
51 51
     'panels' => 
52
-    array (
52
+    array(
53 53
       'default' => 
54
-      array (
54
+      array(
55 55
         0 => 
56
-        array (
56
+        array(
57 57
           0 => 'name',
58 58
           1 => 'assigned_user_name',
59 59
         ),
60 60
         1 => 
61
-        array (
61
+        array(
62 62
           0 => 
63
-          array (
63
+          array(
64 64
             'name' => 'report_module',
65 65
             'studio' => 'visible',
66 66
             'label' => 'LBL_REPORT_MODULE',
@@ -68,9 +68,9 @@  discard block
 block discarded – undo
68 68
           1 => '',
69 69
         ),
70 70
           2 =>
71
-              array (
71
+              array(
72 72
                   0 =>
73
-                      array (
73
+                      array(
74 74
                           'name' => 'graphs_per_row',
75 75
                           'label' => 'LBL_GRAPHS_PER_ROW',
76 76
                       ),
Please login to merge, or discard this patch.