r110431 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r110430‎ | r110431 | r110432 >
Date:21:14, 31 January 2012
Author:foxtrott
Status:deferred
Tags:
Comment:
For job execution set user that initiated the job; store result in params to output it from runJobs
Modified paths:
  • /trunk/extensions/SemanticPageSeries/README (modified) (history)
  • /trunk/extensions/SemanticPageSeries/includes/SPSPageCreationJob.php (modified) (history)
  • /trunk/extensions/SemanticPageSeries/includes/SPSSpecialSeriesEdit.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticPageSeries/includes/SPSPageCreationJob.php
@@ -18,10 +18,6 @@
1919 */
2020 class SPSPageCreationJob extends Job {
2121
22 -// public function __construct( $command, $title, $params = false, $id = 0 ) {
23 -// parent::__construct( $command, $title, $params, $id );
24 -// }
25 -
2622 function __construct( $title, $params = '', $id = 0 ) {
2723 parent::__construct( 'spsCreatePage', $title, $params, $id );
2824 }
@@ -31,9 +27,16 @@
3228 * @return boolean success
3329 */
3430 function run() {
35 -
 31+
 32+ global $wgUser, $wgCommandLineMode;
 33+
 34+ $oldUser = $wgUser;
 35+ $wgUser = User::newFromId( $this->params['user'] );
 36+
 37+ unset( $this->params['user'] );
 38+
3639 $this->params['form'] = $this->title->getText();
37 -
 40+
3841 $handler = new SFAutoeditAPI( null, 'sfautoedit' );
3942 $handler->isApiQuery( false );
4043 $handler->setOptions( $this->params );
@@ -49,7 +52,11 @@
5053
5154 $result = wfMsgReplaceArgs( '$1', array($result) );
5255 }
 56+
5357
 58+ $wgUser = $oldUser;
 59+
 60+ $this->params = array( $result );
5461 wfDebugLog( 'sps', 'Page Creation Job: ' . $result );
5562 }
5663
Index: trunk/extensions/SemanticPageSeries/includes/SPSSpecialSeriesEdit.php
@@ -159,7 +159,7 @@
160160
161161 private function evaluateForm( WebRequest &$request ) {
162162
163 - global $wgOut, $spsgIterators;
 163+ global $wgOut, $wgUser, $spsgIterators;
164164
165165 $requestValues = $_POST;
166166
@@ -213,6 +213,8 @@
214214 }
215215
216216 $targetFormTitle = Title::makeTitleSafe( SF_NS_FORM, $targetFormName );
 217+
 218+ $requestValues['user'] = $wgUser->getId();
217219
218220 foreach ( $iteratorValues as $value ) {
219221 SFAutoeditAPI::addToArray( $requestValues, $targetFieldName, $value, true );
Index: trunk/extensions/SemanticPageSeries/README
@@ -6,8 +6,9 @@
77
88 == Dependencies ==
99
10 -This extension was developed for MediaWiki 1.17 with Semantic Forms 2.4
11 -installed. Other version might work, but are not tested.
 10+This extension was developed for MediaWiki 1.17 with at least Semantic
 11+MediaWiki 1.5.3 and Semantic Forms 2.4 installed. Other version might work, but
 12+are not tested.
1213
1314
1415 == Installation ==