commit: 2d323e26c63a2f1d11f347a6bb725c095965bda2
Author: Brian Evans <grknight <AT> gentoo <DOT> org>
AuthorDate: Tue Jan 30 15:37:19 2018 +0000
Commit: Brian Evans <grknight <AT> gentoo <DOT> org>
CommitDate: Tue Jan 30 15:37:19 2018 +0000
URL: https://gitweb.gentoo.org/proj/bouncer.git/commit/?id=2d323e26
fix library comments and convert util query
php/lib/db.php | 4 ++--
php/lib/util.php | 6 +++---
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/php/lib/db.php b/php/lib/db.php
index ae20f9e..003be70 100644
--- a/php/lib/db.php
+++ b/php/lib/db.php
@@ -1,6 +1,6 @@
<?php
/**
- * Minimal wrappers for core PHP mysql_* functions.
+ * Minimal wrappers for core PHP PDO functions.
* @package mirror
* @subpackage lib
*/
@@ -109,7 +109,7 @@ public static function
get($query,$type=PDO::FETCH_BOTH,$col_id=NULL,$parameters
}
/**
- * Since PHP's mysql_insert_id() sometimes throws an error, this is the
replacement
+ * Wrapper for PDOStatement::lastInsertId()
* @param PDO $dbh optional dbh to get the last inserted id from
* @return int the return value of MySQL's last_insert_id()
*/
diff --git a/php/lib/util.php b/php/lib/util.php
index af64fbb..8f8e1e4 100644
--- a/php/lib/util.php
+++ b/php/lib/util.php
@@ -13,7 +13,7 @@ function microtime_float()
{
list($usec, $sec) = explode(" ", microtime());
return ((float)$usec + (float)$sec);
-}
+}
/**
* Add a message to SESSION['messages'] array.
@@ -157,8 +157,8 @@ function emptify_in_array($array, $needle)
*/
function record_exists($table,$column,$val,$extra=NULL)
{
- $result = db_query("SELECT * FROM {$table} WHERE {$column}='{$val}'
{$extra}");
- if ($result&&mysql_num_rows($result)>0)
+ $result = DB::query("SELECT * FROM {$table} WHERE {$column}='{$val}'
{$extra}");
+ if ($result&&$result->rowCount()>0)
{
return true;
}