From da9d141389dc2760ac15cb6d58d196368790368e Mon Sep 17 00:00:00 2001
From: prasad <prasad@vtiger.com>
Date: Sun, 11 Feb 2018 01:33:35 +0530
Subject: [PATCH] Fixes #808: Fixed start-up notice and took control on
 execution time during install or migration

---
 include/utils/utils.php              |  4 ++--
 includes/runtime/LanguageHandler.php |  2 +-
 modules/Install/views/Index.php      | 12 +++++++++---
 modules/Migration/views/Index.php    |  4 +++-
 modules/Users/Users.php              |  2 +-
 5 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/include/utils/utils.php b/include/utils/utils.php
index 6f59325c7..965910a3f 100755
--- a/include/utils/utils.php
+++ b/include/utils/utils.php
@@ -334,7 +334,7 @@ function set_default_config(&$defaults)
  */
 function decide_to_html() {
 	global $doconvert, $inUTF8, $default_charset;
- 	$action = $_REQUEST['action']; 
+ 	$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : ''; 
  		     
     $inUTF8 = (strtoupper($default_charset) == 'UTF-8'); 
 
@@ -2620,4 +2620,4 @@ function getDuplicatesPreventionMessage($moduleName, $duplicateRecordsList) {
 	return $message;
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/includes/runtime/LanguageHandler.php b/includes/runtime/LanguageHandler.php
index 6af2e4b56..e2a993f87 100644
--- a/includes/runtime/LanguageHandler.php
+++ b/includes/runtime/LanguageHandler.php
@@ -147,7 +147,7 @@ class Vtiger_Language_Handler {
 	public static function getLanguage() {
 		$userModel = Users_Record_Model::getCurrentUserModel();
 		$language = '';
-		if (!empty($userModel)) {
+		if (!empty($userModel) && $userModel->has('language')) {
 			$language = $userModel->get('language');
 		}
 		return empty($language) ? vglobal('default_language') : $language;
diff --git a/modules/Install/views/Index.php b/modules/Install/views/Index.php
index 979c65d99..cc872c29f 100644
--- a/modules/Install/views/Index.php
+++ b/modules/Install/views/Index.php
@@ -27,7 +27,16 @@ class Install_Index_view extends Vtiger_View_Controller {
 		$this->exposeMethod('Step7');
 	}
 
+	protected function applyInstallFriendlyEnv() {
+		// config.inc.php - will not be ready to control this yet.
+		version_compare(PHP_VERSION, '5.5.0') <= 0 ? error_reporting(E_ERROR & ~E_NOTICE & ~E_DEPRECATED) : error_reporting(E_ERROR & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT);
+
+		set_time_limit(0); // override limits on execution time to allow install to finish
+	}
+
 	public function preProcess(Vtiger_Request $request, $display = true) {
+		$this->applyInstallFriendlyEnv();
+
 		date_default_timezone_set('Europe/London'); // to overcome the pre configuration settings
 		// Added to redirect to default module if already installed
 		$configFileName = 'config.inc.php';
@@ -171,9 +180,6 @@ class Install_Index_view extends Vtiger_View_Controller {
 	}
 
 	public function Step7(Vtiger_Request $request) {
-		// Set favourable error reporting
-		version_compare(PHP_VERSION, '5.5.0') <= 0 ? error_reporting(E_ERROR & ~E_NOTICE & ~E_DEPRECATED) : error_reporting(E_ERROR & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT);
-
 		$moduleName = $request->getModule();
 		$webuiInstance = new Vtiger_WebUI();
 		$isInstalled = $webuiInstance->isInstalled();
diff --git a/modules/Migration/views/Index.php b/modules/Migration/views/Index.php
index 8304d97f7..caecf7dba 100644
--- a/modules/Migration/views/Index.php
+++ b/modules/Migration/views/Index.php
@@ -23,7 +23,9 @@ class Migration_Index_View extends Vtiger_View_Controller {
 
 	public function process(Vtiger_Request $request) {
 		// Override error reporting to production mode
-		version_compare(PHP_VERSION, '5.5.0') <= 0 ? error_reporting(E_WARNING & ~E_NOTICE & ~E_DEPRECATED) : error_reporting(E_WARNING & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT); 
+		version_compare(PHP_VERSION, '5.5.0') <= 0 ? error_reporting(E_WARNING & ~E_NOTICE & ~E_DEPRECATED) : error_reporting(E_WARNING & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT);
+		// Migration could be heavy at-times.
+		set_time_limit(0);	
 
 		$mode = $request->getMode();
 		if(!empty($mode)) {
diff --git a/modules/Users/Users.php b/modules/Users/Users.php
index 40877cdd5..06d225806 100755
--- a/modules/Users/Users.php
+++ b/modules/Users/Users.php
@@ -993,7 +993,7 @@ class Users extends CRMEntity {
 	 * @param $record -- record id:: Type integer
 	 * @param $module -- module:: Type varchar
 	 */
-	function retrieve_entity_info($record, $module) {
+	function retrieve_entity_info($record, $module, $allowDeleted = false) {
 		global $adb,$log;
 		$log->debug("Entering into retrieve_entity_info($record, $module) method.");
 
-- 
GitLab