Page MenuHomePhabricator

ExtensionFunctions defined in wmf-config are run after extensions' own ExtensionFunctions
Open, Needs TriagePublic

Description

How/why does FlaggedRevsHooks end up first in $wgExtensionFunctions, even though the closures (from wmf-config) are registered first?

reedy@deploy1001:/srv/mediawiki-staging$ mwscript eval.php dewiktionary
> var_dump( $wgExtensionFunctions );
array(21) {
  [0]=>
  string(38) "FlaggedRevsHooks::onExtensionFunctions"
  [1]=>
  string(29) "CategoryTreeHooks::initialize"
  [2]=>
  string(32) "TimedMediaHandlerHooks::register"
  [3]=>
  string(34) "ConfirmEditHooks::confirmEditSetup"
  [4]=>
  string(41) "CentralAuthHooks::onRunExtensionFunctions"
  [5]=>
  string(49) "MediaWiki\GlobalCssJs\Hooks::onExtensionFunctions"
  [6]=>
  string(37) "CentralNoticeHooks::initCentralNotice"
  [7]=>
  string(16) "MathHooks::setup"
  [8]=>
  string(36) "InterwikiHooks::onExtensionFunctions"
  [9]=>
  string(28) "EchoHooks::initEchoExtension"
  [10]=>
  string(26) "EventLoggingHooks::onSetup"
  [11]=>
  string(52) "InterwikiSorting\InterwikiSortingHooks::registerHook"
  [12]=>
  string(61) "MediaWiki\Extensions\OAuth\MWOAuthHooks::onExtensionFunctions"
  [13]=>
  object(Closure$#23;72)#128 (0) {
  }
  [14]=>
  object(Closure$;106)#47 (0) {
  }
  [15]=>
  object(Closure$#7;56)#57 (0) {
  }
  [16]=>
  object(Closure$;114)#80 (0) {
  }
  [17]=>
  object(Closure$#15;64)#83 (0) {
  }
  [18]=>
  object(Closure$#20;69)#85 (0) {
  }
  [19]=>
  string(38) "\Wikibase\ClientHooks::onExtensionLoad"
  [20]=>
  object(Closure$#27;76)#129 (0) {
  }
}

Event Timeline

Jdforrester-WMF renamed this task from ExtensionFunctions defined in wmf-config are run after Extensions own ExtensionFunctions to ExtensionFunctions defined in wmf-config are run after extensions' own ExtensionFunctions.Jun 25 2019, 11:08 PM

Order of extension functions (and other registry stuff) isn't guaranteed. If they need to run in a specific order, we need to figure out a different solution.