mirror of
https://code.mensbeam.com/MensBeam/Arsse.git
synced 2024-12-22 21:22:40 +00:00
5cd84c4ab4
- Each parameter is checked for type and normalized - Interval strings are converted to DateInterval objects - Timeouts can be specified as interval strings - Most intervals can be null to signify infinity - Driver classes are checked that they implement the correct interface - Short driver names may be used, and are used by default - Helpful errors messages are printed in case of erroneous configuration Exporting is currently broken; this will be fixed in an upcoming commit
43 lines
1.1 KiB
PHP
43 lines
1.1 KiB
PHP
<?php
|
|
/** @license MIT
|
|
* Copyright 2017 J. King, Dustin Wilson et al.
|
|
* See LICENSE and AUTHORS files for details */
|
|
|
|
declare(strict_types=1);
|
|
namespace JKingWeb\Arsse\Service\Serial;
|
|
|
|
use JKingWeb\Arsse\Arsse;
|
|
|
|
class Driver implements \JKingWeb\Arsse\Service\Driver {
|
|
protected $queue = [];
|
|
|
|
public static function driverName(): string {
|
|
return Arsse::$lang->msg("Driver.Service.Serial.Name");
|
|
}
|
|
|
|
public static function requirementsMet(): bool {
|
|
// this driver has no requirements
|
|
return true;
|
|
}
|
|
|
|
public function __construct() {
|
|
}
|
|
|
|
public function queue(int ...$feeds): int {
|
|
$this->queue = array_merge($this->queue, $feeds);
|
|
return sizeof($this->queue);
|
|
}
|
|
|
|
public function exec(): int {
|
|
while (sizeof($this->queue)) {
|
|
$id = array_shift($this->queue);
|
|
Arsse::$db->feedUpdate($id);
|
|
}
|
|
return Arsse::$conf->serviceQueueWidth - sizeof($this->queue);
|
|
}
|
|
|
|
public function clean(): bool {
|
|
$this->queue = [];
|
|
return true;
|
|
}
|
|
}
|