r68887 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r68886‎ | r68887 | r68888 >
Date:16:35, 2 July 2010
Author:daniel
Status:deferred
Tags:
Comment:
various tweaks to improve speed.
Modified paths:
  • /trunk/WikiWord/WikiWordWeb/src/main/maintenance/resource-index.sql (modified) (history)
  • /trunk/WikiWord/WikiWordWeb/src/main/www/common/wwclient.php (modified) (history)
  • /trunk/WikiWord/WikiWordWeb/src/main/www/common/wwimages.php (modified) (history)
  • /trunk/WikiWord/WikiWordWeb/src/main/www/common/wwthesaurus.php (modified) (history)
  • /trunk/WikiWord/WikiWordWeb/src/main/www/common/wwutils.php (modified) (history)
  • /trunk/WikiWord/WikiWordWeb/src/main/www/common/wwwikis.php (modified) (history)
  • /trunk/WikiWord/WikiWordWeb/src/main/www/config.sample.php (modified) (history)
  • /trunk/WikiWord/WikiWordWeb/src/main/www/wikipics/form.html.php (modified) (history)
  • /trunk/WikiWord/WikiWordWeb/src/main/www/wikipics/response.html.php (modified) (history)
  • /trunk/WikiWord/WikiWordWeb/src/main/www/wikipics/search.php (modified) (history)
  • /trunk/WikiWord/WikiWordWeb/src/main/www/wikiword/api.php (modified) (history)

Diff [purge]

Index: trunk/WikiWord/WikiWordWeb/src/main/maintenance/resource-index.sql
@@ -10,4 +10,5 @@
1111 insert into {collection}_{thesaurus}_resource_index ( concept, resources )
1212 select concept, group_concat(distinct concat(type, ":", lang, ":", local_resource_name) separator "|" ) as resources
1313 from {collection}_{thesaurus}_about as A
14 -where type > 0;
 14+where type > 0
 15+group by concept;
Index: trunk/WikiWord/WikiWordWeb/src/main/www/wikiword/api.php
@@ -36,13 +36,15 @@
3737 } else if ($query == 'concepts') {
3838 $term = @$_REQUEST['term'];
3939 $norm = @$_REQUEST['norm'];
 40+ $limit = @$_REQUEST['limit'];
4041
4142 if ( $norm === null ) $norm = 1;
 43+ if ( $limit === null ) $limit = $wwMaxSearchResults;
4244 #$page = @$_REQUEST['page'];
4345
4446 if ( $qlang === null ) $result['error'] = array('code' => 150, 'message' => "missing parameter qlang");
4547 else if ( $term !== null ) {
46 - $result['concepts'] = $thesaurus->getConceptsForTerm($qlang, $term, $lang, $norm, $rclang); #TODO: limit!
 48+ $result['concepts'] = $thesaurus->getConceptsForTerm($qlang, $term, $lang, $norm, $rclang, $limit);
4749 if ( $result['concepts'] === false || $result['concepts'] === null ) {
4850 $result['error'] = array('code' => 210, 'message' => "failed to retrieve concepts for term $langt:$term");
4951 }
@@ -107,7 +109,12 @@
108110 $result['error'] = array('code' => 10, 'message' => "bad query: $query");
109111 }
110112 } catch (Exception $e) {
111 - $result['error'] = array('code' => 1000, 'message' => "unexpected exception: " . $e->getMessage());
 113+ $result['error']['code'] = 1000 + $e->getCode();
 114+ $result['error']['message'] = "unexpected exception: " . $e->getMessage();
 115+
 116+ if ( @$wwExceptionDetails ) {
 117+ $result['error']['trace'] = $e->getTrace();
 118+ };
112119 }
113120
114121 $result['time'] = (microtime(true) - $start) . " sec";
Index: trunk/WikiWord/WikiWordWeb/src/main/www/wikipics/response.html.php
@@ -125,12 +125,13 @@
126126 global $utils;
127127
128128 $name = $utils->pickLocal($concept['name'], $langs);
129 - if ( $name === false || $name === null) return false;
 129+ if ( $name === false || $name === null || $name === "") return false;
