r88500 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r88499‎ | r88500 | r88501 >
Date:22:39, 20 May 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
some work on selective property handling
Modified paths:
  • /trunk/extensions/SemanticWatchlist/includes/SWL_ChangeSet.php (modified) (history)
  • /trunk/extensions/SemanticWatchlist/includes/SWL_Group.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticWatchlist/includes/SWL_Group.php
@@ -421,6 +421,19 @@
422422 }
423423
424424 /**
 425+ * Removethe non covered properties.
 426+ *
 427+ * @since 0.1
 428+ *
 429+ * @param SWLChangeSet $changes
 430+ *
 431+ * @return SWLChangeSet
 432+ */
 433+ public function removeNonCoveredChanges( SWLChangeSet &$changes ) {
 434+ $changes->filterOnProperties( $this->getProperties() );
 435+ }
 436+
 437+ /**
425438 * Gets all the watching users and passes them, together with the specified
426439 * changes and the group object itself, to the SWLGroupNotify hook.
427440 *
@@ -431,7 +444,11 @@
432445 public function notifyWatchingUsers( SWLChangeSet $changes ) {
433446 $users = $this->getWatchingUsers();
434447
435 - wfRunHooks( 'SWLGroupNotify', array( $this, $users, $changes ) );
 448+ $this->removeNonCoveredChanges( $changes );
 449+
 450+ if ( $changes->hasChanges( true ) ) {
 451+ wfRunHooks( 'SWLGroupNotify', array( $this, $users, $changes ) );
 452+ }
436453 }
437454
438455 }
Index: trunk/extensions/SemanticWatchlist/includes/SWL_ChangeSet.php
@@ -363,4 +363,19 @@
364364 return $this->time;
365365 }
366366
 367+ /**
 368+ * Remove changes to properties not in the porvided list.
 369+ *
 370+ * @since 0.1
 371+ *
 372+ * @param array $properties List of property names
 373+ */
 374+ public function filterOnProperties( array $properties ) {
 375+ foreach ( $this->getAllProperties() as /* SMWDIProperty */ $property ) {
 376+ if ( !in_array( $property->getSerialization(), $properties ) ) {
 377+ $this->changeSet->removeChangesForProperty( $property );
 378+ }
 379+ }
 380+ }
 381+
367382 }
\ No newline at end of file

Status & tagging log