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

From: Date: Wed, 22 Jun 2011 21:22:06 +0000
Subject: svn: /web/doc-editor/trunk/php/ RepositoryFetcher.php RepositoryManager.php
Groups: php.doc.web 
Request: Send a blank email to doc-web+get-2052@lists.php.net to get a copy of this message
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); } }

« previous php.doc.web (#2052) next »