} catch (Exception $err) { $e[] = "Got the following database connection error! <code>" . $err->getMessage() . "</code> Please make sure that your database settings are correct and that the database server is running and then try again."; } if (!$e && !$db) { $e[] = "Got the following database connection error! <code>" . $db->error() . "</code> Please make sure that your database settings are correct and that the database server is running and then try again."; } if (!$e && !$GLOBALS['error']) { // If we get a database error, it'll activate $GLOBALS['error'] through PHP error $log[] = "Connected to MySQL database!"; $cv = $db->clientVersion(); if (version_compare($cv, "4.1.0", "<")) { $e[] = "Your MySQL client version is too old. Tweet Nest requires MySQL version 4.1 or higher to function. Your client currently has " . s($cv) . "."; } else { $log[] = "MySQL client version: " . $cv; } $sv = $db->serverVersion(); if (version_compare($sv, "4.1.0", "<")) { $e[] = "Your MySQL server version is too old. Tweet Nest requires MySQL version 4.1 or higher to function. Your server currently has " . s($sv) . "."; } else { $log[] = "MySQL server version: " . $sv; } if (!$e) { // Set up the database! $log[] = "Acceptable MySQL version."; $DTP = $_POST['db_table_prefix']; // This has been verified earlier on in the code // Tweets table $q = $db->query("CREATE TABLE `" . $DTP . "tweets` (`id` int(10) unsigned NOT NULL AUTO_INCREMENT, `userid` int(10) unsigned NOT NULL, `tweetid` bigint(20) unsigned NOT NULL, `type` tinyint(4) NOT NULL DEFAULT '0', `time` int(10) unsigned NOT NULL, `text` varchar(255) NOT NULL, `source` varchar(255) NOT NULL, `favorite` tinyint(4) NOT NULL DEFAULT '0', `extra` text NOT NULL, `coordinates` text NOT NULL, `geo` text NOT NULL, `place` text NOT NULL, `contributors` text NOT NULL, PRIMARY KEY (`id`), FULLTEXT KEY `text` (`text`)) ENGINE=MyISAM DEFAULT CHARSET=utf8"); if (!$q) { $e[] = "An error occured while creating table <code>" . $DTP . "tweets</code>: <code>" . $db->error() . "</code>"; } else {
//connect to mysql require_once 'BasicTest.php'; require_once 'CallTest.php'; require_once 'ObjectTest.php'; require_once 'WhereClauseTest.php'; require_once 'ErrorTest.php'; require_once 'TransactionTest.php'; require_once 'HelperTest.php'; $classes_to_test = array('BasicTest', 'CallTest', 'WhereClauseTest', 'ObjectTest', 'ErrorTest', 'TransactionTest', 'HelperTest'); if ($is_php_53) { require_once 'ErrorTest_53.php'; $classes_to_test[] = 'ErrorTest_53'; } else { echo "PHP 5.3 not detected, skipping 5.3 tests..\n"; } $mysql_version = DB::serverVersion(); if ($mysql_version >= '5.5') { require_once 'TransactionTest_55.php'; $classes_to_test[] = 'TransactionTest_55'; } else { echo "MySQL 5.5 not available (version is {$mysql_version}) -- skipping MySQL 5.5 tests\n"; } $time_start = microtime_float(); foreach ($classes_to_test as $class) { $object = new $class(); foreach (get_class_methods($object) as $method) { if (substr($method, 0, 4) != 'test') { continue; } echo "Running {$class}::{$method}..\n"; $object->{$method}();