MediaWiki REL1_37
ExtensionInfo.php
Go to the documentation of this file.
1<?php
2
3namespace MediaWiki;
4
9
20 public static function getAuthorsFileName( $dir ) {
21 if ( !$dir ) {
22 return false;
23 }
24
25 foreach ( scandir( $dir ) as $file ) {
26 $fullPath = $dir . DIRECTORY_SEPARATOR . $file;
27 if ( preg_match( '/^(AUTHORS|CREDITS)(\.txt|\.wiki|\.mediawiki)?$/', $file ) &&
28 is_readable( $fullPath ) &&
29 is_file( $fullPath )
30 ) {
31 return $fullPath;
32 }
33 }
34
35 return false;
36 }
37
47 public static function getLicenseFileNames( $extDir ) {
48 if ( !$extDir ) {
49 return [];
50 }
51
52 $licenseFiles = [];
53 foreach ( scandir( $extDir ) as $file ) {
54 $fullPath = $extDir . DIRECTORY_SEPARATOR . $file;
55 // Allow files like GPL-COPYING and MIT-LICENSE
56 if ( preg_match( '/^([\w\.-]+)?(COPYING|LICENSE)(\.txt)?$/', $file ) &&
57 is_readable( $fullPath ) &&
58 is_file( $fullPath )
59 ) {
60 $licenseFiles[] = $fullPath;
61 }
62 }
63
64 return $licenseFiles;
65 }
66}
static getLicenseFileNames( $extDir)
Obtains the full paths of COPYING or LICENSE files if they exist.
static getAuthorsFileName( $dir)
Obtains the full path of a AUTHORS or CREDITS file if one exists.
A helper class for throttling authentication attempts.
if(PHP_SAPI !='cli-server') if(!isset( $_SERVER['SCRIPT_FILENAME'])) $file
Item class for a filearchive table row.
Definition router.php:42