]> git.mxchange.org Git - friendica.git/blobdiff - src/Worker/DBClean.php
Missing $a to $this conversion in App
[friendica.git] / src / Worker / DBClean.php
index 7b4e0f3acff08ff3103e6851b59df95261829156..ca0da954c010ff08c51f3e1876ae13383b2ba620 100644 (file)
@@ -84,8 +84,8 @@ class DBClean {
                        $r = DBA::p("SELECT `id` FROM `item` WHERE `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` >= ?
-                                       ORDER BY `id` LIMIT ".intval($limit), $days_unclaimed, $last_id);
-                       $count = DBA::num_rows($r);
+                                       ORDER BY `id` LIMIT ?", $days_unclaimed, $last_id, $limit);
+                       $count = DBA::numRows($r);
                        if ($count > 0) {
                                logger("found global item orphans: ".$count);
                                while ($orphan = DBA::fetch($r)) {
@@ -106,8 +106,8 @@ class DBClean {
                        logger("Deleting items without parents. Last ID: ".$last_id);
                        $r = DBA::p("SELECT `id` FROM `item`
                                        WHERE NOT EXISTS (SELECT `id` FROM `item` AS `i` WHERE `item`.`parent` = `i`.`id`)
-                                       AND `id` >= ? ORDER BY `id` LIMIT ".intval($limit), $last_id);
-                       $count = DBA::num_rows($r);
+                                       AND `id` >= ? ORDER BY `id` LIMIT ?", $last_id, $limit);
+                       $count = DBA::numRows($r);
                        if ($count > 0) {
                                logger("found item orphans without parents: ".$count);
                                while ($orphan = DBA::fetch($r)) {
@@ -132,8 +132,8 @@ class DBClean {
                        logger("Deleting orphaned data from thread table. Last ID: ".$last_id);
                        $r = DBA::p("SELECT `iid` FROM `thread`
                                        WHERE NOT EXISTS (SELECT `id` FROM `item` WHERE `item`.`parent` = `thread`.`iid`) AND `iid` >= ?
-                                       ORDER BY `iid` LIMIT ".intval($limit), $last_id);
-                       $count = DBA::num_rows($r);
+                                       ORDER BY `iid` LIMIT ?", $last_id, $limit);
+                       $count = DBA::numRows($r);
                        if ($count > 0) {
                                logger("found thread orphans: ".$count);
                                while ($orphan = DBA::fetch($r)) {
@@ -158,8 +158,8 @@ class DBClean {
                        logger("Deleting orphaned data from notify table. Last ID: ".$last_id);
                        $r = DBA::p("SELECT `iid`, `id` FROM `notify`
                                        WHERE NOT EXISTS (SELECT `id` FROM `item` WHERE `item`.`id` = `notify`.`iid`) AND `id` >= ?
-                                       ORDER BY `id` LIMIT ".intval($limit), $last_id);
-                       $count = DBA::num_rows($r);
+                                       ORDER BY `id` LIMIT ?", $last_id, $limit);
+                       $count = DBA::numRows($r);
                        if ($count > 0) {
                                logger("found notify orphans: ".$count);
                                while ($orphan = DBA::fetch($r)) {
@@ -184,8 +184,8 @@ class DBClean {
                        logger("Deleting orphaned data from notify-threads table. Last ID: ".$last_id);
                        $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` >= ?
-                                       ORDER BY `id` LIMIT ".intval($limit), $last_id);
-                       $count = DBA::num_rows($r);
+                                       ORDER BY `id` LIMIT ?", $last_id, $limit);
+                       $count = DBA::numRows($r);
                        if ($count > 0) {
                                logger("found notify-threads orphans: ".$count);
                                while ($orphan = DBA::fetch($r)) {
@@ -210,8 +210,8 @@ class DBClean {
                        logger("Deleting orphaned data from sign table. Last ID: ".$last_id);
                        $r = DBA::p("SELECT `iid`, `id` FROM `sign`
                                        WHERE NOT EXISTS (SELECT `id` FROM `item` WHERE `item`.`id` = `sign`.`iid`) AND `id` >= ?
-                                       ORDER BY `id` LIMIT ".intval($limit), $last_id);
-                       $count = DBA::num_rows($r);
+                                       ORDER BY `id` LIMIT ?", $last_id, $limit);
+                       $count = DBA::numRows($r);
                        if ($count > 0) {
                                logger("found sign orphans: ".$count);
                                while ($orphan = DBA::fetch($r)) {
@@ -236,8 +236,8 @@ class DBClean {
                        logger("Deleting orphaned data from term table. Last ID: ".$last_id);
                        $r = DBA::p("SELECT `oid`, `tid` FROM `term`
                                        WHERE NOT EXISTS (SELECT `id` FROM `item` WHERE `item`.`id` = `term`.`oid`) AND `tid` >= ?
-                                       ORDER BY `tid` LIMIT ".intval($limit), $last_id);
-                       $count = DBA::num_rows($r);
+                                       ORDER BY `tid` LIMIT ?", $last_id, $limit);
+                       $count = DBA::numRows($r);
                        if ($count > 0) {
                                logger("found term orphans: ".$count);
                                while ($orphan = DBA::fetch($r)) {
@@ -276,7 +276,7 @@ class DBClean {
                                                                        OR (`item`.`attach` != '') OR `item`.`wall` OR `item`.`origin`)
                                                                        AND `item`.`parent` = `thread`.`iid`)
                                        ORDER BY `thread`.`iid` LIMIT 1000", $days, $last_id);
-                       $count = DBA::num_rows($r);
+                       $count = DBA::numRows($r);
                        if ($count > 0) {
                                logger("found expired threads: ".$count);
                                while ($thread = DBA::fetch($r)) {
@@ -303,8 +303,8 @@ class DBClean {
                        $r = DBA::p("SELECT `id` FROM `item` WHERE `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` <= ?
-                                       ORDER BY `id` LIMIT ".intval($limit), $last_id, $till_id);
-                       $count = DBA::num_rows($r);
+                                       ORDER BY `id` LIMIT ?", $last_id, $till_id, $limit);
+                       $count = DBA::numRows($r);
                        if ($count > 0) {
                                logger("found global item entries from expired threads: ".$count);
                                while ($orphan = DBA::fetch($r)) {
@@ -326,8 +326,8 @@ class DBClean {
                        logger("Deleting old conversations. Last created: ".$last_id);
                        $r = DBA::p("SELECT `received`, `item-uri` FROM `conversation`
                                        WHERE `received` < UTC_TIMESTAMP() - INTERVAL ? DAY
-                                       ORDER BY `received` LIMIT ".intval($limit), $days);
-                       $count = DBA::num_rows($r);
+                                       ORDER BY `received` LIMIT ?", $days, $limit);
+                       $count = DBA::numRows($r);
                        if ($count > 0) {
                                logger("found old conversations: ".$count);
                                while ($orphan = DBA::fetch($r)) {