Fixed code structure
This commit is contained in:
parent
ee5ada6991
commit
b99f5b576e
4 changed files with 26 additions and 22 deletions
|
@ -80,9 +80,10 @@ class dba {
|
||||||
}
|
}
|
||||||
if (!$this->connected) {
|
if (!$this->connected) {
|
||||||
$this->db = null;
|
$this->db = null;
|
||||||
if (!$install)
|
if (!$install) {
|
||||||
system_unavailable();
|
system_unavailable();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$a->save_timestamp($stamp1, "network");
|
$a->save_timestamp($stamp1, "network");
|
||||||
}
|
}
|
||||||
|
@ -114,8 +115,9 @@ class dba {
|
||||||
* @return integer
|
* @return integer
|
||||||
*/
|
*/
|
||||||
public function num_rows() {
|
public function num_rows() {
|
||||||
if (!$this->result)
|
if (!$this->result) {
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->mysqli) {
|
if ($this->mysqli) {
|
||||||
$return = $this->result->num_rows;
|
$return = $this->result->num_rows;
|
||||||
|
@ -128,8 +130,9 @@ class dba {
|
||||||
public function q($sql, $onlyquery = false) {
|
public function q($sql, $onlyquery = false) {
|
||||||
global $a;
|
global $a;
|
||||||
|
|
||||||
if ((!$this->db) || (!$this->connected))
|
if (!$this->db || !$this->connected) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$this->error = '';
|
$this->error = '';
|
||||||
|
|
||||||
|
@ -255,7 +258,7 @@ class dba {
|
||||||
public function qfetch() {
|
public function qfetch() {
|
||||||
$x = false;
|
$x = false;
|
||||||
|
|
||||||
if ($this->result)
|
if ($this->result) {
|
||||||
if ($this->mysqli) {
|
if ($this->mysqli) {
|
||||||
if ($this->result->num_rows)
|
if ($this->result->num_rows)
|
||||||
$x = $this->result->fetch_array(MYSQLI_ASSOC);
|
$x = $this->result->fetch_array(MYSQLI_ASSOC);
|
||||||
|
@ -263,18 +266,19 @@ class dba {
|
||||||
if (mysql_num_rows($this->result))
|
if (mysql_num_rows($this->result))
|
||||||
$x = mysql_fetch_array($this->result, MYSQL_ASSOC);
|
$x = mysql_fetch_array($this->result, MYSQL_ASSOC);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return($x);
|
return($x);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function qclose() {
|
public function qclose() {
|
||||||
if ($this->result)
|
if ($this->result) {
|
||||||
if ($this->mysqli) {
|
if ($this->mysqli) {
|
||||||
$this->result->free_result();
|
$this->result->free_result();
|
||||||
} else {
|
} else {
|
||||||
mysql_free_result($this->result);
|
mysql_free_result($this->result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function dbg($dbg) {
|
public function dbg($dbg) {
|
||||||
$this->debug = $dbg;
|
$this->debug = $dbg;
|
||||||
|
|
|
@ -810,7 +810,7 @@ class ostatus {
|
||||||
`item`.`verb`, `item`.`visible` FROM `term`
|
`item`.`verb`, `item`.`visible` FROM `term`
|
||||||
STRAIGHT_JOIN `item` AS `thritem` ON `thritem`.`parent` = `term`.`oid`
|
STRAIGHT_JOIN `item` AS `thritem` ON `thritem`.`parent` = `term`.`oid`
|
||||||
STRAIGHT_JOIN `item` ON `item`.`parent` = `thritem`.`parent`
|
STRAIGHT_JOIN `item` ON `item`.`parent` = `thritem`.`parent`
|
||||||
WHERE `term`.`uid` = %d AND `term`.`otype` = %d AND `term`.`type` = %d AND `term`.`url` = '%s'))",
|
WHERE `term`.`uid` = %d AND `term`.`otype` = %d AND `term`.`type` = %d AND `term`.`url` = '%s'",
|
||||||
intval($uid), intval(TERM_OBJ_POST), intval(TERM_CONVERSATION), dbesc($conversation_url));
|
intval($uid), intval(TERM_OBJ_POST), intval(TERM_CONVERSATION), dbesc($conversation_url));
|
||||||
|
|
||||||
/* 2016-10-23: The old query will be kept until we are sure that the query above is a good and fast replacement
|
/* 2016-10-23: The old query will be kept until we are sure that the query above is a good and fast replacement
|
||||||
|
|
Loading…
Reference in a new issue