1
1
Fork 0
mirror of https://code.mensbeam.com/MensBeam/Arsse.git synced 2024-12-23 09:02:41 +00:00
Arsse/lib/Service/Internal/Driver.php

40 lines
974 B
PHP
Raw Normal View History

<?php
declare(strict_types=1);
namespace JKingWeb\Arsse\Service\Internal;
2017-08-29 14:50:31 +00:00
use JKingWeb\Arsse\Arsse;
class Driver implements \JKingWeb\Arsse\Service\Driver {
protected $queue = [];
2017-08-29 14:50:31 +00:00
public static function driverName(): string {
return Arsse::$lang->msg("Driver.Service.Internal.Name");
}
2017-08-29 14:50:31 +00:00
public static function requirementsMet(): bool {
// this driver has no requirements
return true;
}
2017-08-29 14:50:31 +00:00
public function __construct() {
}
2017-08-29 14:50:31 +00:00
public function queue(int ...$feeds): int {
$this->queue = array_merge($this->queue, $feeds);
return sizeof($this->queue);
}
2017-08-29 14:50:31 +00:00
public function exec(): int {
while (sizeof($this->queue)) {
$id = array_shift($this->queue);
Arsse::$db->feedUpdate($id);
}
return Arsse::$conf->serviceQueueWidth - sizeof($this->queue);
}
2017-08-29 14:50:31 +00:00
public function clean(): bool {
$this->queue = [];
return true;
}
2017-08-29 14:50:31 +00:00
}