3 * @file mod/repair_ostatus.php
7 use Friendica\Core\L10n;
8 use Friendica\Core\Protocol;
9 use Friendica\Core\System;
10 use Friendica\Database\DBA;
11 use Friendica\Model\Contact;
13 function repair_ostatus_content(App $a) {
16 notice(L10n::t('Permission denied.') . EOL);
17 $a->internalRedirect('ostatus_repair');
21 $o = "<h2>".L10n::t("Resubscribing to OStatus contacts")."</h2>";
27 $counter = intval($_REQUEST['counter']);
29 $r = q("SELECT COUNT(*) AS `total` FROM `contact` WHERE
30 `uid` = %d AND `network` = '%s' AND `rel` IN (%d, %d)",
32 DBA::escape(Protocol::OSTATUS),
33 intval(Contact::FRIEND),
34 intval(Contact::SHARING));
36 if (!DBA::isResult($r)) {
37 return ($o . L10n::t("Error"));
40 $total = $r[0]["total"];
42 $r = q("SELECT `url` FROM `contact` WHERE
43 `uid` = %d AND `network` = '%s' AND `rel` IN (%d, %d)
47 DBA::escape(Protocol::OSTATUS),
48 intval(Contact::FRIEND),
49 intval(Contact::SHARING), $counter++);
51 if (!DBA::isResult($r)) {
52 $o .= L10n::t("Done");
56 $o .= "<p>".$counter."/".$total.": ".$r[0]["url"]."</p>";
58 $o .= "<p>".L10n::t("Keep this window open until done.")."</p>";
60 Contact::createFromProbe($uid, $r[0]["url"], true);
62 $a->page['htmlhead'] = '<meta http-equiv="refresh" content="1; URL='.System::baseUrl().'/repair_ostatus?counter='.$counter.'">';