Page MenuHomePhabricator

require commandLine.inc/Maintenance.php properly
Closed, ResolvedPublic

Description

don't assume $CWD

$ php radioscanningtw.jidanni.org/maintenance/convertUserOptions.php
Warning: require(./commandLine.inc): failed to open stream: No such file
OK, here's the patch for this one. You might want to check the rest:
$ find . -path \*/.svn -prune -o -type f|xargs grep -h commandLine.inc|sort|uniq -c|sort -nr

49 require_once( 'commandLine.inc' );
17 require_once( "commandLine.inc" );
10 require_once( dirname(__FILE__).'/../commandLine.inc' );
 9 require_once 'commandLine.inc';
 4 require_once('commandLine.inc');
 4 require( dirname(__FILE__).'/../commandLine.inc' );
 3 	require_once( dirname(__FILE__) . '/../commandLine.inc' );
 2 require_once(dirname(__FILE__).'/../commandLine.inc');
 2 require_once( dirname(__FILE__) . '/../commandLine.inc' );
 2 require_once "commandLine.inc";
 2 require( dirname( __FILE__ ) .'/../commandLine.inc' );
 2 require "commandLine.inc";
 2 include_once( "commandLine.inc" );
 2 include('commandLine.inc');
 1 require_once( dirname(__FILE__).'/commandLine.inc' );
 1 require_once( dirname(__FILE__).'/../maintenance/commandLine.inc' );
 1 require_once( dirname(__FILE__) . '/../maintenance/commandLine.inc' );
 1 require_once( dirname(__FILE__) . '/' . 'commandLine.inc' );
 1 require_once( dirname( __FILE__ ). '/../maintenance/commandLine.inc' );
 1 require_once( dirname( __FILE__ ) . '/commandLine.inc' );
 1 require_once( "$IP/maintenance/commandLine.inc" );
 1 require( dirname( __FILE__ ) . '/../commandLine.inc' );
 1 require( 'commandLine.inc' );
 1 require( './commandLine.inc' );
 1 require( '../commandLine.inc' );
 1 require 'commandLine.inc';
 1  * The include paths change after this file is included from commandLine.inc,
 1 	require_once( dirname(__FILE__).'/../maintenance/commandLine.inc' );
 1 	require_once( 'commandLine.inc' );

Version: 1.16.x
Severity: normal

Attached:

Details

Reference
bz18855

Related Objects

StatusSubtypeAssignedTask
Resolveddemon
ResolvedNone

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:41 PM
bzimport set Reference to bz18855.
bzimport added a subscriber: Unknown Object (MLST).
Jidanni created this task.May 20 2009, 3:00 PM

There is only one commandLine.inc:
$ find -name commandLine.inc
./maintenance/commandLine.inc
So all of these could be replaced by one single best choice.

Of all of them,
1 require( './commandLine.inc' );
1 require( '../commandLine.inc' );
are the ones that will put one's program out of business if one is not
in the proper current directory.

maintenance/language/digit2html.php, and
maintenance/convertUserOptions.php are implicated. Please apply this
patch for the latter. The rest can wait for now.

demon added a comment.Aug 2 2009, 10:56 PM

Fixed a few in r54244. All the ones in /maintenance should call 'commandLine.inc' directly. No paths, nothing. Things outside of it will use dirname(FILE) and use relative paths as appropriate.

demon added a comment.Aug 3 2009, 9:57 PM

Actually fixed in r54312, require commandLine.inc (or in new scripts: Maintenance.php) using the full path every time.