From 302014466f5065f8a20171bc799ef941062689b6 Mon Sep 17 00:00:00 2001 From: Philip Olson Date: Tue, 7 Apr 2009 17:05:40 +0000 Subject: [PATCH] Edited sqlite check to include checking of every possible sqlite version --- include/site.inc | 25 +++++++++++++++++++++++++ mirror-info.php | 3 ++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/include/site.inc b/include/site.inc index 4f7b4e216..8f5c51ce7 100644 --- a/include/site.inc +++ b/include/site.inc @@ -303,6 +303,31 @@ function fetch_header($url, $header) { return isset($headers[$header]) ? $headers[$header] : null; } +function get_available_sqlites() { + + $allsqlites = array(1 => 'sqlite', 2 => 'sqlite3', 4 => 'pdo_sqlite', 8 => 'pdo_sqlite2'); + $avail = 0; + + if (function_exists('sqlite_open')) { + $avail += 1; + } + if (class_exists('sqlite3')) { + $avail += 2; + } + if (method_exists('PDO', 'getavailabledrivers')) { + foreach (PDO::getavailabledrivers() as $driver) { + switch ($driver) { + case 'sqlite': + $avail += 4; + break; + case 'sqlite2': + $avail += 8; + break; + } + } + } + return $avail; +} // Guess the current site from what Apache tells us. // This should be the main name of the mirror (in case diff --git a/mirror-info.php b/mirror-info.php index 259521658..fc664abbc 100644 --- a/mirror-info.php +++ b/mirror-info.php @@ -18,7 +18,8 @@ $filename = $_SERVER['DOCUMENT_ROOT'] . '/distributions/' . $RELEASES[5][$PHP_5_ $md5_ok = (int) (file_exists($filename) && md5_file($filename) == $PHP_5_MD5["tar.bz2"]); // Does this mirror have sqlite? -$sqlite = (int) function_exists("sqlite_open"); +// Gets all available sqlite versions for possible future sqlite wrapper +$sqlite = get_available_sqlites(); if (isset($_GET["token"]) && md5($_GET["token"]) === "19a3ec370affe2d899755f005e5cd90e") { $retval = run_self_tests();