mirror of
https://code.mensbeam.com/MensBeam/Arsse.git
synced 2024-12-23 09:02:41 +00:00
6d4aa4db6e
- Basic update service handles only one feed at a time and possibly leaks memory - Output for REST requests is still very basic - No avatar support - No reporting of whether cron works - No cleanup before or after feed updates
38 lines
No EOL
925 B
PHP
38 lines
No EOL
925 B
PHP
<?php
|
|
declare(strict_types=1);
|
|
namespace JKingWeb\Arsse\Service\Internal;
|
|
use JKingWeb\Arsse\Data;
|
|
|
|
class Driver implements \JKingWeb\Arsse\Service\Driver {
|
|
protected $queue = [];
|
|
|
|
static function driverName(): string {
|
|
return Data::$lang->msg("Driver.Service.Internal.Name");
|
|
}
|
|
|
|
static function requirementsMet(): bool {
|
|
// this driver has no requirements
|
|
return true;
|
|
}
|
|
|
|
function __construct() {
|
|
}
|
|
|
|
function queue(int ...$feeds): int {
|
|
$this->queue = array_merge($this->queue, $feeds);
|
|
return sizeof($this->queue);
|
|
}
|
|
|
|
function exec(): int {
|
|
while(sizeof($this->queue)) {
|
|
$id = array_shift($this->queue);
|
|
Data::$db->feedUpdate($id);
|
|
}
|
|
return Data::$conf->serviceQueueWidth - sizeof($this->queue);
|
|
}
|
|
|
|
function clean(): bool {
|
|
$this->queue = [];
|
|
return true;
|
|
}
|
|
} |