r108938 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r108937‎ | r108938 | r108939 >
Date:19:35, 14 January 2012
Author:robin
Status:resolved (Comments)
Tags:
Comment:
(Bug 33553) Babel AutoCreate should not be able to create categories it is not allowed to create (protected titles)
Modified paths:
  • /trunk/extensions/Babel/BabelAutoCreate.class.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Babel/BabelAutoCreate.class.php
@@ -39,7 +39,6 @@
4040 } else {
4141 $text = wfMsgForContent( 'babel-autocreate-text-levels', $level, $language, $code );
4242 }
43 - $article = new Article( $title, 0 );
4443
4544 $user = self::user();
4645 # Do not add a message if the username is invalid or if the account that adds it, is blocked
@@ -48,6 +47,11 @@
4948 }
5049
5150
 51+ $article = new Article( $title, 0 );
 52+ if( !$article->getTitle()->quickUserCan( 'create', $user ) ) {
 53+ return; # The Babel AutoCreate account is not allowed to create the page
 54+ }
 55+
5256 /* $article->doEdit will call $wgParser->parse.
5357 * Calling Parser::parse recursively is baaaadd... (bug 29245)
5458 * @todo FIXME: surely there is a better way?
@@ -56,7 +60,6 @@
5761 $oldParser = $wgParser;
5862 $parserClass = $wgParserConf['class'];
5963 $wgParser = new $parserClass( $wgParserConf );
60 -
6164 $article->doEdit(
6265 $text,
6366 wfMsgForContent( 'babel-autocreate-reason', wfMsgForContent( 'babel-url' ) ),

Follow-up revisions

RevisionCommit summaryAuthorDate
r109205Followup r108938, don't create an article object to just get the title out again...reedy20:07, 17 January 2012

Comments

#Comment by Nikerabbit (talk | contribs)   09:22, 15 January 2012

Why are you asking the title from Article when you just used $title to create Article object?

#Comment by SPQRobin (talk | contribs)   17:57, 15 January 2012

No special reason.. it doesn't make any difference I suppose

#Comment by Krinkle (talk | contribs)   02:19, 27 February 2012

This wasn't merged yet (I see no follow-ups). If that is the case, do we still need it? 1.19 was branched after this so it'll be in 1.19.0 and already is in 1.19wmf1. Untagging for now, feel free to re-tag.

#Comment by SPQRobin (talk | contribs)   13:13, 27 February 2012

Now that it's in 1.19wmf1 (and actually deployed on most wikis), it doesn't need to be in 1.18wmf1 anymore, so it's okay.

Status & tagging log