http://www.mediawiki.org/wiki/Special:Code/MediaWiki/73632
Revision: 73632
Author: maxsem
Date: 2010-09-23 19:36:06 +0000 (Thu, 23 Sep 2010)
Log Message:
-----------
Special:Version now displays whether a SQLite database supports full-text search
Modified Paths:
--------------
trunk/phase3/RELEASE-NOTES
trunk/phase3/includes/db/Database.php
trunk/phase3/includes/db/DatabaseSqlite.php
trunk/phase3/includes/specials/SpecialVersion.php
trunk/phase3/languages/messages/MessagesEn.php
trunk/phase3/languages/messages/MessagesQqq.php
trunk/phase3/maintenance/language/messages.inc
Modified: trunk/phase3/RELEASE-NOTES
===================================================================
--- trunk/phase3/RELEASE-NOTES 2010-09-23 19:33:50 UTC (rev 73631)
+++ trunk/phase3/RELEASE-NOTES 2010-09-23 19:36:06 UTC (rev 73632)
@@ -160,6 +160,8 @@
* Added new hook GetIP
* (bug 16574) Allow administrators to temporarily disable the account creation
limit for IP addresses: [[MediaWiki:Ratelimit-excluded-ips]]
+* Special:Version now displays whether a SQLite database supports full-text
+ search.
=== Bug fixes in 1.17 ===
* (bug 17560) Half-broken deletion moved image files to deletion archive
Modified: trunk/phase3/includes/db/Database.php
===================================================================
--- trunk/phase3/includes/db/Database.php 2010-09-23 19:33:50 UTC (rev
73631)
+++ trunk/phase3/includes/db/Database.php 2010-09-23 19:36:06 UTC (rev
73632)
@@ -177,11 +177,20 @@
/**
* A string describing the current software version, like from
- * mysql_get_server_info(). Will be listed on Special:Version, etc.
+ * mysql_get_server_info().
*
- * @return string: Version information from the database
+ * @return string: Version information from the database server.
*/
public function getServerVersion();
+
+ /**
+ * A string describing the current software version, and possibly
+ * other details in a user-friendly way. Will be listed on
Special:Version, etc.
+ * Use getServerVersion() to get machine-friendly information.
+ *
+ * @return string: Version information from the database server
+ */
+ public function getServerInfo();
}
/**
@@ -216,6 +225,17 @@
# These optionally set a variable and return the previous state
/**
+ * A string describing the current software version, and possibly
+ * other details in a user-friendly way. Will be listed on
Special:Version, etc.
+ * Use getServerVersion() to get machine-friendly information.
+ *
+ * @return string: Version information from the database server
+ */
+ public function getServerInfo() {
+ return $this->getServerVersion();
+ }
+
+ /**
* Fail function, takes a Database as a parameter
* Set to false for default, 1 for ignore errors
*/
Modified: trunk/phase3/includes/db/DatabaseSqlite.php
===================================================================
--- trunk/phase3/includes/db/DatabaseSqlite.php 2010-09-23 19:33:50 UTC (rev
73631)
+++ trunk/phase3/includes/db/DatabaseSqlite.php 2010-09-23 19:36:06 UTC (rev
73632)
@@ -148,14 +148,19 @@
* @return String
*/
function getFulltextSearchModule() {
+ static $cachedResult = null;
+ if ( $cachedResult !== null ) {
+ return $cachedResult;
+ }
+ $cachedResult = false;
$table = 'dummy_search_test';
$this->query( "DROP TABLE IF EXISTS $table", __METHOD__ );
if ( $this->query( "CREATE VIRTUAL TABLE $table USING
FTS3(dummy_field)", __METHOD__, true ) ) {
$this->query( "DROP TABLE IF EXISTS $table", __METHOD__
);
- return 'FTS3';
+ $cachedResult = 'FTS3';
}
- return false;
+ return $cachedResult;
}
/**
@@ -469,6 +474,13 @@
}
/**
+ * @return string User-friendly database information
+ */
+ public function getServerInfo() {
+ return wfMsg( $this->getFulltextSearchModule() ?
'sqlite-has-fts' : 'sqlite-no-fts', $this->getServerVersion() );
+ }
+
+ /**
* Get information about a given field
* Returns false if the field does not exist.
*/
Modified: trunk/phase3/includes/specials/SpecialVersion.php
===================================================================
--- trunk/phase3/includes/specials/SpecialVersion.php 2010-09-23 19:33:50 UTC
(rev 73631)
+++ trunk/phase3/includes/specials/SpecialVersion.php 2010-09-23 19:36:06 UTC
(rev 73632)
@@ -121,7 +121,7 @@
$software = array();
$software['[http://www.mediawiki.org/ MediaWiki]'] =
self::getVersionLinked();
$software['[http://www.php.net/ PHP]'] = phpversion() . " (" .
php_sapi_name() . ")";
- $software[$dbr->getSoftwareLink()] = $dbr->getServerVersion();
+ $software[$dbr->getSoftwareLink()] = $dbr->getServerInfo();
// Allow a hook to add/remove items.
wfRunHooks( 'SoftwareInfo', array( &$software ) );
Modified: trunk/phase3/languages/messages/MessagesEn.php
===================================================================
--- trunk/phase3/languages/messages/MessagesEn.php 2010-09-23 19:33:50 UTC
(rev 73631)
+++ trunk/phase3/languages/messages/MessagesEn.php 2010-09-23 19:36:06 UTC
(rev 73632)
@@ -4344,4 +4344,8 @@
'htmlform-reset' => 'Undo changes',
'htmlform-selectorother-other' => 'Other',
+# SQLite support
+'sqlite-has-fts' => '$1 with full-text search support',
+'sqlite-no-fts' => '$1 without full-text search support',
+
);
Modified: trunk/phase3/languages/messages/MessagesQqq.php
===================================================================
--- trunk/phase3/languages/messages/MessagesQqq.php 2010-09-23 19:33:50 UTC
(rev 73631)
+++ trunk/phase3/languages/messages/MessagesQqq.php 2010-09-23 19:36:06 UTC
(rev 73632)
@@ -3753,4 +3753,7 @@
{{Identical|Other}}',
+# SQLite
+'sqlite-has-fts' => 'Shown on Special:Version, $1 is version',
+'sqlite-no-fts' => 'Shown on Special:Version, $1 is version',
);
Modified: trunk/phase3/maintenance/language/messages.inc
===================================================================
--- trunk/phase3/maintenance/language/messages.inc 2010-09-23 19:33:50 UTC
(rev 73631)
+++ trunk/phase3/maintenance/language/messages.inc 2010-09-23 19:36:06 UTC
(rev 73632)
@@ -3217,6 +3217,9 @@
'htmlform-reset',
'htmlform-selectorother-other',
),
+ 'sqlite' => array(
+ 'sqlite-has-fts',
+ ), 'sqlite-no-fts',
);
/** Comments for each block */
@@ -3428,4 +3431,5 @@
'comparepages' => 'Special:ComparePages',
'db-error-messages' => 'Database error messages',
'html-forms' => 'HTML forms',
+ 'sqlite' => 'SQLite databse support',
);
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs