You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
915 B
37 lines
915 B
<?php namespace WpsMcloud\Actions;
|
|
|
|
use WpsMcloud\Actions\Convert\Attachment;
|
|
use WpsMcloud\Actions\Convert\ReplacerService;
|
|
use WpsMcloud\Support\Counters;
|
|
|
|
class Convert
|
|
{
|
|
private Attachment $attachment;
|
|
|
|
private ReplacerService $replacer;
|
|
|
|
public static int $countProcessedImages = 0;
|
|
|
|
public static int $countImagesNotFound = 0;
|
|
|
|
public function __construct()
|
|
{
|
|
$this->attachment = new Attachment();
|
|
|
|
$this->replacer = new ReplacerService();
|
|
}
|
|
|
|
public function run()
|
|
{
|
|
$images = $this->attachment->getImagesWithoutS3MetaData();
|
|
|
|
echo sprintf('Count for the processing: %d<br>', count($images));
|
|
|
|
foreach ($images as $post) {
|
|
$this->replacer->processImage($post);
|
|
}
|
|
|
|
echo sprintf('Processed: %d<br>', Counters::$processedImages);
|
|
echo sprintf('Not found: %d<br>', Counters::$imagesNotFound);
|
|
}
|
|
}
|