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:
Thiemo Kreuz 2018-12-17 11:46:02 +01:00
parent e8eb80eec3
commit 8d7fc8c66a

View file

@ -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"
: '';