summaryrefslogtreecommitdiffstats
path: root/web/lib/stats.inc.php
diff options
context:
space:
mode:
authorcanyonknight <canyonknight@gmail.com>2012-08-09 00:09:51 +0200
committerLukas Fleischer <archlinux@cryptocrack.de>2012-09-18 00:58:46 +0200
commite171f6f34eeacf35cf7142b4788d43e7d0978546 (patch)
tree28ab4e0a631d0a16e5972490c0ed6cfbad8b8231 /web/lib/stats.inc.php
parentb3393208fb00a00e77a475e8007168f266718ac5 (diff)
downloadaur-e171f6f34eeacf35cf7142b4788d43e7d0978546.tar.gz
aur-e171f6f34eeacf35cf7142b4788d43e7d0978546.tar.xz
Migrate all DB code to use PDO
All DB code currently uses the quickly aging mysql_* functions. These functions are strongly discouraged and may eventually be deprecated. Transition all code to utilize the PDO data access abstraction layer. PDO allows for consistent query code across multiple databases. This could potentially allow for someone to use a database other than MySQL with minimal code changes. All functions and behaviors are reproduced as faithfully as possible with PDO equivalents and some changes in code. Signed-off-by: canyonknight <canyonknight@gmail.com> Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Diffstat (limited to 'web/lib/stats.inc.php')
-rw-r--r--web/lib/stats.inc.php4
1 files changed, 2 insertions, 2 deletions
diff --git a/web/lib/stats.inc.php b/web/lib/stats.inc.php
index 2828dc92..2c26d43e 100644
--- a/web/lib/stats.inc.php
+++ b/web/lib/stats.inc.php
@@ -6,10 +6,10 @@ function updates_table($dbh) {
$key = 'recent_updates';
if(!($newest_packages = get_cache_value($key))) {
$q = 'SELECT * FROM Packages ORDER BY ModifiedTS DESC LIMIT 10';
- $result = db_query($q, $dbh);
+ $result = $dbh->query($q);
$newest_packages = new ArrayObject();
- while ($row = mysql_fetch_assoc($result)) {
+ while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
$newest_packages->append($row);
}
set_cache_value($key, $newest_packages);