From: Bartosz DziewoƄski Date: Mon, 21 Nov 2016 14:39:26 +0000 (+0100) Subject: updateCredits: Do not change working directory X-Git-Tag: 1.31.0-rc.0~4806^2 X-Git-Url: https://git.cyclocoop.org/%242?a=commitdiff_plain;h=acb085d21af97f0e6019845e3ce672ec478c79ac;p=lhc%2Fweb%2Fwiklou.git updateCredits: Do not change working directory This allows the script to be used by MediaWiki extensions. Example in UploadWizard: I181dda3ca3ef3f43e863482057b4949c1bc32e9b. Change-Id: Ib121c6e226bdc1b3a8976c96b8d9f21546a1b5d3 --- diff --git a/maintenance/updateCredits.php b/maintenance/updateCredits.php index a43e0ba3f0..eb717e8c66 100644 --- a/maintenance/updateCredits.php +++ b/maintenance/updateCredits.php @@ -26,8 +26,6 @@ if ( PHP_SAPI != 'cli' ) { die( "This script can only be run from the command line.\n" ); } -chdir( dirname( __DIR__ ) ); - $CREDITS = 'CREDITS'; $START_CONTRIBUTORS = ''; $END_CONTRIBUTORS = ''; @@ -38,6 +36,10 @@ $header = []; $contributors = []; $footer = []; +if ( !file_exists( $CREDITS ) ) { + exit( 'No CREDITS file found. Are you running this script in the right directory?' ); +} + $lines = explode( "\n", file_get_contents( $CREDITS ) ); foreach ( $lines as $line ) { if ( $inHeader ) {