- Timestamp:
- Jul 13, 2015 8:48:29 PM (9 years ago)
- Location:
- trunk/bin
- Files:
-
- 1 deleted
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bin/_config.inc.php
r532 r533 27 27 */ 28 28 29 $this_script = basename($_SERVER['argv'][0]); 29 // The name of the CLI. 30 $cli_executed = basename($_SERVER['argv'][0]); 30 31 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. 34 if (!defined('COMMON_BASE')) { 35 define('COMMON_BASE', realpath('.')); 36 } 37 38 // Use codebase files releative to this file. 39 define('CODEBASE_PATH', realpath(dirname(__FILE__) . '/../')); 40 33 41 $db_auth_file = false; 34 42 $rii = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(COMMON_BASE)); … … 41 49 } 42 50 if (!$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)); 44 52 } 45 53 if (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)); 47 55 } 48 56 … … 55 63 56 64 // Include core libraries. 57 require_once 'codebase/lib/App.inc.php';58 require_once 'codebase/lib/Utilities.inc.php';65 require_once CODEBASE_PATH . '/lib/App.inc.php'; 66 require_once CODEBASE_PATH . '/lib/Utilities.inc.php'; 59 67 60 68 define('_CLI', true); … … 74 82 'log_file_priority' => false, 75 83 'log_screen_priority' => LOG_INFO, 76 'log_directory' => COMMON_BASE . '/log',84 'log_directory' => '/tmp', 77 85 'log_filename' => 'site_log', 78 86 )); -
trunk/bin/acl.cli.php
r532 r533 42 42 43 43 // ACL! 44 require_once 'codebase/lib/ACL.inc.php';44 require_once CODEBASE_PATH . '/lib/ACL.inc.php'; 45 45 $acl =& ACL::getInstance(); 46 46 $acl->setParam(array('create_table' => false)); … … 181 181 function help() 182 182 { 183 global $ this_script;183 global $cli_executed; 184 184 185 185 ?> … … 210 210 implying access to any object of that type. 211 211 212 Usage: <?php echo $ this_script; ?> command [args]212 Usage: <?php echo $cli_executed; ?> command [args] 213 213 214 214 Where command is any of the following (with arguments): … … 255 255 $app =& App::getInstance(); 256 256 $db =& DB::getInstance(); 257 global $this_script;258 257 259 258 echo "\n"; … … 314 313 $app =& App::getInstance(); 315 314 $db =& DB::getInstance(); 316 global $this_script;317 315 318 316 // Retrieve access value from db. -
trunk/bin/init_codebase_tables.cli.php
r532 r533 33 33 34 34 require_once dirname(__FILE__) . '/_config.inc.php'; 35 require_once 'codebase/lib/ACL.inc.php';36 require_once 'codebase/lib/Auth_SQL.inc.php';37 require_once 'codebase/lib/Lock.inc.php';38 require_once 'codebase/lib/Prefs.inc.php';39 require_once 'codebase/lib/Version.inc.php';35 require_once CODEBASE_PATH . '/lib/ACL.inc.php'; 36 require_once CODEBASE_PATH . '/lib/Auth_SQL.inc.php'; 37 require_once CODEBASE_PATH . '/lib/Lock.inc.php'; 38 require_once CODEBASE_PATH . '/lib/Prefs.inc.php'; 39 require_once CODEBASE_PATH . '/lib/Version.inc.php'; 40 40 41 41 /******************************************************************** … … 54 54 exit(1); 55 55 } 56 57 $app->logMsg(sprintf('Running initDB on %s codebase tables in db %s', $class, $db->getParam('db_name')), LOG_INFO, __FILE__, __LINE__); 56 58 57 59 if ('all' == $class) { … … 82 84 function help() 83 85 { 84 global $ this_script;86 global $cli_executed; 85 87 ?> 86 This script initializes DB tables managed by Codebase classes. 88 This script initializes DB tables managed by Codebase classes. If database schema is changed a log message will display. 87 89 88 Usage: <?php echo $ this_script; ?> [OPTIONS] CLASSNAME90 Usage: <?php echo $cli_executed; ?> [OPTIONS] CLASSNAME 89 91 90 92 OPTIONS -
trunk/bin/module_maker/form_template.cli.php
r523 r533 26 26 */ 27 27 28 include_once dirname(__FILE__) . '/_config.inc.php'; 28 if ($_SERVER['argc'] > 1 && isset($_SERVER['argv'][1]) && '' != $_SERVER['argv'][1] && is_dir($_SERVER['argv'][1])) { 29 // First arg is path to current site. Realpath removes trailing /s 30 define('COMMON_BASE', realpath($_SERVER['argv'][1])); 31 } else { 32 die("Error: First argument must be the directory path to an existing site (ex: /home/sc/www.strangecode.com).\n"); 33 } 34 35 include_once dirname(__FILE__) . '/../_config.inc.php'; 29 36 30 37 // Test arguments. -
trunk/bin/module_maker/list_template.cli.php
r468 r533 26 26 */ 27 27 28 include_once dirname(__FILE__) . '/_config.inc.php'; 28 if ($_SERVER['argc'] > 1 && isset($_SERVER['argv'][1]) && '' != $_SERVER['argv'][1] && is_dir($_SERVER['argv'][1])) { 29 // First arg is path to current site. Realpath removes trailing /s 30 define('COMMON_BASE', realpath($_SERVER['argv'][1])); 31 } else { 32 die("Error: First argument must be the directory path to an existing site (ex: /home/sc/www.strangecode.com).\n"); 33 } 34 35 include_once dirname(__FILE__) . '/../_config.inc.php'; 29 36 30 37 $op = null; -
trunk/bin/module_maker/module.cli.php
r500 r533 26 26 */ 27 27 28 include_once dirname(__FILE__) . '/_config.inc.php'; 28 if ($_SERVER['argc'] > 1 && isset($_SERVER['argv'][1]) && '' != $_SERVER['argv'][1] && is_dir($_SERVER['argv'][1])) { 29 // First arg is path to current site. Realpath removes trailing /s 30 define('COMMON_BASE', realpath($_SERVER['argv'][1])); 31 } else { 32 die("Error: First argument must be the directory path to an existing site (ex: /home/sc/www.strangecode.com).\n"); 33 } 34 35 include_once dirname(__FILE__) . '/../_config.inc.php'; 29 36 30 37 $op = null; -
trunk/bin/module_maker/sql.cli.php
r468 r533 26 26 */ 27 27 28 include_once dirname(__FILE__) . '/_config.inc.php'; 28 if ($_SERVER['argc'] > 1 && isset($_SERVER['argv'][1]) && '' != $_SERVER['argv'][1] && is_dir($_SERVER['argv'][1])) { 29 // First arg is path to current site. Realpath removes trailing /s 30 define('COMMON_BASE', realpath($_SERVER['argv'][1])); 31 } else { 32 die("Error: First argument must be the directory path to an existing site (ex: /home/sc/www.strangecode.com).\n"); 33 } 34 35 include_once dirname(__FILE__) . '/../_config.inc.php'; 29 36 30 37 $op = null; -
trunk/bin/module_maker/validation.cli.php
r468 r533 5 5 * For details visit the project site: <http://trac.strangecode.com/codebase/> 6 6 * Copyright 2001-2012 Strangecode, LLC 7 * 7 * 8 8 * This file is part of The Strangecode Codebase. 9 9 * … … 12 12 * Free Software Foundation, either version 3 of the License, or (at your option) 13 13 * any later version. 14 * 14 * 15 15 * The Strangecode Codebase is distributed in the hope that it will be useful, but 16 16 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 17 17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 18 18 * details. 19 * 19 * 20 20 * You should have received a copy of the GNU General Public License along with 21 21 * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>. … … 26 26 */ 27 27 28 include_once dirname(__FILE__) . '/_config.inc.php'; 28 if ($_SERVER['argc'] > 1 && isset($_SERVER['argv'][1]) && '' != $_SERVER['argv'][1] && is_dir($_SERVER['argv'][1])) { 29 // First arg is path to current site. Realpath removes trailing /s 30 define('COMMON_BASE', realpath($_SERVER['argv'][1])); 31 } else { 32 die("Error: First argument must be the directory path to an existing site (ex: /home/sc/www.strangecode.com).\n"); 33 } 34 35 include_once dirname(__FILE__) . '/../_config.inc.php'; 29 36 30 37 // Test arguments.
Note: See TracChangeset
for help on using the changeset viewer.