dépôts
/
lhc
/
web
/
wiklou.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
(from parent 1:
3082005
)
Merge "Setup: Avoid using count() function in any kind of loop(s)"
author
jenkins-bot
<jenkins-bot@gerrit.wikimedia.org>
Wed, 16 Jan 2019 07:04:36 +0000
(07:04 +0000)
committer
Gerrit Code Review
<gerrit@wikimedia.org>
Wed, 16 Jan 2019 07:04:36 +0000
(07:04 +0000)
includes/Setup.php
patch
|
blob
|
history
diff --git
a/includes/Setup.php
b/includes/Setup.php
index
aba050d
..
61fad2d
100644
(file)
--- a/
includes/Setup.php
+++ b/
includes/Setup.php
@@
-367,10
+367,9
@@
if ( $wgRCFilterByAge ) {
// Note that we allow 1 link higher than the max for things like 56 days but a 60 day link.
sort( $wgRCLinkDays );
- // phpcs:ignore Generic.CodeAnalysis.ForLoopWithTestFunctionCall
- for ( $i = 0; $i < count( $wgRCLinkDays ); $i++ ) {
- if ( $wgRCLinkDays[$i] >= $rcMaxAgeDays ) {
- $wgRCLinkDays = array_slice( $wgRCLinkDays, 0, $i + 1, false );
+ foreach ( $wgRCLinkDays as $i => $days ) {
+ if ( $days >= $rcMaxAgeDays ) {
+ array_splice( $wgRCLinkDays, $i + 1 );
break;
}
}