Changeset 674 for trunk/bin


Ignore:
Timestamp:
May 2, 2019 10:17:26 PM (5 years ago)
Author:
anonymous
Message:

Add user.cli.php and supporting changes

Location:
trunk/bin
Files:
1 added
2 edited

Legend:

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

    r572 r674  
    3939define('CODEBASE_PATH', realpath(dirname(__FILE__) . '/../'));
    4040
    41 
    4241$db_auth_file = false;
    4342if (!defined('_NODB')) {
     
    5150    }
    5251    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));
     52        printf("%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);
     53        exit(1);
    5454    }
    5555    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));
     56        printf("%s error: you must execute this script as the owner of the web files.\n", $cli_executed);
     57        exit(1);
    5758    }
    5859}
    5960
    6061// Set include path.
    61 ini_set('include_path', get_include_path() . PATH_SEPARATOR . COMMON_BASE);
     62ini_set('include_path', join(PATH_SEPARATOR, array_unique(array(
     63    '.',
     64    COMMON_BASE,
     65    dirname($db_auth_file)
     66))));
    6267
    6368/********************************************************************
     
    6671
    6772// Include core libraries.
    68 require_once CODEBASE_PATH . '/lib/App.inc.php';
    69 require_once CODEBASE_PATH . '/lib/Utilities.inc.php';
     73(include_once 'codebase/lib/App.inc.php') || require_once CODEBASE_PATH . '/lib/App.inc.php';
    7074
    7175define('_CLI', true);
  • trunk/bin/acl.cli.php

    r534 r674  
    189189Access Control List command line tool.
    190190
    191 This script must be run in the common site directory (i.e. the parent
    192 directory of the document root). DB credentials are retrieved from:
    193 global/db_auth.inc.php so this file must exist. Furthermore this script
    194 must be executed as the owner of the db_auth.inc.php file.
     191This script must be run in a common site directory configured with a DB auth file,
     192e.g., `lib/db_auth.json`, readable by the user executing this script.
    195193
    196194Three types of objects are managed by this interface:
Note: See TracChangeset for help on using the changeset viewer.