Make Block::newFromTarget() work again when passing only a vague target
authorAlexandre Emsenhuber <ialex.wiki@gmail.com>
Fri, 11 Jan 2013 10:30:21 +0000 (11:30 +0100)
committerAlexandre Emsenhuber <ialex.wiki@gmail.com>
Fri, 11 Jan 2013 10:30:21 +0000 (11:30 +0100)
commit323480faaa2c76db8470165db5638c419bde45d4
tree505f04284f5e182d75f632dde8429fa9d4129ab0
parente500a2e6c6e9bab7d79f8743ac625adc8c157491
Make Block::newFromTarget() work again when passing only a vague target

Since SVN r106354 (85ee2d2d), when passing null or an invalid block target
to Block::newFromTarget(), it was never returning any block, even if the
vague target would have matched one.

This broke two features of core MediaWiki:
- Excluding user and user talk pages of blocked users from being indexed,
  the feature that actually caused bug 33101 and the revision mentionned above
- Blocking of account creation when both the user and its IP address are blocked,
  but of only the IP address blocks prevents account creation (bug 13611)
And maybe some others in extensions, I didn't check that.

This changes reverts part of r106354 to make Block::newFromTarget() work again
in that case and changed Article::getRobotPolicy() to pass the user to be checked
as vague target only when it's an IP address and as specific target otherwise.

Change-Id: Ie7e16e0bae8c4326d16cca237877693f7b474a01
includes/Article.php
includes/Block.php