Paladox has uploaded a new change for review.
https://gerrit.wikimedia.org/r/203092
Change subject: Add extension.json and replaced settings with prefix wg
......................................................................
Add extension.json and replaced settings with prefix wg
* This add the extension.json file.
* Setting have been renamed with the prefix now wg. followers mediawiki
guidlines. and also they had to be renamed to work with extension.json.
Bug: T87998
Change-Id: I8ee42ebe11aa0f25eb1719069c0a13d87da54cb9
---
M CreateAccountTestWiki.php
M InfoPage.php
M ListUsersTestWiki.php
M SpecialRandomByTest.php
M SpecialSearchWiki.php
M SpecialViewUserLang.php
M TestWikiRC.php
M WikimediaIncubator.class.php
M WikimediaIncubator.php
A extension.json
M i18n/qqq.json
11 files changed, 338 insertions(+), 120 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikimediaIncubator
refs/changes/92/203092/1
diff --git a/CreateAccountTestWiki.php b/CreateAccountTestWiki.php
index 80fb213..9b26bdc 100644
--- a/CreateAccountTestWiki.php
+++ b/CreateAccountTestWiki.php
@@ -18,10 +18,10 @@
* @return bool
*/
public static function onUserCreateForm( &$template ) {
- global $wgRequest, $wmincProjects;
+ global $wgRequest, $wgwmincProjects;
$projectvalue = strtolower( $wgRequest->getVal(
'testwikiproject', '' ) );
$codevalue = strtolower( $wgRequest->getVal( 'testwikicode', ''
) );
- if ( WikimediaIncubator::validateLanguageCode( $codevalue ) &&
isset( $wmincProjects[$projectvalue] ) ) {
+ if ( WikimediaIncubator::validateLanguageCode( $codevalue ) &&
isset( $wgwmincProjects[$projectvalue] ) ) {
$template->set( 'header',
Html::hidden('testwiki-project', $projectvalue).
Html::hidden('testwiki-code', $codevalue)
@@ -35,12 +35,12 @@
* @return bool
*/
public static function onAddNewAccount( $user ) {
- global $wgRequest, $wmincProjects, $wmincPref;
+ global $wgRequest, $wgwmincProjects, $wgwmincPref;
$projectvalue = $wgRequest->getVal( 'testwiki-project' );
$codevalue = $wgRequest->getVal( 'testwiki-code' );
- if ( WikimediaIncubator::validateLanguageCode( $codevalue ) &&
isset( $wmincProjects[$projectvalue] ) ) {
- $user->setOption( $wmincPref . '-project',
$projectvalue );
- $user->setOption( $wmincPref . '-code', $codevalue );
+ if ( WikimediaIncubator::validateLanguageCode( $codevalue ) &&
isset( $wgwmincProjects[$projectvalue] ) ) {
+ $user->setOption( $wgwmincPref . '-project',
$projectvalue );
+ $user->setOption( $wgwmincPref . '-code', $codevalue );
$user->saveSettings();
}
return true;
diff --git a/InfoPage.php b/InfoPage.php
index b6e345d..4e52bc1 100644
--- a/InfoPage.php
+++ b/InfoPage.php
@@ -1,18 +1,17 @@
<?php
/**
* Implements the "info page" (Wx/xx pages)
-
-'missing' showMissingWiki()
- A [Project] in this language does not yet exist.
-'incubator' showIncubatingWiki()
- 'open': This is a new Incubator wiki that is not yet verified by the
language committee.
- 'eligible': This Incubator wiki has been marked as eligible by the
language committee.
- 'imported': This Incubator wiki has been imported from xyz.wikiproject.org
after that wiki was closed.
- 'approved': This Incubator wiki has been approved by the language
committee and will soon be created.
-'existing' showExistingWiki()
- 'created': This project has been approved by the language committee and is
now available at xyz.wikiproject.org.
- 'beforeincubator': This project was created before Wikimedia Incubator
started and is available at xyz.wikiproject.org.
-
+ * 'missing' showMissingWiki()
+ * A [Project] in this language does not yet exist.
+ * 'incubator' showIncubatingWiki()
+ * 'open': This is a new Incubator wiki that is not yet verified by the
language committee.
+ * 'eligible': This Incubator wiki has been marked as eligible by the
language committee.
+ * 'imported': This Incubator wiki has been imported from
xyz.wikiproject.org after that wiki was closed.
+ * 'approved': This Incubator wiki has been approved by the language
committee and will soon be created.
+ * 'existing' showExistingWiki()
+ * 'created': This project has been approved by the language committee and
is now available at xyz.wikiproject.org.
+ * 'beforeincubator': This project was created before Wikimedia Incubator
started and is available at xyz.wikiproject.org.
+ *
* @file
* @ingroup Extensions
* @author Robin Pepermans (SPQRobin)
@@ -25,16 +24,16 @@
* @param $prefixdata
*/
public function __construct( $title, $prefixdata ) {
- global $wmincProjects, $wmincSisterProjects, $wgLang;
+ global $wgwmincProjects, $wgwmincSisterProjects, $wgLang;
$this->mTitle = $title;
$this->mPrefix = $prefixdata['prefix'];
$this->mLangCode = $prefixdata['lang'];
$this->mProjectCode = $prefixdata['project'];
- $allProjects = array_merge( $wmincProjects,
$wmincSisterProjects );
+ $allProjects = array_merge( $wgwmincProjects,
$wgwmincSisterProjects );
$this->mProjectName = isset( $allProjects[$this->mProjectCode]
) ?
$allProjects[$this->mProjectCode] : '';
$this->mPortal = WikimediaIncubator::getSubdomain( 'www',
$this->mProjectCode );
- $this->mIsSister = array_key_exists( $this->mProjectCode,
$wmincSisterProjects );
+ $this->mIsSister = array_key_exists( $this->mProjectCode,
$wgwmincSisterProjects );
$this->mDBStatus = '';
$this->mSubStatus = '';
$this->mThisLangData = array( 'type' => 'valid' ); # For later
code check feature
@@ -89,8 +88,8 @@
* (Wikipedia, Wiktionary, ...)
*/
public function listOtherProjects() {
- global $wmincProjects, $wmincSisterProjects;
- $otherProjects = $wmincProjects + $wmincSisterProjects;
+ global $wgwmincProjects, $wgwmincSisterProjects;
+ $otherProjects = $wgwmincProjects + $wgwmincSisterProjects;
unset( $otherProjects[$this->mProjectCode] );
$listOtherProjects = array();
foreach ( $otherProjects as $code => $name ) {
@@ -106,12 +105,12 @@
* (Meta, Commons, ...)
*/
public function listMultilingualProjects() {
- global $wmincMultilingualProjects, $wmincProjects;
- if ( !is_array( $wmincMultilingualProjects ) ) { return ''; }
+ global $wgwmincMultilingualProjects, $wgwmincProjects;
+ if ( !is_array( $wgwmincMultilingualProjects ) ) { return ''; }
$list = array();
- foreach ( $wmincMultilingualProjects as $key => $name ) {
+ foreach ( $wgwmincMultilingualProjects as $key => $name ) {
# multilingual projects are listed under wikipedia
- $fakeProject = key( $wmincProjects );
+ $fakeProject = key( $wgwmincProjects );
$url = WikimediaIncubator::getSubdomain( $key,
$fakeProject );
$list[$url] = '<li>' . $this->makeLogo( $fakeProject,
true,
array( 'width' => 75 ), $url, $key, true ) .
'</li>';
@@ -227,7 +226,7 @@
* @return String
*/
public function showExistingWiki() {
- global $wgLang, $wmincSisterProjects;
+ global $wgLang, $wgwmincSisterProjects;
$created = isset( $this->mCreated ) ? $this->mCreated : ''; #
for future use
$bug = isset( $this->mBug ) ? $this->mBug : ''; # for future use
$subdomain = WikimediaIncubator::getSubdomain(
$this->mLangCode, $this->mProjectCode );
@@ -241,7 +240,7 @@
# wminc-infopage-status-open, wminc-infopage-status-imported,
wminc-infopage-status-closedsister,
# wminc-infopage-status-approved,
wminc-infopage-status-created, wminc-infopage-status-beforeincubator
$msgname = 'wminc-infopage-status-' . $this->mSubStatus; //
wminc-infopage-status-beforeincubator
- if ( $this->mSubStatus === 'beforeincubator' && isset(
$wmincSisterProjects[$this->mProjectCode] ) ) {
+ if ( $this->mSubStatus === 'beforeincubator' && isset(
$wgwmincSisterProjects[$this->mProjectCode] ) ) {
$msgname =
'wminc-infopage-status-beforeincubator-sister';
}
$content = Html::rawElement( 'div',
diff --git a/ListUsersTestWiki.php b/ListUsersTestWiki.php
index 4fd1bdb..a481648 100644
--- a/ListUsersTestWiki.php
+++ b/ListUsersTestWiki.php
@@ -9,10 +9,10 @@
* @return Array or null
*/
static function getProjectInput() {
- global $wmincProjectSite, $wgRequest;
+ global $wgwmincProjectSite, $wgRequest;
$input = strtolower( $wgRequest->getVal( 'testwiki' ) );
- if( $input == strtolower( $wmincProjectSite['name'] ) || $input
== strtolower( $wmincProjectSite['short'] ) ) {
- return $wmincProjectSite;
+ if( $input == strtolower( $wgwmincProjectSite['name'] ) ||
$input == strtolower( $wgwmincProjectSite['short'] ) ) {
+ return $wgwmincProjectSite;
}
return null;
}
@@ -58,10 +58,10 @@
if ( !$project && !$testwiki ) {
return true; # no input or invalid input
}
- global $wmincPref;
+ global $wgwmincPref;
$query['tables']['p1'] = 'user_properties';
$query['join_conds']['p1'] = array( 'JOIN', array(
'user_id=p1.up_user',
- 'p1.up_property' => "$wmincPref-project",
+ 'p1.up_property' => "$wgwmincPref-project",
'p1.up_value' => $project ? $project['short'] :
$testwiki['project']
) );
if ( $project ) {
@@ -69,7 +69,7 @@
}
$query['tables']['p2'] = 'user_properties';
$query['join_conds']['p2'] = array( 'JOIN', array(
'user_id=p2.up_user',
- 'p2.up_property' => "$wmincPref-code",
+ 'p2.up_property' => "$wgwmincPref-code",
'p2.up_value' => $testwiki['lang']
) );
return true;
diff --git a/SpecialRandomByTest.php b/SpecialRandomByTest.php
index bdb543d..35afbad 100644
--- a/SpecialRandomByTest.php
+++ b/SpecialRandomByTest.php
@@ -10,7 +10,7 @@
class SpecialRandomByTest extends RandomPage {
public function __construct() {
- global $wmincPref, $wmincProjectSite;
+ global $wgwmincPref, $wgwmincProjectSite;
$target = $this->getRequest()->getVal( 'testwiki' );
$target = WikimediaIncubator::analyzePrefix( $target );
$project = isset( $target['project'] ) ? $target['project'] :
'';
@@ -19,7 +19,7 @@
$dbr = wfGetDB( DB_SLAVE );
$this->extra[] = 'page_title' .
$dbr->buildLike(
WikimediaIncubator::displayPrefix( $project, $lang ) . '/', $dbr->anyString() );
- } elseif( $this->getUser()->getOption( $wmincPref . '-project'
) == $wmincProjectSite['short'] ) {
+ } elseif( $this->getUser()->getOption( $wgwmincPref .
'-project' ) == $wgmincProjectSite['short'] ) {
# project or help namespace
$this->extra['page_namespace'] = array( 4, 12 );
}
diff --git a/SpecialSearchWiki.php b/SpecialSearchWiki.php
index 355a47f..85b213b 100644
--- a/SpecialSearchWiki.php
+++ b/SpecialSearchWiki.php
@@ -14,12 +14,12 @@
* @param $subpage Mixed: parameter passed to the page or null
*/
public function execute( $subpage ) {
- global $wmincProjects, $wmincSisterProjects, $wgScript;
+ global $wgwmincProjects, $wgwmincSisterProjects, $wgScript;
$this->setHeaders();
# Array of projects
- $this->mProjects = array_merge( $wmincProjects,
$wmincSisterProjects );
+ $this->mProjects = array_merge( $wgwmincProjects,
$wgwmincSisterProjects );
# Queries
if ( $subpage ) {
diff --git a/SpecialViewUserLang.php b/SpecialViewUserLang.php
index e2f28ea..55bdf73 100644
--- a/SpecialViewUserLang.php
+++ b/SpecialViewUserLang.php
@@ -68,7 +68,7 @@
* @param $target Mixed: user whose language and test wiki we're
looking up
*/
function showInfo( $target ) {
- global $wmincPref, $wmincProjectSite;
+ global $wgwmincPref, $wgwmincProjectSite;
$user = User::newFromName( $target );
if ( User::isIP( $target ) || !$user ) {
# show error if it is an IP address, or another error
occurs
@@ -83,14 +83,14 @@
$this->getOutput()->addHTML( Xml::span( wfMessage(
'wminc-userdoesnotexist', $target )->text(), 'error' ) );
return;
}
- $userproject = $user->getOption( $wmincPref . '-project' );
+ $userproject = $user->getOption( $wgwmincPref . '-project' );
$userproject = ( $userproject ? $userproject : 'none' );
- $usercode = $user->getOption( $wmincPref . '-code' );
+ $usercode = $user->getOption( $wgwmincPref . '-code' );
$prefix = WikimediaIncubator::displayPrefix( $userproject,
$usercode ? $usercode : 'none' );
if ( WikimediaIncubator::isContentProject( $userproject ) ) {
$testwiki = Linker::link( Title::newFromText( $prefix )
);
- } elseif ( $prefix == $wmincProjectSite['short'] ) {
- $testwiki = htmlspecialchars( $wmincProjectSite['name']
);
+ } elseif ( $prefix == $wgwmincProjectSite['short'] ) {
+ $testwiki = htmlspecialchars(
$wgwmincProjectSite['name'] );
} else {
$testwiki = wfMessage( 'wminc-testwiki-none'
)->escaped();
}
diff --git a/TestWikiRC.php b/TestWikiRC.php
index a2fd9ab..ba00d64 100644
--- a/TestWikiRC.php
+++ b/TestWikiRC.php
@@ -9,17 +9,17 @@
class TestWikiRC {
static function getValues() {
- global $wgUser, $wmincPref, $wgRequest;
+ global $wgUser, $wgwmincPref, $wgRequest;
$url = WikimediaIncubator::getUrlParam();
- $projectvalue = $url ? $url['project'] : $wgUser->getOption(
$wmincPref . '-project' );
- $codevalue = $url ? $url['lang'] : $wgUser->getOption(
$wmincPref . '-code' );
+ $projectvalue = $url ? $url['project'] : $wgUser->getOption(
$wgwmincPref . '-project' );
+ $codevalue = $url ? $url['lang'] : $wgUser->getOption(
$wgwmincPref . '-code' );
$projectvalue = strtolower( $wgRequest->getVal(
'rc-testwiki-project', $projectvalue ) );
$codevalue = strtolower( $wgRequest->getVal(
'rc-testwiki-code', $codevalue ) );
return array( $projectvalue, $codevalue );
}
static function onRcQuery( &$conds, &$tables, &$join_conds, $opts ) {
- global $wmincProjectSite, $wmincTestWikiNamespaces;
+ global $wgwmincProjectSite, $wgwmincTestWikiNamespaces;
list( $projectvalue, $codevalue ) = self::getValues();
$prefix = WikimediaIncubator::displayPrefix( $projectvalue,
$codevalue );
$opts->add( 'rc-testwiki-project', false );
@@ -29,14 +29,14 @@
if ( $projectvalue == 'none' || $projectvalue == '' ) {
// If "none" is selected, display normal recent changes
return true;
- } elseif ( $projectvalue == $wmincProjectSite['short'] ) {
+ } elseif ( $projectvalue == $wgwmincProjectSite['short'] ) {
// If project site is selected, display all changes
except test wiki changes
$dbr = wfGetDB( DB_SLAVE );
$conds[] = 'rc_title NOT ' . $dbr->buildLike( 'W',
$dbr->anyChar(), '/', $dbr->anyString() );
} elseif ( WikimediaIncubator::validatePrefix( $prefix, true )
) {
// Else, display changes to the selected test wiki in
the appropriate namespaces
$dbr = wfGetDB( DB_SLAVE );
- $conds['rc_namespace'] = $wmincTestWikiNamespaces;
+ $conds['rc_namespace'] = $wgwmincTestWikiNamespaces;
$conds[] = 'rc_title ' . $dbr->buildLike( $prefix .
'/', $dbr->anyString() ) .
' OR rc_title = ' . $dbr->addQuotes( $prefix );
} else {
@@ -46,7 +46,7 @@
}
static function onRcForm( &$items, $opts ) {
- global $wmincProjects, $wmincProjectSite, $wmincLangCodeLength;
+ global $wgwmincProjects, $wgwmincProjectSite,
$wgwmincLangCodeLength;
list( $projectvalue, $codevalue ) = self::getValues();
$opts->consumeValue( 'rc-testwiki-project' );
@@ -54,12 +54,12 @@
$label = Xml::label( wfMessage( 'wminc-testwiki' )->text(),
'rc-testwiki' );
$select = new XmlSelect( 'rc-testwiki-project',
'rc-testwiki-project', $projectvalue );
$select->addOption( wfMessage( 'wminc-testwiki-none' )->text(),
'none' );
- foreach ( $wmincProjects as $prefix => $name ) {
+ foreach ( $wgwmincProjects as $prefix => $name ) {
$select->addOption( $name, $prefix );
}
- $select->addOption( $wmincProjectSite['name'],
$wmincProjectSite['short'] );
- $langcode = Xml::input( 'rc-testwiki-code',
(int)$wmincLangCodeLength, $codevalue,
- array( 'id' => 'rc-testwiki-code', 'maxlength' =>
(int)$wmincLangCodeLength ) );
+ $select->addOption( $wgwmincProjectSite['name'],
$wgwmincProjectSite['short'] );
+ $langcode = Xml::input( 'rc-testwiki-code',
(int)$wgwmincLangCodeLength, $codevalue,
+ array( 'id' => 'rc-testwiki-code', 'maxlength' =>
(int)$wgwmincLangCodeLength ) );
$items['testwiki'] = array( $label, $select->getHTML() . ' ' .
$langcode );
return true;
}
diff --git a/WikimediaIncubator.class.php b/WikimediaIncubator.class.php
index a658b6c..96783e8 100644
--- a/WikimediaIncubator.class.php
+++ b/WikimediaIncubator.class.php
@@ -31,28 +31,28 @@
* @return true
*/
static function onGetPreferences( $user, &$preferences ) {
- global $wmincPref, $wmincProjects, $wmincProjectSite,
$wmincLangCodeLength;
+ global $wgwmincPref, $wgwmincProjects, $wgwmincProjectSite,
$wgwmincLangCodeLength;
$preferences['language']['help-message'] =
'wminc-prefinfo-language';
- $prefinsert[$wmincPref . '-project'] = array(
+ $prefinsert[$wgwmincPref . '-project'] = array(
'type' => 'select',
'options' =>
array( wfMessage( 'wminc-testwiki-none'
)->plain() => 'none' ) +
- array_flip( $wmincProjects ) +
+ array_flip( $wgwmincProjects ) +
array( wfMessage( 'wminc-testwiki-site'
)->plain() => $wmincProjectSite['short'] ),
'section' => 'personal/i18n',
'label-message' => 'wminc-testwiki',
- 'id' => $wmincPref . '-project',
+ 'id' => $wgwmincPref . '-project',
'help-message' => 'wminc-prefinfo-project',
);
- $prefinsert[$wmincPref . '-code'] = array(
+ $prefinsert[$wgwmincPref . '-code'] = array(
'type' => 'text',
'section' => 'personal/i18n',
'label-message' => 'wminc-testwiki-code',
- 'id' => $wmincPref . '-code',
- 'maxlength' => (int)$wmincLangCodeLength,
- 'size' => (int)$wmincLangCodeLength,
+ 'id' => $wgwmincPref . '-code',
+ 'maxlength' => (int)$wgwmincLangCodeLength,
+ 'size' => (int)$wgwmincLangCodeLength,
'help' => wfMessage( 'wminc-prefinfo-code' )->parse() .
self::getTestWikiLanguages(),
'list' => 'wminc-testwiki-codelist',
@@ -88,12 +88,12 @@
* @return String or true
*/
static function validateCodePreference( $input, $alldata ) {
- global $wmincPref;
+ global $wgwmincPref;
# If the user selected a project that NEEDS a language code,
# but the user DID NOT enter a valid language code, give an
error
$filteredInput = self::filterCodePreference( $input );
- if ( isset( $alldata[$wmincPref.'-project'] ) &&
- self::isContentProject( $alldata[$wmincPref.'-project']
) &&
+ if ( isset( $alldata[$wgwmincPref.'-project'] ) &&
+ self::isContentProject(
$alldata[$wgwmincPref.'-project'] ) &&
!self::validateLanguageCode( $filteredInput ) ) {
return Xml::element( 'span', array( 'class' => 'error'
),
wfMessage( 'wminc-prefinfo-error' )->plain() );
@@ -116,8 +116,8 @@
* @return Boolean
*/
static function validateLanguageCode( $code ) {
- global $wmincLangCodeLength;
- if ( strlen( $code ) > $wmincLangCodeLength ) { return false; }
+ global $wgwmincLangCodeLength;
+ if ( strlen( $code ) > $wgwmincLangCodeLength ) { return false;
}
if ( $code == 'be-x-old' ) {
return true; # one exception... waiting to be renamed
to be-tarask
}
@@ -142,9 +142,9 @@
static function analyzePrefix( $input, $onlyInfoPage = false,
$allowSister = false ) {
$data = array( 'error' => null );
if ( $input instanceof Title ) {
- global $wmincTestWikiNamespaces;
+ global $wgwmincTestWikiNamespaces;
$title = $input->getText();
- if ( !in_array( $input->getNamespace(),
$wmincTestWikiNamespaces ) ) {
+ if ( !in_array( $input->getNamespace(),
$wgwmincTestWikiNamespaces ) ) {
return array( 'error' => 'notestwikinamespace'
);
}
if ( $onlyInfoPage && $input->getNamespace() != NS_MAIN
) {
@@ -167,11 +167,11 @@
$data['error'] = 'invalidlangcode';
}
}
- global $wmincProjects, $wmincSisterProjects;
- $listProjects = array_map( array( __CLASS__, 'preg_quote_slash'
), array_keys( $wmincProjects ) );
- if ( $allowSister && is_array( $wmincSisterProjects ) ) {
+ global $wgwmincProjects, $wgwmincSisterProjects;
+ $listProjects = array_map( array( __CLASS__, 'preg_quote_slash'
), array_keys( $wgwmincProjects ) );
+ if ( $allowSister && is_array( $wgwmincSisterProjects ) ) {
# join the project codes with those of the sister
projects
- $listSister = array_map( array( __CLASS__,
'preg_quote_slash' ), array_keys( $wmincSisterProjects ) );
+ $listSister = array_map( array( __CLASS__,
'preg_quote_slash' ), array_keys( $wgwmincSisterProjects ) );
$listProjects = array_merge( $listProjects, $listSister
);
}
$listProjects = implode( '|', $listProjects );
@@ -228,16 +228,16 @@
* @return String or false
*/
static function getProject( $project = '', $returnName = false,
$includeSister = false ) {
- global $wgUser, $wmincPref, $wmincProjects,
$wmincSisterProjects;
+ global $wgUser, $wgwmincPref, $wgwmincProjects,
$wgwmincSisterProjects;
$url = self::getUrlParam();
if ( $project ) {
$r = $project; # Precedence to given value
} elseif ( $url ) {
$r = $url['project']; # Otherwise URL &testwiki= if set
} else {
- $r = $wgUser->getOption( $wmincPref . '-project' ); #
Defaults to preference
+ $r = $wgUser->getOption( $wgwmincPref . '-project' ); #
Defaults to preference
}
- $projects = $includeSister ? array_merge( $wmincProjects,
$wmincSisterProjects ) : $wmincProjects;
+ $projects = $includeSister ? array_merge( $wgwmincProjects,
$wgwmincSisterProjects ) : $wgwmincProjects;
if ( array_key_exists( $r, $projects ) ) {
# If a code is given, return what is wanted
return $returnName ? $projects[$r] : $r;
@@ -267,17 +267,17 @@
* @return String
*/
static function displayPrefix( $project = '', $code = '', $allowSister
= false ) {
- global $wmincSisterProjects;
+ global $wgwmincSisterProjects;
if ( $project && $code ) {
$projectvalue = $project;
$codevalue = $code;
} else {
- global $wgUser, $wmincPref;
+ global $wgUser, $wgwmincPref;
$url = self::getUrlParam();
- $projectvalue = ( $url ? $url['project'] :
$wgUser->getOption($wmincPref . '-project') );
- $codevalue = ( $url ? $url['lang'] :
$wgUser->getOption($wmincPref . '-code') );
+ $projectvalue = ( $url ? $url['project'] :
$wgUser->getOption($wgwmincPref . '-project') );
+ $codevalue = ( $url ? $url['lang'] :
$wgUser->getOption($wgwmincPref . '-code') );
}
- $sister = (bool)( $allowSister && isset(
$wmincSisterProjects[$projectvalue] ) );
+ $sister = (bool)( $allowSister && isset(
$wgwmincSisterProjects[$projectvalue] ) );
if ( self::isContentProject( $projectvalue ) || $sister ) {
// if parameters are set OR it falls back to user pref
and
// he has a content project pref set -> return the
prefix
@@ -295,8 +295,8 @@
* @return object Title
*/
static function displayPrefixedTitle( $title, $ns = 0 ) {
- global $wgLang, $wmincTestWikiNamespaces;
- if ( in_array( $ns, $wmincTestWikiNamespaces ) ) {
+ global $wgLang, $wgwmincTestWikiNamespaces;
+ if ( in_array( $ns, $wgwmincTestWikiNamespaces ) ) {
/* Standard namespace as defined by
* $wmincTestWikiNamespaces, so use format:
* TITLE + NS => NS:Wx/xxx/TITLE
@@ -330,17 +330,17 @@
* @return Boolean
*/
static function shouldWeShowUnprefixedError( $title ) {
- global $wmincTestWikiNamespaces, $wmincProjectSite,
$wmincPseudoCategoryNSes;
+ global $wgwmincTestWikiNamespaces, $wgwmincProjectSite,
$wgwmincPseudoCategoryNSes;
$prefixdata = self::analyzePrefix( $title->getText() );
$ns = $title->getNamespace();
- $categories = array_map( array( __CLASS__, 'preg_quote_slash'
), $wmincPseudoCategoryNSes );
+ $categories = array_map( array( __CLASS__, 'preg_quote_slash'
), $wgwmincPseudoCategoryNSes );
if ( !$prefixdata['error'] ) {
# no error in prefix -> no error to show
return false;
- } elseif ( self::displayPrefix() == $wmincProjectSite['short']
) {
+ } elseif ( self::displayPrefix() ==
$wgwmincProjectSite['short'] ) {
# If user has "project" (Incubator) as test wiki
preference, it isn't needed to check
return false;
- } elseif ( !in_array( $ns, $wmincTestWikiNamespaces ) ) {
+ } elseif ( !in_array( $ns, $wgwmincTestWikiNamespaces ) ) {
# OK if it's not in one of the content namespaces
return false;
} elseif ( ( $ns == NS_CATEGORY || $ns == NS_CATEGORY_TALK ) &&
@@ -451,7 +451,7 @@
if ( !self::canWeCheckDB() ) {
return false;
}
- global $wmincProjectDatabases, $wgConf;
+ global $wgwmincProjectDatabases, $wgConf;
$wgConf->loadFullData();
$lang = strtolower( $lang );
$langHyphen = str_replace( '_', '-', $lang );
@@ -459,7 +459,7 @@
$projectName = self::getProject( $project, true, true );
$projectCode = self::getProject( $project, false, true );
if ( !$projectCode ) {
- global $wmincMultilingualProjects;
+ global $wgwmincMultilingualProjects;
$projectCode = array_search( $project,
$wmincMultilingualProjects );
}
$site = strtolower( $projectName );
@@ -469,8 +469,8 @@
# I don't see any other way than to hardcode it here
(from: CommonSettings.php)
'stdlogo' =>
"//upload.wikimedia.org/$site/$langHyphen/b/bc/Wiki.png",
);
- $dbSuffix = isset( $wmincProjectDatabases[$projectCode] ) ?
- $wmincProjectDatabases[$projectCode] : $site;
+ $dbSuffix = isset( $wgwmincProjectDatabases[$projectCode] ) ?
+ $wgwmincProjectDatabases[$projectCode] : $site;
return $wgConf->get( $setting, $langUnderscore . $dbSuffix,
$dbSuffix, $params );
}
@@ -479,8 +479,8 @@
* @return Boolean
*/
static function canWeCheckDB() {
- global $wmincExistingWikis, $wmincProjectDatabases;
- if ( !is_array( $wmincProjectDatabases ) || !is_array(
$wmincExistingWikis ) ) {
+ global $wgwmincExistingWikis, $wgwmincProjectDatabases;
+ if ( !is_array( $wgwmincProjectDatabases ) || !is_array(
$wgwmincExistingWikis ) ) {
return false; # We don't know the databases
}
return true; # Should work now
@@ -498,11 +498,11 @@
} elseif ( !$prefix || $prefix['error'] ) {
return false; # shouldn't be, but you never know
}
- global $wmincProjectDatabases, $wgDummyLanguageCodes;
+ global $wgwmincProjectDatabases, $wgDummyLanguageCodes;
$dbLang = str_replace('-', '_', $prefix['lang'] );
$project = $prefix['project'];
- $dbProject = isset( $wmincProjectDatabases[$project] ) ?
- $wmincProjectDatabases[$project] : $project;
+ $dbProject = isset( $wgwmincProjectDatabases[$project] ) ?
+ $wgwmincProjectDatabases[$project] : $project;
$redirectcode = array_search( $prefix['lang'],
$wgDummyLanguageCodes );
if ( $redirectcode ) {
$prefix['lang'] = $redirectcode;
@@ -514,13 +514,13 @@
* @return false or array with closed databases
*/
static function getDBClosedWikis() {
- global $wmincClosedWikis;
- if ( !self::canWeCheckDB() || !$wmincClosedWikis ) {
+ global $wgwmincClosedWikis;
+ if ( !self::canWeCheckDB() || !$wgwmincClosedWikis ) {
return false;
}
# Is probably a file, but it might be that an array is given
- return is_array( $wmincClosedWikis ) ? $wmincClosedWikis :
- array_map( 'trim', file( $wmincClosedWikis ) );
+ return is_array( $wgwmincClosedWikis ) ? $wgwmincClosedWikis :
+ array_map( 'trim', file( $wgwmincClosedWikis ) );
}
/**
@@ -532,9 +532,9 @@
if ( !$db ) {
return false;
}
- global $wmincExistingWikis;
+ global $wgwmincExistingWikis;
$closed = self::getDBClosedWikis();
- if ( !in_array( $db, $wmincExistingWikis ) ) {
+ if ( !in_array( $db, $wgwmincExistingWikis ) ) {
return 'missing'; # not in the list
} elseif ( is_array( $closed ) && in_array( $db, $closed ) ) {
return 'closed'; # in the list of closed wikis
@@ -557,7 +557,7 @@
return true;
}
- global $wgOut, $wmincSisterProjects;
+ global $wgOut, $wgwmincSisterProjects;
$prefix2 = self::analyzePrefix( $title, false, true );
$p = isset( $prefix2['project' ] ) ? $prefix2['project'] : '';
if ( self::getDBState( $prefix2 ) == 'existing' ) {
@@ -574,7 +574,7 @@
wfMessage( 'wminc-error-wiki-exists'
)->rawParams( $showLink )->escaped() .
'</div>' );
}
- } elseif ( array_key_exists( $p, $wmincSisterProjects ) ) {
+ } elseif ( array_key_exists( $p, $wgwmincSisterProjects ) ) {
# A sister project is not hosted here, so direct the
user to the relevant wiki
$link = self::getSubdomain( $prefix2['lang'], $p,
( $title->getNsText() ? $title->getNsText() .
':' : '' ) . $prefix2['realtitle'] );
@@ -849,16 +849,16 @@
if ( $title->isKnown() ) {
return true;
}
- global $wmincProjectSite, $wmincTestWikiNamespaces;
+ global $wgwmincProjectSite, $wgwmincTestWikiNamespaces;
$prefix = self::displayPrefix();
$newNs = $title->getNamespace();
$newTitle = $title->getText();
$newTitleData = self::analyzePrefix( $newTitle, false, true );
- if ( !in_array( $title->getNamespace(),
$wmincTestWikiNamespaces ) ) {
+ if ( !in_array( $title->getNamespace(),
$wgwmincTestWikiNamespaces ) ) {
# namespace not affected by the prefix system: show
normal msg
return true;
- } elseif ( $prefix == $wmincProjectSite['short'] ) {
+ } elseif ( $prefix == $wgwmincProjectSite['short'] ) {
$newNs = NS_PROJECT;
} elseif ( self::getDBState( $newTitleData ) == 'existing' ) {
# the wiki already exists
diff --git a/WikimediaIncubator.php b/WikimediaIncubator.php
index a637bc7..afbe6f8 100644
--- a/WikimediaIncubator.php
+++ b/WikimediaIncubator.php
@@ -23,11 +23,11 @@
);
/* General (globals and/or configuration) */
-$wmincPref = 'incubatortestwiki'; // Name of the preference
+$wgwmincPref = 'incubatortestwiki'; // Name of the preference
$dir = __DIR__ . '/';
# only one-letter codes can be used for projects
-$wmincProjects = array(
+$wgwmincProjects = array(
'p' => 'Wikipedia',
'b' => 'Wikibooks',
't' => 'Wiktionary',
@@ -36,30 +36,30 @@
'y' => 'Wikivoyage',
);
# Sister projects is here defined as projects that are not on Incubator
-$wmincSisterProjects = array(
+$wgwmincSisterProjects = array(
's' => 'Wikisource',
'v' => 'Wikiversity',
);
-$wmincMultilingualProjects = array(
+$wgwmincMultilingualProjects = array(
'meta' => 'Meta-Wiki',
'commons' => 'Wikimedia Commons',
'species' => 'Wikispecies',
'mediawiki' => 'MediaWiki',
'wikidata' => 'Wikidata',
);
-$wmincProjectSite = array(
+$wgwmincProjectSite = array(
'name' => 'Incubator',
'short' => 'inc',
);
-$wmincTestWikiNamespaces = array(
+$wgwmincTestWikiNamespaces = array(
NS_MAIN, NS_TALK,
NS_TEMPLATE, NS_TEMPLATE_TALK,
NS_CATEGORY, NS_CATEGORY_TALK,
828, 829, //NS_MODULE, NS_MODULE_TALK,
);
-$wmincLangCodeLength = 12; // can be changed if needed (depends on policy)
+$wgwmincLangCodeLength = 12; // can be changed if needed (depends on policy)
// Pseudo category namespaces like "Category:Maintenance:Delete", for easy
whitelisting and structure
-$wmincPseudoCategoryNSes = array(
+$wgwmincPseudoCategoryNSes = array(
'Incubator', 'Help', 'Users', 'Maintenance', 'Files',
);
@@ -120,9 +120,10 @@
$wgSpecialPages['RandomByTest'] = 'SpecialRandomByTest';
/* support for automatic checking in a list of databases if a wiki exists */
-$wmincExistingWikis = $wgLocalDatabases;
+global $wgLocalDatabases;
+$wgwmincExistingWikis = $wgLocalDatabases;
/* Stupid "wiki" referring to "wikipedia" in WMF config */
-$wmincProjectDatabases = array(
+$wgwmincProjectDatabases = array(
'p' => 'wiki',
'b' => 'wikibooks',
't' => 'wiktionary',
@@ -133,7 +134,7 @@
'y' => 'wikivoyage',
);
# set this to an array or file of closed wikis (like SiteMatrix
$wgSiteMatrixClosedSites)
-$wmincClosedWikis = false;
+$wgwmincClosedWikis = false;
/* Wx/xx[x] info page */
$wgAutoloadClasses['InfoPage'] = $dir . 'InfoPage.php';
diff --git a/extension.json b/extension.json
new file mode 100644
index 0000000..54bb791
--- /dev/null
+++ b/extension.json
@@ -0,0 +1,218 @@
+{
+ "name": "Wikimedia Incubator",
+ "version": "5.3.0",
+ "author": [
+ "SPQRobin",
+ "Hydriz"
+ ],
+ "url": "https://www.mediawiki.org/wiki/Extension:WikimediaIncubator",
+ "descriptionmsg": "wminc-desc",
+ "type": "other",
+ "GroupPermissions": {
+ "test-sysop": {
+ "delete": true,
+ "undelete": true,
+ "deletedhistory": true,
+ "block": true,
+ "blockemail": true,
+ "rollback": true,
+ "suppressredirect": true,
+ "autopatrol": true
+ },
+ "*": {
+ "viewuserlang": false
+ },
+ "sysop": {
+ "viewuserlang": true
+ }
+ },
+ "AddGroups": {
+ "bureaucrat": [
+ "test-sysop"
+ ]
+ },
+ "RemoveGroups": {
+ "bureaucrat": [
+ "test-sysop"
+ ]
+ },
+ "AvailableRights": [
+ "viewuserlang"
+ ],
+ "SpecialPages": {
+ "ViewUserLang": "SpecialViewUserLang",
+ "MyMainPage": "SpecialMyMainPage",
+ "RandomByTest": "SpecialRandomByTest",
+ "SearchWiki": "SpecialSearchWiki",
+ "IncubatorFirstSteps": "SpecialIncubatorFirstSteps"
+ },
+ "SpecialPageGroups": {
+ "ViewUserLang": "users"
+ },
+ "MessagesDirs": {
+ "WikimediaIncubator": [
+ "i18n"
+ ]
+ },
+ "ExtensionMessagesFiles": {
+ "WikimediaIncubator": "WikimediaIncubator.i18n.php",
+ "WikimediaIncubatorAlias": "WikimediaIncubator.alias.php",
+ "WikimediaIncubatorMagic": "WikimediaIncubator.i18n.magic.php"
+ },
+ "AutoloadClasses": {
+ "SpecialViewUserLang": "SpecialViewUserLang.php",
+ "WikimediaIncubator": "WikimediaIncubator.class.php",
+ "SpecialMyMainPage": "SpecialMyMainPage.php",
+ "TestWikiRC": "TestWikiRC.php",
+ "AutoTestWiki": "CreateAccountTestWiki.php",
+ "SpecialRandomByTest": "SpecialRandomByTest.php",
+ "InfoPage": "InfoPage.php",
+ "ListUsersTestWiki": "ListUsersTestWiki.php",
+ "SpecialSearchWiki": "SpecialSearchWiki.php",
+ "SpecialIncubatorFirstSteps": "SpecialIncubatorFirstSteps.php"
+ },
+ "ResourceModules": {
+ "WikimediaIncubator.InfoPage": {
+ "styles": "InfoPage.css"
+ }
+ },
+ "ResourceFileModulePaths": {
+ "localBasePath": "",
+ "remoteExtPath": "WikimediaIncubator"
+ },
+ "Hooks": {
+ "ContributionsToolLinks": [
+ "WikimediaIncubator::efLoadViewUserLangLink"
+ ],
+ "GetPreferences": [
+ "WikimediaIncubator::onGetPreferences"
+ ],
+ "UserGetDefaultOptions": [
+ "WikimediaIncubator::onUserGetDefaultOptions"
+ ],
+ "MagicWordwgVariableIDs": [
+ "WikimediaIncubator::magicWordVariable"
+ ],
+ "ParserGetVariableValueSwitch": [
+ "WikimediaIncubator::magicWordValue"
+ ],
+ "getUserPermissionsErrors": [
+ "WikimediaIncubator::onGetUserPermissionsErrors"
+ ],
+ "MovePageIsValidMove": [
+ "WikimediaIncubator::onMovePageIsValidMove"
+ ],
+ "AbortMove": [
+ "WikimediaIncubator::checkPrefixMovePermissions"
+ ],
+ "SpecialRecentChangesQuery": [
+ "TestWikiRC::onRcQuery"
+ ],
+ "SpecialRecentChangesPanel": [
+ "TestWikiRC::onRcForm"
+ ],
+ "UserCreateForm": [
+ "AutoTestWiki::onUserCreateForm"
+ ],
+ "AddNewAccount": [
+ "AutoTestWiki::onAddNewAccount"
+ ],
+ "ShowMissingArticle": [
+ "WikimediaIncubator::onShowMissingArticle"
+ ],
+ "EditFormPreloadText": [
+ "WikimediaIncubator::onEditFormPreloadText"
+ ],
+ "MediaWikiPerformAction": [
+ "WikimediaIncubator::onMediaWikiPerformAction"
+ ],
+ "TitleIsAlwaysKnown": [
+ "WikimediaIncubator::onTitleIsAlwaysKnown"
+ ],
+ "ParserFirstCallInit": [
+ "WikimediaIncubator::onParserFirstCallInit"
+ ],
+ "BeforePageDisplay": [
+ "WikimediaIncubator::fnTestWikiLogo"
+ ],
+ "PageContentLanguage": [
+ "WikimediaIncubator::onPageContentLanguage"
+ ],
+ "SpecialListusersHeaderForm": [
+ "ListUsersTestWiki::onSpecialListusersHeaderForm"
+ ],
+ "SpecialListusersQueryInfo": [
+ "ListUsersTestWiki::onSpecialListusersQueryInfo"
+ ],
+ "SpecialListusersHeader": [
+ "ListUsersTestWiki::onSpecialListusersHeader"
+ ],
+ "SpecialSearchCreateLink": [
+ "WikimediaIncubator::onSpecialSearchCreateLink"
+ ],
+ "SpecialSearchPowerBox": [
+ "WikimediaIncubator::onSpecialSearchPowerBox"
+ ],
+ "SpecialSearchSetupEngine": [
+ "WikimediaIncubator::onSpecialSearchSetupEngine"
+ ],
+ "UnitTestsList": [
+ "WikimediaIncubator::onUnitTestsList"
+ ]
+ },
+ "config": {
+ "wmincPref": "incubatortestwiki",
+ "wmincProjects": {
+ "p": "Wikipedia",
+ "b": "Wikibooks",
+ "t": "Wiktionary",
+ "q": "Wikiquote",
+ "n": "Wikinews",
+ "y": "Wikivoyage"
+ },
+ "wmincSisterProjects": {
+ "s": "Wikisource",
+ "v": "Wikiversity"
+ },
+ "wmincMultilingualProjects": {
+ "meta": "Meta-Wiki",
+ "commons": "Wikimedia Commons",
+ "species": "Wikispecies",
+ "mediawiki": "MediaWiki",
+ "wikidata": "Wikidata"
+ },
+ "wmincProjectSite": {
+ "name": "Incubator",
+ "short": "inc"
+ },
+ "wmincTestWikiNamespaces": [
+ 0,
+ 1,
+ 10,
+ 11,
+ 14,
+ 15,
+ 828,
+ 829
+ ],
+ "wmincLangCodeLength": 12,
+ "wmincPseudoCategoryNSes": [
+ "Incubator",
+ "Help",
+ "Users",
+ "Maintenance",
+ "Files"
+ ],
+ "wmincProjectDatabases": {
+ "p": "wiki",
+ "b": "wikibooks",
+ "t": "wiktionary",
+ "q": "wikiquote",
+ "n": "wikinews",
+ "s": "wikisource",
+ "v": "wikiversity",
+ "y": "wikivoyage"
+ },
+ "wmincClosedWikis": false
+ }
+}
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 90acc88..30607da 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -18,7 +18,7 @@
"Liuxinyu970226"
]
},
- "wminc-desc": "{{desc|name=Wikimedia
Incubator|url=http://www.mediawiki.org/wiki/Extension:WikimediaIncubator}}",
+ "wminc-desc": "{{desc|name=Wikimedia
Incubator|url=https://www.mediawiki.org/wiki/Extension:WikimediaIncubator}}",
"wminc-manual": "As in \"handbook\" (a page with a step-by-step
guide).\n{{Identical|Manual}}",
"wminc-listwikis": "List of wikis that are in Wikimedia Incubator.
Please keep it short as it is used in the sidebar.",
"wminc-testwiki": "See [[:File:Incubator-testwiki-preference.jpg]].",
--
To view, visit https://gerrit.wikimedia.org/r/203092
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I8ee42ebe11aa0f25eb1719069c0a13d87da54cb9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikimediaIncubator
Gerrit-Branch: master
Gerrit-Owner: Paladox <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits