mirror of
https://github.com/diocloid/LinkTitles.git
synced 2025-07-13 01:39:30 +02:00
Make the SQL query work with sqlite databases.
The fallback query does not use the CHAR_LENGTH function, but uses LENGTH.
This commit is contained in:
@ -140,18 +140,34 @@
|
||||
// by length from shortest to longest.
|
||||
// Only titles from 'normal' pages (namespace uid = 0)
|
||||
// are returned.
|
||||
// Since the db may be sqlite, we need a try..catch structure
|
||||
// because sqlite does not support the CHAR_LENGTH function.
|
||||
$dbr = wfGetDB( DB_SLAVE );
|
||||
$res = $dbr->select(
|
||||
'page',
|
||||
'page_title',
|
||||
array(
|
||||
'page_namespace = 0',
|
||||
'CHAR_LENGTH(page_title) >= ' . $wgLinkTitlesMinimumTitleLength,
|
||||
'page_title NOT IN ' . $black_list,
|
||||
),
|
||||
__METHOD__,
|
||||
array( 'ORDER BY' => 'CHAR_LENGTH(page_title) ' . $sort_order )
|
||||
);
|
||||
try {
|
||||
$res = $dbr->select(
|
||||
'page',
|
||||
'page_title',
|
||||
array(
|
||||
'page_namespace = 0',
|
||||
'CHAR_LENGTH(page_title) >= ' . $wgLinkTitlesMinimumTitleLength,
|
||||
'page_title NOT IN ' . $black_list,
|
||||
),
|
||||
__METHOD__,
|
||||
array( 'ORDER BY' => 'CHAR_LENGTH(page_title) ' . $sort_order )
|
||||
);
|
||||
} catch (Exception $e) {
|
||||
$res = $dbr->select(
|
||||
'page',
|
||||
'page_title',
|
||||
array(
|
||||
'page_namespace = 0',
|
||||
'LENGTH(page_title) >= ' . $wgLinkTitlesMinimumTitleLength,
|
||||
'page_title NOT IN ' . $black_list,
|
||||
),
|
||||
__METHOD__,
|
||||
array( 'ORDER BY' => 'LENGTH(page_title) ' . $sort_order )
|
||||
);
|
||||
}
|
||||
|
||||
// Iterate through the page titles
|
||||
foreach( $res as $row ) {
|
||||
|
@ -49,7 +49,7 @@
|
||||
'name' => 'LinkTitles',
|
||||
'author' => '[https://www.mediawiki.org/wiki/User:Bovender Daniel Kraus]',
|
||||
'url' => 'https://www.mediawiki.org/wiki/Extension:LinkTitles',
|
||||
'version' => '2.2.0',
|
||||
'version' => '2.2.1',
|
||||
'descriptionmsg' => 'linktitles-desc'
|
||||
);
|
||||
|
||||
|
3
NEWS
3
NEWS
@ -1,3 +1,6 @@
|
||||
LinkTitles 2.2.1: 2013-07-22
|
||||
* Make the extension work with sqlite databases.
|
||||
|
||||
LinkTitles 2.2.0: 2013-04-16
|
||||
* Fix case-sensitive linking when $wgCapitalLinks is false.
|
||||
|
||||
|
BIN
release/LinkTitles-2.2.1.tar.gz
Normal file
BIN
release/LinkTitles-2.2.1.tar.gz
Normal file
Binary file not shown.
Reference in New Issue
Block a user