2022-11-11 06:18:15 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace OCA\Memories\Migration;
|
|
|
|
|
2023-04-14 23:02:13 +00:00
|
|
|
use OCA\Memories\Db\AddMissingIndices;
|
|
|
|
use OCA\Memories\Service\BinExt;
|
2023-04-11 18:52:12 +00:00
|
|
|
use OCA\Memories\Util;
|
2022-11-11 06:18:15 +00:00
|
|
|
use OCP\IConfig;
|
|
|
|
use OCP\Migration\IOutput;
|
|
|
|
use OCP\Migration\IRepairStep;
|
|
|
|
|
2022-11-11 06:22:06 +00:00
|
|
|
class Repair implements IRepairStep
|
|
|
|
{
|
|
|
|
protected IConfig $config;
|
|
|
|
|
|
|
|
public function __construct(IConfig $config)
|
|
|
|
{
|
|
|
|
$this->config = $config;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getName(): string
|
|
|
|
{
|
|
|
|
return 'Repair steps for Memories';
|
|
|
|
}
|
|
|
|
|
|
|
|
public function run(IOutput $output): void
|
|
|
|
{
|
2023-04-14 02:43:13 +00:00
|
|
|
// Add missing indices
|
2023-10-06 22:42:47 +00:00
|
|
|
AddMissingIndices::run($output);
|
2023-04-14 02:43:13 +00:00
|
|
|
|
2023-04-11 00:51:16 +00:00
|
|
|
// kill any instances of go-vod and exiftool
|
2023-04-11 18:52:12 +00:00
|
|
|
Util::pkill(BinExt::getName('go-vod'));
|
|
|
|
Util::pkill(BinExt::getName('exiftool'));
|
2023-04-10 21:32:35 +00:00
|
|
|
|
|
|
|
// detect exiftool
|
2023-04-14 23:02:13 +00:00
|
|
|
if ($path = BinExt::detectExiftool()) {
|
2023-04-10 21:32:35 +00:00
|
|
|
$output->info("exiftool binary is configured: {$path}");
|
|
|
|
} else {
|
|
|
|
$output->warning('exiftool binary could not be configured');
|
|
|
|
}
|
|
|
|
|
|
|
|
// detect go-vod
|
2023-04-14 23:02:13 +00:00
|
|
|
if ($path = BinExt::detectGoVod()) {
|
2023-04-10 21:32:35 +00:00
|
|
|
$output->info("go-vod binary is configured: {$path}");
|
|
|
|
} else {
|
|
|
|
$output->warning('go-vod binary could not be configured');
|
|
|
|
}
|
|
|
|
|
|
|
|
// detect ffmpeg
|
2023-04-14 23:02:13 +00:00
|
|
|
if ($path = BinExt::detectFFmpeg()) {
|
2023-04-10 21:32:35 +00:00
|
|
|
$output->info("ffmpeg binary is configured: {$path}");
|
|
|
|
} else {
|
|
|
|
$output->warning('ffmpeg binary could not be configured');
|
|
|
|
}
|
2022-11-11 06:22:06 +00:00
|
|
|
}
|
|
|
|
}
|