public function getContentModelName() {
if ( $this->exists() ) {
# look at the revision's actual content model
- $content = $this->getContent();
- return $content->getModelName();
+ $rev = $this->getRevision();
+ return $rev->getContentModelName();
} else {
# use the default model for this page
return $this->mTitle->getContentModelName();
if ( $this->mLastRevision ) {
return $this->mLastRevision->getContent( $audience );
}
- return false;
+ return null;
}
/**
if ( $txt !== $content_text ) {
# if the text changed, unserialize the new version to create an updated Content object.
- $content = $content->getContentHandler()->unserialize( $txt );
+ $content = $content->getContentHandler()->unserializeContent( $txt );
}
}
$edit->format = $serialization_format;
$edit->popts = $this->makeParserOptions( 'canonical' );
- $edit->output = $edit->pstContent->getParserOutput( $this->mTitle, $revid, $edit->popts );
+
+ // TODO: is there no better way to obtain a context here?
+ $context = RequestContext::getMain();
+ $context->setTitle( $this->mTitle );
+ $edit->output = $edit->pstContent->getParserOutput( $context, $revid, $edit->popts );
$edit->newContent = $content;
$edit->oldContent = $this->getContent( Revision::RAW );
}
# Update the links tables and other secondary data
- $updates = $editInfo->output->getLinksUpdateAndOtherUpdates( $this->mTitle );
+ $updates = $editInfo->output->getSecondaryDataUpdates( $this->mTitle );
SecondaryDataUpdate::runUpdates( $updates );
wfRunHooks( 'ArticleEditUpdates', array( &$this, &$editInfo, $options['changed'] ) );
$this->updateCategoryCounts( array(), $cats );
+ #TODO: move this to an Update object!
+
# If using cascading deletes, we can skip some explicit deletes
if ( !$dbw->cascadingDeletes() ) {
$dbw->delete( 'revision', array( 'rev_page' => $id ), __METHOD__ );
# NOTE: stub for backwards-compatibility. assumes the given text is wikitext. will break horribly if it isn't.
$handler = ContentHandler::getForModelName( CONTENT_MODEL_WIKITEXT );
- $oldContent = $oldtext ? $handler->unserialize( $oldtext ) : null;
- $newContent = $newtext ? $handler->unserialize( $newtext ) : null;
+ $oldContent = $oldtext ? $handler->unserializeContent( $oldtext ) : null;
+ $newContent = $newtext ? $handler->unserializeContent( $newtext ) : null;
return $handler->getAutosummary( $oldContent, $newContent, $flags );
}
}
$time = - microtime( true );
- $this->parserOutput = $content->getParserOutput( $this->page->getTitle(), $this->revid, $this->parserOptions );
+ // TODO: page might not have this method? Hard to tell what page is supposed to be here...
+ $this->parserOutput = $content->getParserOutput( $this->page->getContext(), $this->revid, $this->parserOptions );
$time += microtime( true );
# Timing hack