3 * @file mod/repair_ostatus.php
6 use Friendica\Core\L10n;
7 use Friendica\Core\System;
8 use Friendica\Model\Contact;
10 function repair_ostatus_content(App $a) {
13 notice(L10n::t('Permission denied.') . EOL);
14 goaway($_SESSION['return_url']);
18 $o = "<h2>".L10n::t("Resubscribing to OStatus contacts")."</h2>";
24 $counter = intval($_REQUEST['counter']);
26 $r = q("SELECT COUNT(*) AS `total` FROM `contact` WHERE
27 `uid` = %d AND `network` = '%s' AND `rel` IN (%d, %d)",
29 dbesc(NETWORK_OSTATUS),
30 intval(CONTACT_IS_FRIEND),
31 intval(CONTACT_IS_SHARING));
34 return($o.L10n::t("Error"));
36 $total = $r[0]["total"];
38 $r = q("SELECT `url` FROM `contact` WHERE
39 `uid` = %d AND `network` = '%s' AND `rel` IN (%d, %d)
43 dbesc(NETWORK_OSTATUS),
44 intval(CONTACT_IS_FRIEND),
45 intval(CONTACT_IS_SHARING), $counter++);
48 $o .= L10n::t("Done");
52 $o .= "<p>".$counter."/".$total.": ".$r[0]["url"]."</p>";
54 $o .= "<p>".L10n::t("Keep this window open until done.")."</p>";
56 $result = Contact::createFromProbe($uid, $r[0]["url"], true);
58 $a->page['htmlhead'] = '<meta http-equiv="refresh" content="1; URL='.System::baseUrl().'/repair_ostatus?counter='.$counter.'">';