Commit graph

267 commits

Author SHA1 Message Date
umherirrender
b409008ca5 Remove wrong @return from doc blocks
These functions actually does not return anything, so the @return is
wrong here. '@return void' is ignored.

Change-Id: I11495ee05b943c16c1c4715d617c8b50de22276c
2014-08-25 13:50:05 +00:00
umherirrender
6b4c44c2db Add missing @param to function docs
Change-Id: Ib26407bc55dff7969d8a3b1e2ae51751b202d8fb
2014-08-18 16:24:59 +00:00
umherirrender
21e0c1c533 Correct variable names in @param to match method declarations
Some @param have a typo in the variable name,
some @param's were in wrong order.

Change-Id: Ie25806831027112b398f6f4a909c59147ac3a5fa
2014-08-13 21:48:28 +02:00
umherirrender
1c68a1ee86 Cleanup some docs (includes/*.php)
- Swap "$variable type" to "type $variable"
- Added missing types
- Fixed spacing inside docs
- Makes beginning of @param/@return/@var/@throws in capital
- Changed some types to match the more common spelling

Change-Id: I783e4dbfe5f6f98b32b9a03ccf6439e13e132bcc
2014-07-24 19:42:24 +02:00
umherirrender
5dffa8cb9a Each line in a doc block should start with *
Added missing * to some doc blocks

Change-Id: I0709f2e94b053437fa0f06bb67ae7ae4c248a618
2014-07-24 10:08:16 +02:00
umherirrender
53c420e278 Fixed spacing
- use tab as indent instead of spaces
- Added space after closures "function"
- Added spaces around string_concat
- Added newline inside empty blocks
- Removed four spaces after comma

Change-Id: I4425b0c6a69b36f40acfea6511b8950cf09ce2b2
2014-07-20 21:41:41 +02:00
Kunal Mehta
79edb56b2f Block: $row is a stdClass, not a ResultWrapper
Change-Id: I874d2fad32099aff05868680a6194b8d0d44fb23
2014-07-12 20:55:43 -07:00
Alexandre Emsenhuber
c915c406c1 Use the user from the context to format the date in Block::getPermissionsError()
Language::timeanddate() uses $wgUser to get the time correction and the
format to use.

Change-Id: I7dee3ae523d99aec7b36a317612a61376cf26d21
2014-07-08 22:13:01 +02:00
Brandon Black
e323bc3393 Speed up CIDR matching from $wgSquidServersNoPurge
This adds a new generic library class IPSet, which precomputes
a reasonably-efficient data structure from the input list of
addresses and CIDR net/mask specs for fast runtime matching,
and then uses it to check trusted XFF-setters.

See also: 32b4f19f173fc5cff1029eedee63a39a2d72dd3a
Bug: 57021
Change-Id: Ia3b12fb90c3e7e492374a128943b014481cc2730
2014-05-15 17:23:12 +00:00
Siebrand Mazeland
3f0a2a94c9 Make phpcs-strict pass on includes/ (6/~10)
Change-Id: I566183b5d660a55bb3b2aa7186aaed5355ead2c6
2014-05-12 16:46:52 +02:00
umherirrender
986eead588 Fixed some @params documentation (includes/[Block.php|Revision.php])
Swapped some "$var type" to "type $var" or added missing types
before the $var. Changed some other types to match the more common
spelling. Makes beginning of some text in captial.

Change-Id: Ie592d31e85651663e3b3e1aa4ee7c270d06d0c81
2014-04-23 11:25:56 +02:00
umherirrender
edc924869f Changed some comments from /// to /** @var */
Change-Id: I55b30099e4464c272c35bcabbddbb0b1364a5d65
2014-04-07 05:01:19 +00:00
umherirrender
23fab68274 Fix spacing after @param and friends in comments
Searched for:
\@(param|return|throws|since|deprecated|access|todo|var)[ \t]{2,}

Change-Id: Icce22ba9fe0635455691ca58d9872d618151f346
2014-04-05 20:02:29 +00:00
jenkins-bot
5b874eaa98 Merge "Try to make a dent in CodeSniffer reports on includes/ (1)" 2014-03-26 16:14:11 +00:00
umherirrender
9b38eebe0d [Regression] Delete autoblocks when removing autoblock flag
Since I5403f6e1d7f8f07273cd5da8068b928fdddcdfc9 on reblock the block
will be updated and not deleted/inserted and that update did not trigger
a delete of existing autoblocks.

Bug: 62748
Change-Id: I50384a41d819689944907e653e2495391253831b
2014-03-23 17:27:02 +01:00
Siebrand Mazeland
7a635c5dfd Try to make a dent in CodeSniffer reports on includes/ (1)
Change-Id: Iaf3120b4e32cc5835ef9ed86236d98679e2b87fa
2014-03-23 01:29:41 +00:00
jenkins-bot
5df5a5b4a8 Merge "Make autoblocks update with the parent block" 2014-01-31 18:59:09 +00:00
Siebrand Mazeland
5988bdee5d Remove methods in Block deprecated in 1.18
One use found in core or Gerrit extensions which was replaced.

* Block::clear() (deprecated in 1.18)
* Block::decodeExpiry() (deprecated in 1.18)
* Block::encodeExpiry() (deprecated in 1.18)
* Block::forUpdate() (deprecated in 1.18)
* Block::infinity() (deprecated in 1.18)
* Block::load() (deprecated in 1.18)
* Block::newFromDB() (deprecated in 1.18)
* Block::normaliseRange() (deprecated in 1.18)
* Block::parseExpiryInput() (deprecated in 1.18)

Change-Id: Ia8ea6b5248111326f929062346f3868a0550421b
2014-01-11 20:32:24 +01:00
Tyler Anthony Romeo
6040f3af90 Make autoblocks update with the parent block
Change SpecialBlock so that when a block already exists, it just updates
the existing block rather than deleting and inserting a new row. Also,
Block::update() was changed to update existing autoblocks with the new
block parameters.

Bug: 48813
Change-Id: I5403f6e1d7f8f07273cd5da8068b928fdddcdfc9
2014-01-03 04:06:52 -05:00
umherirrender
0bc583af2c Move closing parenthesis from multi line if and function to own line
The Line continuation Coding conventions prefers the closing parenthesis
on the same line than the beginning curly braces. This is done for ifs
and functions.
Also move some boolean operator from the end of a line to the beginning
and changed some indentation to make the condition hopefully better
readable.

Change-Id: Id0437b06bde86eb5a75bc59eefa19e7edb624426
2013-12-01 21:39:00 +01:00
umherirrender
5dbfd5bf80 Fixed spacing
- Removed trailing spaces in comments
- Removed multiple empty lines
- Removed space after object operator

Change-Id: I9fd3256ab490c7cd2034de3fd94e6be6e6d6d8f2
2013-11-21 18:52:25 +00:00
jenkins-bot
a98cef2118 Merge "copy paste comment should probably have end instead of start" 2013-06-30 21:46:11 +00:00
Carl Fürstenberg
8ffd46add1 copy paste comment should probably have end instead of start
Change-Id: I864e75da57e339f48b7b64191d956b000202bfdb
2013-06-23 03:02:33 +02:00
Kevin Israel
876bddf637 Change @since and @deprecated notes to 1.22
Using the following command line, I have found doc comments mentioning
"1.21" when they should mention "1.22" instead, which I have fixed
manually:

git diff REL1_21 | grep --color=always -C 10 -iE \
'^\+.*(since|deprecated).*1\.21(\D|$)' | aha > oldver.html

I also moved the release notes for I1987190f ("Combine JavaScript and
JSON encoding logic") from RELEASE-NOTES-1.21 to RELEASE-NOTES-1.22
because I had reverted the commit on REL1_21 only (see Id3b88102 and
bug 47431 for the rationale).

Change-Id: I11b917a371e07267dfa98b8449776d0c1cb29b15
Follows-Up: I25cf5a94f6e47f85a9d0b80cc1c9c9f957288478
Follows-Up: I3d72e4105f6244b0695116940e62a2ddef66eb66
Follows-Up: I3faa9c3e8107c6e46cdf21f8c18adda1f42890d7
Follows-Up: I6aab19c8d68bf47beddad42632b0360a7b12f251
Follows-Up: I86368821fc2cd0729df5342b8572eb470c0f77a0
Follows-Up: Id3b88102e768318e3605a19e9952121091a40915
Follows-Up: Ie667088010e24eb6cb569f9e8e8e2553005223eb
2013-06-21 05:33:22 +00:00
Timo Tijhof
4bd5471ca3 docs: Remove odd colons after @todo
Most were this way already:
https://doc.wikimedia.org/mediawiki-core/master/php/html/todo.html

Ran a find/replace on the odd ones. Also made them all
lower case.

Change-Id: I70c6a69344ddebc603e9a1c1d87e3cc4f4f4c560
2013-05-15 06:23:40 +00:00
umherirrender
9f14ecf829 Added space after switch/Removed spaces after unset
While at it, added/removed some other spaces in the same files

Change-Id: I84d8001aa123a008807ad5eb76f396aed7c899a4
2013-04-26 16:42:31 +02:00
Kevin Israel
47d1060398 Remove is_numeric check from Title::checkUserBlock
This should allow the usernames of administrators such as "7"
to show correctly on permissions error pages.

I extracted the working code from UserBlockedError::__construct
into a separate method Block::getPermissionsError, called from
both places with context provided as an argument.

Additional changes to get the test suite to pass are included.

Bug: 46768
Change-Id: I49d973992a99e03b4e8de112b47b737037a85338
2013-04-24 01:05:23 +00:00
umherirrender
ef2f507d23 Fixed spacing in files direct in includes folder
Added spaces before if, foreach
Added some braces for one line statements

Change-Id: Ibb8dd102db045522d12ff939075ba7420d95ab6b
2013-04-21 06:38:49 +00:00
Aaron Schulz
4738bc315a Moved Block and Title purgeExpired() functions to onTransactionIdle().
Change-Id: I82b2f4689a42481cd2a476351354f55ded581ff5
2013-04-18 22:53:28 +00:00
Timo Tijhof
acb292d733 phpcs: Fix Squiz.WhiteSpace.ScopeClosingBrace.ContentBefore violations
ERROR: Closing brace must be on a line by itself
Squiz.WhiteSpace.ScopeClosingBrace.ContentBefore

- For non-empty scopes it means the closing brace must be on a separate
  line. This is already the case in most classes in some cases the "lazy
  closing" is still used.
  array(
   'x' ); // Moved } to next line
  function () { return 'x'; } // Moved } to next line
  case 1:
    stuff; break; // Moved break to next line
- For empty function it serves as a visual distinction between there not
  being a scope block / function body and there being an empty function
  body.
  function foo(); // No body
  function foo() {} // Empty body - violation
  function bar() { // Empty body corrected
  }

Change-Id: I0310ec379c6d41cc7d483671994d027a49f32164
2013-04-11 07:34:41 +00:00
Hashar
572ee81c0b Revert "Remove is_numeric check from Title::checkUserBlock"
Breaks unit testing (see bug 47031). The commit managed to land in
the branch because of a bug in Jenkins (bug 46723).

This reverts commit 8cc0b601aa

Change-Id: I4b3fadccaae9c35964a0c47d63b22c4f35148a24
2013-04-09 08:20:12 +00:00
Kevin Israel
8cc0b601aa Remove is_numeric check from Title::checkUserBlock
This should allow the usernames of administrators such as "7"
to show correctly on permissions error pages.

I extracted the working code from UserBlockedError::__construct
into a separate method Block::getPermissionsError, called from
both places with context provided as an argument.

Bug: 46768
Change-Id: Ic3fa926a5a4c109faff35fffbccb60fb06ea4a18
2013-04-09 02:40:35 +00:00
umherirrender
978bb31c5e Add missing wfProfileOut before throwing an exception
Change-Id: I1d830da0597f19efd0b2ae48642389975e736e23
2013-04-08 18:37:24 +00:00
Skizzerz
d99bda6ee6 Apply IP blocks to X-Forwarded-For header
Adds a new configuration variable ($wgApplyIpBlocksToXff), which when
enabled will scan the XFF header for IP addresses and check if any of
them have been blocked. $wgApplyIpBlocksToXff is disabled by default.

Bug: 23343
Change-Id: I3faa9c3e8107c6e46cdf21f8c18adda1f42890d7
2013-03-30 05:51:46 -07:00
Aaron Schulz
4ba66e41b5 Revert "Apply IP blocks to X-Forwarded-For header"
Test are now starting to fail for everything.

This reverts commit a5d70e3ae6

Change-Id: I30c9eb9c00be12ff080e85452e17c2a310f03bd3
2013-03-29 19:13:35 +00:00
Skizzerz
a5d70e3ae6 Apply IP blocks to X-Forwarded-For header
Adds a new configuration variable ($wgApplyIpBlocksToXff), which when
enabled will scan the XFF header for IP addresses and check if any of
them have been blocked. $wgApplyIpBlocksToXff is disabled by default.

Bug: 23343
Change-Id: I3e38b94d10600a60d2d4857de54307f34c4662c4
2013-03-29 11:29:17 -07:00
Yuri Astrakhan
9506e3d812 Spellchecked /includes directory
* Ran spell-checker over code comments in /includes/
* A few spellchecking fixes for wfDebug() calls

Found one very strange (NOOP?) line in Linker.php - see "TODO: BUG?"

Change-Id: Ibb86b51073b980eda9ecce2cf0b8dd33f058adbf
2013-03-13 03:42:41 -04:00
Tyler Anthony Romeo
4dcc7961df Fixed @param tags to conform with Doxygen format.
Doxygen expects parameter types to come before the
parameter name in @param tags. Used a quick regex
to switch everything around where possible. This
only fixes cases where a primitve variable (or a
primitive followed by other types) is the variable
type. Other cases will need to be fixed manually.

Change-Id: Ic59fd20856eb0489d70f3469a56ebce0efb3db13
2013-03-11 13:15:01 -04:00
umherirrender
d63121016d fix some spacing
Added/removed spaces around logical/arithmetic operator
Reduced multiple empty lines to one empty line
Removed wrong tabs before comments at end of line
Removed too many spaces in assigments

Change-Id: I2bba4e72f9b5f88c53324d7b70e6042f1aad8f6b
2013-03-07 17:53:21 +01:00
umherirrender
1044b0b8df fix some spacing
Change-Id: I8f976013f33c5818e4402604fe8610aa3f43b0c6
2013-02-04 20:18:33 +00:00
umherirrender
6fbbbd17ca fix some spacing
Change-Id: Ie7bb35871cc99237f3a655f7db22ca1f0646df5e
2013-01-27 14:21:50 +01:00
Liangent
2fff677ca9 Disable template expansion in message <autoblocker>.
Sometimes sysops put template calls in block messages and they will be
expanded in the <blockedtext> interface. However in corresponding
autoblocks, template calls get expanded to long strings and truncated.

Change-Id: I3150192ec8c95d2e4807f058a855856e467145de
2013-01-18 11:07:36 +00:00
Aaron Schulz
8feda3a26f Made Block::purgeExpired() check for read-only mode.
Change-Id: Ida4f82b8e17a0f7ba872e46fd8a4c87831e5254f
2013-01-17 14:25:55 -08:00
Aaron Schulz
e478e48810 Merge "Make Block::newFromTarget() work again when passing only a vague target" 2013-01-11 23:39:17 +00:00
Alexandre Emsenhuber
323480faaa 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
2013-01-11 11:30:21 +01:00
Alexandre Emsenhuber
d85239a186 Use ResultWrapper::numRows() instead of DatabaseBase::numRows()
Change-Id: I87f059aaff72bf06ebc72ad3a7904cca8e11fab9
2013-01-06 11:52:40 +01:00
umherirrender
8b948fc6e6 recentchanges.rc_ip is used for retroactive autoblocks
Document this at $wgPutIPinRC and check the global explicit

Change-Id: I5a796edc855ae954ebd0fb11fe54b486e5eff7ed
2013-01-04 20:58:00 +01:00
Alexandre Emsenhuber
d4716689d1 Block::parseTarget() accepts and can return null
Documentation currently omits this.

Change-Id: I183121e5134c1bbd53a613780d171b52737f071d
2013-01-03 11:53:41 +01:00
Antoine Musso
cb60d72be1 misc style fix
* makes booleans lower case
* add spaces before open braces

Change-Id: Id88884e08bc23d7730361ee91646f54f5e16920b
2012-12-20 16:09:25 +01:00
umherirrender
82375631c2 Fix tabs inside/between statements/text
This tabs are strange and a space there is better

Change-Id: I0885dff575ee2fcd0668d08fef3226e132c5b319
2012-10-26 18:18:59 +02:00