Last modified: 2009-08-03 21:57:29 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T20855, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 18855 - require commandLine.inc/Maintenance.php properly
require commandLine.inc/Maintenance.php properly
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
Maintenance scripts (Other open bugs)
1.16.x
All All
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
: patch
Depends on:
Blocks: code_quality 19133
  Show dependency treegraph
 
Reported: 2009-05-20 15:00 UTC by Dan Jacobson
Modified: 2009-08-03 21:57 UTC (History)
1 user (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
don't assume $CWD (374 bytes, patch)
2009-05-20 15:00 UTC, Dan Jacobson
Details

Description Dan Jacobson 2009-05-20 15:00:39 UTC
Created attachment 6140 [details]
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' );
Comment 1 Dan Jacobson 2009-05-26 12:20:39 UTC
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.
Comment 2 Chad H. 2009-08-02 22:56:14 UTC
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.
Comment 3 Chad H. 2009-08-03 21:57:29 UTC
Actually fixed in r54312, require commandLine.inc (or in new scripts: Maintenance.php) using the full path every time.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links