Initial commit

This commit is contained in:
2022-07-10 10:27:25 +03:00
commit e3e7af347b
22 changed files with 1618 additions and 0 deletions

37
src/Actions/Convert.php Normal file
View File

@ -0,0 +1,37 @@
<?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);
}
}