11 * Obtains the full path of a AUTHORS or CREDITS file if one exists.
13 * @param string $dir Path to the root directory
17 * @return bool|string False if no such file exists, otherwise returns
20 public static function getAuthorsFileName( $dir ) {
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 ) &&
39 * Obtains the full paths of COPYING or LICENSE files if they exist.
41 * @param string $extDir Path to the extensions root directory
45 * @return string[] Returns an array of zero or more paths.
47 public static function getLicenseFileNames( $extDir ) {
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 ) &&
60 $licenseFiles[] = $fullPath;