Further cleanup for core API change

PS25 and later changed things around a fair bit, meaning the previous update
needs some further updating. In some cases additional cleanup is also necessary
for future core API changes.

Bug: T96595
Change-Id: Iaac674f77079d29d42813fd69620bdce8905730f
This commit is contained in:
Brad Jorsch 2015-04-20 14:41:29 -04:00
parent 5cf9798adb
commit ccd2091f5d
2 changed files with 14 additions and 11 deletions

View file

@ -199,9 +199,10 @@ class ApiVisualEditor extends ApiBase {
);
$api->execute();
if ( defined( 'ApiResult::META_CONTENT' ) ) {
$result = $api->getResult()->getResultData();
// Transform content nodes to '*'
$result = ApiResult::transformForBC( $result );
$result = $api->getResult()->getResultData( null, array(
'BC' => array(), // Transform content nodes to '*'
'Types' => array(), // Add back-compat subelements
) );
} else {
$result = $api->getResultData();
}
@ -246,9 +247,11 @@ class ApiVisualEditor extends ApiBase {
$api->execute();
if ( defined( 'ApiResult::META_CONTENT' ) ) {
$result = $api->getResult()->getResultData();
// Remove any metadata keys from the langlinks array
$result = ApiResult::removeMetadata( $result );
$result = $api->getResult()->getResultData( null, array(
'BC' => array(), // Backwards-compatible structure transformations
'Types' => array(), // Backwards-compatible structure transformations
'Strip' => 'all', // Remove any metadata keys from the langlinks array
) );
} else {
$result = $api->getResultData();
}

View file

@ -78,11 +78,11 @@ class ApiVisualEditorEdit extends ApiVisualEditor {
$api->execute();
if ( defined( 'ApiResult::META_CONTENT' ) ) {
$result = $api->getResult()->getResultData();
// Transform content nodes to '*'
$result = ApiResult::transformForBC( $result );
// Remove any metadata keys from the links array
$result = ApiResult::removeMetadata( $result );
$result = $api->getResult()->getResultData( null, array(
'BC' => array(), // Transform content nodes to '*'
'Types' => array(), // Add back-compat subelements
'Strip' => 'all', // Remove any metadata keys from the links array
) );
} else {
$result = $api->getResultData();
}