- Timestamp:
- Feb 27, 2017 2:12:39 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bin/_config.inc.php
r564 r572 36 36 } 37 37 38 // Use codebase files rel eative to this file.38 // Use codebase files relative to this file. 39 39 define('CODEBASE_PATH', realpath(dirname(__FILE__) . '/../')); 40 40 41 41 42 $db_auth_file = false; 42 $rii = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(COMMON_BASE)); 43 $rii->setMaxDepth(2); 44 foreach ($rii as $filename => $file) { 45 if (in_array(basename($filename), ['db_auth.inc.php', 'db_auth.json'])) { 46 $db_auth_file = $filename; 47 break; 43 if (!defined('_NODB')) { 44 $rii = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(COMMON_BASE)); 45 $rii->setMaxDepth(2); 46 foreach ($rii as $filename => $file) { 47 if (in_array(basename($filename), ['db_auth.inc.php', 'db_auth.json'])) { 48 $db_auth_file = $filename; 49 break; 50 } 48 51 } 49 } 50 if (!$db_auth_file) { 51 die(sprintf("%s error: the current directory must be common site directory (i.e. the parent directory of the document root) AND a db_auth file must exist within two directory levels.\n", $cli_executed));52 } 53 if (fileowner($db_auth_file) != getmyuid()) { 54 die(sprintf("%s error: you must execute this script as the owner of the web files.\n", $cli_executed));52 if (!$db_auth_file) { 53 die(sprintf("%s error: the current directory must be common site directory (i.e. the parent directory of the document root) AND a db_auth file must exist within two directory levels.\n", $cli_executed)); 54 } 55 if (fileowner($db_auth_file) != getmyuid()) { 56 die(sprintf("%s error: you must execute this script as the owner of the web files.\n", $cli_executed)); 57 } 55 58 } 56 59 … … 72 75 'site_email' => 'codebase@strangecode.com', 73 76 'enable_session' => false, 74 'enable_db' => true,77 'enable_db' => defined('_NODB') ? false : true, 75 78 'db_create_tables' => true, 76 79 'db_auth_file' => $db_auth_file, … … 86 89 )); 87 90 88 if ( strtolower(getFilenameExtension($db_auth_file)) != 'json') {89 // DB auth file is not JSON, and will not be automatically beloaded by $app's 'db_auth_file' parser.91 if (false !== $db_auth_file && strtolower(getFilenameExtension($db_auth_file)) != 'json') { 92 // DB auth file is not JSON, and will not be automatically loaded by $app's 'db_auth_file' parser. 90 93 require_once $db_auth_file; 91 94 } … … 95 98 $app->start(); 96 99 97 // Global DB object. Automatically pre-configured by $app->start(). 98 $db =& DB::getInstance(); 100 if (!defined('_NODB')) { 101 // Global DB object. Automatically pre-configured by $app->start(). 102 $db =& DB::getInstance(); 103 }
Note: See TracChangeset
for help on using the changeset viewer.