From a24ce453a08452531d009d1908553b2453c2e309 Mon Sep 17 00:00:00 2001 From: Greg Sabino Mullane Date: Wed, 5 Jul 2006 03:56:48 +0000 Subject: [PATCH] Add decodeBlob() function to complement encodeBlob() --- includes/BagOStuff.php | 9 ++++++++- includes/Database.php | 4 ++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/includes/BagOStuff.php b/includes/BagOStuff.php index 7585088edd..182756ab93 100644 --- a/includes/BagOStuff.php +++ b/includes/BagOStuff.php @@ -231,7 +231,7 @@ abstract class SqlBagOStuff extends BagOStuff { } if($row=$this->_fetchobject($res)) { $this->_debug("get: retrieved data; exp time is " . $row->exptime); - return $this->_unserialize($row->value); + return $this->_unserialize($this->_blobdecode($row->value)); } else { $this->_debug('get: no matching rows'); } @@ -291,6 +291,9 @@ abstract class SqlBagOStuff extends BagOStuff { function _blobencode($str) { return $str; } + function _blobdecode($str) { + return $str; + } abstract function _doinsert($table, $vals); abstract function _doquery($sql); @@ -408,6 +411,10 @@ class MediaWikiBagOStuff extends SqlBagOStuff { $dbw =& wfGetDB( DB_MASTER ); return $dbw->encodeBlob($s); } + function _blobdecode($s) { + $dbw =& wfGetDB( DB_MASTER ); + return $dbw->decodeBlob($s); + } function getTableName() { if ( !$this->tableInitialised ) { $dbw =& wfGetDB( DB_MASTER ); diff --git a/includes/Database.php b/includes/Database.php index 65ccd58f0b..f8e579b481 100644 --- a/includes/Database.php +++ b/includes/Database.php @@ -1854,6 +1854,10 @@ class Database { return $b; } + function decodeBlob($b) { + return $b; + } + /** * Read and execute SQL commands from a file. * Returns true on success, error string on failure -- 2.20.1