$wgGitRepositoryViewers to link to gitweb

My git remote is configured just to be ssh://review/mediawiki/core.git
and I have "review" set up in $HOME/.ssh/config.

Unfortunately, I need to change git remote URLs to make sure
the repository is linked from Special:Version.

This shouldn't be necessary; either we should fallback to the
official MediaWiki git repository or we should add the configuration
option to adapt to local needs.

Change-Id: I2e0b6470c16ec36d0e94cceab844f4a4c4334067
This commit is contained in:
saper 2012-05-06 22:12:14 +02:00
parent 7cf5f38232
commit 8bab490dec
3 changed files with 19 additions and 13 deletions

View file

@ -15,6 +15,8 @@ Since 1.20, the lowest supported version of PHP is now 5.3.2. Please
upgrade PHP if you have not done so prior to upgrading MediaWiki.
=== Configuration changes in 1.20 ===
* $wgGitRepositoryViewers defines a mapping from Git remote repository to the
Gitweb instance URL used in Special:Version
* `$wgUsePathInfo = true;` is no longer needed to make $wgArticlePath work on servers
using like nginx, lighttpd, and apache over fastcgi. MediaWiki now always extracts
path info from REQUEST_URI if it's available.

View file

@ -4562,6 +4562,20 @@ $wgReadOnlyFile = false;
*/
$wgUpgradeKey = false;
/**
* Map GIT repository URLs to viewer URLs to provide links in Special:Version
*
* Key is a pattern passed to preg_match() and preg_replace(),
* without the delimiters (which are #) and must match the whole URL.
* The value is the replacement for the key (it can contain $1, etc.)
* %h will be replaced by the short SHA-1 (7 first chars) and %H by the
* full SHA-1 of the HEAD revision.
*/
$wgGitRepositoryViewers = array(
'https://gerrit.wikimedia.org/r/p/(.*)' => 'https://gerrit.wikimedia.org/r/gitweb?p=$1;h=%H',
'ssh://(?:[a-z0-9_]+@)?gerrit.wikimedia.org:29418/(.*)' => 'https://gerrit.wikimedia.org/r/gitweb?p=$1;h=%H',
);
/** @} */ # End of maintenance }
/************************************************************************//**

View file

@ -187,20 +187,10 @@ class GitInfo {
* @return array
*/
protected static function getViewers() {
global $wgGitRepositoryViewers;
if( self::$viewers === false ) {
// Map of repo URLs to viewer URLs.
//
// Key is a pattern passed to preg_match() and preg_replace(),
// without the delimiters (which are #) and must match the whole URL.
// The value is the replacement for the key (it can contain $1, etc.)
// %h will be replaced by the short SHA-1 (7 first chars) and %H by the
// full SHA-1 of the HEAD revision.
self::$viewers = array(
'https://gerrit.wikimedia.org/r/p/(.*)' => 'https://gerrit.wikimedia.org/r/gitweb?p=$1;h=%H',
'ssh://(?:[a-z0-9_]+@)?gerrit.wikimedia.org:29418/(.*)' => 'https://gerrit.wikimedia.org/r/gitweb?p=$1;h=%H',
);
self::$viewers = $wgGitRepositoryViewers;
wfRunHooks( 'GitViewers', array( &self::$viewers ) );
}