コード例 #1
0
if ($_SERVER['REMOTE_ADDR'] !== $_SERVER['SERVER_ADDR']) {
    die('Access denied.');
}
require_once dirname(__FILE__) . "/../shared/common.php";
require_once dirname(__FILE__) . '/../classes/BulkLookup.php';
// Process ISBN lookup
$limit = 10;
$q = new BulkLookupQuery();
$remain = $q->countQueue();
file_put_contents(dirname(__FILE__) . '/../cron/cronrun.txt', 'LOCK');
if ($remain < 1) {
    // Disable cron.
    file_put_contents(dirname(__FILE__) . '/../cron/cronrun.txt', 'OFF');
    die;
} else {
    $q->getQueue('queue', $limit);
    while ($row = $q->fetch()) {
        $rows[] = $row;
    }
    foreach ($rows as $row) {
        if ($row['tries'] < 3) {
            //$isbnList[] = $row['isbn'];
            $isbnList[] = array('isbn' => $row['isbn'], 'amount' => $row['amount']);
        } else {
            $q->setLookupStatus('manual', $row['isbn'], $row['amount']);
        }
    }
    $lookup = new BulkLookup();
    $lookup->search($isbnList);
}
file_put_contents(dirname(__FILE__) . '/../cron/cronrun.txt', 'ON');
コード例 #2
0
        echo $loc->getText('OPAC');
        ?>
</th></tr>
<?php 
        $bl = new BulkLookupQuery();
        // Paging
        $limit = 50;
        $total = $bl->countQueue('manual_list');
        if (0 + $_GET['page'] < 1 || ($p - 1) * $limit >= $total) {
            $p = 1;
        } else {
            $p = 0 + $_GET['page'];
        }
        $bl->getManualList($limit, ($p - 1) * $limit);
        $rows = array();
        while ($row = $bl->fetch()) {
            $rows[] = $row;
        }
        if (count($rows) < 1) {
            echo "<tr><td colspan=\"7\" class=\"primary\">" . $loc->getText('bulkReportNoItem') . "</td></tr>";
        }
        foreach ($rows as $row) {
            $bibid = $bl->getExistBiblio($row['isbn']);
            $status = $bibid > 0 ? "yes" : "no";
            echo "<tr>" . "  <td class=\"primary\">{$row['isbn']}</td>" . "  <td class=\"primary center\">{$row['hits']}</td>" . "  <td class=\"primary\">{$row['created']}</td>" . "  <td class=\"primary\"><a href=\"../catalog/biblio_new.php?isbn={$row['isbn']}&hits={$row['hits']}\">" . $loc->getText('add') . "</a></td>" . "  <td class=\"primary\">" . "    <a href=\"?del={$row['isbn']}&type=manual\" onclick=\"return confirm('" . $loc->getText('bulkReportConfirmRemoveISBN', array('isbn' => $row['isbn'])) . "')\">" . $loc->getText('remove') . "</a>" . "  </td>" . ($bibid < 1 ? "  <td class=\"primary\">&nbsp;</td>" : "  <td class=\"primary\">" . "    <a href=\"../catalog/biblio_copy_new_form.php?bibid={$bibid}&isbn={$row['isbn']}&hits={$row['hits']}\">copy</a>" . "  </td>") . "  <td class=\"primary\">{$status}</td>" . "</tr>";
        }
        ?>
</table>

<?php 
        // Paging link