Legoktm has uploaded a new change for review.
https://gerrit.wikimedia.org/r/75299
Change subject: [WIP] Edit via the API
......................................................................
[WIP] Edit via the API
Change-Id: Ib51f2f4a65a45d70e278c13c198733fd47bc3229
---
M MassMessageJob.php
1 file changed, 22 insertions(+), 10 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MassMessage
refs/changes/99/75299/1
diff --git a/MassMessageJob.php b/MassMessageJob.php
index 79be647..5584a86 100644
--- a/MassMessageJob.php
+++ b/MassMessageJob.php
@@ -93,17 +93,29 @@
return true;
}
- // Mark the edit as bot
- $flags = $flags | EDIT_FORCE_BOT;
-
- $status = $talkPage->doEditContent(
- ContentHandler::makeContent( $text, $this->title ),
- $this->params['subject'],
- $flags,
- false,
- $user
- );
+ $this->editPage();
return $status->isGood();
}
+
+ function editPage() {
+ $api = new ApiMain(
+ new FauxRequest(
+ array(
+ 'action' => 'edit',
+ 'title' =>
$this->title->getFullText(),
+ 'section' => 'new',
+ 'summary' => $this->params['subject'],
+ 'text' => $this->params['message'],
+ 'notminor' => true,
+ 'bot' => true,
+ 'token' => '', // ???????
+ ),
+ true // was posted?
+ ),
+ true // enable write?
+ );
+
+ $api->execute();
+ }
}
--
To view, visit https://gerrit.wikimedia.org/r/75299
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib51f2f4a65a45d70e278c13c198733fd47bc3229
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MassMessage
Gerrit-Branch: master
Gerrit-Owner: Legoktm <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits