+ protected function getContentInternal() {
+ if( is_null( $this->mContent ) ) {
+ // Revision is immutable. Load on demand:
+
+ $handler = $this->getContentHandler();
+ $format = $this->getContentFormat();
+
+ if( is_null( $this->mText ) ) {
+ // Load text on demand:
+ $this->mText = $this->loadText();
+ }
+
+ $this->mContent = $handler->unserialize( $this->mText, $format );
+ }
+
+ return $this->mContent;
+ }
+
+ public function getContentModelName() {
+ if ( !$this->mContentModelName ) {
+ $title = $this->getTitle(); #XXX: never null?
+ $this->mContentModelName = $title->getContentModelName();
+ }
+
+ return $this->mContentModelName;
+ }
+
+ public function getContentFormat() {
+ if ( !$this->mContentFormat ) {
+ $handler = $this->getContentHandler();
+ $this->mContentFormat = $handler->getDefaultFormat();
+ }
+
+ return $this->mContentFormat;
+ }
+
+ public function getContentHandler() {
+ if ( !$this->mContentHandler ) {
+ $m = $this->getModelName();
+ $this->mContentHandler = ContentHandler::getForModelName( $m );
+
+ #XXX: do we need to verify that mContentHandler supports mContentFormat?
+ # otherwise, a fixed content format may cause problems on insert.
+ }
+
+ return $this->mContentHandler;
+ }
+