Exemplo n.º 1
0
 foreach (array_keys($wikiList) as $wiki) {
     $domain = $wt->metap[$wiki]["domain"];
     $apibase = "http://{$domain}/w/api.php?";
     $pages = array_values($wikiList[$wiki]);
     $data = array('action' => 'query', 'format' => 'json', 'prop' => 'info|revisions', 'inprop' => 'watched|watchers|notificationtimestamp|url', 'indexpageids' => '', 'converttitles' => '', 'titles' => implode('|', $pages));
     $query = $apibase . http_build_query($data);
     #print_r($apibase);
     #print_r($data);
     $res = json_decode($wt->gethttp($query))->query->pages;
     foreach ($res as $pageid => $row) {
         $hash = crc32($wiki . $row->title);
         foreach ($pageList as $i => $entry) {
             if ($hash == $entry["hash"]) {
                 try {
                     $diff = $wt->datediff(new DateTime($row->revisions[0]->timestamp));
                     $lastrev = $wt->dateFmt($row->revisions[0]->timestamp);
                     $err = false;
                 } catch (Exception $e) {
                     $err = true;
                 }
                 if ($err) {
                     $diff = $wt->datediff(null);
                     $lastrev = null;
                 }
                 $pageList[$i]["pageid"] = $pageid;
                 $pageList[$i]["ns"] = $row->ns;
                 $pageList[$i]["lastrev"] = $lastrev;
                 $pageList[$i]["datediff"] = "<span style=\"color:{$diff->diffcolor} \" >{$diff->difftxt}</span>";
                 $pageList[$i]["lastrevid"] = $row->lastrevid;
                 $pageList[$i]["lastuser"] = $row->revisions[0]->user;
                 $pageList[$i]["lastcomment"] = $row->revisions[0]->comment;
Exemplo n.º 2
0
$datefrom = $wt->checkDate($datefrom);
$datediff = '–';
if ($datefrom) {
    $dt = new DateTime($dateto);
    $df = new DateTime($datefrom);
    $datediff = $df->diff($dt, true)->format('%a') . ' ' . $I18N->msg('days', array("variables" => array(2)));
}
$dbr = $wt->loadDatabase($lang, $wiki);
$list = getAdminStats($dbr, $wi, $datefrom, $dateto);
$wt->content = getPageTemplate('result');
$wt->assign('list', $list);
$wt->assign('numcuradmins', $wt->numFmt(count($curAdmins)));
$wt->assign('noactionadmins', $wt->numFmt($noActionAdmin));
$wt->assign('pctnoaction', $wt->numFmt($pctnoaction, 1));
$wt->assign('domain', $domain);
$wt->assign('datefrom', $wt->dateFmt($datefrom . ' 00:00:00'));
$wt->assign('numdays', $datediff);
unset($list, $curAdmins);
$wt->showPage();
function getCurrentAdmins($wi)
{
    global $wt, $perflog;
    $stime = microtime(true);
    $res = array();
    $apibase = "http://{$wi->domain}/w/api.php?";
    $data = array("action" => "query", "list" => "allusers", "format" => "json", "augroup" => "sysop|bureaucrat|steward|oversight|checkuser", "auprop" => "groups|editcount", "aufrom" => "", "aulimit" => "500");
    $continue = true;
    $i = 0;
    while ($continue) {
        if ($i > 0) {
            $data["aufrom"] = $continue;
Exemplo n.º 3
0
$wt->assign('runextended', $extendedLink);
$msgDay = $I18N->msg('days', array("variables" => array(1)));
$msgDays = $I18N->msg('days', array("variables" => array(2)));
$wt->assign('avgeditsperdaytext', $I18N->msg('avg_edits_per_time_sign', array("variables" => array($msgDay))));
$wt->assign('xtoolsbase', XTOOLS_BASE_WEB_DIR);
$wt->assign("lang", $lang);
$wt->assign("wiki", $wiki);
$wt->assign("userid", $cnt->mUID);
$wt->assign("username", $cnt->getName());
$wt->assign("usernameurl", rawurlencode($cnt->getName()));
$wt->assign("userprefix", rawurlencode($cnt->mNamespaces["names"][2]));
$wt->assign("domain", $domain);
$wt->assign("loadwiki", "&wiki={$wiki}&lang={$lang}");
$adminlink = '<a href="//' . XTOOLS_BASE_WEB_DIR . '/adminstats/?project=' . $wi->domain . '" >sysop</a>';
$wt->assign("groups", str_replace('sysop', $adminlink, implode(', ', $cnt->mGroups)) . $groupsGlobal);
$wt->assign("firstedit", $wt->dateFmt($cnt->mFirstEdit));
$wt->assign("latestedit", $wt->dateFmt($cnt->mLatestEdit));
$wt->assign('editdays', $cnt->mEditDays . " {$msgDays}");
$wt->assign('avgeditsperday', $wt->numFmt($cnt->mTotal / $cnt->mEditDays, 1));
$wt->assign("unique", $wt->numFmt($cnt->getUnique()));
$wt->assign("average", $wt->numFmt($cnt->getAveragePageEdits(), 1));
$wt->assign("average_len", $wt->numFmt($cnt->mAverageLen));
$wt->assign("pages_created", $wt->numFmt($cnt->mCreated + $cnt->mDeletedCreated));
$wt->assign("pages_moved", $wt->numFmt($cnt->mLogActions["move/"]));
//+ $cnt->mLogActions["move/move_redir"]
$wt->assign("uploaded", $wt->numFmt($cnt->mLogActions["upload/"]));
//["upload/upload"]
$wt->assign("uploaded_commons", $wt->numFmt($cnt->mUploadedCommons));
$wt->assign("autoedits", $wt->numFmt($cnt->mAutoEdits));
$wt->assign("reverted", $wt->numFmt($cnt->mReverted));
$wt->assign("edits_summary", $wt->numFmt($cnt->mEditsSummary));
Exemplo n.º 4
0
$wt->assign("page", $ai->pagetitleFull);
$wt->assign("urlencodedpage", $ai->pagetitleFullUrl);
$wt->assign('pageid', $ai->pageid);
$wt->assign("totaledits", $wt->numFmt($ai->data['count']));
$wt->assign("editorcount", $wt->numFmt($ai->data['editor_count']));
$wt->assign("pagesize", $wt->numFmt($ai->data['current_size']));
$wt->assign("minoredits", $wt->numFmt($ai->data['minor_count']));
$wt->assign("minoredits", $wt->numFmt($ai->data['minor_count']));
$wt->assign("anonedits", $wt->numFmt($ai->data['anon_count']));
$wt->assign("minorpct", $wt->numFmt($ai->data['minor_count'] / $ai->data['count'] * 100, 1));
$wt->assign("anonpct", $wt->numFmt($ai->data['anon_count'] / $ai->data['count'] * 100, 1));
$wt->assign('botedits', $wt->numFmt($ai->data['botedit_count']));
$wt->assign('boteditspct', $wt->numFmt($ai->data['botedit_count'] / $ai->data['count'] * 100, 1));
$wt->assign("autoedits", $wt->numFmt($ai->data['automated_count']));
$wt->assign("autoeditspct", $wt->numFmt($ai->data['automated_count'] / $ai->data['count'] * 100, 1));
$wt->assign("firstedit", $wt->dateFmt(date('Y-m-d H:i:s', strtotime($ai->data['first_edit']['timestamp']))));
$wt->assign("firstuser", $ai->data['first_edit']['user']);
$wt->assign("latestedit", $wt->dateFmt(date('Y-m-d H:i:s', strtotime($ai->data['last_edit']['timestamp']))));
$wt->assign("latestuser", $ai->data['last_edit']['user']);
$wt->assign("maxadd", $wt->dateFmt(date('Y-m-d H:i:s', strtotime($ai->data['max_add']['timestamp']))));
$wt->assign("maxadduser", $ai->data['max_add']['user']);
$wt->assign("maxaddnum", $wt->numFmt($ai->data['max_add']['size']));
$wt->assign("maxadddiff", $ai->data['max_add']['revid']);
$wt->assign("maxdel", $wt->dateFmt(date('Y-m-d H:i:s', strtotime($ai->data['max_del']['timestamp']))));
$wt->assign("maxdeluser", $ai->data['max_del']['user']);
$wt->assign("maxdelnum", $wt->numFmt($ai->data['max_del']['size']));
$wt->assign("maxdeldiff", $ai->data['max_del']['revid']);
$wt->assign("timebwedits", $wt->numFmt($ai->data['average_days_per_edit'], 1) . ' ' . $I18N->msg('days', array("variables" => array(2))));
$wt->assign("editspermonth", $wt->numFmt($ai->data['edits_per_month'], 1));
$wt->assign("editsperyear", $wt->numFmt($ai->data['edits_per_year'], 1));
$wt->assign("lastday", $wt->numFmt($ai->data['count_history']['today']));