Add decodeBlob() function to complement encodeBlob()
authorGreg Sabino Mullane <greg@users.mediawiki.org>
Wed, 5 Jul 2006 03:56:48 +0000 (03:56 +0000)
committerGreg Sabino Mullane <greg@users.mediawiki.org>
Wed, 5 Jul 2006 03:56:48 +0000 (03:56 +0000)
includes/BagOStuff.php
includes/Database.php

index 7585088..182756a 100644 (file)
@@ -231,7 +231,7 @@ abstract class SqlBagOStuff extends BagOStuff {
                }
                if($row=$this->_fetchobject($res)) {
                        $this->_debug("get: retrieved data; exp time is " . $row->exptime);
                }
                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');
                }
                } else {
                        $this->_debug('get: no matching rows');
                }
@@ -291,6 +291,9 @@ abstract class SqlBagOStuff extends BagOStuff {
        function _blobencode($str) {
                return $str;
        }
        function _blobencode($str) {
                return $str;
        }
+       function _blobdecode($str) {
+               return $str;
+       }
 
        abstract function _doinsert($table, $vals);
        abstract function _doquery($sql);
 
        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);
        }
                $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 );
        function getTableName() {
                if ( !$this->tableInitialised ) {
                        $dbw =& wfGetDB( DB_MASTER );
index 65ccd58..f8e579b 100644 (file)
@@ -1854,6 +1854,10 @@ class Database {
                return $b;
        }
 
                return $b;
        }
 
+       function decodeBlob($b) {
+               return $b;
+       }
+
        /**
         * Read and execute SQL commands from a file.
         * Returns true on success, error string on failure
        /**
         * Read and execute SQL commands from a file.
         * Returns true on success, error string on failure