Example #1
0
/**
 * Rebuild link tracking tables from scratch.  This takes several
 * hours, depending on the database size and server configuration.
 *
 * @file
 * @todo document
 * @ingroup Maintenance
 */
/** */
require_once "commandLine.inc";
#require_once( "rebuildlinks.inc" );
require_once "refreshLinks.inc";
require_once "rebuildtextindex.inc";
require_once "rebuildrecentchanges.inc";
$dbclass = 'Database' . ucfirst($wgDBtype);
$database = new $dbclass($wgDBserver, $wgDBadminuser, $wgDBadminpassword, $wgDBname);
if ($wgDBtype == 'mysql') {
    print "** Rebuilding fulltext search index (if you abort this will break searching; run this script again to fix):\n";
    dropTextIndex($database);
    rebuildTextIndex($database);
    createTextIndex($database);
}
print "\n\n** Rebuilding recentchanges table:\n";
rebuildRecentChangesTable();
# Doesn't work anymore
# rebuildLinkTables();
# Use the slow incomplete one instead. It's designed to work in the background
print "\n\n** Rebuilding links tables -- this can take a long time. It should be safe to abort via ctrl+C if you get bored.\n";
refreshLinks(1);
print "Done.\n";
exit;
Example #2
0
<?php

/**
 * @todo document
 * @package MediaWiki
 * @subpackage Maintenance
 */
/** */
$optionsWithArgs = array('m', 'e');
require_once "commandLine.inc";
require_once "refreshLinks.inc";
error_reporting(E_ALL & ~E_NOTICE);
if (!$options['dfn-only']) {
    if ($args[0]) {
        $start = (int) $args[0];
    } else {
        $start = 1;
    }
    refreshLinks($start, $options['new-only'], $options['m'], $options['e']);
}
// this bit's bad for replication: disabling temporarily
// --brion 2005-07-16
//deleteLinksFromNonexistent();
if ($options['globals']) {
    print_r($GLOBALS);
}
<?php

if ($token != $_SESSION['token'] || $_SESSION['links'][$index]->url != $url) {
    showFatalError("Bookmark garbled!  Please <a href=\"?action=restart\">" . "restart.</a>");
}
if ($_SESSION['links_ctime'] < filectime($bookmarkFile)) {
    showFatalError("Stale bookmark list detected!  " . "Please <a href=\"?action=restart\">restart</a>");
}
unset($_SESSION['links'][$index]);
$_SESSION['links'] = array_values($_SESSION['links']);
writeLinkFile($bookmarkFile, $_SESSION['links']);
refreshLinks($SESSION, $bookmarkFile);
include 'templates/list.html';
<?php

$index = $REQUEST['index'];
$url = $REQUEST['url'];
// Quick sanity check to make sure we are not getting stale or bogus info
if ($_SESSION['links'][$index]->url != $url) {
    showFatalError("Bookmark garbled!  Please <a href=\"?action=restart\">" . "restart.</a>");
}
$_SESSION['links'][$index]->lastVisitedTimestamp = time();
$_SESSION['links'][$index]->visitCount++;
writeLinkFile($bookmarkFile, $_SESSION['links']);
refreshLinks($bookmarkFile);
header("Location: {$_SESSION['links'][$index]->url}\r\n");
Example #5
0
    php refreshLinks.php [<start>] [-e <end>] [-m <maxlag>] [--dfn-only]
                         [--new-only] [--redirects-only]
    php refreshLinks.php [<start>] [-e <end>] [-m <maxlag>] --old-redirects-only

    --help               : This help message
    --dfn-only           : Delete links from nonexistent articles only
    --new-only           : Only affect articles with just a single edit
    --redirects-only     : Only fix redirects, not all links
    --old-redirects-only : Only fix redirects with no redirect table entry
    -m <number>          : Maximum replication lag
    <start>              : First page id to refresh
    -e <number>          : Last page id to refresh

TEXT;
    exit(0);
}
error_reporting(E_ALL & ~E_NOTICE);
if (!$options['dfn-only']) {
    if (isset($args[0])) {
        $start = (int) $args[0];
    } else {
        $start = 1;
    }
    refreshLinks($start, $options['new-only'], $options['m'], $options['e'], $options['redirects-only'], $options['old-redirects-only']);
}
// this bit's bad for replication: disabling temporarily
// --brion 2005-07-16
//deleteLinksFromNonexistent();
if ($options['globals']) {
    print_r($GLOBALS);
}