Ignore:
Timestamp:
Jul 13, 2015 8:48:29 PM (9 years ago)
Author:
anonymous
Message:

Adapted module maker scripts to use the new cli config file. Updated config to load codebase classes from its own codebase dir.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bin/_config.inc.php

    r532 r533  
    2727*/
    2828
    29 $this_script = basename($_SERVER['argv'][0]);
     29// The name of the CLI.
     30$cli_executed = basename($_SERVER['argv'][0]);
    3031
    31 // Assume execution occurs while in the common app directory.
    32 define('COMMON_BASE', realpath('.'));
     32// Enforce "relaxed" directory location, if set by the called script.
     33// This script can be executed in any directory that is an ancestor 2 directories above the db_auth file.
     34if (!defined('COMMON_BASE')) {
     35    define('COMMON_BASE', realpath('.'));
     36}
     37
     38// Use codebase files releative to this file.
     39define('CODEBASE_PATH', realpath(dirname(__FILE__) . '/../'));
     40
    3341$db_auth_file = false;
    3442$rii = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(COMMON_BASE));
     
    4149}
    4250if (!$db_auth_file) {
    43     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", $this_script));
     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));
    4452}
    4553if (fileowner($db_auth_file) != getmyuid()) {
    46     die(sprintf("%s error: you must execute this script as the owner of the web files.\n", $this_script));
     54    die(sprintf("%s error: you must execute this script as the owner of the web files.\n", $cli_executed));
    4755}
    4856
     
    5563
    5664// Include core libraries.
    57 require_once 'codebase/lib/App.inc.php';
    58 require_once 'codebase/lib/Utilities.inc.php';
     65require_once CODEBASE_PATH . '/lib/App.inc.php';
     66require_once CODEBASE_PATH . '/lib/Utilities.inc.php';
    5967
    6068define('_CLI', true);
     
    7482    'log_file_priority' => false,
    7583    'log_screen_priority' => LOG_INFO,
    76     'log_directory' => COMMON_BASE . '/log',
     84    'log_directory' => '/tmp',
    7785    'log_filename' => 'site_log',
    7886));
Note: See TracChangeset for help on using the changeset viewer.