X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fcron.php;h=3acf711dd163056234b822a1eb27f39387108a7b;hb=3ea5706d167df8e576bbe6ced0a4caa836f644e0;hp=bf3243cb60f9513bec0d6eeca5af44296a97f738;hpb=32c7896c5dce4543eeb326f5abc1037451b84757;p=friendica.git diff --git a/include/cron.php b/include/cron.php index bf3243cb60..3acf711dd1 100644 --- a/include/cron.php +++ b/include/cron.php @@ -30,7 +30,6 @@ function cron_run(&$argv, &$argc){ require_once('include/session.php'); require_once('include/datetime.php'); - require_once('library/simplepie/simplepie.inc'); require_once('include/items.php'); require_once('include/Contact.php'); require_once('include/email.php'); @@ -164,6 +163,9 @@ function cron_run(&$argv, &$argc){ // Repair missing Diaspora values in contacts cron_repair_diaspora($a); + // Repair entries in the database + cron_repair_database(); + $manual_id = 0; $generation = 0; $force = false; @@ -417,6 +419,23 @@ function cron_repair_diaspora(&$a) { } } +/** + * @brief Do some repairs in database entries + * + */ +function cron_repair_database() { + + // Set the parent if it wasn't set. (Shouldn't happen - but does sometimes) + // This call is very "cheap" so we can do it at any time without a problem + q("UPDATE `item` INNER JOIN `item` AS `parent` ON `parent`.`uri` = `item`.`parent-uri` AND `parent`.`uid` = `item`.`uid` SET `item`.`parent` = `parent`.`id` WHERE `item`.`parent` = 0"); + + /// @todo + /// - remove thread entries without item + /// - remove sign entries without item + /// - remove children when parent got lost + /// - set contact-id in item when not present +} + if (array_search(__file__,get_included_files())===0){ cron_run($_SERVER["argv"],$_SERVER["argc"]); killme();