On 14-04-17 11:58 AM, Daniel Barrett wrote:
What is the proper way to make an empty edit of an existing article programmatically, in a maintenance script? I tried this:
$title = Title::newFromText("My existing article name"); // succeeds
$wikiPage = new WikiPage($title); // succeeds
$wikiPage->doEditContent($wikiPage->getContent(Revision::RAW), '');
but doEditContent just sits there until I get "limit.sh: timed out" in my shell. I can do an empty edit through the browser (click Edit, click Save) just fine.
I do the following in my calendar extension:
<?php $dbw = wfGetDb( DB_MASTER );
$revision = Revision::newNullRevision( $dbw, $articleId, $details, true );
if( $revision ) { $revision->insertOn( $dbw ); }
$dbw->commit(); ?>
HTH!
Cheers, Rob.