r36953 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r36952‎ | r36953 | r36954 >
Date:22:03, 2 July 2008
Author:yaron
Status:old
Tags:
Comment:
Removed now-unnecessary setup() function, added autoloading of 'include'
files, simplified some code
Modified paths:
  • /trunk/extensions/SemanticDrilldown/includes/SD_GlobalFunctions.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticDrilldown/includes/SD_GlobalFunctions.php
@@ -19,17 +19,19 @@
2020 define('SD_SP_HAS_LABEL', 7);
2121 define('SD_SP_HAS_DRILLDOWN_TITLE', 8);
2222
23 -$wgExtensionFunctions[] = 'sdgSetupExtension';
 23+$wgExtensionCredits['specialpage'][]= array(
 24+ 'name' => 'Semantic Drilldown',
 25+ 'version' => SD_VERSION,
 26+ 'author' => 'Yaron Koren',
 27+ 'url' => 'http://www.mediawiki.org/wiki/Extension:Semantic_Drilldown',
 28+ 'description' => 'A drilldown interface for navigating through semantic data',
 29+);
2430
2531 require_once($sdgIP . '/languages/SD_Language.php');
2632
27 -if (version_compare($wgVersion, '1.11', '>=' )) {
28 - $wgExtensionMessagesFiles['SemanticDrilldown'] = $sdgIP . '/languages/SD_Messages.php';
29 -} else {
30 - $wgExtensionFunctions[] = 'sdfLoadMessagesManually';
31 -}
 33+$wgExtensionMessagesFiles['SemanticDrilldown'] = $sdgIP . '/languages/SD_Messages.php';
3234
33 -// register all special pages
 35+// register all special pages and other classes
3436 $wgSpecialPages['Filters'] = 'SDFilters';
3537 $wgSpecialPageGroups['Filters'] = 'users';
3638 $wgAutoloadClasses['SDFilters'] = $sdgIP . '/specials/SD_Filters.php';
@@ -40,39 +42,10 @@
4143 $wgSpecialPageGroups['BrowseData'] = 'users';
4244 $wgAutoloadClasses['SDBrowseData'] = $sdgIP . '/specials/SD_BrowseData.php';
4345
44 -/**
45 - * Do the actual intialization of the extension. This is just a delayed init that makes sure
46 - * MediaWiki is set up properly before we add our stuff.
47 - */
48 -function sdgSetupExtension() {
49 - global $sdgNamespace, $sdgIP, $wgVersion, $wgExtensionCredits;
 46+$wgAutoloadClasses['SDFilter'] = $sdgIP . '/includes/SD_Filter.php';
 47+$wgAutoloadClasses['SDFilterValue'] = $sdgIP . '/includes/SD_FilterValue.php';
 48+$wgAutoloadClasses['SDAppliedFilter'] = $sdgIP . '/includes/SD_AppliedFilter.php';
5049
51 - require_once($sdgIP . '/includes/SD_Filter.php');
52 - require_once($sdgIP . '/includes/SD_FilterValue.php');
53 - require_once($sdgIP . '/includes/SD_AppliedFilter.php');
54 -
55 - /**********************************************/
56 - /***** register hooks *****/
57 - /**********************************************/
58 -
59 - /**********************************************/
60 - /***** create globals for outside hooks *****/
61 - /**********************************************/
62 -
63 - /**********************************************/
64 - /***** credits (see "Special:Version") *****/
65 - /**********************************************/
66 - $wgExtensionCredits['specialpage'][]= array(
67 - 'name' => 'Semantic Drilldown',
68 - 'version' => SD_VERSION,
69 - 'author' => 'Yaron Koren',
70 - 'url' => 'http://www.mediawiki.org/wiki/Extension:Semantic_Drilldown',
71 - 'description' => 'A drilldown interface for navigating through semantic data',
72 - );
73 -
74 - return true;
75 -}
76 -
7750 /**********************************************/
7851 /***** namespace settings *****/
7952 /**********************************************/
@@ -191,8 +164,7 @@
192165 function sdfGetTopLevelCategories() {
193166 $categories = array();
194167 $dbr = wfGetDB( DB_SLAVE );
195 - $page = $dbr->tableName('page');
196 - $categorylinks = $dbr->tableName('categorylinks');
 168+ extract($dbr->tableNames('page', 'categorylinks'));
197169 $cat_ns = NS_CATEGORY;
198170 $sql = "SELECT page_title FROM $page p LEFT OUTER JOIN $categorylinks cl ON p.page_id = cl.cl_from WHERE p.page_namespace = $cat_ns AND cl.cl_to IS NULL";
199171 $res = $dbr->query($sql);
@@ -417,8 +389,7 @@
418390 $pages = array();
419391 $subcategories = array();
420392 $dbr = wfGetDB( DB_SLAVE );
421 - $categorylinks = $dbr->tableName( 'categorylinks' );
422 - $page = $dbr->tableName( 'page' );
 393+ extract($dbr->tableNames('page', 'categorylinks'));
423394 $cat_ns = NS_CATEGORY;
424395 $query_category = str_replace(' ', '_', $category_name);
425396 $query_category = str_replace("'", "\'", $query_category);

Follow-up revisions

RevisionCommit summaryAuthorDate
r80420Removed orphan method since r36953ialex20:10, 16 January 2011

Status & tagging log