mirror of
https://github.com/diocloid/LinkTitles.git
synced 2025-07-13 09:49:31 +02:00
Merge branch 'release-4.0.6'
This commit is contained in:
8
NEWS
8
NEWS
@ -1,3 +1,11 @@
|
|||||||
|
Version 4.0.6 (2016-12-28)
|
||||||
|
------------------------------------------------------------------------
|
||||||
|
|
||||||
|
- Fix: Custom namespace weights were not respected.
|
||||||
|
|
||||||
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
|
|
||||||
|
|
||||||
Version 4.0.5 (2016-12-14)
|
Version 4.0.5 (2016-12-14)
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
|
|
||||||
|
10
README.md
10
README.md
@ -13,7 +13,14 @@ pages](http://bovender.github.io/LinkTitles).
|
|||||||
|
|
||||||
This extension is [semantically versioned](http://semver.org).
|
This extension is [semantically versioned](http://semver.org).
|
||||||
|
|
||||||
If you wish to contribute, please issue pull requests against the `develop` branch.
|
|
||||||
|
Contributing
|
||||||
|
------------
|
||||||
|
|
||||||
|
If you wish to contribute, please issue pull requests against the `develop`
|
||||||
|
branch, as I follow Vincent Driessen's advice on [A successful Git branching
|
||||||
|
model](http://nvie.com/git-model) (knowing that there are [alternative
|
||||||
|
workflows](http://scottchacon.com/2011/08/31/github-flow.html)).
|
||||||
|
|
||||||
|
|
||||||
Contributors
|
Contributors
|
||||||
@ -21,3 +28,4 @@ Contributors
|
|||||||
|
|
||||||
- Daniel Kraus (@bovender), main developer
|
- Daniel Kraus (@bovender), main developer
|
||||||
- Ulrich Strauss (@c0nnex), namespaces
|
- Ulrich Strauss (@c0nnex), namespaces
|
||||||
|
- Brent Laabs (@labster), bug fixes
|
||||||
|
@ -2,11 +2,12 @@
|
|||||||
"name": "LinkTitles",
|
"name": "LinkTitles",
|
||||||
"author": [
|
"author": [
|
||||||
"[https://www.mediawiki.org/wiki/User:Bovender Daniel Kraus (bovender)]",
|
"[https://www.mediawiki.org/wiki/User:Bovender Daniel Kraus (bovender)]",
|
||||||
"Ulrich Strauss (c0nnex)"
|
"Ulrich Strauss (c0nnex)",
|
||||||
|
"Brent Laabs (labster)"
|
||||||
],
|
],
|
||||||
"type": "parserhook",
|
"type": "parserhook",
|
||||||
"url": "https://www.mediawiki.org/wiki/Extension:LinkTitles",
|
"url": "https://www.mediawiki.org/wiki/Extension:LinkTitles",
|
||||||
"version": "4.0.5",
|
"version": "4.0.6",
|
||||||
"license-name": "GPL-2.0+",
|
"license-name": "GPL-2.0+",
|
||||||
"descriptionmsg": "linktitles-desc",
|
"descriptionmsg": "linktitles-desc",
|
||||||
"requires": {
|
"requires": {
|
||||||
|
2
gh-pages
2
gh-pages
Submodule gh-pages updated: fe99cf4e03...47356620d1
@ -35,7 +35,7 @@ class Extension {
|
|||||||
|
|
||||||
/// A Title object for the target page currently being examined.
|
/// A Title object for the target page currently being examined.
|
||||||
private static $targetTitle;
|
private static $targetTitle;
|
||||||
|
|
||||||
// The TitleValue object of the target page
|
// The TitleValue object of the target page
|
||||||
private static $targetTitleValue;
|
private static $targetTitleValue;
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ class Extension {
|
|||||||
|
|
||||||
private static $wordStartDelim;
|
private static $wordStartDelim;
|
||||||
private static $wordEndDelim;
|
private static $wordEndDelim;
|
||||||
|
|
||||||
public static $ltConsoleOutput;
|
public static $ltConsoleOutput;
|
||||||
public static $ltConsoleOutputDebug;
|
public static $ltConsoleOutputDebug;
|
||||||
|
|
||||||
@ -130,16 +130,16 @@ class Extension {
|
|||||||
|
|
||||||
// Build a blacklist of pages that are not supposed to be link
|
// Build a blacklist of pages that are not supposed to be link
|
||||||
// targets. This includes the current page.
|
// targets. This includes the current page.
|
||||||
$blackList = str_replace( '_', ' ',
|
$blackList = str_replace( ' ', '_',
|
||||||
'("' . implode( '", "',$wgLinkTitlesBlackList ) . '", "' .
|
'("' . implode( '","',$wgLinkTitlesBlackList ) . '","' .
|
||||||
addslashes( self::$currentTitle->getDbKey() ) . '")' );
|
addslashes( self::$currentTitle->getDbKey() ) . '")' );
|
||||||
|
|
||||||
$currentNamespace[] = $title->getNamespace();
|
$currentNamespace[] = $title->getNamespace();
|
||||||
|
|
||||||
// Build our weight list. Make sure current namespace is first element
|
// Build our weight list. Make sure current namespace is first element
|
||||||
$namespaces = array_diff($wgLinkTitlesNamespaces, $currentNamespace);
|
$namespaces = array_diff($wgLinkTitlesNamespaces, $currentNamespace);
|
||||||
array_unshift($namespaces, $currentNamespace[0] );
|
array_unshift($namespaces, $currentNamespace[0] );
|
||||||
|
|
||||||
// No need for sanitiy check. we are sure that we have at least one element in the array
|
// No need for sanitiy check. we are sure that we have at least one element in the array
|
||||||
$weightSelect = "CASE page_namespace ";
|
$weightSelect = "CASE page_namespace ";
|
||||||
$currentWeight = 0;
|
$currentWeight = 0;
|
||||||
@ -148,7 +148,7 @@ class Extension {
|
|||||||
$weightSelect = $weightSelect . " WHEN " . $namspacevalue . " THEN " . $currentWeight . PHP_EOL;
|
$weightSelect = $weightSelect . " WHEN " . $namspacevalue . " THEN " . $currentWeight . PHP_EOL;
|
||||||
}
|
}
|
||||||
$weightSelect = $weightSelect . " END ";
|
$weightSelect = $weightSelect . " END ";
|
||||||
$namespacesClause = str_replace( '_', ' ','(' . implode( ', ',$namespaces ) . ')' );
|
$namespacesClause = '(' . implode( ', ', $namespaces ) . ')';
|
||||||
|
|
||||||
// Build an SQL query and fetch all page titles ordered by length from
|
// Build an SQL query and fetch all page titles ordered by length from
|
||||||
// shortest to longest. Only titles from 'normal' pages (namespace uid
|
// shortest to longest. Only titles from 'normal' pages (namespace uid
|
||||||
@ -165,7 +165,7 @@ class Extension {
|
|||||||
'page_title NOT IN ' . $blackList,
|
'page_title NOT IN ' . $blackList,
|
||||||
),
|
),
|
||||||
__METHOD__,
|
__METHOD__,
|
||||||
array( 'ORDER BY' => 'CHAR_LENGTH(page_title) ' . $sort_order )
|
array( 'ORDER BY' => 'weight ASC, CHAR_LENGTH(page_title) ' . $sort_order )
|
||||||
);
|
);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$res = $dbr->select(
|
$res = $dbr->select(
|
||||||
@ -177,7 +177,7 @@ class Extension {
|
|||||||
'page_title NOT IN ' . $blackList,
|
'page_title NOT IN ' . $blackList,
|
||||||
),
|
),
|
||||||
__METHOD__,
|
__METHOD__,
|
||||||
array( 'ORDER BY' => 'LENGTH(page_title) ' . $sort_order )
|
array( 'ORDER BY' => 'weight ASC, LENGTH(page_title) ' . $sort_order )
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -194,7 +194,7 @@ class Extension {
|
|||||||
// regexp compilation errors
|
// regexp compilation errors
|
||||||
self::$targetTitleText = self::$targetTitle->getText();
|
self::$targetTitleText = self::$targetTitle->getText();
|
||||||
$quotedTitle = preg_quote(self::$targetTitleText, '/');
|
$quotedTitle = preg_quote(self::$targetTitleText, '/');
|
||||||
|
|
||||||
self::ltDebugLog('TargetTitle='. self::$targetTitleText,"private");
|
self::ltDebugLog('TargetTitle='. self::$targetTitleText,"private");
|
||||||
self::ltDebugLog('TargetTitleQuoted='. $quotedTitle,"private");
|
self::ltDebugLog('TargetTitleQuoted='. $quotedTitle,"private");
|
||||||
|
|
||||||
@ -243,7 +243,7 @@ class Extension {
|
|||||||
}; // foreach $res as $row
|
}; // foreach $res as $row
|
||||||
return $newText;
|
return $newText;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Automatically processes a single page, given a $title Title object.
|
/// Automatically processes a single page, given a $title Title object.
|
||||||
/// This function is called by the SpecialLinkTitles class and the
|
/// This function is called by the SpecialLinkTitles class and the
|
||||||
/// LinkTitlesJob class.
|
/// LinkTitlesJob class.
|
||||||
@ -349,9 +349,9 @@ class Extension {
|
|||||||
|
|
||||||
/// Sets member variables for the current target page.
|
/// Sets member variables for the current target page.
|
||||||
private static function newTarget( $ns, $title ) {
|
private static function newTarget( $ns, $title ) {
|
||||||
self::$targetTitle = \Title::makeTitleSafe( $ns, $title );
|
self::$targetTitle = \Title::makeTitleSafe( $ns, $title );
|
||||||
self::ltDebugLog( 'newtarget='. self::$targetTitle->getText(), "private" );
|
self::ltDebugLog( 'newtarget='. self::$targetTitle->getText(), "private" );
|
||||||
self::$targetTitleValue = self::$targetTitle->getTitleValue();
|
self::$targetTitleValue = self::$targetTitle->getTitleValue();
|
||||||
self::ltDebugLog( 'altTarget='. self::$targetTitleValue->getText(), "private" );
|
self::ltDebugLog( 'altTarget='. self::$targetTitleValue->getText(), "private" );
|
||||||
self::$targetContent = null;
|
self::$targetContent = null;
|
||||||
}
|
}
|
||||||
@ -477,6 +477,6 @@ private static function BuildDelimiters() {
|
|||||||
}
|
}
|
||||||
wfDebugLog('LinkTitles', $text , 'private');
|
wfDebugLog('LinkTitles', $text , 'private');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// vim: ts=2:sw=2:noet:comments^=\:///
|
// vim: ts=2:sw=2:noet:comments^=\:///
|
||||||
|
Reference in New Issue
Block a user