Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 26 additions & 7 deletions status.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,21 @@
//
// Original by [Lullabot](http://www.lullabot.com/articles/varnish-multiple-web-servers-drupal)
// Adapted for DrupalCONCEPT by Jochen Lillich <jochen@freistil-consulting.de>
//
//

// Register our shutdown function so that no other shutdown functions run before this one.
// This shutdown function calls exit(), immediately short-circuiting any other shutdown functions,
// such as those registered by the devel.module for statistics.


register_shutdown_function('status_shutdown');
function status_shutdown() {
exit();
}

// Drupal bootstrap.
define('DRUPAL_ROOT', getcwd());

require_once './includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_DATABASE);

Expand All @@ -23,18 +27,33 @@ function status_shutdown() {

// Check that the main database is active.
$result = db_query('SELECT * FROM {users} WHERE uid = 1');
$account = db_fetch_object($result);
if (!$account->uid == 1) {
$errors[] = 'Master database not responding.';


//Drupal6
//$account = db_fetch_object($result);

// Drupal 7
foreach ($result as $record) {
if (!$record->uid == 1) {
$errors[] = 'Master database not responding.';
}
}



// Check that the slave database is active.
if (function_exists('db_query_slave')) {
$result = db_query_slave('SELECT * FROM {users} WHERE uid = 1');
$account = db_fetch_object($result);
if (!$account->uid == 1) {
$errors[] = 'Slave database not responding.';
//Drupal 6
//$account = db_fetch_object($result);

// Drupal 7
foreach ($result as $record) {
if (!$record->uid == 1) {
$errors[] = 'Slave database not responding.';
}
}

}

// Check that all memcache instances are running on this server.
Expand Down