summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorPaul Arthur <paul.arthur@flowerysong.com>2013-02-03 02:35:13 -0500
committerPaul Arthur <paul.arthur@flowerysong.com>2013-02-03 02:35:13 -0500
commit675fd21cf145ff882463d604fe9e4bf9defa256e (patch)
tree394a8fbc073b1e7bda9de012e88b627247d20e58 /lib
parentab1856901367eab3ee390047f7829bdabfd2410d (diff)
downloadampache-675fd21cf145ff882463d604fe9e4bf9defa256e.tar.gz
ampache-675fd21cf145ff882463d604fe9e4bf9defa256e.tar.bz2
ampache-675fd21cf145ff882463d604fe9e4bf9defa256e.zip
Add a check that makes sure PDO is available
Calling an unavailable class is a fatal error, so people without PDO were left with a fairly useless blank screen and no indicator of what was wrong. Let's be a bit more user-friendly.
Diffstat (limited to 'lib')
-rw-r--r--lib/debug.lib.php13
-rw-r--r--lib/init.php2
2 files changed, 14 insertions, 1 deletions
diff --git a/lib/debug.lib.php b/lib/debug.lib.php
index f1c5dbcc..f96c9ffa 100644
--- a/lib/debug.lib.php
+++ b/lib/debug.lib.php
@@ -74,6 +74,19 @@ function check_php_pcre() {
} // check_php_pcre
/**
+ * check_pdo
+ *
+ * Checks to make sure that PDO is available.
+ */
+function check_pdo() {
+ if (class_exists('PDO') && in_array('mysql', PDO::getAvailableDrivers())) {
+ return true;
+ }
+
+ return false;
+}
+
+/**
* check_config_values
* checks to make sure that they have at least set the needed variables
*/
diff --git a/lib/init.php b/lib/init.php
index 9955c088..8b8248f0 100644
--- a/lib/init.php
+++ b/lib/init.php
@@ -53,7 +53,7 @@ else {
// Verify that a few important but commonly disabled PHP functions exist and
// that we're on a usable version
-if (!function_exists('hash') || !function_exists('inet_pton') || (floatval(phpversion()) < 5.3)) {
+if (!function_exists('hash') || !function_exists('inet_pton') || (floatval(phpversion()) < 5.3) || !class_exists('PDO')) {
$link = $path . '/test.php';
}