/**
* setMeta and getMeta currently aren't used for anything, I just thought
* they might be useful in the future.
- * @param string $meta a single string
+ * @param $meta String: a single string.
*/
function setMeta( $meta ) {}
*/
function addItem() {}
- /**
+ /**
* Get item by hash
*/
function getItem( $hash ) {}
-
+
# Set the "default text"
# This concept is an odd property of the current DB schema, whereby each text item has a revision
- # associated with it. The default text is the text of the associated revision. There may, however,
+ # associated with it. The default text is the text of the associated revision. There may, however,
# be other revisions in the same object
function setText() {}
function ConcatenatedGzipHistoryBlob() {
if ( !function_exists( 'gzdeflate' ) ) {
- die( "Need zlib support to read or write this kind of history object (ConcatenatedGzipHistoryBlob)\n" );
+ throw new MWException( "Need zlib support to read or write this kind of history object (ConcatenatedGzipHistoryBlob)\n" );
}
}
}
/** @todo document */
- function uncompress() {
+ function uncompress() {
if ( $this->mCompressed ) {
$this->mItems = unserialize( gzinflate( $this->mItems ) );
$this->mCompressed = false;
* @package MediaWiki
*/
class HistoryBlobStub {
- var $mOldId, $mHash;
+ var $mOldId, $mHash, $mRef;
/** @todo document */
function HistoryBlobStub( $hash = '', $oldid = 0 ) {
$this->mHash = $hash;
}
-
+
/**
* Sets the location (old_id) of the main object to which this object
* points
$this->mOldId = $id;
}
+ /**
+ * Sets the location (old_id) of the referring object
+ */
+ function setReferrer( $id ) {
+ $this->mRef = $id;
+ }
+
+ /**
+ * Gets the location of the referring object
+ */
+ function getReferrer() {
+ return $this->mRef;
+ }
+
/** @todo document */
function getText() {
+ $fname = 'HistoryBlob::getText';
global $wgBlobCache;
if( isset( $wgBlobCache[$this->mOldId] ) ) {
$obj = $wgBlobCache[$this->mOldId];
return false;
}
$flags = explode( ',', $row->old_flags );
+ if( in_array( 'external', $flags ) ) {
+ $url=$row->old_text;
+ @list($proto,$path)=explode('://',$url,2);
+ if ($path=="") {
+ wfProfileOut( $fname );
+ return false;
+ }
+ require_once('ExternalStore.php');
+ $row->old_text=ExternalStore::fetchFromUrl($url);
+
+ }
if( !in_array( 'object', $flags ) ) {
return false;
}
-
+
if( in_array( 'gzip', $flags ) ) {
// This shouldn't happen, but a bug in the compress script
// may at times gzip-compress a HistoryBlob object row.
} else {
$obj = unserialize( $row->old_text );
}
-
+
if( !is_object( $obj ) ) {
// Correct for old double-serialization bug.
$obj = unserialize( $obj );
}
-
+
// Save this item for reference; if pulling many
// items in a row we'll likely use it again.
$obj->uncompress();
function HistoryBlobCurStub( $curid = 0 ) {
$this->mCurId = $curid;
}
-
+
/**
* Sets the location (cur_id) of the main object to which this object
* points