svn: /web/doc-editor/trunk/php/ RepositoryFetcher.php RepositoryManager.php

[email protected] (Neal Poole)
Newsgroups php.doc.web
Message-ID <[email protected]>
nbpoole                                  Wed, 22 Jun 2011 21:22:06 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=312388

Log:
Fixed database issue caused by non-static methods being called in a static context. Properly marked aforementioned methods as static.

Changed paths:
    U   web/doc-editor/trunk/php/RepositoryFetcher.php
    U   web/doc-editor/trunk/php/RepositoryManager.php

Modified: web/doc-editor/trunk/php/RepositoryFetcher.php
===================================================================
--- web/doc-editor/trunk/php/RepositoryFetcher.php	2011-06-22 20:00:24 UTC (rev 312387)
+++ web/doc-editor/trunk/php/RepositoryFetcher.php	2011-06-22 21:22:06 UTC (rev 312388)
@@ -1239,7 +1239,7 @@
      * @param $field The name of the field for this value
      * @return The value.
      */
-    public function getStaticValue($type, $field)
+    public static function getStaticValue($type, $field)
     {

         // Save in DB
@@ -1252,8 +1252,9 @@
             $type,
             $field
         );
-        $r = $this->conn->query($s, $params);

+        $r = DBConnection::getInstance()->query($s, $params);
+
         if( $r->num_rows == 0 ) {
             return false;
         } else {

Modified: web/doc-editor/trunk/php/RepositoryManager.php
===================================================================
--- web/doc-editor/trunk/php/RepositoryManager.php	2011-06-22 20:00:24 UTC (rev 312387)
+++ web/doc-editor/trunk/php/RepositoryManager.php	2011-06-22 21:22:06 UTC (rev 312388)
@@ -1943,7 +1943,7 @@
      * @param $forceNew TRUE to indicate that this value must be added e.g. not updated. By default, the value is updated.
      * @return Nothing.
      */
-    public function setStaticValue($type, $field, $value, $forceNew=false)
+    public static function setStaticValue($type, $field, $value, $forceNew=false)
     {
         $project = AccountManager::getInstance()->project;

@@ -1957,17 +1957,17 @@
             $type,
             $field
         );
-        $r = $this->conn->query($s, $params);
+        $r = DBConnection::getInstance()->query($s, $params);

         if( $r->num_rows == 0 || $forceNew) {
             $s = "INSERT INTO staticValue (`project`, `type`, `field`, `value`, `date`) VALUES ('%s', '%s', '%s', '%s', now())";
             $params = array($project, $type, $field, $value);
-            $this->conn->query($s, $params);
+            DBConnection::getInstance()->query($s, $params);
         } else {
             $a = $r->fetch_object();
             $s = "UPDATE staticValue SET `value`= '%s', `date`=now() WHERE `id`=%d";
             $params = array($value, $a->id);
-            $this->conn->query($s, $params);
+            DBConnection::getInstance()->query($s, $params);
         }
     }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.