<?php

namespace script;

use KupShop\AdminBundle\Util\Script\Script;
use KupShop\FeedsBundle\EventSubscriber\ExpensiveFeedsSubscriber;
use KupShop\KupShopBundle\Util\Compat\ServiceContainer;

class ExpensiveFeedsScript extends Script
{
    use \DatabaseCommunication;

    protected static $name = 'Přegenerovat expensive feedy';
    protected static $defaultParameters = [];

    protected function run(array $arguments)
    {
        $timeStart = getScriptTime();
        $subscriber = ServiceContainer::getService(ExpensiveFeedsSubscriber::class);
        $subscriber->generateExpensiveFeeds();

        $this->log('Hotovo');
        $this->log('Peak memory: '.memory_get_peak_usage(true));
        $this->log('Duration: '.(getScriptTime() - $timeStart));
    }
}

return ExpensiveFeedsScript::class;
