Removed unused/seldom-used DBAL functions that weren't entirely supported in PDO
authorDan Fuhry <dan@enanocms.org>
Wed, 21 Aug 2013 22:34:54 -0400
changeset 1377 fa2b0825bbc5
parent 1376 60b580d22c7b
child 1378 e58294b867c1
Removed unused/seldom-used DBAL functions that weren't entirely supported in PDO
includes/dbal.php
plugins/SpecialPageFuncs.php
plugins/admin/LangManager.php
--- a/includes/dbal.php	Wed Aug 21 22:13:58 2013 -0400
+++ b/includes/dbal.php	Wed Aug 21 22:34:54 2013 -0400
@@ -423,23 +423,6 @@
 	}
 	
 	/**
- 	* Set the internal result pointer to X
- 	* @param int $pos The number of the row
- 	* @param resource $result The MySQL result resource - if not given, the latest cached query is assumed
- 	* @return true on success, false on failure
- 	*/
- 	
-	function sql_data_seek($pos, $result = false)
-	{
-		if ( !$result )
-			$result = $this->latest_result;
-		if ( !$result )
-			return false;
-		
-		return mysql_data_seek($result, $pos) ? true : false;
-	}
-	
-	/**
  	* Reports a bad query to the admin
  	* @param string $query the naughty query
  	* @access private
@@ -559,16 +542,6 @@
 	}
 	
 	/**
- 	* Returns the number of rows affected.
- 	* @return int
- 	*/
-	
-	function sql_affectedrows()
-	{
-		return mysql_affected_rows($this->_conn);
-	}
-	
-	/**
 	* Get MySQL server version
 	* @return string
 	*/
@@ -1084,23 +1057,6 @@
 	}
 	
 	/**
- 	* Set the internal result pointer to X
- 	* @param int $pos The number of the row
- 	* @param resource $result The MySQL result resource - if not given, the latest cached query is assumed
- 	* @return true on success, false on failure
- 	*/
- 	
-	function sql_data_seek($pos, $result = false)
-	{
-		if ( !$result )
-			$result = $this->latest_result;
-		if ( !$result )
-			return false;
-		
-		return mysql_data_seek($result, $pos) ? true : false;
-	}
-	
-	/**
  	* Reports a bad query to the admin
  	* @param string $query the naughty query
  	* @access private
@@ -1225,16 +1181,6 @@
 	}
 	
 	/**
- 	* Returns the number of rows affected.
- 	* @return int
- 	*/
-	
-	function sql_affectedrows()
-	{
-		return mysql_affected_rows($this->_conn);
-	}
-	
-	/**
 	* Get MySQL server version
 	* @return string
 	*/
@@ -1255,9 +1201,8 @@
 	function close()
 	{
 		// anything we locked should certainly be unlocked now;
-		@mysql_query("COMMIT;", $this->_conn);
-		@mysql_query("UNLOCK TABLES;", $this->_conn);
-		@mysql_close($this->_conn);
+		$this->sql_query("COMMIT;", $this->_conn);
+		$this->sql_query("UNLOCK TABLES;", $this->_conn);
 		unset($this->_conn);
 	}
 	
@@ -1691,23 +1636,6 @@
 	}
 	
 	/**
- 	* Set the internal result pointer to X
- 	* @param int $pos The number of the row
- 	* @param resource $result The PostgreSQL result resource - if not given, the latest cached query is assumed
- 	* @return true on success, false on failure
- 	*/
- 	
-	function sql_data_seek($pos, $result = false)
-	{
-		if ( !$result )
-			$result = $this->latest_result;
-		if ( !$result )
-			return false;
-		
-		return pg_result_seek($result, $pos) ? true : false;
-	}
-	
-	/**
  	* Reports a bad query to the admin
  	* @param string $query the naughty query
  	* @access private
@@ -1921,16 +1849,6 @@
 	}
 	
 	/**
- 	* Returns the number of rows affected.
- 	* @return int
- 	*/
-	
-	function sql_affectedrows()
-	{
-		return pg_affected_rows($this->latest_result);
-	}
-
-	/**
  	* Generates and outputs a report of all the SQL queries made during execution. Should only be called after everything's over with.
  	*/
 	
--- a/plugins/SpecialPageFuncs.php	Wed Aug 21 22:13:58 2013 -0400
+++ b/plugins/SpecialPageFuncs.php	Wed Aug 21 22:34:54 2013 -0400
@@ -376,8 +376,7 @@
 	global $lang;
 	
 	$platform = 'Unknown';
-	$uname = @file_get_contents('/proc/sys/kernel/ostype');
-	if($uname == "Linux\n")
+	if(strtolower(PHP_OS) === 'linux')
 		$platform = 'Linux';
 	else if(@file_exists('/hurd/pfinet')) // I have a little experience with GNU/Hurd :-) http://hurdvm.enanocms.org/
 		$platform = 'GNU/Hurd';
@@ -493,7 +492,7 @@
 			{
 				case 'MYSQL':
 					?>
-					<tr><td style="width: 100px;" class="row1"><?php echo $lang->get('meta_enano_about_lbl_mysqlversion'); ?></td><td class="row1"><?php echo mysql_get_server_info($db->_conn); ?></td></tr>
+					<tr><td style="width: 100px;" class="row1"><?php echo $lang->get('meta_enano_about_lbl_mysqlversion'); ?></td><td class="row1"><?php echo $db->get_server_version(); ?></td></tr>
 					<?php
 					break;
 				case 'PGSQL':
--- a/plugins/admin/LangManager.php	Wed Aug 21 22:13:58 2013 -0400
+++ b/plugins/admin/LangManager.php	Wed Aug 21 22:34:54 2013 -0400
@@ -548,8 +548,12 @@
 	$btn_edit = $lang->get('acplm_portal_btn_edit');
 	$btn_unin = $lang->get('acplm_portal_btn_unin');
 	
+	$rows = array();
+	
 	while ( $row = $db->fetchrow($q) )
 	{
+		$rows[] = $row;
+		
 		$cls = ( $cls == 'row1' ) ? 'row2' : 'row1';
 		
 		echo '<tr>';
@@ -569,11 +573,7 @@
 	
 	echo '</table></div>';
 	
-	// Reset the result pointer to zero so we can fetch that list of languages again
-	if ( !$db->sql_data_seek(0, $q) )
-	{
-		$db->_die('LangManager doing seek back to zero for installation blacklist');
-	}
+	$db->free_result();
 	
 	// $lang_list is fetched by the posthandler sometimes
 	if ( !isset($lang_list) )
@@ -583,7 +583,7 @@
 		$lang_list = list_available_languages();
 	}
 	
-	while ( $row = $db->fetchrow($q) )
+	foreach ( $rows as $row )
 	{
 		$lang_code =& $row['lang_code'];
 		if ( isset($lang_list[$lang_code]) )