http://www.mediawiki.org/wiki/Special:Code/MediaWiki/88762
Revision: 88762
Author: jeroendedauw
Date: 2011-05-24 22:19:16 +0000 (Tue, 24 May 2011)
Log Message:
-----------
added before and after edit/changeset insert hooks and batched inserts
Modified Paths:
--------------
trunk/extensions/SemanticWatchlist/includes/SWL_ChangeSet.php
trunk/extensions/SemanticWatchlist/includes/SWL_Edit.php
Modified: trunk/extensions/SemanticWatchlist/includes/SWL_ChangeSet.php
===================================================================
--- trunk/extensions/SemanticWatchlist/includes/SWL_ChangeSet.php
2011-05-24 22:06:54 UTC (rev 88761)
+++ trunk/extensions/SemanticWatchlist/includes/SWL_ChangeSet.php
2011-05-24 22:19:16 UTC (rev 88762)
@@ -498,6 +498,8 @@
return 0;
}
+ wfRunHooks( 'SWLBeforeChangeSetInsert', array( &$this,
&$groupsToAssociate, &$editId ) );
+
$dbw = wfGetDB( DB_MASTER );
$dbw->insert(
@@ -547,6 +549,8 @@
}
}
+ $dbw->begin();
+
foreach ( $changes as $change ) {
if ( $change['property'] == '' ) {
// When removing the last value for a property
of a page,
@@ -576,6 +580,10 @@
);
}
+ $dbw->commit();
+
+ wfRunHooks( 'SWLAfterChangeSetInsert', array( &$this,
$groupsToAssociate, $editId ) );
+
return $id;
}
Modified: trunk/extensions/SemanticWatchlist/includes/SWL_Edit.php
===================================================================
--- trunk/extensions/SemanticWatchlist/includes/SWL_Edit.php 2011-05-24
22:06:54 UTC (rev 88761)
+++ trunk/extensions/SemanticWatchlist/includes/SWL_Edit.php 2011-05-24
22:19:16 UTC (rev 88762)
@@ -148,6 +148,8 @@
* @return boolean Success indicator
*/
protected function insertIntoDB() {
+ wfRunHooks( 'SWLBeforeEditInsert', array( &$this ) );
+
$dbr = wfGetDB( DB_MASTER );
$result = $dbr->insert(
@@ -161,6 +163,8 @@
$this->id = $dbr->insertId();
+ wfRunHooks( 'SWLAfterEditInsert', array( &$this ) );
+
return $result;
}
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs