]> git.mxchange.org Git - friendica.git/commitdiff
Expire does work now for activities as well
authorMichael <heluecht@pirati.ca>
Fri, 6 Jul 2018 06:45:30 +0000 (06:45 +0000)
committerMichael <heluecht@pirati.ca>
Fri, 6 Jul 2018 06:45:30 +0000 (06:45 +0000)
src/Worker/Expire.php

index 342408894ed3a1c3d573e32ddd1b09ac5d6ed59e..5d56308faf073cf5fa8815f4c027c3dbb0481d68 100644 (file)
@@ -26,17 +26,18 @@ class Expire {
                if ($param == 'delete') {
                        logger('Delete expired items', LOGGER_DEBUG);
                        // physically remove anything that has been deleted for more than two months
-                       $r = dba::p("SELECT `id`, `iaid`, `icid` FROM `item` WHERE `deleted` AND `changed` < UTC_TIMESTAMP() - INTERVAL 60 DAY");
-                       while ($row = dba::fetch($r)) {
+                       $condition = ["`deleted` AND `changed` < UTC_TIMESTAMP() - INTERVAL 60 DAY"];
+                       $rows = dba::select('item', ['id', 'iaid', 'icid'],  $condition);
+                       while ($row = dba::fetch($rows)) {
                                dba::delete('item', ['id' => $row['id']]);
                                if (!empty($row['iaid']) && !dba::exists('item', ['iaid' => $row['iaid']])) {
-                                       dba::delete('item-content', ['id' => $row['icid']]);
+                                       dba::delete('item-activity', ['id' => $row['iaid']]);
                                }
                                if (!empty($row['icid']) && !dba::exists('item', ['icid' => $row['icid']])) {
                                        dba::delete('item-content', ['id' => $row['icid']]);
                                }
                        }
-                       dba::close($r);
+                       dba::close($rows);
 
                        logger('Delete expired items - done', LOGGER_DEBUG);