From 4e3d31981c4465524bd829326595a952230c68f8 Mon Sep 17 00:00:00 2001 From: Daniel Kraus Date: Sun, 20 May 2012 17:00:46 +0200 Subject: [PATCH] Implement PreferShortTitles option --- LinkTitles.body.php | 4 +++- LinkTitles.php | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/LinkTitles.body.php b/LinkTitles.body.php index a7b14ac..755f5f1 100755 --- a/LinkTitles.body.php +++ b/LinkTitles.body.php @@ -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; diff --git a/LinkTitles.php b/LinkTitles.php index 5fa5ca8..3dbca2c 100755 --- a/LinkTitles.php +++ b/LinkTitles.php @@ -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