Exemplo n.º 1
0
function runGc()
{
    global $db, $gcLimit;
    $now = time();
    $sql = "SELECT * FROM ticket WHERE expire < {$now}";
    $sql .= " OR (last_stamp + last_time) < {$now}";
    $sql .= " OR expire_dln <= downloads";
    if ($gcLimit) {
        $sql .= " LIMIT {$gcLimit}";
    }
    foreach ($db->query($sql)->fetchAll() as $DATA) {
        ticketPurge($DATA);
    }
    // expire grants
    $sql = "SELECT * FROM \"grant\" WHERE grant_expire < {$now}";
    if ($gcLimit) {
        $sql .= " LIMIT {$gcLimit}";
    }
    foreach ($db->query($sql)->fetchAll() as $DATA) {
        grantPurge($DATA);
    }
}
Exemplo n.º 2
0
    if (!is_array($sel)) {
        $sel = array($sel);
    }
    // purge immediately
    foreach ($sel as $id) {
        if (!isGrantId($id)) {
            continue;
        }
        $sql = "SELECT * FROM \"grant\" WHERE id = " . $db->quote($id);
        $DATA = $db->query($sql)->fetch();
        if ($DATA === false) {
            continue;
        }
        // actually purge the grant
        $list[] = htmlEntUTF8(grantStr($DATA));
        grantPurge($DATA, false);
    }
    if (count($list)) {
        infoMessage(T_("Purged"), $list);
    }
}
// list active grants
$sql = 'SELECT g.*, u.name AS "user" FROM "grant" g' . ' LEFT JOIN "user" u ON u.id = g.user_id' . ' ORDER BY time DESC';
?>
<form action="<?php 
echo $ref;
?>
" method="post">
  <table class="sortable" id="allgrants">
    <thead>
      <tr>