r107629 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r107628‎ | r107629 | r107630 >
Date:09:51, 30 December 2011
Author:adamw
Status:deferred (Comments)
Tags:
Comment:
save article offset into bz2 chunk
Modified paths:
  • /trunk/extensions/Offline/DumpReader.php (modified) (history)
  • /trunk/extensions/Offline/SearchBz2.php (modified) (history)
  • /trunk/extensions/Offline/SpecialOffline.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Offline/SearchBz2.php
@@ -87,7 +87,7 @@
8888 if ($result === false)
8989 return false;
9090
91 - list ($bzfile, $title) = $result;
 91+ list ($bzfile, $offset, $title) = $result;
9292
9393 $matches = array();
9494 $row = new stdClass();
Index: trunk/extensions/Offline/SpecialOffline.php
@@ -47,7 +47,7 @@
4848 // lookup a real article in the index can be searched
4949 $results = DumpReader::index_search(wfMsg('offline_test_article'));
5050 if (count($results) > 0)
51 - list ($bz_file, $entry_title) = $results[0];
 51+ list ($bz_file, $offset, $entry_title) = $results[0];
5252
5353 $test_index = isset($bz_file);
5454 $this->printTest($test_index, 'offline_index_test');
Index: trunk/extensions/Offline/DumpReader.php
@@ -10,7 +10,8 @@
1111 $results = self::index_search($title);
1212 if (count($results) > 0) {
1313 $archive_file = $results[0][0];
14 - $title = $results[0][1];
 14+ $plaintext_offset = $results[0][1];
 15+ $title = $results[0][2];
1516
1617 $article_wml = self::load_all_data($title, $archive_file);
1718 } else {
@@ -104,9 +105,7 @@
105106 for ($i = $matches->begin(); !$i->equals($matches->end()); $i->next())
106107 {
107108 $entry = $i->get_document()->get_data();
108 - $fsep = strpos($entry, ':');
109 - $row = array(substr($entry, 0, $fsep), substr($entry, $fsep + 1));
110 - $result[] = $row;
 109+ $result[] = explode(':', $entry, 3);
111110 }
112111 # not in Xapian 1.0.X
113112 #$db->close();

Comments

#Comment by Reedy (talk | contribs)   23:39, 4 January 2012

Going to just note this on the newest revision for ease

  • You've got mixed usages of tabs and spaces for indenting
  • If you list classes and files in the correct autoloader globals in your setup file, and won't need arbitary includes of files

Status & tagging log