proc_run(PRIORITY_LOW, 'include/expire.php');
- if (get_config("system", "worker")) {
- proc_run(PRIORITY_LOW, 'include/dbclean.php', 1);
- proc_run(PRIORITY_LOW, 'include/dbclean.php', 2);
- proc_run(PRIORITY_LOW, 'include/dbclean.php', 3);
- proc_run(PRIORITY_LOW, 'include/dbclean.php', 4);
- proc_run(PRIORITY_LOW, 'include/dbclean.php', 5);
- proc_run(PRIORITY_LOW, 'include/dbclean.php', 6);
- proc_run(PRIORITY_LOW, 'include/dbclean.php', 7);
- } else {
- proc_run(PRIORITY_LOW, 'include/dbclean.php');
- }
+ proc_run(PRIORITY_LOW, 'include/dbclean.php');
cron_update_photo_albums();
}
} else {
$stage = 0;
}
- remove_orphans($stage);
+
+ if (get_config("system", "worker") AND ($stage == 0)) {
+ proc_run(PRIORITY_LOW, 'include/dbclean.php', 1);
+ proc_run(PRIORITY_LOW, 'include/dbclean.php', 2);
+ proc_run(PRIORITY_LOW, 'include/dbclean.php', 3);
+ proc_run(PRIORITY_LOW, 'include/dbclean.php', 4);
+ proc_run(PRIORITY_LOW, 'include/dbclean.php', 5);
+ proc_run(PRIORITY_LOW, 'include/dbclean.php', 6);
+ proc_run(PRIORITY_LOW, 'include/dbclean.php', 7);
+ } else {
+ remove_orphans($stage);
+ }
}
/**
function remove_orphans($stage = 0) {
global $db;
+ $count = 0;
+
if (($stage == 1) OR ($stage == 0)) {
logger("Deleting old global item entries from item table without user copy");
if ($db->q("SELECT `id` FROM `item` WHERE `uid` = 0
while ($orphan = $db->qfetch()) {
q("DELETE FROM `item` WHERE `id` = %d", intval($orphan["id"]));
}
-
- // Call it again if not all entries were purged
- if (($count > 0) AND get_config("system", "worker")) {
- proc_run(PRIORITY_LOW, 'include/dbclean.php', 1);
- }
}
$db->qclose();
logger("Done deleting old global item entries from item table without user copy");
while ($orphan = $db->qfetch()) {
q("DELETE FROM `item` WHERE `id` = %d", intval($orphan["id"]));
}
-
- // Call it again if not all entries were purged
- if (($count > 0) AND get_config("system", "worker")) {
- proc_run(PRIORITY_LOW, 'include/dbclean.php', 2);
- }
}
$db->qclose();
logger("Done deleting items without parents");
while ($orphan = $db->qfetch()) {
q("DELETE FROM `thread` WHERE `iid` = %d", intval($orphan["iid"]));
}
-
- // Call it again if not all entries were purged
- if (($count > 0) AND get_config("system", "worker")) {
- proc_run(PRIORITY_LOW, 'include/dbclean.php', 3);
- }
}
$db->qclose();
logger("Done deleting orphaned data from thread table");
while ($orphan = $db->qfetch()) {
q("DELETE FROM `notify` WHERE `iid` = %d", intval($orphan["iid"]));
}
-
- // Call it again if not all entries were purged
- if (($count > 0) AND get_config("system", "worker")) {
- proc_run(PRIORITY_LOW, 'include/dbclean.php', 4);
- }
}
$db->qclose();
logger("Done deleting orphaned data from notify table");
while ($orphan = $db->qfetch()) {
q("DELETE FROM `notify-threads` WHERE `id` = %d", intval($orphan["id"]));
}
-
- // Call it again if not all entries were purged
- if (($count > 0) AND get_config("system", "worker")) {
- proc_run(PRIORITY_LOW, 'include/dbclean.php', 5);
- }
}
$db->qclose();
logger("Done deleting orphaned data from notify-threads table");
while ($orphan = $db->qfetch()) {
q("DELETE FROM `sign` WHERE `iid` = %d", intval($orphan["iid"]));
}
-
- // Call it again if not all entries were purged
- if (($count > 0) AND get_config("system", "worker")) {
- proc_run(PRIORITY_LOW, 'include/dbclean.php', 6);
- }
}
$db->qclose();
logger("Done deleting orphaned data from sign table");
while ($orphan = $db->qfetch()) {
q("DELETE FROM `term` WHERE `oid` = %d", intval($orphan["oid"]));
}
-
- // Call it again if not all entries were purged
- if (($count > 0) AND get_config("system", "worker")) {
- proc_run(PRIORITY_LOW, 'include/dbclean.php', 7);
- }
}
$db->qclose();
logger("Done deleting orphaned data from term table");
}
+
+ // Call it again if not all entries were purged
+ if (($stage != 0) AND ($count > 0) AND get_config("system", "worker")) {
+ proc_run(PRIORITY_LOW, 'include/dbclean.php');
+ }
+
}
if (array_search(__file__,get_included_files())===0){