}
//We add interwiki links as the interwiki user
global $wgUser;
$wgUser = User::newFromName("InterwikiBot");
$ourPageTable = Misc::getLangDB($wgLanguageCode) . ".page";
$lowDate = wfTimestamp(TS_MW, strtotime("-30 day", strtotime(date('Ymd', time()))));
$links = TranslationLink::batchGetRemovedLinks($wgLanguageCode, true);
TranslationLink::batchPopulateURLs($links);
foreach ($links as $link) {
    if ($link->removeLink(true, $debug)) {
        print "Removing link between " . $link->fromURL . "(" . $link->fromAID . ") and " . $link->toURL . "(" . $link->toAID . ")\n";
    } else {
        print "Failed to remove link between " . $link->fromURL . "(" . $link->fromAID . ") and " . $link->toURL . "(" . $link->toAID . ")\n";
    }
}
$links = TranslationLink::batchGetRemovedLinks($wgLanguageCode, false);
TranslationLink::batchPopulateURLs($links);
foreach ($links as $link) {
    if ($link->removeLink(false, $debug)) {
        print "Removing link between " . $link->toURL . "(" . $link->toAID . ") and " . $link->fromURL . "(" . $link->fromAID . ")\n";
    } else {
        print "Failed to remove link between " . $link->toURL . "(" . $link->toAID . ") and " . $link->fromURL . "(" . $link->fromAID . ")\n";
    }
}
foreach ($allLangs as $lang) {
    // We don't add interwiki links from a language to itself
    if ($lang == $wgLanguageCode) {
        continue;
    }
    $anotherLink = array();
    $invalidLink = array();