Wikia code/includes/specials/SpecialVersion.php
This page is obsolete. It is being retained for archival purposes. It may document extensions or features that are obsolete and/or no longer supported. Do not rely on the information here being up-to-date. The information shown below refers to the now unmaintained 1.16 MediaWiki release. The current stable release number is 1.42.1. |
--- D:\Programming\SVN\mediawiki\branches\REL1_16\phase3\includes\specials\SpecialVersion.php 2011-07-18 22:31:17.758789100 +0100
+++ D:\Programming\SVN\wikia\trunk\includes\specials\SpecialVersion.php 2011-08-17 15:28:16.407226600 +0100
@@ -112,6 +112,10 @@
"<tr>
<th>" . wfMsg( 'version-software-product' ) . "</th>
<th>" . wfMsg( 'version-software-version' ) . "</th>
+ </tr>\n
+ <tr>
+ <td>Wikia</td>
+ <td>" . self::getWikiaVersion() . "</td>
</tr>\n";
foreach( $software as $name => $version ) {
$out .= "<tr>
@@ -149,6 +153,24 @@
return $version;
}
+ /** Return a string of the Wikia version with SVN revision */
+ public static function getWikiaVersion() {
+ global $wgWikiaConfRevision;
+ if (preg_match('/\/wikia\/(tags\/)?([^\/]+)/', '$HeadURL: https://svn.wikia-code.com/wikia/trunk/includes/specials/SpecialVersion.php $', $matches)) {
+ $wikia_release = $matches[2];
+ } else {
+ $wikia_release = '';
+ }
+
+ if (preg_match('/\/(svn\/)?tags\/wikia-conf\/([^\/]+)/', $wgWikiaConfRevision, $matches)) {
+ $conf_release = $matches[2];
+ } else {
+ $conf_release = 'trunk';
+ }
+
+ return "Code: $wikia_release, Config: $conf_release";
+ }
+
/**
* Return a wikitext-formatted string of the MediaWiki version with a link to
* the SVN revision if available
@@ -179,7 +201,7 @@
/** Generate wikitext showing extensions name, URL, author and description */
function extensionCredits() {
- global $wgExtensionCredits, $wgExtensionFunctions, $wgParser, $wgSkinExtensionFunctions;
+ global $wgExtensionCredits, $wgExtensionFunctions, $wgParser, $wgFileExtensions, $wgSkinExtensionFunctions;
if ( ! count( $wgExtensionCredits ) && ! count( $wgExtensionFunctions ) && ! count( $wgSkinExtensionFunctions ) )
return '';
@@ -188,6 +210,7 @@
'specialpage' => wfMsg( 'version-specialpages' ),
'parserhook' => wfMsg( 'version-parserhooks' ),
'variable' => wfMsg( 'version-variables' ),
+ 'widget' => 'Widgets',
'media' => wfMsg( 'version-mediahandlers' ),
'other' => wfMsg( 'version-other' ),
);
@@ -225,6 +248,11 @@
$out .= '<tr><td colspan="4">' . $this->listToText( $fhooks ) . "</td></tr>\n";
}
+ if ( count( $wgFileExtensions ) ) {
+ $out .= $this->openExtType('File extensions allowed for upload');
+ $out .= '<tr><td colspan="3">' . $this->listToText( $wgFileExtensions ) . "</td></tr>\n";
+ }
+
if ( count( $wgSkinExtensionFunctions ) ) {
$out .= $this->openExtType( wfMsg( 'version-skin-extension-functions' ), 'skin-extension-functions' );
$out .= '<tr><td colspan="4">' . $this->listToText( $wgSkinExtensionFunctions ) . "</td></tr>\n";
@@ -506,5 +534,44 @@
}
}
+ public static function getSvnURL( $dir ) {
+ // http://svnbook.red-bean.com/nightly/en/svn.developer.insidewc.html
+ $entries = $dir . '/.svn/entries';
+
+ if( !file_exists( $entries ) ) {
+ return false;
+ }
+
+ $content = file( $entries );
+
+ // check if file is xml (subversion release <= 1.3) or not (subversion release = 1.4)
+ if( preg_match( '/^<\?xml/', $content[0] ) ) {
+ // subversion is release <= 1.3
+ if( !function_exists( 'simplexml_load_file' ) ) {
+ // We could fall back to expat... YUCK
+ return false;
+ }
+
+ // SimpleXml whines about the xmlns...
+ wfSuppressWarnings();
+ $xml = simplexml_load_file( $entries );
+ wfRestoreWarnings();
+
+ if( $xml ) {
+ foreach( $xml->entry as $entry ) {
+ if( $xml->entry[0]['name'] == '' ) {
+ // The directory entry should always have a revision marker.
+ if( $entry['url'] ) {
+ return str_replace( 'https://svn.wikia-code.com', '', $entry['url'] );
+ }
+ }
+ }
+ }
+ return false;
+ } else {
+ // subversion is release 1.4
+ return str_replace( rtrim($content[5]), '', rtrim($content[4]) );
+ }
+ }
/**#@-*/
}