r55984 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r55983‎ | r55984 | r55985 >
Date:18:38, 7 September 2009
Author:midom
Status:resolved (Comments)
Tags:
Comment:
features time - a feature that allows to disable a feature!
(rationale: allows turning off relatively expensive code that generates invisible stuff :)
Modified paths:
  • /trunk/phase3/includes/DefaultSettings.php (modified) (history)
  • /trunk/phase3/includes/Linker.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Linker.php
@@ -1941,6 +1941,9 @@
19421942 * @deprecated Returns raw bits of HTML, use titleAttrib() and accesskey()
19431943 */
19441944 public function tooltipAndAccesskey( $name ) {
 1945+ global $wgDisableTooltipsAndAccesskeys;
 1946+ if ($wgDisableTooltipsAndAccesskeys)
 1947+ return array();
19451948 # FIXME: If Sanitizer::expandAttributes() treated "false" as "output
19461949 # no attribute" instead of "output '' as value for attribute", this
19471950 # would be three lines.
@@ -1959,6 +1962,9 @@
19601963
19611964 /** @deprecated Returns raw bits of HTML, use titleAttrib() */
19621965 public function tooltip( $name, $options = null ) {
 1966+ global $wgDisableTooltipsAndAccesskeys;
 1967+ if ($wgDisableTooltipsAndAccesskeys)
 1968+ return array();
19631969 # FIXME: If Sanitizer::expandAttributes() treated "false" as "output
19641970 # no attribute" instead of "output '' as value for attribute", this
19651971 # would be two lines.
Index: trunk/phase3/includes/DefaultSettings.php
@@ -3467,6 +3467,11 @@
34683468 $wgDisableHardRedirects = false;
34693469
34703470 /**
 3471+ * Disable tooltips and access keys
 3472+ */
 3473+$wgDisableTooltipsAndAccesskeys = false;
 3474+
 3475+/**
34713476 * Use http.dnsbl.sorbs.net to check for open proxies
34723477 */
34733478 $wgEnableSorbs = false;

Follow-up revisions

RevisionCommit summaryAuthorDate
r56068Cleanup r55984: rename new $wgDisableTooltipsAndAccesskeys to $wgEnableToolti...brion20:59, 8 September 2009
r56174Fixes for r56068 and r55984:...ialex10:59, 11 September 2009

Comments

#Comment by Brion VIBBER (talk | contribs)   19:24, 8 September 2009

I'd recommend using 'positive' names for such bools to make them easier to understand, eg $wgEnableTooltipsAndAccesskeys vs $wgDisableTooltipsAndAccesskeys

Status & tagging log