]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
$_PEAR now defined globally as new PEAR, so no static calls are made
authorMikael Nordfeldth <mmn@hethane.se>
Mon, 23 Sep 2013 20:27:17 +0000 (22:27 +0200)
committerMikael Nordfeldth <mmn@hethane.se>
Mon, 23 Sep 2013 20:27:43 +0000 (22:27 +0200)
classes/Memcached_DataObject.php
lib/framework.php
lib/schema.php
lib/statusnet.php

index 7689ea979bd14976da7efa8e49902442901c399c..888b19a0245580cdd3fcb86a3a21747222b5d482 100644 (file)
@@ -751,12 +751,12 @@ class Memcached_DataObject extends Safe_DataObject
 
     function _connect()
     {
-        global $_DB_DATAOBJECT;
+        global $_DB_DATAOBJECT, $_PEAR;
 
         $sum = $this->_getDbDsnMD5();
 
         if (!empty($_DB_DATAOBJECT['CONNECTIONS'][$sum]) &&
-            !PEAR::isError($_DB_DATAOBJECT['CONNECTIONS'][$sum])) {
+            !$_PEAR->isError($_DB_DATAOBJECT['CONNECTIONS'][$sum])) {
             $exists = true;
         } else {
             $exists = false;
index 50a04d4fd39c1645476725e2a36fde212cd55d7d..4e9078845f7fad84e2e4d524c28a82e48c32758d 100644 (file)
@@ -174,4 +174,5 @@ function PEAR_ErrorToPEAR_Exception($err)
     throw new PEAR_Exception($err->getMessage());
 }
 
-PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'PEAR_ErrorToPEAR_Exception');
+/* global */ $_PEAR = new PEAR;
+$_PEAR->setErrorHandling(PEAR_ERROR_CALLBACK, 'PEAR_ErrorToPEAR_Exception');
index 92555499baffd3f64215cc63933800dfaf476a12..94cde28f9d4692610a5b00cafd11c693ca61f1b5 100644 (file)
@@ -345,9 +345,11 @@ class Schema
 
     public function dropTable($name)
     {
+        global $_PEAR;
+
         $res = $this->conn->query("DROP TABLE $name");
 
-        if (PEAR::isError($res)) {
+        if ($_PEAR->isError($res)) {
             throw new Exception($res->getMessage());
         }
 
@@ -372,6 +374,8 @@ class Schema
 
     public function createIndex($table, $columnNames, $name=null)
     {
+        global $_PEAR;
+
         if (!is_array($columnNames)) {
             $columnNames = array($columnNames);
         }
@@ -384,7 +388,7 @@ class Schema
                                    "ADD INDEX $name (".
                                    implode(",", $columnNames).")");
 
-        if (PEAR::isError($res)) {
+        if ($_PEAR->isError($res)) {
             throw new Exception($res->getMessage());
         }
 
@@ -402,9 +406,11 @@ class Schema
 
     public function dropIndex($table, $name)
     {
+        global $_PEAR;
+
         $res = $this->conn->query("ALTER TABLE $table DROP INDEX $name");
 
-        if (PEAR::isError($res)) {
+        if ($_PEAR->isError($res)) {
             throw new Exception($res->getMessage());
         }
 
@@ -423,11 +429,13 @@ class Schema
 
     public function addColumn($table, $columndef)
     {
+        global $_PEAR;
+
         $sql = "ALTER TABLE $table ADD COLUMN " . $this->_columnSql($columndef);
 
         $res = $this->conn->query($sql);
 
-        if (PEAR::isError($res)) {
+        if ($_PEAR->isError($res)) {
             throw new Exception($res->getMessage());
         }
 
@@ -447,12 +455,14 @@ class Schema
 
     public function modifyColumn($table, $columndef)
     {
+        global $_PEAR;
+
         $sql = "ALTER TABLE $table MODIFY COLUMN " .
           $this->_columnSql($columndef);
 
         $res = $this->conn->query($sql);
 
-        if (PEAR::isError($res)) {
+        if ($_PEAR->isError($res)) {
             throw new Exception($res->getMessage());
         }
 
@@ -472,11 +482,13 @@ class Schema
 
     public function dropColumn($table, $columnName)
     {
+        global $_PEAR;
+
         $sql = "ALTER TABLE $table DROP COLUMN $columnName";
 
         $res = $this->conn->query($sql);
 
-        if (PEAR::isError($res)) {
+        if ($_PEAR->isError($res)) {
             throw new Exception($res->getMessage());
         }
 
@@ -513,6 +525,8 @@ class Schema
      */
     function runSqlSet(array $statements)
     {
+        global $_PEAR;
+
         $ok = true;
         foreach ($statements as $sql) {
             if (defined('DEBUG_INSTALLER')) {
@@ -520,7 +534,7 @@ class Schema
             }
             $res = $this->conn->query($sql);
 
-            if (PEAR::isError($res)) {
+            if ($_PEAR->isError($res)) {
                 throw new Exception($res->getMessage());
             }
         }
@@ -1027,8 +1041,10 @@ class Schema
      */
     protected function fetchQueryData($sql)
     {
+        global $_PEAR;
+
         $res = $this->conn->query($sql);
-        if (PEAR::isError($res)) {
+        if ($_PEAR->isError($res)) {
             throw new Exception($res->getMessage());
         }
 
index ac7784eed1f28ef39803fb1528d81c8e65a5cd59..14b57ea052799ccd58ddfbc81296a2d4202da59d 100644 (file)
@@ -264,7 +264,7 @@ class StatusNet
      */
     public static function initDefaults($server, $path)
     {
-        global $_server, $_path, $config;
+        global $_server, $_path, $config, $_PEAR;
 
         Event::clearHandlers();
         self::$plugins = array();
@@ -296,7 +296,7 @@ class StatusNet
         // default configuration, overwritten in config.php
         // Keep DB_DataObject's db config synced to ours...
 
-        $config['db'] = &PEAR::getStaticProperty('DB_DataObject','options');
+        $config['db'] = &$_PEAR->getStaticProperty('DB_DataObject','options');
 
         $config['db'] = $default['db'];