protected function getDrupalRoot()
    {
        if ($path = getenv('DRUPAL_ROOT')) {
            return $path;
        }

        $path = getcwd();
        while ($path !== '/') {
            if (file_exists($path.'/includes/bootstrap.inc')) {
                return $path;
            }

            $path = dirname($path);
        }

        return '';
    }