Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4101567
ExtensionInfo.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
ExtensionInfo.php
View Options
<?php
namespace
MediaWiki\Utils
;
/**
* @since 1.35
*/
class
ExtensionInfo
{
/**
* Obtains the full path of a AUTHORS or CREDITS file if one exists.
*
* @param string $dir Path to the root directory
*
* @since 1.35
*
* @return string|false False if no such file exists, otherwise returns
* a path to it.
*/
public
static
function
getAuthorsFileName
(
$dir
)
{
if
(
!
$dir
)
{
return
false
;
}
foreach
(
scandir
(
$dir
)
as
$file
)
{
$fullPath
=
$dir
.
DIRECTORY_SEPARATOR
.
$file
;
if
(
preg_match
(
'/^(AUTHORS|CREDITS)(
\.
txt|
\.
wiki|
\.
mediawiki)?$/'
,
$file
)
&&
is_readable
(
$fullPath
)
&&
is_file
(
$fullPath
)
)
{
return
$fullPath
;
}
}
return
false
;
}
/**
* Obtains the full paths of COPYING or LICENSE files if they exist.
*
* @since 1.35
* @param string $extDir Path to the extensions root directory
* @return string[] Returns an array of zero or more paths.
*/
public
static
function
getLicenseFileNames
(
string
$extDir
):
array
{
if
(
!
$extDir
)
{
return
[];
}
$licenseFiles
=
[];
foreach
(
scandir
(
$extDir
)
as
$file
)
{
$fullPath
=
$extDir
.
DIRECTORY_SEPARATOR
.
$file
;
// Allow files like GPL-COPYING and MIT-LICENSE
if
(
preg_match
(
'/^([
\w\.
-]+)?(COPYING|LICENSE)(
\.
txt)?$/'
,
$file
)
&&
is_readable
(
$fullPath
)
&&
is_file
(
$fullPath
)
)
{
$licenseFiles
[]
=
$fullPath
;
}
}
return
$licenseFiles
;
}
}
/** @deprecated class alias since 1.41 */
class_alias
(
ExtensionInfo
::
class
,
'MediaWiki
\\
ExtensionInfo'
);
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Tue, Aug 18, 17:01 (3 w, 4 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
01/80/15d3e58e706d1a21c9baa36bb4e8
Default Alt Text
ExtensionInfo.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment