* @private
*/
function getCategoryInsertions( $existing = array() ) {
+ global $wgContLang;
$diffs = array_diff_assoc( $this->mCategories, $existing );
$arr = array();
foreach ( $diffs as $name => $sortkey ) {
+ $nt = Title::makeTitleSafe( NS_CATEGORY, $name );
+ $wgContLang->findVariantLink( $name, $nt, false, true );
$arr[] = array(
'cl_from' => $this->mId,
'cl_to' => $name,
function parserConvert($t, $p) {return $t;}
function getVariants() { return array( $this->mLang->getCode() ); }
function getPreferredVariant() {return $this->mLang->getCode(); }
- function findVariantLink(&$l, &$n, $forTemplate = false) {}
+ function findVariantLink(&$l, &$n, $forTemplate = false, $ignoreSubmitCond = false) {}
function getExtraHashOptions() {return '';}
function getParsedTitle() {return '';}
function markNoConversion($text, $noParse=false) {return $text;}
*
* @param $link String: the name of the link
* @param $nt Mixed: the title object of the link
+ * @param boolean $ignoreSubmitCond: to disable the submit condition if
+ * we need to find a category's variant link when database update.
* @return null the input parameters may be modified upon return
*/
- function findVariantLink( &$link, &$nt, $forTemplate = false ) {
- $this->mConverter->findVariantLink($link, $nt, $forTemplate );
+ function findVariantLink( &$link, &$nt, $forTemplate = false, $ignoreSubmitCond = false ) {
+ $this->mConverter->findVariantLink( $link, $nt, $forTemplate, $ignoreSubmitCond );
}
/**
* into an array of all possible variants of the text:
* 'variant' => text in that variant
*/
-
function convertLinkToAllVariants($text){
return $this->mConverter->convertLinkToAllVariants($text);
}
*
* @param string $link the name of the link
* @param mixed $nt the title object of the link
+ * @param boolean $ignoreSubmitCond: to disable the submit condition if
+ * we need to find a category's variant link when database update.
* @return null the input parameters may be modified upon return
* @public
*/
- function findVariantLink( &$link, &$nt, $forTemplate = false ) {
+ function findVariantLink( &$link, &$nt, $forTemplate = false, $ignoreSubmitCond = false ) {
global $wgDisableLangConversion, $wgDisableTitleConversion, $wgRequest, $wgUser;
$isredir = $wgRequest->getText( 'redirect', 'yes' );
$action = $wgRequest->getText( 'action' );
$ns=NS_MAIN;
if ( $disableLinkConversion || ( !$forTemplate && ( $isredir == 'no' || $action == 'edit'
- || $action == 'submit' || $linkconvert == 'no' || $wgUser->getOption('noconvertlink') == 1 ) ) ) {
- return;
- }
+ || (!$ignoreSubmitCond && $action == 'submit') || $linkconvert == 'no'
+ || $wgUser->getOption('noconvertlink') == 1 ) ) ) { return; }
if(is_object($nt))
$ns = $nt->getNamespace();
foreach( $titles as $varnt ) {
if( $varnt->getArticleID() > 0 ) {
$nt = $varnt;
- $link = $v;
+ $link = $varnt->getText();
break;
}
}
* names as they were
* - do not try to find variants for usernames
*/
- function findVariantLink( &$link, &$nt, $forTemplate = false ) {
+ function findVariantLink( &$link, &$nt, $forTemplate = false, $ignoreSubmitCond = false ) {
// check for user namespace
if(is_object($nt)){
$ns = $nt->getNamespace();
}
$oldlink=$link;
- parent::findVariantLink( $link, $nt, $forTemplate );
+ parent::findVariantLink( $link, $nt, $forTemplate, $ignoreSubmitCond );
if( $this->getPreferredVariant()==$this->mMainLanguageCode )
$link=$oldlink;
}
* names as they were
* - do not try to find variants for usernames
*/
- function findVariantLink( &$link, &$nt, $forTemplate = false ) {
+ function findVariantLink( &$link, &$nt, $forTemplate = false, $ignoreSubmitCond = false ) {
// check for user namespace
if(is_object($nt)){
$ns = $nt->getNamespace();
}
$oldlink=$link;
- parent::findVariantLink( $link, $nt, $forTemplate );
+ parent::findVariantLink( $link, $nt, $forTemplate, $ignoreSubmitCond );
if( $this->getPreferredVariant() == $this->mMainLanguageCode )
$link=$oldlink;
}
* names as they were
* - do not try to find variants for usernames
*/
- function findVariantLink( &$link, &$nt, $forTemplate = false ) {
+ function findVariantLink( &$link, &$nt, $forTemplate = false, $ignoreSubmitCond = false ) {
// check for user namespace
if(is_object($nt)){
$ns = $nt->getNamespace();
}
$oldlink=$link;
- parent::findVariantLink( $link, $nt, $forTemplate );
+ parent::findVariantLink( $link, $nt, $forTemplate, $ignoreSubmitCond );
if($this->getPreferredVariant()==$this->mMainLanguageCode)
$link=$oldlink;
}