if ( !$revIds ) {
return $revLens; // empty
}
- wfProfileIn( __METHOD__ );
$res = $db->select( 'revision',
array( 'rev_id', 'rev_len' ),
array( 'rev_id' => $revIds ),
foreach ( $res as $row ) {
$revLens[$row->rev_id] = $row->rev_len;
}
- wfProfileOut( __METHOD__ );
return $revLens;
}
$format = $this->getContentFormat();
$this->mContent = $handler->unserializeContent( $this->mText, $format );
- } else {
- $this->mContent = false; // negative caching!
}
}
* @return string Text the text requested or false on failure
*/
public static function getRevisionText( $row, $prefix = 'old_', $wiki = false ) {
- wfProfileIn( __METHOD__ );
# Get data
$textField = $prefix . 'text';
if ( isset( $row->$textField ) ) {
$text = $row->$textField;
} else {
- wfProfileOut( __METHOD__ );
return false;
}
$url = $text;
$parts = explode( '://', $url, 2 );
if ( count( $parts ) == 1 || $parts[1] == '' ) {
- wfProfileOut( __METHOD__ );
return false;
}
$text = ExternalStore::fetchFromURL( $url, array( 'wiki' => $wiki ) );
if ( $text !== false ) {
$text = self::decompressRevisionText( $text, $flags );
}
- wfProfileOut( __METHOD__ );
return $text;
}
public function insertOn( $dbw ) {
global $wgDefaultExternalStore, $wgContentHandlerUseDB;
- wfProfileIn( __METHOD__ );
-
$this->checkContentModel();
$data = $this->mText;
// Store and get the URL
$data = ExternalStore::insertToDefault( $data );
if ( !$data ) {
- wfProfileOut( __METHOD__ );
throw new MWException( "Unable to store text to external storage" );
}
if ( $flags ) {
$title = $this->getTitle();
if ( $title === null ) {
- wfProfileOut( __METHOD__ );
throw new MWException( "Insufficient information to determine the title of the "
. "revision's page!" );
}
$this->mId = $rev_id !== null ? $rev_id : $dbw->insertId();
- wfRunHooks( 'RevisionInsertComplete', array( &$this, $data, $flags ) );
+ Hooks::run( 'RevisionInsertComplete', array( &$this, $data, $flags ) );
- wfProfileOut( __METHOD__ );
return $this->mId;
}
* @return string|bool The revision's text, or false on failure
*/
protected function loadText() {
- wfProfileIn( __METHOD__ );
// Caching may be beneficial for massive use of external storage
global $wgRevisionCacheExpiry, $wgMemc;
$text = $wgMemc->get( $key );
if ( is_string( $text ) ) {
wfDebug( __METHOD__ . ": got id $textId from cache\n" );
- wfProfileOut( __METHOD__ );
return $text;
}
}
$wgMemc->set( $key, $text, $wgRevisionCacheExpiry );
}
- wfProfileOut( __METHOD__ );
-
return $text;
}
public static function newNullRevision( $dbw, $pageId, $summary, $minor, $user = null ) {
global $wgContentHandlerUseDB;
- wfProfileIn( __METHOD__ );
-
$fields = array( 'page_latest', 'page_namespace', 'page_title',
'rev_text_id', 'rev_len', 'rev_sha1' );
$revision = null;
}
- wfProfileOut( __METHOD__ );
return $revision;
}