MediaWiki  master
updateCredits.php
Go to the documentation of this file.
1 <?php
25 if ( PHP_SAPI != 'cli' ) {
26  die( "This script can only be run from the command line.\n" );
27 }
28 
29 $CREDITS = 'CREDITS';
30 $START_CONTRIBUTORS = '<!-- BEGIN CONTRIBUTOR LIST -->';
31 $END_CONTRIBUTORS = '<!-- END CONTRIBUTOR LIST -->';
32 
33 $inHeader = true;
34 $inFooter = false;
35 $header = [];
37 $footer = [];
38 
39 if ( !file_exists( $CREDITS ) ) {
40  exit( 'No CREDITS file found. Are you running this script in the right directory?' );
41 }
42 
43 $lines = explode( "\n", file_get_contents( $CREDITS ) );
44 foreach ( $lines as $line ) {
45  if ( $inHeader ) {
46  $header[] = $line;
47  $inHeader = $line !== $START_CONTRIBUTORS;
48  } elseif ( $inFooter ) {
49  $footer[] = $line;
50  } elseif ( $line == $END_CONTRIBUTORS ) {
51  $inFooter = true;
52  $footer[] = $line;
53  } else {
54  $name = substr( $line, 2 );
55  $contributors[$name] = true;
56  }
57 }
58 unset( $lines );
59 
60 $lines = explode( "\n", shell_exec( 'git log --format="%aN"' ) );
61 foreach ( $lines as $line ) {
62  if ( empty( $line ) ) {
63  continue;
64  }
65  if ( substr( $line, 0, 5 ) === '[BOT]' ) {
66  continue;
67  }
68  $contributors[$line] = true;
69 }
70 
71 $contributors = array_keys( $contributors );
72 $collator = Collator::create( 'root' );
73 $collator->setAttribute( Collator::NUMERIC_COLLATION, Collator::ON );
74 $collator->sort( $contributors );
75 array_walk( $contributors, function ( &$v, $k ) {
76  $v = "* {$v}";
77 } );
78 
79 file_put_contents( $CREDITS,
80  implode( "\n", array_merge( $header, $contributors, $footer ) ) );
$START_CONTRIBUTORS
$collator
if(PHP_SAPI !='cli') $CREDITS
Update the CREDITS list by merging in the list of git commit authors.
$contributors
$inFooter
$inHeader
$header
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
Definition: distributors.txt:9
$END_CONTRIBUTORS
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition: injection.txt:35
$line
Definition: cdb.php:59
if(!file_exists( $CREDITS)) $lines
Allows to change the fields on the form that will be generated $name
Definition: hooks.txt:271
$footer