Example #1
0
		callEditHook($page_id, $rev_id, $page_ns, $user_id);
	}
}
else {
	$dbr = wfGetDB( DB_SLAVE, 'stats', $wgExternalSharedDB );
	$where = array( 'city_public' => 1 );
	if ( !empty($wikia) ) {
		$pos = strpos($wikia, '+');
		if ( $pos !== false ) {
			$where[] = "city_id >= '".str_replace('+', '', $wikia)."'";
		} else {
			$where['city_dbname'] = $wikia;
		}
	}
	$start = time();
	$res = $dbr->select( 'city_list', array( '*' ), $where, 'archiveStatsData' );
	while( $row = $dbr->fetchObject( $res ) ) {
		$serverName = WikiFactory::getVarValueByName( "wgServer", $row->city_id );
		runArchiveStats($row->city_id, $serverName, $dateRun, $usedb);
	}
	$dbr->freeResult( $res );
	$end = time();
	$time = time_duration($end - $start);
	if ( empty($time) ) {
		$time = '0 sec';
	}
	echo "Script finished after: " . $time . " \n";
}

echo "end \n";
Example #2
0
<?php 
    if ($num_rows > 0) {
        // query contains stuff
        foreach ($data_set as $pen) {
            // get data from query and loop
            $ban_id = $pen['ban_id'];
            $type = $pen['type'];
            $time_add = $pen['time_add'];
            $time_expire = $pen['time_expire'];
            $reason = tableClean($pen['reason']);
            $client_id = $pen['client_id'];
            $client_name = tableClean($pen['name']);
            $duration = $pen['duration'];
            ## Tidt data to make more human friendly
            if ($time_expire != '-1') {
                $duration_read = time_duration($duration * 60);
            } else {
                $duration_read = '';
            }
            $time_expire_read = timeExpirePen($time_expire);
            $time_add_read = date($tformat, $time_add);
            $reason_read = removeColorCode($reason);
            if ($mem->loggedIn()) {
                $client_name_read = clientLink($client_name, $client_id);
            } else {
                $client_name_read = $client_name;
            }
            ## Row color
            $alter = alter();
            // setup heredoc (table data)
            $data = <<<EOD
Example #3
0
    return $result;
}
if ($help) {
    echo <<<TEXT
Usage:
    php testArchiveData.php --help
    php testArchiveData.php [--limit=N]

    --help         : This help message
    --limit=N      : Number of records to check
TEXT;
    exit(0);
} else {
    $start = time();
    $wikia = $wgCityId;
    $records = getEventsRecords($wikia, $limit);
    $res = array('ok' => 0, 'error' => 0);
    echo "Found " . count($records) . " \n";
    foreach ($records as $id => $oRow) {
        $dbname = WikiFactory::IDtoDB($oRow->wiki_id);
        if ($dbname) {
            $result = compareEventRecordWithRevision($dbname, $oRow, $debug);
            $key = $result === false ? 'error' : 'ok';
            $res[$key]++;
        }
    }
    $end = time();
    echo "\n\nScript finished after: " . time_duration($end - $start) . " \n";
    echo "Result: ok:" . $res['ok'] . ", err:" . $res['error'] . " \n";
}
echo "end \n";
Example #4
0
//foreach ($qstat->element[0] as $element) {
$job_name = $qstat->djob_info->element[0]->JB_job_name;
$job_owner = $qstat->djob_info->element[0]->JB_owner;
$job_group = $qstat->djob_info->element[0]->JB_group;
$job_ust = $qstat->djob_info->element[0]->JB_submission_time;
$job_st = date(r, number_format($job_ust, 0, '', ''));
$job_qn = $qstat->djob_info->element[0]->JB_hard_queue_list->destin_ident_list->QR_name;
$job_pe = $qstat->djob_info->element[0]->JB_pe;
$job_slots = $qstat->djob_info->element[0]->JB_pe_range->ranges->RN_min;
echo "\t<table align=center width=95% border=\"1\" cellpadding=\"0\" cellspacing=\"0\">\n        <tbody>\n\t\t<tr CLASS=\"header\">\n\t\t<td>JobID</td>\n                <td>Name</td>\n                <td>Owner</td>\n                <td>Group</td>\n                <td>SubmitTime</td>\n                <td>Queue</td>\n                <td>PE</td>\n                <td>Slots</td>\n                </tr>\n                <tr>\n                <td>{$jobid}</td>\n                <td>{$job_name}</td>\n                <td>{$job_owner}</td>\n                <td>{$job_group}</td>\n                <td>{$job_st}</td>\n                <td>{$job_qn}</td>\n                <td>{$job_pe}</td>\n                <td>{$job_slots}</td>\n              </tr>\t  \n           </tbody>\n\t</table><br>";
$i = 0;
foreach ($qstat->xpath('//scaled') as $usage) {
    $usage_stats[$i++] = $usage->UA_value;
}
if ($usage_stats[0] > 0) {
    $cputime = time_duration($usage_stats[0], 'dhms');
} else {
    $cputime = 0;
}
echo "\t<table align=center width=95% border=\"1\" cellpadding=\"0\" cellspacing=\"0\">\n        <tbody>\n\t\t<tr CLASS=\"header\">\n\t\t<td>CPUTime (s)</td>\n                <td>Mem (GB)</td>\n                <td>io</td>\n                <td>iow</td>\n                <td>VMem (M)</td>\n                <td>MaxVMem (M)</td>\n                </tr>\n                <tr>\n                <td>{$cputime}</td>\n                <td>" . number_format($usage_stats[1], 2, '.', '') . "</td>\n                <td>" . number_format($usage_stats[2], 2, '.', '') . "</td>\n                <td>" . number_format($usage_stats[3], 2, '.', '') . "</td>\n                <td>" . number_format($usage_stats[4] / 1024 / 1024, 2, '.', '') . "</td>\n                <td>" . number_format($usage_stats[5] / 1024 / 1024, 2, '.', '') . "</td>\n              </tr>\t  \n           </tbody>\n\t</table><br>";
exec("rm /tmp/{$token}.xml");
?>


<br>

      </td>
    </tr>
<?php 
include "bottom.php";
?>
Example #5
0
			<th colspan="6">Click client name to see details</th>
		</tr>
	</tfoot>
	<tbody>
	<?php 
    if ($num_rows > 0) {
        // query contains stuff
        foreach ($data_set as $info) {
            // get data from query and loop
            $cid = $info['id'];
            $name = $info['name'];
            $level = $info['level'];
            $connections = $info['connections'];
            $time_edit = $info['time_edit'];
            ## Change to human readable
            $time_diff = time_duration($time - $time_edit, 'yMwd');
            $time_edit = date($tformat, $time_edit);
            // this must be after the time_diff
            $client_link = clientLink($name, $cid);
            $alter = alter();
            // setup heredoc (table data)
            $data = <<<EOD
\t\t\t<tr class="{$alter}">
\t\t\t\t<td><strong>{$client_link}</strong></td>
\t\t\t\t<td>@{$cid}</td>
\t\t\t\t<td>{$level}</td>
\t\t\t\t<td>{$connections}</td>
\t\t\t\t<td><em>{$time_edit}</em></td>
\t\t\t\t<td><em>{$time_diff}</em></td>
\t\t\t</tr>
EOD;
Example #6
0
// run query
$stmt->store_result();
// store the result - needed for the num_rows check
if ($stmt->num_rows) {
    // if results exist
    $stmt->bind_result($pid, $type, $time_add, $time_expire, $reason, $data, $inactive, $duration, $admin_id, $admin_name);
    while ($stmt->fetch()) {
        // fetcht the results and store in an array
        // Change into readable times
        $time_add = date($tformat, $time_add);
        $time_expire_read = timeExpire($time_expire, $type, $inactive);
        $reason = tableClean(removeColorCode($reason));
        $data = tableClean($data);
        $admin_name = tableClean($admin_name);
        if ($type_inc != 'Kick' && $type_inc != 'Notice' && $time_expire != '-1') {
            $duration = time_duration($duration * 60, 'yMwdhm');
        } else {
            $duration = '';
        }
        // Row odd/even colouring
        $alter = alter();
        if ($admin_id != 1) {
            // if admin is not B3 show clientdetails link else show just the name
            $admin_link = '<a href="clientdetails.php?id=' . $admin_id . '" title="View the admin\'s client page">' . $admin_name . '</a>';
        } else {
            $admin_link = $admin_name;
        }
        if ($mem->reqLevel('unban')) {
            // if user has access to unban show unban button
            $unban = unbanButton($pid, $cid, $type, $inactive);
        } else {
Example #7
0
<html>
<head>
</head>
<body>

	<fieldset id="edit-ban">
		<legend>Edit this Ban</legend>
		
		<?php 
if ($num_rows > 0) {
    $reason_read = cleanvar(removeColorCode($reason));
    $name = cleanvar($name);
    $time_add_read = date($tformat, $time_add);
    $time_expire_read = timeExpirePen($time_expire);
    if ($duration != 0) {
        $duration_read = time_duration($duration * 60, 'yMwdhm');
    } else {
        $duration_read = 'Permanent';
    }
    $token_eb = genFormToken('editban');
    ?>
		
		<fieldset class="none eb-fs">
			<legend>Information about the ban</legend>
			<table class="cd-table">
				<tbody>
					<tr>
						<th>Client Name</th>
						<td><?php 
    echo $name;
    ?>