mirror of
https://github.com/diocloid/LinkTitles.git
synced 2025-07-13 09:49:31 +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,7 +140,10 @@
|
|||||||
// by length from shortest to longest.
|
// by length from shortest to longest.
|
||||||
// Only titles from 'normal' pages (namespace uid = 0)
|
// Only titles from 'normal' pages (namespace uid = 0)
|
||||||
// are returned.
|
// 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 );
|
$dbr = wfGetDB( DB_SLAVE );
|
||||||
|
try {
|
||||||
$res = $dbr->select(
|
$res = $dbr->select(
|
||||||
'page',
|
'page',
|
||||||
'page_title',
|
'page_title',
|
||||||
@ -152,6 +155,19 @@
|
|||||||
__METHOD__,
|
__METHOD__,
|
||||||
array( 'ORDER BY' => 'CHAR_LENGTH(page_title) ' . $sort_order )
|
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
|
// Iterate through the page titles
|
||||||
foreach( $res as $row ) {
|
foreach( $res as $row ) {
|
||||||
|
@ -49,7 +49,7 @@
|
|||||||
'name' => 'LinkTitles',
|
'name' => 'LinkTitles',
|
||||||
'author' => '[https://www.mediawiki.org/wiki/User:Bovender Daniel Kraus]',
|
'author' => '[https://www.mediawiki.org/wiki/User:Bovender Daniel Kraus]',
|
||||||
'url' => 'https://www.mediawiki.org/wiki/Extension:LinkTitles',
|
'url' => 'https://www.mediawiki.org/wiki/Extension:LinkTitles',
|
||||||
'version' => '2.2.0',
|
'version' => '2.2.1',
|
||||||
'descriptionmsg' => 'linktitles-desc'
|
'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
|
LinkTitles 2.2.0: 2013-04-16
|
||||||
* Fix case-sensitive linking when $wgCapitalLinks is false.
|
* 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