* @param bool $showCacheHint whether to show a message telling the user to clear the browser cache (default: true).
*/
protected function showCssOrJsPage( $showCacheHint = true ) {
+ $outputPage = $this->getContext()->getOutput();
+
if ( $showCacheHint ) {
$dir = $this->getContext()->getLanguage()->getDir();
$lang = $this->getContext()->getLanguage()->getCode();
- $outputPage = $this->getContext()->getOutput();
$outputPage->wrapWikiMsg( "<div id='mw-clearyourcache' lang='$lang' dir='$dir' class='mw-content-$dir'>\n$1\n</div>",
'clearyourcache' );
}
// Give hooks a chance to customise the output
- if ( ContentHandler::runLegacyHooks( 'ShowRawCssJs', array( $this->fetchContentObject(), $this->getTitle(), $wgOut ) ) ) {
+ if ( ContentHandler::runLegacyHooks( 'ShowRawCssJs', array( $this->fetchContentObject(), $this->getTitle(), $outputPage ) ) ) {
$po = $this->mContentObject->getParserOutput( $this->getTitle() );
- $wgOut->addHTML( $po->getText() );
+ $outputPage->addHTML( $po->getText() );
}
}
* @param $flags Integer Bitfield (optional)
* @return Revision or null
*/
- public static function newFromPageId( $pageId, $revId = 0, $flags = null ) {
+ public static function newFromPageId( $pageId, $revId = 0, $flags = 0 ) {
$conds = array( 'page_id' => $pageId );
if ( $revId ) {
$conds['rev_id'] = $revId;
} else {
// Use a join to get the latest revision
$conds[] = 'rev_id = page_latest';
- // Callers assume this will be up-to-date
- $flags = is_int( $flags ) ? $flags : self::READ_LATEST; // b/c
}
return self::newFromConds( $conds, (int)$flags );
}
}
if ( $warn ) {
- wfWarn( "Using obsolete hook $event via ContentHandler::runLegacyHooks()", 2 );
+ // Log information about which handlers are registered for the legacy hook,
+ // so we can find and fix them.
+
+ $handlers = Hooks::getHandlers( $event );
+ $handlerInfo = array();
+
+ wfSuppressWarnings();
+
+ foreach ( $handlers as $handler ) {
+ $info = '';
+
+ if ( is_array( $handler ) ) {
+ if ( is_object( $handler[0] ) ) {
+ $info = get_class( $handler[0] );
+ } else {
+ $info = $handler[0];
+ }
+
+ if ( isset( $handler[1] ) ) {
+ $info .= '::' . $handler[1];
+ }
+ } else if ( is_object( $handler ) ) {
+ $info = get_class( $handler[0] );
+ $info .= '::on' . $event;
+ } else {
+ $info = $handler;
+ }
+
+ $handlerInfo[] = $info;
+ }
+
+ wfRestoreWarnings();
+
+ wfWarn( "Using obsolete hook $event via ContentHandler::runLegacyHooks()! Handlers: " . implode(', ', $handlerInfo), 2 );
}
// convert Content objects to text
*/
public function bind( $object ) {
if ( is_object( $object ) ) {
+ if ( !isset( $object->tempFSFileReferences ) ) {
+ // Init first since $object might use __get() and return only a copy variable
+ $object->tempFSFileReferences = array();
+ }
$object->tempFSFileReferences[] = $this;
}
}
$this->assertNotEquals( false, $contents, "Local copy of $source exists ($backendName)." );
$this->assertEquals( $content[0], $contents, "Local copy of $source is correct ($backendName)." );
}
+
+ $obj = new stdClass();
+ $tmpFile->bind( $obj );
}
function provider_testGetLocalCopy() {