Esempio n. 1
0
function wfBlockVanillaUser($block, $user)
{
    global $wgVanillaDB;
    try {
        if ($block->mUser == 0) {
            return true;
        }
        Vanilla::setUserRole($block->mUser, 1);
    } catch (Exception $e) {
        print_r($e);
        exit;
    }
    return true;
}
Esempio n. 2
0
function wfBlockVanillaUser($block, $user)
{
    global $wgVanillaDB;
    try {
        $target = $block->getTargetAndType();
        if (!is_array($target) || $target[1] != Block::TYPE_USER) {
            return true;
        }
        $user = User::newFromName($target[0], false);
        if ($user) {
            $user->load();
        }
        if (!$user || $user->getId() == 0) {
            return true;
        }
        Vanilla::setUserRole($user->getId(), 1);
    } catch (Exception $e) {
        wfDebug('VANILLA FORUMS ERROR ' . print_r($e, true));
        print_r($e);
        exit;
    }
    return true;
}
<?php

require_once 'commandLine.inc';
$dbr = wfGetDB(DB_SLAVE);
$old = wfTimestamp(TS_MW, time() - 7200);
// last 2 hours
$new = wfTimestampNow();
$res = $dbr->select('ipblocks', array('ipb_user'), array('ipb_user != 0', "ipb_expiry >= '{$old}'", "ipb_expiry <= '{$new}'"));
while ($row = $dbr->fetchObject($res)) {
    Vanilla::setUserRole($row->ipb_user, 8);
}