mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-27 17:20:40 +00:00
Avoid expensive array_shift where possible
array_shift manipulates the original array. This is surprisingly expensive, because it iterates *all* elements in the array and decrements numeric keys. The code touched in this patch does not need this restructured new array, but only the individual elements. Change-Id: I166fdbe199400611a21cbd608dd3e177336c8fd5
This commit is contained in:
parent
e8eb80eec3
commit
8d7fc8c66a
|
@ -66,7 +66,7 @@ class TestDiscussionParser extends Maintenance {
|
|||
|
||||
$newData = unserialize( $newData );
|
||||
|
||||
$pageData = array_shift( $newData['query']['pages'] );
|
||||
$pageData = reset( $newData['query']['pages'] );
|
||||
$oldText = isset( $pageData['revisions'][1] )
|
||||
? trim( $pageData['revisions'][1]['*'] ) . "\n"
|
||||
: '';
|
||||
|
|
Loading…
Reference in a new issue