X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FupdateCredits.php;h=b7e8c1ccd3e26fedf1bb372ee746cb602cf6933a;hb=720a3569b852fc4a5fc71e1ccc7d0ea156e24f7d;hp=a43e0ba3f0439d8cc0d4430724e4dea8072a7775;hpb=1f83b424294a6fd78cb73cf43db3464ca7481774;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/updateCredits.php b/maintenance/updateCredits.php index a43e0ba3f0..b7e8c1ccd3 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 ) { @@ -57,7 +59,7 @@ unset( $lines ); $lines = explode( "\n", shell_exec( 'git log --format="%aN"' ) ); foreach ( $lines as $line ) { - if ( empty( $line ) ) { + if ( empty( $line ) ) { continue; } if ( substr( $line, 0, 5 ) === '[BOT]' ) { @@ -67,7 +69,8 @@ foreach ( $lines as $line ) { } $contributors = array_keys( $contributors ); -$collator = Collator::create( 'uca-default-u-kn' ); +$collator = Collator::create( 'root' ); +$collator->setAttribute( Collator::NUMERIC_COLLATION, Collator::ON ); $collator->sort( $contributors ); array_walk( $contributors, function ( &$v, $k ) { $v = "* {$v}";