130130
131131 $name = str_replace("_", " ", $name);
132132 $score = @$concept['score'];
133133
134134 if ($text === null) $text = $name;
 135+ if ($text === null || $text === false || $text === "") return false;
135136
136137 $u = getConceptDetailsURL($langs, $concept);
137138 return '<a href="' . htmlspecialchars($u) . '" title="' . htmlspecialchars($name) . ' (score: ' . (int)$score . ')'. '">' . htmlspecialchars($text) . '</a>';
@@ -333,6 +334,7 @@
334335 if (!isset($skinPath)) $skinPath = "$scriptPath/../skin/";
335336
336337 header("Content-Type: text/html; charset=UTF-8");
 338+debug("starting HTML output");
337339 ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
338340 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
339341 <head>
@@ -373,6 +375,8 @@
374376 ?>
375377 <table border="0" class="results" cellspacing="0" summary="search results">
376378 <?php
 379+ debug("processing results");
 380+
377381 $count = 0;
378382 foreach ( $result as $row ) {
379383 $count = $count + 1;
@@ -380,10 +384,16 @@
381385
382386 ?>
383387 <?php
 388+ if ( @$debug ) {
 389+ print "<p class='debug'>procesing concept #".htmlspecialchars($row['id'])."</p>";
 390+ flush();
 391+ }
 392+
384393 mangleConcept($row);
385394 $continue= printConcept($row, $languages, $terse);
386395
387396 if (!$continue) break;
 397+ if ($limit && $count >= $limit) break;
388398 ?>
389399
390400 <?php
Index: trunk/WikiWord/WikiWordWeb/src/main/www/wikipics/search.php
@@ -14,6 +14,11 @@
1515 function getImagesAbout($concept, $max) {
1616 global $utils, $profiling;
1717
 18+ if ( @$debug ) {
 19+ print "<p class='debug'>fetching images about #".htmlspecialchars($concept['id'])."</p>";
 20+ flush();
 21+ }
 22+
1823 $t = microtime(true);
1924 $pics = $utils->getImagesAbout($concept, $max);
2025 $profiling['pics'] += (microtime(true) - $t);
@@ -149,11 +154,23 @@
150155 sortConceptList($concept['broader']);
151156 }
152157
 158+function debug( $msg ) {
 159+ global $debug;
 160+
 161+ if ( @$debug ) {
 162+ print "<p class='debug'>".htmlspecialchars($msg)."</p>";
 163+ flush();
 164+ }
 165+}
 166+
153167 $conceptId = @$_REQUEST['id'];
154168 $term = @$_REQUEST['term'];
155169 $lang = @$_REQUEST['lang'];
156170 $format = @$_REQUEST['format'];
 171+$limit = @$_REQUEST['limit'];
157172
 173+if ( $limit === null ) $limit = $wwMaxSearchResults;
 174+
158175 if ( $term===null ) {
159176 $term = @$_SERVER['PATH_INFO'];
160177 $term = preg_replace('!^/!', '', $term);
@@ -178,6 +195,7 @@
179196 if (!isset($scriptPath)) $scriptPath = dirname($wwSelf);
180197 if (!isset($skinPath)) $skinPath = "$scriptPath/../skin/";
181198
 199+$debug = false;
182200 $error = NULL;
183201
184202 if ($lang) {
@@ -202,15 +220,18 @@
203221
204222 if ( !$utils->db ) $utils->connect($wwDBServer, $wwDBUser, $wwDBPassword, $wwDBDatabase);
205223
206 -if (@$_REQUEST['debug']) $utils->debug = true;
 224+if (@$_REQUEST['debug']) {
 225+ $debug = true;
 226+ $utils->debug = true;
 227+ $thesaurus->debug = true;
 228+}
207229
208 -$limit = 20;
209230 $norm = 1;
210231
211232 $mode = NULL;
212233 $result = NULL;
213234
214 -$fallback_languages = array( "en" ); #TODO: make the user define this list
 235+$fallback_languages = array( "en", "commons" ); #TODO: make the user define this list
215236
216237 if ( $lang ) {
217238 $languages = preg_split('![,;/|+]!', $lang);
@@ -232,7 +253,7 @@
233254 try {
234255 if ($lang && $conceptId) {
235256 $mode = "concept";
236 - $result = $thesaurus->getConceptInfo($conceptId, $lang, null, $allLanguages);
 257+ $result = $thesaurus->getConceptInfo($conceptId, $lang, null, $allLanguages, $wwMax);
237258 if ( $result ) $result = array( $result ); //hack
238259 } else if ($lang && $term) {
239260 $mode = "term";
@@ -244,6 +265,8 @@
245266 $profiling['thesaurus'] += (microtime(true) - $t);
246267 }
247268
 269+debug("generating response");
 270+
248271 /*if ( $format == "atom" || $format == "xml" || $format == "opensearch" ) include("response.atom.php");
249272 else*/
250273 include("response.html.php");
Index: trunk/WikiWord/WikiWordWeb/src/main/www/wikipics/form.html.php
@@ -34,9 +34,9 @@
3535 </table>
3636
3737 <?php
38 - if ($utils->debug) {
 38+ if ( @$debug ) {
3939 print '<input type="hidden" name="debug" value="true"/>';
40 - print "<p>debug mode enabled!</p>";
 40+ print "<p class='debug'>debug mode enabled!</p>";
4141 flush();
4242 }
4343 ?>
Index: trunk/WikiWord/WikiWordWeb/src/main/www/common/wwclient.php
@@ -3,6 +3,7 @@
44
55 class WWClient {
66 var $api;
 7+ var $debug = false;
78
89 function __construct( $api ) {
910 $this->api = $api;
@@ -29,13 +30,27 @@
3031 $url .= urlencode( $v );
3132 }
3233
 34+ if ($this->debug) {
 35+ $t = microtime(true);
 36+ print "\n<span class='debug'>[fetching " . htmlspecialchars($url) . "]</span>\n";
 37+ flush();
 38+ }
 39+
3340 $data = file_get_contents( $url ); //TODO: CURL
 41+
3442 if ( !$data ) throw new Exception("failed to fetch data from $url");
3543
3644 $data = unserialize($data);
3745 if ( !$data ) throw new Exception("failed to unserialize data from $url");
3846
3947 if ( @$data['error'] ) throw new Exception("API returned error ".$data['error']['code'].": ".$data['error']['message']."; url: $url");
 48+
 49+ if ($this->debug) {
 50+ $t = microtime(true) - $t;
 51+ print "\n<span class='debug'>[took " . $t . " sec]</span>\n";
 52+ flush();
 53+ }
 54+
4055 return $data;
4156 }
4257
@@ -144,6 +159,7 @@
145160 'lang' => $languages,
146161 'norm' => $norm,
147162 'term' => $term,
 163+ 'limit' => $limit,
148164 );
149165
150166 $rs = $this->query( $param );
Index: trunk/WikiWord/WikiWordWeb/src/main/www/common/wwutils.php
@@ -23,8 +23,9 @@
2424 if ($db == NULL && isset($this)) $db = $this->db;
2525
2626 if ($this->debug) {
27 - print "\n<pre>" . htmlspecialchars($sql) . "</pre>\n";
 27+ print "\n<div class='debug'>SQL: <pre>" . htmlspecialchars($sql) . "</pre></div>\n";
2828 flush();
 29+ $t = microtime(true);
2930 }
3031
3132 if (!$db) {
@@ -39,6 +40,12 @@
4041 throw new Exception("$error (#$errno);\nlast query: $sql");
4142 }
4243
 44+ if ($this->debug) {
 45+ $t = microtime(true) - $t;
 46+ print "\n<div class='debug'>SQL time: $t</div>\n";
 47+ flush();
 48+ }
 49+
4350 return $result;
4451 }
4552
@@ -155,6 +162,8 @@
156163 }
157164
158165 function pickLocal($items, $languages) {
 166+ if ( !is_array($items) ) return $items;
 167+
159168 $lang = $this->pickLanguage($items, $languages);
160169 if (!$lang) return false;
161170 return $items[$lang];
Index: trunk/WikiWord/WikiWordWeb/src/main/www/common/wwthesaurus.php
@@ -92,7 +92,7 @@
9393 . " AND S.norm <= " . (int)$norm;
9494
9595 $sql .= " ORDER BY S.score DESC, S.concept "
96 - . " LIMIT " . (int)$limit;
 96+ . " LIMIT " . (int)$limit * count( $languages );
9797
9898 #FIXME: query-lang vs. output-languages!
9999
@@ -103,7 +103,7 @@
104104 $rs = $this->queryConceptsForTerm($qlang, $term, $languages, $norm, $rclang, $limit);
105105 $list = WWUtils::slurpRows($rs);
106106 mysql_free_result($rs);
107 - return $this->buildConcepts($list);
 107+ return $this->buildConcepts($list, $limit);
108108 }
109109
110110 function getPagesForConcept( $id, $lang = null ) {
@@ -257,7 +257,7 @@
258258
259259 $rc = array();
260260 foreach ($rr as $r) {
261 - list($t, $lang, $n) = explode(":", $p, 3);
 261+ list($t, $lang, $n) = explode(":", $r, 3);
262262 $rc[$lang][$n] = (int)$t;
263263 }
264264 }
@@ -308,11 +308,11 @@
309309 $sql .= " FROM {$wwTablePrefix}_{$wwThesaurusDataset}_concept_info as I ";
310310 if ( $rclang ) $sql .= " JOIN {$wwTablePrefix}_{$wwThesaurusDataset}_resource_index as R ON R.concept = I.concept ";
311311
312 - $sql .= " WHERE concept = ".(int)$id;
 312+ $sql .= " WHERE I.concept = ".(int)$id;
313313
314314 if ($lang) {
315 - if ( is_array($lang) ) $sql .= " AND lang IN " . $this->quoteSet($lang);
316 - else $sql .= " AND lang = " . $this->quote($lang);
 315+ if ( is_array($lang) ) $sql .= " AND I.lang IN " . $this->quoteSet($lang);
 316+ else $sql .= " AND I.lang = " . $this->quote($lang);
317317 }
318318
319319 $r = $this->getRows($sql);
@@ -321,7 +321,7 @@
322322 return $this->buildConcept($r);
323323 }
324324
325 - function buildConcepts($rows) {
 325+ function buildConcepts($rows, $limit = false) {
326326 $concepts = array();
327327 $buff = array();
328328 $id = null;
@@ -334,6 +334,8 @@
335335
336336 $id = null;
337337 $score = null;
 338+
 339+ if ( $limit && count($concepts) >= $limit ) break;
338340 }
339341
340342 if ($id === null) {
@@ -343,7 +345,7 @@
344346 $buff[] = $row;
345347 }
346348
347 - if ($buff) {
 349+ if ($buff && $id && ( !$limit || count($concepts) < $limit ) ) {
348350 $concepts[$id] = $this->buildConcept($buff);
349351 $buff = array();
350352 }
Index: trunk/WikiWord/WikiWordWeb/src/main/www/common/wwimages.php
@@ -109,7 +109,7 @@
110110 $sql .= " AND P.page_title = " . $this->quote($title);
111111 if ($commonsOnly) $sql .= " AND R.img_name IS NULL";
112112
113 - return $this->queryWiki($lang, $sql);
 113+ return $this->queryWikiFast($lang, $sql);
114114 }
115115
116116 function getImagesOnPage($lang, $ns, $title, $commonsOnly = false) {
@@ -143,7 +143,7 @@
144144 $sql .= " AND P.page_title = " . $this->quote($title);
145145 if ($commonsOnly) $sql .= " AND R.img_name IS NULL";
146146
147 - return $this->queryWiki($lang, $sql);
 147+ return $this->queryWikiFast($lang, $sql);
148148 }
149149
150150 function getImagesOnPageTemplates($lang, $ns, $title, $commonsOnly = false) {
@@ -165,7 +165,7 @@
166166 $sql .= " WHERE C.cl_to = " . $this->quote($title);
167167 $sql .= " AND P.page_namespace = " . NS_IMAGE;
168168
169 - return $this->queryWiki($lang, $sql);
 169+ return $this->queryWikiFast($lang, $sql);
170170 }
171171
172172 function getImagesInCategory($lang, $title) {
@@ -208,7 +208,7 @@
209209 $sql .= " FROM $image_table as T ";
210210 $sql .= " WHERE T.img_name IN " . $this->quoteSet($images);
211211
212 - return $this->queryWiki($lang, $sql);
 212+ return $this->queryWikiFast($lang, $sql);
213213 }
214214
215215 function getMetaForImages($lang, $images) {
@@ -232,7 +232,7 @@
233233 $sql .= " WHERE P.page_title = " . $this->quote($image);
234234 $sql .= " AND P.page_namespace = " . NS_IMAGE;
235235
236 - return $this->queryWiki($lang, $sql);
 236+ return $this->queryWikiFast($lang, $sql);
237237 }
238238
239239 function getTemplatesOnImagePage($lang, $image) {
@@ -254,7 +254,7 @@
255255 $sql .= " WHERE P.page_title = " . $this->quote($image);
256256 $sql .= " AND P.page_namespace = " . NS_IMAGE;
257257
258 - return $this->queryWiki($lang, $sql);
 258+ return $this->queryWikiFast($lang, $sql);
259259 }
260260
261261 function getCategoriesOfImagePage($lang, $image) {
@@ -295,6 +295,7 @@
296296
297297 $wikis = array();
298298 $pages = array();
 299+ $pagesText = "";
299300
300301 foreach ($concepts as $lang => $rc) {
301302 if (!isset($wwLanguages[$lang])) continue;
@@ -306,12 +307,15 @@
307308 if ( $t != 10) continue; //use only articles
308309 $p = "gil_wiki = " . $this->quote($wiki) . " AND gil_page_namespace_id = 0 AND gil_page_title = " . $this->quote($r);
309310 $pages[] = $p;
 311+
 312+ if ($pagesText) $pagesText .= ", ";
 313+ $pagesText .= $wiki . ':' . str_replace('*', '_', $r);
310314 }
311315 }
312316
313317 if (!$pages || !$wikis) return false;
314318
315 - $sql = " /* queryImagesOnPagesGlobally() */ ";
 319+ $sql = " /* queryImagesOnPagesGlobally($pagesText) */ ";
316320 $sql .= " SELECT distinct gil_to as image FROM $globalimagelinks_table ";
317321 $sql .= " WHERE gil_wiki in " . $this->quoteSet( $wikis );
318322 $sql .= " AND gil_page_namespace_id = 0 ";
@@ -331,19 +335,21 @@
332336 return $list;
333337 }
334338
335 - function queryGlobalUsageCounts( $images, $wikis = ".*wiki" ) {
 339+ function queryGlobalUsageCounts( $images, $wikis = null ) {
336340 if (!$images) return false;
337341
 342+ //FIXME: use pre-calculated usage counts if $wwImageUsageTable is set!!!
 343+
338344 $globalimagelinks_table = $this->getWikiTableName("commons", "globalimagelinks");
339345
340 - $sql = " /* queryGlobalUsageCounts() */ ";
 346+ $sql = " /* queryGlobalUsageCounts(" . str_replace('*', '_', implode(', ', $images) ) . ") */ ";
341347 $sql .= " SELECT gil_to as image, gil_wiki as wiki, count(*) as linkcount FROM $globalimagelinks_table ";
342348 $sql .= " WHERE gil_page_namespace_id = 0 ";
343349 $sql .= " AND gil_to IN " . $this->quoteSet( $images );
344350
345351 if ( $wikis ) {
346352 if ( is_array( $wikis ) ) $sql .= " AND gil_wiki IN " . $this->quoteSet( $wikis );
347 - else if ( is_array( $wikis ) ) $sql .= " AND gil_wiki REGEX " . $this->quote( '^' . $wikis . '$' );
 353+ else if ( $wikis ) $sql .= " AND gil_wiki RLIKE " . $this->quote( '^' . $wikis . '$' );
348354
349355 #TODO: could also limit to to x or min size n using toolserver.wiki !
350356 }
@@ -351,10 +357,10 @@
352358 $sql .= " GROUP BY gil_to, gil_wiki ";
353359 $sql .= " ORDER BY gil_to, gil_wiki ";
354360
355 - return $this->queryWiki("commons", $sql);
 361+ return $this->queryWikiFast("commons", $sql);
356362 }
357363
358 - function getGlobalUsageCounts( $images, $wikis = ".*wiki" ) {
 364+ function getGlobalUsageCounts( $images, $wikis = null ) {
359365 if (!$images) return array();
360366
361367 $rs = $this->queryGlobalUsageCounts($images, $wikis);
@@ -412,7 +418,9 @@
413419 $globalImageList = $this->getImagesOnPagesGlobally($pages); //use wikis for $wwLanguages only
414420
415421 //TODO: sanity limit on number of images. $max * 5 ?
416 - $globalImageUsage = $this->getGlobalUsageCounts($globalImageList, ".*wiki"); //use all wikipedias
 422+ //$globalImageUsage = $this->getGlobalUsageCounts($globalImageList, ".*wiki"); //use all wikipedias
 423+ $globalImageUsage = $this->getGlobalUsageCounts($globalImageList, null); //use all wikis
 424+ //FIXME: getGlobalUsageCounts is SLOW!!!
417425
418426 foreach ($globalImageUsage as $image => $usage) {
419427 $m = @$usage['*max*'];
@@ -667,11 +675,11 @@
668676 return $this->allPics;
669677 }
670678
671 - function queryGlobalUsageCounts( $images, $wikis = ".*wiki" ) {
 679+ function queryGlobalUsageCounts( $images, $wikis = null ) {
672680 throw new Exception( __METHOD__ . " not implemented" );
673681 }
674682
675 - function getGlobalUsageCounts( $images, $wikis = ".*wiki" ) {
 683+ function getGlobalUsageCounts( $images, $wikis = null ) {
676684 if (!$images) return array();
677685
678686 foreach ($images as $current) {
Index: trunk/WikiWord/WikiWordWeb/src/main/www/common/wwwikis.php
@@ -24,7 +24,9 @@
2525 }
2626
2727 function getWikiInfo($lang) {
28 - global $wwWikiInfoTable, $wwWikiDbName, $wwWikiServerName, $wwCommonsServerName;
 28+ global $wwWikiInfoTable, $wwWikiDbName;
 29+ global $wwWikiServerName, $wwWikiFastServerName;
 30+ global $wwCommonsServerName, $wwCommonsFastServerName;
2931
3032 $db = str_replace('{lang}', $lang, $wwWikiDbName);
3133
@@ -37,36 +39,56 @@
3840 mysql_free_result($rs);
3941
4042 if (!$info) $info = false;
41 - else $info['server'] = str_replace('{num}', $info['server'], $wwWikiServerName);
 43+ else {
 44+ $info['server'] = str_replace('{num}', $info['server'], $wwWikiServerName);
4245
43 - if ($lang == "commons" && $wwCommonsServerName) $info['server'] = $wwCommonsServerName;
 46+ if ( $wwWikiFastServerName ) $info['fast-server'] = str_replace('{num}', $info['server'], $wwWikiServerName);
 47+ else $info['fast-server'] = $info['server'];
4448
 49+ if ($lang == "commons" && $wwCommonsServerName) $info['server'] = $wwCommonsServerName;
 50+ if ($lang == "commons" && $wwCommonsFastServerName) $info['fast-server'] = $wwCommonsFastServerName;
 51+ else $info['fast-server'] = $info['server'];
 52+ }
 53+
4554 return $info;
4655 }
4756
48 - function getWikiConnection($lang) {
49 - if (isset($this->wikidbs[$lang])) return $this->wikidbs[$lang];
 57+ function getWikiConnection($lang, $fast = false) {
 58+ if ( $fast ) $key = "$lang+fast";
 59+ else $key = $lang;
5060
 61+ if (isset($this->wikidbs[$key])) return $this->wikidbs[$key];
 62+
5163 $info = $this->getWikiInfo($lang);
5264
5365 if (!$info) {
5466 $db = false;
5567 } else {
56 - $db = mysql_connect($info['server'], $this->dbuser, $this->dbpassword);
 68+ if ($fast && isset($info['fast-server'])) $server = $info['fast-server'];
 69+ else $server = $info['server'];
 70+
 71+ $db = mysql_connect($server, $this->dbuser, $this->dbpassword);
5772 if (!$db) throw new Exception("Connection Failure to Database: " . mysql_error());
5873 if (!mysql_select_db($info['dbname'], $db)) throw new Exception ("Database not found: " . mysql_error());
5974 if (!mysql_query("SET NAMES Latin1;", $db)) throw new Exception ("Database not found: " . mysql_error());
6075 }
6176
62 - $this->wikidbs[$lang] = $db;
 77+ $this->wikidbs[$key] = $db;
6378 return $db;
6479 }
6580
6681 function queryWiki($lang, $sql) {
67 - $db = $this->getWikiConnection($lang);
 82+ $db = $this->getWikiConnection($lang, false);
6883 if (!$db) throw new Exception ("Wiki not found: $lang");
6984
7085 return $this->query($sql, $db);
7186 }
7287
 88+ function queryWikiFast($lang, $sql) {
 89+ $db = $this->getWikiConnection($lang, true);
 90+ if (!$db) throw new Exception ("Wiki not found: $lang");
 91+
 92+ return $this->query($sql, $db);
 93+ }
 94+
7395 }
Index: trunk/WikiWord/WikiWordWeb/src/main/www/config.sample.php
@@ -21,6 +21,8 @@
2222 $wwGalleryColumns = 5;
2323 $wwMaxGalleryImages = 200;
2424 $wwMaxDetailLinks = 1000;
 25+$wwMaxSearchResults = 8;
 26+
2527 $wwThumbSize = 120;
2628 $wwThumbnailURL = "http://toolserver.org/tsthumb/tsthumb?f={name}&domain=commons.wikimedia.org&w={width}&h={height}";
2729 $wwImagePageURL = "http://commons.wikimedia.org/wiki/File:{name}";
@@ -32,8 +34,10 @@
3335 $wwWikiInfoTable = "toolserver.wiki";
3436 $wwWikiDbName = "{lang}wiki_p";
3537 $wwWikiServerName = "sql-s{num}";
 38+$wwWikiFastServerName = "sql-s{num}-fast";
3639
3740 $wwCommonsServerName = null;
 41+$wwCommonsFastServerName = null;
3842
3943 $wwTagsTable = null;
4044

Status & tagging log