Though getOutput() is what first came to mind, I do not particularly
like the name, partly because it is used in many, many places as a
method that returns an OutputPage object.
* Renamed the method to __toString(). This is appropriate because
each instance, at any given time, corresponds to a single string
value (and exceptions cannot occur during this conversion).
* Removed unnecessary variables from ApiQuery and ExportTest. In
these and most other cases, it should no longer be necessary to
call getOutput() explicitly.
Change-Id: Icf202743d1f332f8981338f42eb6e3e5a04abdf1
$exporter->pageByTitle( $title );
}
$exporter->closeStream();
$exporter->pageByTitle( $title );
}
$exporter->closeStream();
- $exportxml = $sink->getOutput();
// Don't check the size of exported stuff
// It's not continuable, so it would cause more
// Don't check the size of exported stuff
// It's not continuable, so it would cause more
if ( $this->mParams['exportnowrap'] ) {
$result->reset();
// Raw formatter will handle this
if ( $this->mParams['exportnowrap'] ) {
$result->reset();
// Raw formatter will handle this
- $result->addValue( null, 'text', $exportxml, ApiResult::NO_SIZE_CHECK );
+ $result->addValue( null, 'text', $sink, ApiResult::NO_SIZE_CHECK );
$result->addValue( null, 'mime', 'text/xml', ApiResult::NO_SIZE_CHECK );
} else {
$result->addValue( null, 'mime', 'text/xml', ApiResult::NO_SIZE_CHECK );
} else {
- $result->addValue( 'query', 'export', $exportxml, ApiResult::NO_SIZE_CHECK );
+ $result->addValue( 'query', 'export', $sink, ApiResult::NO_SIZE_CHECK );
$result->addValue( 'query', ApiResult::META_BC_SUBELEMENTS, [ 'export' ] );
}
}
$result->addValue( 'query', ApiResult::META_BC_SUBELEMENTS, [ 'export' ] );
}
}
- public function getOutput() {
+ public function __toString() {
return $this->output;
}
}
return $this->output;
}
}
$exporter->openStream();
$exporter->pageByTitle( $title );
$exporter->closeStream();
$exporter->openStream();
$exporter->pageByTitle( $title );
$exporter->closeStream();
- $xmlString = $sink->getOutput();
// This throws error if invalid xml output
// This throws error if invalid xml output
- $xmlObject = simplexml_load_string( $xmlString );
+ $xmlObject = simplexml_load_string( $sink );
/**
* Check namespaces match xml
/**
* Check namespaces match xml