r108206 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r108205‎ | r108206 | r108207 >
Date:09:21, 6 January 2012
Author:adamw
Status:deferred
Tags:
Comment:
declare autoload classes instead of pseudorandomly calling require
Modified paths:
  • /trunk/extensions/Offline/DatabaseBz2.php (modified) (history)
  • /trunk/extensions/Offline/DumpReader.php (modified) (history)
  • /trunk/extensions/Offline/Offline.php (modified) (history)
  • /trunk/extensions/Offline/SearchBz2.php (modified) (history)
  • /trunk/extensions/Offline/SpecialOffline.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Offline/DatabaseBz2.php
@@ -28,8 +28,6 @@
2929 {
3030 function select( $table, $fields, $conds='', $fname = 'Database::select', $options = array() )
3131 {
32 - require_once(dirname(__FILE__).'/DumpReader.php');
33 - require_once(dirname(__FILE__).'/CachedStorage.php');
3432 $row = array();
3533 $title = false;
3634 if (isset($conds['page_title'])) {
Index: trunk/extensions/Offline/Offline.php
@@ -19,9 +19,12 @@
2020 $wgSpecialPageGroups['Offline'] = 'wiki'; // XXX is not the key?
2121
2222
 23+$wgAutoloadClasses['CachedStorage'] = $dir.'/CachedStorage.php';
2324 $wgAutoloadClasses['DatabaseBz2'] = $dir.'/DatabaseBz2.php';
 25+$wgAutoloadClasses['DumpReader'] = $dir.'/DumpReader.php';
2426 $wgAutoloadClasses['SearchBz2'] = $dir.'/SearchBz2.php';
2527 $wgAutoloadClasses['SpecialOffline'] = $dir.'/SpecialOffline.php';
 28+$wgAutoloadClasses['XapianDatabase'] = $dir.'/xapian.php';
2629
2730
2831 function wfOfflineInit() {
Index: trunk/extensions/Offline/SearchBz2.php
@@ -48,7 +48,6 @@
4949 protected function searchInternal( $term, $fulltext ) {
5050 global $wgCountTotalSearchHits;
5151
52 - require_once(dirname(__FILE__).'/DumpReader.php');
5352 $results = DumpReader::index_search($term);
5453
5554 return new Bz2SearchResultSet( $results, $term);
Index: trunk/extensions/Offline/SpecialOffline.php
@@ -28,8 +28,6 @@
2929 function execute($param) {
3030 global $wgOut, $wgTitle;
3131
32 - require_once(dirname(__FILE__).'/DumpReader.php');
33 -
3432 $this->setHeaders();
3533 $this->outputHeader();
3634
Index: trunk/extensions/Offline/DumpReader.php
@@ -77,7 +77,6 @@
7878 #wfDebug("looking up word [$title]");
7979
8080 try {
81 - require_once("xapian.php");
8281 global $wgOfflineWikiPath;
8382 $db = new XapianDatabase("$wgOfflineWikiPath/db");
8483 #$qp = new XapianQueryParser();

Status & tagging log