Exemplo n.º 1
0
<?php

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);
Exemplo n.º 2
0
<?php

$tab = "admin";
$nav = "BulkLookup";
$helpPage = "BulkLookup";
$cancelLocation = "../admin/index.php";
require_once "../shared/common.php";
require_once "../shared/logincheck.php";
require_once "../classes/Localize.php";
$loc = new Localize(OBIB_LOCALE, $tab);
require_once '../classes/BulkLookup.php';
$q = new BulkLookupQuery();
$queued = $q->countQueue();
$trying = $q->countQueue('queue_try');
$done = $q->countQueue('publish');
$covered = $q->countQueue('cover');
$copied = $q->countQueue('copy');
$failed = $q->countQueue('manual');
$estimate_time = date('H:i:s', $q->getStartTime());
//1
$est_time = $q->getStartTime();
$est_hour = str_pad(floor($est_time / 3600), 2, '0', STR_PAD_LEFT);
$est_min = str_pad(floor($est_time % 3600 / 60), 2, '0', STR_PAD_LEFT);
$est_sec = str_pad(floor($est_time % 60), 2, '0', STR_PAD_LEFT);
$estimate_time = $est_hour . ':' . $est_min . ':' . $est_sec;
if ($queued < 1) {
    echo "DONE";
}
$cron_status = file_get_contents('../cron/cronrun.txt');
echo $loc->getText('lookup_bulkStatus', array('updated' => date('Y-m-d H:i:s'), 'estimate' => $estimate_time, 'cron_status' => $cron_status, 'remain' => $queued, 'trying' => $trying, 'done' => $done + $covered, 'covered' => $covered, 'copied' => $copied, 'failed' => $failed));
if ($queued < 1) {
Exemplo n.º 3
0
        ?>
</th><th><?php 
        echo $loc->getText('Created');
        ?>
</th><th colspan="3"><?php 
        echo $loc->getText('function');
        ?>
</th><th><?php 
        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']);