Implement PreferShortTitles option

This commit is contained in:
Daniel Kraus
2012-05-20 17:00:46 +02:00
parent 8ea8da6100
commit 4e3d31981c
2 changed files with 6 additions and 1 deletions

View File

@ -45,6 +45,8 @@
// extract the current page's title.
$my_title = $article->getTitle()->getText();
( $wgLinkTitlesPreferShortTitles ) ? $sort_order = 'DESC' : $sort_order = '';
// Build an SQL query and fetch all page titles ordered
// by length from shortest to longest.
// Only titles from 'normal' pages (namespace uid = 0)
@ -55,7 +57,7 @@
'page_title',
'page_namespace = 0',
__METHOD__,
array( 'ORDER BY' => 'length(page_title) DESC' ));
array( 'ORDER BY' => 'length(page_title) ' . $sort_order ));
// Iterate through the page titles
$new_text = $text;

View File

@ -45,6 +45,9 @@
// Hook up our custom function to the ArticleSave event.
$wgHooks['ArticleSave'][] = 'LinkTitles::onArticleSave';
// Configuration variables
$wgLinkTitlesPreferShortTitles = false;
// vim: ts=2:sw=2:noet