You are here

function valid_root in Production check & Production monitor 7

Same name and namespace in other branches
  1. 6 prod_check.dbconnect.php \valid_root()

Based on the DrupalBoot*::valid_root() from Drush.

1 call to valid_root()
locate_root in ./prod_check.dbconnect.php
Locate the actual Drupal root. Based on drush_locate_root().

File

./prod_check.dbconnect.php, line 50
Simple database connection check that can be placed anywhere within a Drupal installation. Does NOT need to be in the root where index.php resides!

Code

function valid_root($path) {
  if (!empty($path) && is_dir($path) && file_exists($path . '/index.php')) {
    $candidate = 'includes/common.inc';
    if (file_exists($path . '/' . $candidate) && file_exists($path . '/misc/drupal.js')) {
      return TRUE;
    }
  }
  return FALSE;
}