Rename DBA::num_rows to DBA::numRows
This commit is contained in:
parent
1f2c0b98b5
commit
415b982d39
|
@ -498,7 +498,7 @@ class Worker
|
||||||
// The processlist only shows entries of the current user
|
// The processlist only shows entries of the current user
|
||||||
if ($max != 0) {
|
if ($max != 0) {
|
||||||
$r = DBA::p('SHOW PROCESSLIST');
|
$r = DBA::p('SHOW PROCESSLIST');
|
||||||
$used = DBA::num_rows($r);
|
$used = DBA::numRows($r);
|
||||||
DBA::close($r);
|
DBA::close($r);
|
||||||
|
|
||||||
logger("Connection usage (user values): ".$used."/".$max, LOGGER_DEBUG);
|
logger("Connection usage (user values): ".$used."/".$max, LOGGER_DEBUG);
|
||||||
|
|
|
@ -666,7 +666,7 @@ class DBA
|
||||||
if (is_bool($stmt)) {
|
if (is_bool($stmt)) {
|
||||||
$retval = $stmt;
|
$retval = $stmt;
|
||||||
} else {
|
} else {
|
||||||
$retval = (self::num_rows($stmt) > 0);
|
$retval = (self::numRows($stmt) > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
self::close($stmt);
|
self::close($stmt);
|
||||||
|
@ -732,7 +732,7 @@ class DBA
|
||||||
* @param PDOStatement|mysqli_result|mysqli_stmt Statement object
|
* @param PDOStatement|mysqli_result|mysqli_stmt Statement object
|
||||||
* @return int Number of rows
|
* @return int Number of rows
|
||||||
*/
|
*/
|
||||||
public static function num_rows($stmt) {
|
public static function numRows($stmt) {
|
||||||
if (!is_object($stmt)) {
|
if (!is_object($stmt)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@ class DBM
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_object($array)) {
|
if (is_object($array)) {
|
||||||
return DBA::num_rows($array) > 0;
|
return DBA::numRows($array) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (is_array($array) && (count($array) > 0));
|
return (is_array($array) && (count($array) > 0));
|
||||||
|
|
|
@ -706,7 +706,7 @@ class DBStructure
|
||||||
if (is_bool($stmt)) {
|
if (is_bool($stmt)) {
|
||||||
$retval = $stmt;
|
$retval = $stmt;
|
||||||
} else {
|
} else {
|
||||||
$retval = (DBA::num_rows($stmt) > 0);
|
$retval = (DBA::numRows($stmt) > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
DBA::close($stmt);
|
DBA::close($stmt);
|
||||||
|
@ -741,7 +741,7 @@ class DBStructure
|
||||||
if (is_bool($stmt)) {
|
if (is_bool($stmt)) {
|
||||||
$retval = $stmt;
|
$retval = $stmt;
|
||||||
} else {
|
} else {
|
||||||
$retval = (DBA::num_rows($stmt) > 0);
|
$retval = (DBA::numRows($stmt) > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
DBA::close($stmt);
|
DBA::close($stmt);
|
||||||
|
|
|
@ -272,7 +272,7 @@ class Item extends BaseObject
|
||||||
if (is_bool($stmt)) {
|
if (is_bool($stmt)) {
|
||||||
$retval = $stmt;
|
$retval = $stmt;
|
||||||
} else {
|
} else {
|
||||||
$retval = (DBA::num_rows($stmt) > 0);
|
$retval = (DBA::numRows($stmt) > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
DBA::close($stmt);
|
DBA::close($stmt);
|
||||||
|
|
|
@ -85,7 +85,7 @@ class DBClean {
|
||||||
NOT EXISTS (SELECT `guid` FROM `item` AS `i` WHERE `item`.`guid` = `i`.`guid` AND `i`.`uid` != 0) AND
|
NOT EXISTS (SELECT `guid` FROM `item` AS `i` WHERE `item`.`guid` = `i`.`guid` AND `i`.`uid` != 0) AND
|
||||||
`received` < UTC_TIMESTAMP() - INTERVAL ? DAY AND `id` >= ?
|
`received` < UTC_TIMESTAMP() - INTERVAL ? DAY AND `id` >= ?
|
||||||
ORDER BY `id` LIMIT ".intval($limit), $days_unclaimed, $last_id);
|
ORDER BY `id` LIMIT ".intval($limit), $days_unclaimed, $last_id);
|
||||||
$count = DBA::num_rows($r);
|
$count = DBA::numRows($r);
|
||||||
if ($count > 0) {
|
if ($count > 0) {
|
||||||
logger("found global item orphans: ".$count);
|
logger("found global item orphans: ".$count);
|
||||||
while ($orphan = DBA::fetch($r)) {
|
while ($orphan = DBA::fetch($r)) {
|
||||||
|
@ -107,7 +107,7 @@ class DBClean {
|
||||||
$r = DBA::p("SELECT `id` FROM `item`
|
$r = DBA::p("SELECT `id` FROM `item`
|
||||||
WHERE NOT EXISTS (SELECT `id` FROM `item` AS `i` WHERE `item`.`parent` = `i`.`id`)
|
WHERE NOT EXISTS (SELECT `id` FROM `item` AS `i` WHERE `item`.`parent` = `i`.`id`)
|
||||||
AND `id` >= ? ORDER BY `id` LIMIT ".intval($limit), $last_id);
|
AND `id` >= ? ORDER BY `id` LIMIT ".intval($limit), $last_id);
|
||||||
$count = DBA::num_rows($r);
|
$count = DBA::numRows($r);
|
||||||
if ($count > 0) {
|
if ($count > 0) {
|
||||||
logger("found item orphans without parents: ".$count);
|
logger("found item orphans without parents: ".$count);
|
||||||
while ($orphan = DBA::fetch($r)) {
|
while ($orphan = DBA::fetch($r)) {
|
||||||
|
@ -133,7 +133,7 @@ class DBClean {
|
||||||
$r = DBA::p("SELECT `iid` FROM `thread`
|
$r = DBA::p("SELECT `iid` FROM `thread`
|
||||||
WHERE NOT EXISTS (SELECT `id` FROM `item` WHERE `item`.`parent` = `thread`.`iid`) AND `iid` >= ?
|
WHERE NOT EXISTS (SELECT `id` FROM `item` WHERE `item`.`parent` = `thread`.`iid`) AND `iid` >= ?
|
||||||
ORDER BY `iid` LIMIT ".intval($limit), $last_id);
|
ORDER BY `iid` LIMIT ".intval($limit), $last_id);
|
||||||
$count = DBA::num_rows($r);
|
$count = DBA::numRows($r);
|
||||||
if ($count > 0) {
|
if ($count > 0) {
|
||||||
logger("found thread orphans: ".$count);
|
logger("found thread orphans: ".$count);
|
||||||
while ($orphan = DBA::fetch($r)) {
|
while ($orphan = DBA::fetch($r)) {
|
||||||
|
@ -159,7 +159,7 @@ class DBClean {
|
||||||
$r = DBA::p("SELECT `iid`, `id` FROM `notify`
|
$r = DBA::p("SELECT `iid`, `id` FROM `notify`
|
||||||
WHERE NOT EXISTS (SELECT `id` FROM `item` WHERE `item`.`id` = `notify`.`iid`) AND `id` >= ?
|
WHERE NOT EXISTS (SELECT `id` FROM `item` WHERE `item`.`id` = `notify`.`iid`) AND `id` >= ?
|
||||||
ORDER BY `id` LIMIT ".intval($limit), $last_id);
|
ORDER BY `id` LIMIT ".intval($limit), $last_id);
|
||||||
$count = DBA::num_rows($r);
|
$count = DBA::numRows($r);
|
||||||
if ($count > 0) {
|
if ($count > 0) {
|
||||||
logger("found notify orphans: ".$count);
|
logger("found notify orphans: ".$count);
|
||||||
while ($orphan = DBA::fetch($r)) {
|
while ($orphan = DBA::fetch($r)) {
|
||||||
|
@ -185,7 +185,7 @@ class DBClean {
|
||||||
$r = DBA::p("SELECT `id` FROM `notify-threads`
|
$r = DBA::p("SELECT `id` FROM `notify-threads`
|
||||||
WHERE NOT EXISTS (SELECT `id` FROM `item` WHERE `item`.`parent` = `notify-threads`.`master-parent-item`) AND `id` >= ?
|
WHERE NOT EXISTS (SELECT `id` FROM `item` WHERE `item`.`parent` = `notify-threads`.`master-parent-item`) AND `id` >= ?
|
||||||
ORDER BY `id` LIMIT ".intval($limit), $last_id);
|
ORDER BY `id` LIMIT ".intval($limit), $last_id);
|
||||||
$count = DBA::num_rows($r);
|
$count = DBA::numRows($r);
|
||||||
if ($count > 0) {
|
if ($count > 0) {
|
||||||
logger("found notify-threads orphans: ".$count);
|
logger("found notify-threads orphans: ".$count);
|
||||||
while ($orphan = DBA::fetch($r)) {
|
while ($orphan = DBA::fetch($r)) {
|
||||||
|
@ -211,7 +211,7 @@ class DBClean {
|
||||||
$r = DBA::p("SELECT `iid`, `id` FROM `sign`
|
$r = DBA::p("SELECT `iid`, `id` FROM `sign`
|
||||||
WHERE NOT EXISTS (SELECT `id` FROM `item` WHERE `item`.`id` = `sign`.`iid`) AND `id` >= ?
|
WHERE NOT EXISTS (SELECT `id` FROM `item` WHERE `item`.`id` = `sign`.`iid`) AND `id` >= ?
|
||||||
ORDER BY `id` LIMIT ".intval($limit), $last_id);
|
ORDER BY `id` LIMIT ".intval($limit), $last_id);
|
||||||
$count = DBA::num_rows($r);
|
$count = DBA::numRows($r);
|
||||||
if ($count > 0) {
|
if ($count > 0) {
|
||||||
logger("found sign orphans: ".$count);
|
logger("found sign orphans: ".$count);
|
||||||
while ($orphan = DBA::fetch($r)) {
|
while ($orphan = DBA::fetch($r)) {
|
||||||
|
@ -237,7 +237,7 @@ class DBClean {
|
||||||
$r = DBA::p("SELECT `oid`, `tid` FROM `term`
|
$r = DBA::p("SELECT `oid`, `tid` FROM `term`
|
||||||
WHERE NOT EXISTS (SELECT `id` FROM `item` WHERE `item`.`id` = `term`.`oid`) AND `tid` >= ?
|
WHERE NOT EXISTS (SELECT `id` FROM `item` WHERE `item`.`id` = `term`.`oid`) AND `tid` >= ?
|
||||||
ORDER BY `tid` LIMIT ".intval($limit), $last_id);
|
ORDER BY `tid` LIMIT ".intval($limit), $last_id);
|
||||||
$count = DBA::num_rows($r);
|
$count = DBA::numRows($r);
|
||||||
if ($count > 0) {
|
if ($count > 0) {
|
||||||
logger("found term orphans: ".$count);
|
logger("found term orphans: ".$count);
|
||||||
while ($orphan = DBA::fetch($r)) {
|
while ($orphan = DBA::fetch($r)) {
|
||||||
|
@ -276,7 +276,7 @@ class DBClean {
|
||||||
OR (`item`.`attach` != '') OR `item`.`wall` OR `item`.`origin`)
|
OR (`item`.`attach` != '') OR `item`.`wall` OR `item`.`origin`)
|
||||||
AND `item`.`parent` = `thread`.`iid`)
|
AND `item`.`parent` = `thread`.`iid`)
|
||||||
ORDER BY `thread`.`iid` LIMIT 1000", $days, $last_id);
|
ORDER BY `thread`.`iid` LIMIT 1000", $days, $last_id);
|
||||||
$count = DBA::num_rows($r);
|
$count = DBA::numRows($r);
|
||||||
if ($count > 0) {
|
if ($count > 0) {
|
||||||
logger("found expired threads: ".$count);
|
logger("found expired threads: ".$count);
|
||||||
while ($thread = DBA::fetch($r)) {
|
while ($thread = DBA::fetch($r)) {
|
||||||
|
@ -304,7 +304,7 @@ class DBClean {
|
||||||
NOT EXISTS (SELECT `guid` FROM `item` AS `i` WHERE `item`.`guid` = `i`.`guid` AND `i`.`uid` != 0) AND
|
NOT EXISTS (SELECT `guid` FROM `item` AS `i` WHERE `item`.`guid` = `i`.`guid` AND `i`.`uid` != 0) AND
|
||||||
`received` < UTC_TIMESTAMP() - INTERVAL 90 DAY AND `id` >= ? AND `id` <= ?
|
`received` < UTC_TIMESTAMP() - INTERVAL 90 DAY AND `id` >= ? AND `id` <= ?
|
||||||
ORDER BY `id` LIMIT ".intval($limit), $last_id, $till_id);
|
ORDER BY `id` LIMIT ".intval($limit), $last_id, $till_id);
|
||||||
$count = DBA::num_rows($r);
|
$count = DBA::numRows($r);
|
||||||
if ($count > 0) {
|
if ($count > 0) {
|
||||||
logger("found global item entries from expired threads: ".$count);
|
logger("found global item entries from expired threads: ".$count);
|
||||||
while ($orphan = DBA::fetch($r)) {
|
while ($orphan = DBA::fetch($r)) {
|
||||||
|
@ -327,7 +327,7 @@ class DBClean {
|
||||||
$r = DBA::p("SELECT `received`, `item-uri` FROM `conversation`
|
$r = DBA::p("SELECT `received`, `item-uri` FROM `conversation`
|
||||||
WHERE `received` < UTC_TIMESTAMP() - INTERVAL ? DAY
|
WHERE `received` < UTC_TIMESTAMP() - INTERVAL ? DAY
|
||||||
ORDER BY `received` LIMIT ".intval($limit), $days);
|
ORDER BY `received` LIMIT ".intval($limit), $days);
|
||||||
$count = DBA::num_rows($r);
|
$count = DBA::numRows($r);
|
||||||
if ($count > 0) {
|
if ($count > 0) {
|
||||||
logger("found old conversations: ".$count);
|
logger("found old conversations: ".$count);
|
||||||
while ($orphan = DBA::fetch($r)) {
|
while ($orphan = DBA::fetch($r)) {
|
||||||
|
|
|
@ -10,7 +10,7 @@ class TagUpdate
|
||||||
{
|
{
|
||||||
$messages = DBA::p("SELECT `oid`,`item`.`guid`, `item`.`created`, `item`.`received` FROM `term` INNER JOIN `item` ON `item`.`id`=`term`.`oid` WHERE `term`.`otype` = 1 AND `term`.`guid` = ''");
|
$messages = DBA::p("SELECT `oid`,`item`.`guid`, `item`.`created`, `item`.`received` FROM `term` INNER JOIN `item` ON `item`.`id`=`term`.`oid` WHERE `term`.`otype` = 1 AND `term`.`guid` = ''");
|
||||||
|
|
||||||
logger('fetched messages: ' . DBA::num_rows($messages));
|
logger('fetched messages: ' . DBA::numRows($messages));
|
||||||
while ($message = DBA::fetch($messages)) {
|
while ($message = DBA::fetch($messages)) {
|
||||||
if ($message['uid'] == 0) {
|
if ($message['uid'] == 0) {
|
||||||
$global = true;
|
$global = true;
|
||||||
|
@ -29,7 +29,7 @@ class TagUpdate
|
||||||
|
|
||||||
$messages = DBA::select('item', ['guid'], ['uid' => 0]);
|
$messages = DBA::select('item', ['guid'], ['uid' => 0]);
|
||||||
|
|
||||||
logger('fetched messages: ' . DBA::num_rows($messages));
|
logger('fetched messages: ' . DBA::numRows($messages));
|
||||||
while ($message = DBA::fetch(messages)) {
|
while ($message = DBA::fetch(messages)) {
|
||||||
DBA::update('item', ['global' => true], ['guid' => $message['guid']]);
|
DBA::update('item', ['global' => true], ['guid' => $message['guid']]);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue