Gentoo Archives: gentoo-commits

From: Brian Evans <grknight@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/bouncer:master commit in: php/lib/
Date: Tue, 30 Jan 2018 18:16:21
Message-Id: 1517326639.2d323e26c63a2f1d11f347a6bb725c095965bda2.grknight@gentoo
1 commit: 2d323e26c63a2f1d11f347a6bb725c095965bda2
2 Author: Brian Evans <grknight <AT> gentoo <DOT> org>
3 AuthorDate: Tue Jan 30 15:37:19 2018 +0000
4 Commit: Brian Evans <grknight <AT> gentoo <DOT> org>
5 CommitDate: Tue Jan 30 15:37:19 2018 +0000
6 URL: https://gitweb.gentoo.org/proj/bouncer.git/commit/?id=2d323e26
7
8 fix library comments and convert util query
9
10 php/lib/db.php | 4 ++--
11 php/lib/util.php | 6 +++---
12 2 files changed, 5 insertions(+), 5 deletions(-)
13
14 diff --git a/php/lib/db.php b/php/lib/db.php
15 index ae20f9e..003be70 100644
16 --- a/php/lib/db.php
17 +++ b/php/lib/db.php
18 @@ -1,6 +1,6 @@
19 <?php
20 /**
21 - * Minimal wrappers for core PHP mysql_* functions.
22 + * Minimal wrappers for core PHP PDO functions.
23 * @package mirror
24 * @subpackage lib
25 */
26 @@ -109,7 +109,7 @@ public static function get($query,$type=PDO::FETCH_BOTH,$col_id=NULL,$parameters
27 }
28
29 /**
30 - * Since PHP's mysql_insert_id() sometimes throws an error, this is the replacement
31 + * Wrapper for PDOStatement::lastInsertId()
32 * @param PDO $dbh optional dbh to get the last inserted id from
33 * @return int the return value of MySQL's last_insert_id()
34 */
35
36 diff --git a/php/lib/util.php b/php/lib/util.php
37 index af64fbb..8f8e1e4 100644
38 --- a/php/lib/util.php
39 +++ b/php/lib/util.php
40 @@ -13,7 +13,7 @@ function microtime_float()
41 {
42 list($usec, $sec) = explode(" ", microtime());
43 return ((float)$usec + (float)$sec);
44 -}
45 +}
46
47 /**
48 * Add a message to SESSION['messages'] array.
49 @@ -157,8 +157,8 @@ function emptify_in_array($array, $needle)
50 */
51 function record_exists($table,$column,$val,$extra=NULL)
52 {
53 - $result = db_query("SELECT * FROM {$table} WHERE {$column}='{$val}' {$extra}");
54 - if ($result&&mysql_num_rows($result)>0)
55 + $result = DB::query("SELECT * FROM {$table} WHERE {$column}='{$val}' {$extra}");
56 + if ($result&&$result->rowCount()>0)
57 {
58 return true;
59 }