remove php version checks for older ( < 5.4) code incompatibilities
This commit is contained in:
		| @@ -120,12 +120,6 @@ class Admin extends \Zotlabs\Web\Controller { | |||||||
|  |  | ||||||
| 		// Could be extended to provide also other alerts to the admin | 		// Could be extended to provide also other alerts to the admin | ||||||
| 		$alertmsg = ''; | 		$alertmsg = ''; | ||||||
| 		// annoy admin about upcoming unsupported PHP version |  | ||||||
| 		if (version_compare(PHP_VERSION, '5.4', '<')) { |  | ||||||
| 			$alertmsg = 'Your PHP version ' . PHP_VERSION . ' will not be supported with the next major release of $Projectname. You are strongly urged to upgrade to a current version.' |  | ||||||
| 				. '<br>PHP 5.3 has reached its <a href="http://php.net/eol.php" class="alert-link">End of Life (EOL)</a> in August 2014.' |  | ||||||
| 				. ' A list about current PHP versions can be found <a href="http://php.net/supported-versions.php" class="alert-link">here</a>.'; |  | ||||||
| 		} |  | ||||||
|  |  | ||||||
| 		$vmaster = get_repository_version('master'); | 		$vmaster = get_repository_version('master'); | ||||||
| 		$vdev = get_repository_version('dev'); | 		$vdev = get_repository_version('dev'); | ||||||
|   | |||||||
| @@ -344,11 +344,8 @@ function q($sql) { | |||||||
| 	if(\DBA::$dba && \DBA::$dba->connected) { | 	if(\DBA::$dba && \DBA::$dba->connected) { | ||||||
| 		$stmt = vsprintf($sql, $args); | 		$stmt = vsprintf($sql, $args); | ||||||
| 		if($stmt === false) { | 		if($stmt === false) { | ||||||
| 			if(version_compare(PHP_VERSION, '5.4.0') >= 0) | 			db_logger('dba: vsprintf error: ' . | ||||||
| 				db_logger('dba: vsprintf error: ' . | 				print_r(debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT, 1), true),LOGGER_NORMAL,LOG_CRIT); | ||||||
| 					print_r(debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT, 1), true),LOGGER_NORMAL,LOG_CRIT); |  | ||||||
| 			else |  | ||||||
| 				db_logger('dba: vsprintf error: ' . print_r(debug_backtrace(), true),LOGGER_NORMAL,LOG_CRIT); |  | ||||||
| 		} | 		} | ||||||
| 		if(\DBA::$dba->debug) | 		if(\DBA::$dba->debug) | ||||||
| 			db_logger('Sql: ' . $stmt, LOGGER_DEBUG, LOG_INFO); | 			db_logger('Sql: ' . $stmt, LOGGER_DEBUG, LOG_INFO); | ||||||
|   | |||||||
| @@ -648,12 +648,8 @@ function logger($msg, $level = LOGGER_NORMAL, $priority = LOG_INFO) { | |||||||
|  |  | ||||||
| 	$where = ''; | 	$where = ''; | ||||||
|  |  | ||||||
| 	// We require > 5.4 but leave the version check so that install issues (including version) can be logged | 	$stack = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2); | ||||||
|  | 	$where = basename($stack[0]['file']) . ':' . $stack[0]['line'] . ':' . $stack[1]['function'] . ': '; | ||||||
| 	if(version_compare(PHP_VERSION, '5.4.0') >= 0) { |  | ||||||
| 		$stack = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2); |  | ||||||
| 		$where = basename($stack[0]['file']) . ':' . $stack[0]['line'] . ':' . $stack[1]['function'] . ': '; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	$s = datetime_convert() . ':' . log_priority_str($priority) . ':' . session_id() . ':' . $where . $msg . PHP_EOL; | 	$s = datetime_convert() . ':' . log_priority_str($priority) . ':' . session_id() . ':' . $where . $msg . PHP_EOL; | ||||||
| 	$pluginfo = array('filename' => $logfile, 'loglevel' => $level, 'message' => $s,'priority' => $priority, 'logged' => false); | 	$pluginfo = array('filename' => $logfile, 'loglevel' => $level, 'message' => $s,'priority' => $priority, 'logged' => false); | ||||||
| @@ -687,16 +683,14 @@ function btlogger($msg, $level = LOGGER_NORMAL, $priority = LOG_INFO) { | |||||||
| 		@file_put_contents(BTLOGGER_DEBUG_FILE, $s, FILE_APPEND); | 		@file_put_contents(BTLOGGER_DEBUG_FILE, $s, FILE_APPEND); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	if(version_compare(PHP_VERSION, '5.4.0') >= 0) { | 	$stack = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); | ||||||
| 		$stack = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); | 	if($stack) { | ||||||
| 		if($stack) { | 		for($x = 1; $x < count($stack); $x ++) { | ||||||
| 			for($x = 1; $x < count($stack); $x ++) { | 			$s = 'stack: ' . basename($stack[$x]['file']) . ':' . $stack[$x]['line'] . ':' . $stack[$x]['function'] . '()'; | ||||||
| 				$s = 'stack: ' . basename($stack[$x]['file']) . ':' . $stack[$x]['line'] . ':' . $stack[$x]['function'] . '()'; | 			logger($s,$level, $priority); | ||||||
| 				logger($s,$level, $priority); |  | ||||||
|  |  | ||||||
| 				if(file_exists(BTLOGGER_DEBUG_FILE) && is_writable(BTLOGGER_DEBUG_FILE)) { | 			if(file_exists(BTLOGGER_DEBUG_FILE) && is_writable(BTLOGGER_DEBUG_FILE)) { | ||||||
| 					@file_put_contents(BTLOGGER_DEBUG_FILE, $s . PHP_EOL, FILE_APPEND); | 				@file_put_contents(BTLOGGER_DEBUG_FILE, $s . PHP_EOL, FILE_APPEND); | ||||||
| 				} |  | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| @@ -751,10 +745,10 @@ function dlogger($msg, $level = 0) { | |||||||
| 		return; | 		return; | ||||||
|  |  | ||||||
| 	$where = ''; | 	$where = ''; | ||||||
| 	if(version_compare(PHP_VERSION, '5.4.0') >= 0) { |  | ||||||
| 		$stack = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2); | 	$stack = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2); | ||||||
| 		$where = basename($stack[0]['file']) . ':' . $stack[0]['line'] . ':' . $stack[1]['function'] . ': '; | 	$where = basename($stack[0]['file']) . ':' . $stack[0]['line'] . ':' . $stack[1]['function'] . ': '; | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	@file_put_contents($logfile, datetime_convert() . ':' . session_id() . ' ' . $where . $msg . PHP_EOL, FILE_APPEND); | 	@file_put_contents($logfile, datetime_convert() . ':' . session_id() . ' ' . $where . $msg . PHP_EOL, FILE_APPEND); | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user