Gergő Tisza has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/135087

Change subject: Do not override existing value when initializing 
$wgEventLoggingSchemas
......................................................................

Do not override existing value when initializing $wgEventLoggingSchemas

This makes it possible for extensions to set $wgEventLoggingSchemas
before it is being initialized by the EventLogging extension.

This might or might not be a good idea. In PHP,

  $wgEventLoggingSchemas['foo'] = 123;

is entirely valid even if $wgEventLoggingSchemas has not been defined
yet, so this patch would make it possible to set that variable
in a convenient way, just like other globals are set, without
resorting to hooks or callbacks. On the other hand,

  $wgEventLoggingSchemas += array(
      'foo' => 123,
      'bar' => 456,
  );

would still break, so this might give developers a false sense of
security.

Bug: 65680
Change-Id: I3b4680f162ad3b1796672dae5a50a230beae0fdc
---
M EventLogging.php
1 file changed, 8 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/EventLogging 
refs/changes/87/135087/1

diff --git a/EventLogging.php b/EventLogging.php
index d76cd12..c5ae623 100644
--- a/EventLogging.php
+++ b/EventLogging.php
@@ -88,13 +88,14 @@
  */
 $wgEventLoggingDBname = 'metawiki';
 
-/**
- * @var array: A map of event schema names to revision IDs.
- *
- * @example array: array( 'MultimediaViewerNetworkPerformance' => 7917896 );
- */
-$wgEventLoggingSchemas = array();
-
+if ( !isset( $wgEventLoggingSchemas ) ) {
+       /**
+        * @var array: A map of event schema names to revision IDs.
+        *
+        * @example array: array( 'MultimediaViewerNetworkPerformance' => 
7917896 );
+        */
+       $wgEventLoggingSchemas = array();
+}
 
 // Helpers
 

-- 
To view, visit https://gerrit.wikimedia.org/r/135087
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3b4680f162ad3b1796672dae5a50a230beae0fdc
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/EventLogging
Gerrit-Branch: master
Gerrit-Owner: GergÅ‘ Tisza <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to