]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
DB_DataObject recommends using ->tableName()
authorMikael Nordfeldth <mmn@hethane.se>
Sat, 6 Jun 2015 17:35:10 +0000 (19:35 +0200)
committerMikael Nordfeldth <mmn@hethane.se>
Sat, 6 Jun 2015 17:35:10 +0000 (19:35 +0200)
classes/File.php
classes/Managed_DataObject.php
classes/Memcached_DataObject.php
classes/Safe_DataObject.php
classes/Status_network_tag.php

index d4abbfddeef3f5f45c26621fce6414c16e75827f..1a29ea5107e537dec350188c4b7b323e523b2e76 100644 (file)
@@ -488,13 +488,13 @@ class File extends Managed_DataObject
             throw new ServerException('URL already exists in DB');
         }
         $sql = 'UPDATE %1$s SET urlhash=%2$s, url=%3$s WHERE urlhash=%4$s;';
-        $result = $this->query(sprintf($sql, $this->__table,
+        $result = $this->query(sprintf($sql, $this->tableName(),
                                              $this->_quote((string)self::hashurl($url)),
                                              $this->_quote((string)$url),
                                              $this->_quote((string)$this->urlhash)));
         if ($result === false) {
             common_log_db_error($this, 'UPDATE', __FILE__);
-            throw new ServerException("Could not UPDATE {$this->__table}.url");
+            throw new ServerException("Could not UPDATE {$this->tableName()}.url");
         }
 
         return $result;
index a69a957bcc0225bad8b4085312b1b73a53b9ea13..ec514029939547997f5e098925e79816868d0034 100644 (file)
@@ -406,7 +406,7 @@ abstract class Managed_DataObject extends Memcached_DataObject
                 common_log_db_error($this, 'UPDATE', __FILE__);
                 // rollback as something bad occurred
                 $this->query('ROLLBACK');
-                throw new ServerException("Could not UPDATE non-keys for {$this->__table}");
+                throw new ServerException("Could not UPDATE non-keys for {$this->tableName()}");
             }
             $orig->decache();
             $this->encache();
@@ -428,7 +428,7 @@ abstract class Managed_DataObject extends Memcached_DataObject
             common_log_db_error($this, 'UPDATE', __FILE__);
             // rollback as something bad occurred
             $this->query('ROLLBACK');
-            throw new ServerException("Could not UPDATE key fields for {$this->__table}");
+            throw new ServerException("Could not UPDATE key fields for {$this->tableName()}");
         }
 
         // Update non-keys too, if the previous endeavour worked.
@@ -438,7 +438,7 @@ abstract class Managed_DataObject extends Memcached_DataObject
             common_log_db_error($this, 'UPDATE', __FILE__);
             // rollback as something bad occurred
             $this->query('ROLLBACK');
-            throw new ServerException("Could not UPDATE non-keys for {$this->__table}");
+            throw new ServerException("Could not UPDATE non-keys for {$this->tableName()}");
         }
         $orig->decache();
         $this->encache();
index c725e1d9aa1754f5ab2488f9db2052079710450c..c1f6f644db010d9e85e4d121b73474f3cb547724 100644 (file)
@@ -461,11 +461,11 @@ class Memcached_DataObject extends Safe_DataObject
         }
 
         global $_DB_DATAOBJECT;
-        if (!isset($_DB_DATAOBJECT['INI'][$this->_database][$this->__table."__keys"])) {
+        if (!isset($_DB_DATAOBJECT['INI'][$this->_database][$this->tableName()."__keys"])) {
             $this->databaseStructure();
 
         }
-        return $_DB_DATAOBJECT['INI'][$this->_database][$this->__table."__keys"];
+        return $_DB_DATAOBJECT['INI'][$this->_database][$this->tableName()."__keys"];
     }
 
     function encache()
@@ -836,7 +836,7 @@ class Memcached_DataObject extends Safe_DataObject
         if (!$dsn) {
 
             if (!$this->_database) {
-                $this->_database = isset($options["table_{$this->__table}"]) ? $options["table_{$this->__table}"] : null;
+                $this->_database = isset($options["table_{$this->tableName()}"]) ? $options["table_{$this->tableName()}"] : null;
             }
 
             if ($this->_database && !empty($options["database_{$this->_database}"]))  {
index 8e5e72c013bdc6ebe7d68cada500fb408e294efa..6aed88ae1f67501d1e1af30ffe6995b0cc469f70 100644 (file)
@@ -186,7 +186,7 @@ class Safe_DataObject extends GS_DataObject
 
             // database loaded - but this is table is not available..
             if (
-                    empty($_DB_DATAOBJECT['INI'][$this->_database][$this->__table])
+                    empty($_DB_DATAOBJECT['INI'][$this->_database][$this->tableName()])
                     && !empty($_DB_DATAOBJECT['CONFIG']['proxy'])
                 ) {
                 if (!empty($_DB_DATAOBJECT['CONFIG']['debug'])) {
@@ -197,7 +197,7 @@ class Safe_DataObject extends GS_DataObject
 
 
                 $x = new DB_DataObject_Generator;
-                $x->fillTableSchema($this->_database,$this->__table);
+                $x->fillTableSchema($this->_database,$this->tableName());
             }
             return true;
         }
@@ -225,7 +225,7 @@ class Safe_DataObject extends GS_DataObject
 
         // now have we loaded the structure..
 
-        if (!empty($_DB_DATAOBJECT['INI'][$this->_database][$this->__table])) {
+        if (!empty($_DB_DATAOBJECT['INI'][$this->_database][$this->tableName()])) {
             return true;
         }
         // - if not try building it..
@@ -234,11 +234,11 @@ class Safe_DataObject extends GS_DataObject
                 require_once 'DB/DataObject/Generator.php';
 
             $x = new DB_DataObject_Generator;
-            $x->fillTableSchema($this->_database,$this->__table);
+            $x->fillTableSchema($this->_database,$this->tableName());
             // should this fail!!!???
             return true;
         }
-        $this->debug("Cant find database schema: {$this->_database}/{$this->__table} \n".
+        $this->debug("Cant find database schema: {$this->_database}/{$this->tableName()} \n".
                     "in links file data: " . print_r($_DB_DATAOBJECT['INI'],true),"databaseStructure",5);
         // we have to die here!! - it causes chaos if we don't (including looping forever!)
         // Low level exception. No need for i18n as discussed with Brion.
index 9e5ff89be352c9863d72a977756c8445ae5da7ea..b45224ff74c5225b02fa23c21d10269c9ba65d22 100644 (file)
@@ -38,7 +38,7 @@ class Status_network_tag extends Safe_DataObject
         $sn = new Status_network();
         $sn->_connect();
 
-        $config['db']['table_'. $this->__table] = $sn->_database;
+        $config['db']['table_'. $this->tableName()] = $sn->_database;
 
         $this->_connect();
     }