← Back to team overview

anewt-developers team mailing list archive

[Branch ~uws/anewt/anewt.uws] Rev 1694: [database] Simplify version comparison in MySQL backend

 

------------------------------------------------------------
revno: 1694
committer: Wouter Bolsterlee <uws@xxxxxxxxx>
branch nick: anewt.uws
timestamp: Mon 2009-07-20 22:01:43 +0200
message:
  [database] Simplify version comparison in MySQL backend
  
  I only recently discovered the version_compare() function,
  so the custom version comparison code can be replaced by a
  simple function call... yay for less hacky code!
modified:
  database/backend-mysql.lib.php

=== modified file 'database/backend-mysql.lib.php'
--- database/backend-mysql.lib.php	2009-07-20 19:45:56 +0000
+++ database/backend-mysql.lib.php	2009-07-20 20:01:43 +0000
@@ -61,12 +61,8 @@
 		$encoding = $this->settings['encoding'];
 
 		/* Persistent connection are only available since PHP 5.3 */
-		if ($this->settings['persistent'])
-		{
-			list ($php_major_version, $php_minor_version, $php_micro_version_and_trailing_crap) = explode('.', PHP_VERSION, 3);
-			if ((10 * (int) $php_major_version + (int) $php_minor_version) >= 53)
-				$hostname = sprintf('p:%s', $hostname);
-		}
+		if (version_compare(PHP_VERSION, '5.3.0', '>='))
+			$hostname = sprintf('p:%s', $hostname);
 
 		try
 		{



--
lp:anewt
https://code.launchpad.net/~uws/anewt/anewt.uws

Your team Anewt developers is subscribed to branch lp:anewt.
To unsubscribe from this branch go to https://code.launchpad.net/~uws/anewt/anewt.uws/+edit-subscription.