Script de monitor Drupal simples (evite bootstrap completo, verifique a disponibilidade do banco de dados e do cache)

<?php
// OH HAI THARE
// NO CACH PLZ
header
( "Cache-Control: no-cache, max-age=0, must-revalidate");
// SET ERROR HANDLR
set_error_handler
('monitor_handle_error');
// CAN HAS DRUPAL BOOTSTRAP?
define
('DRUPAL_ROOT', __DIR__);
chdir
(DRUPAL_ROOT);
require_once
'includes/bootstrap.inc';
try {
// CAN HAS CONFIGURSHION?
drupal_bootstrap
(DRUPAL_BOOTSTRAP_CONFIGURATION);
// RESET ERROR HANDLR CUZ BOOTSTRAP OVERRIDE IT
set_error_handler
('monitor_handle_error');
// CAN HAS DATABAZ?
drupal_bootstrap
(DRUPAL_BOOTSTRAP_DATABASE);
Database::getConnection();
// CAN HAS CACHE?
cache_get
('monitor');
// AWSUM, EVRYTHIN IZ K
print 'UP';
}
catch (Exception $e) {
// EXCEPSHUN KATCHD, TRIGGR AN ERROR
trigger_error
($e->getMessage(), E_USER_ERROR);
}

// ERROR HANDLR
function monitor_handle_error($errno, $errstr, $errfile, $errline, $errcontext) {
// LETS DYE REPORTIN FAILURE
header
("{$_SERVER['SERVER_PROTOCOL']} 500 FAIL");
die('FAIL');
}
// KTHXBYE