Files

46 lines
1.0 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Command;
use Flight;
use flight\commands\AbstractBaseCommand;
use Webapp\Data\Cache;
/**
* Generate all js app cache for all user
*
* Usage: php runway caches
*
*/
class CacheCommand extends AbstractBaseCommand {
/**
* Construct
* @param array<string,mixed> $config From .runway-config.json
*/
public function __construct(array $config) {
parent::__construct('caches', 'Generate all js app cache for all user', $config);
}
/**
* Executes the function
* @return void
*/
public function execute() {
$io = $this->io();
require ($this->projectRoot . '/app/config/runway.php');
$asset = require($this->projectRoot . '/app/config/asset.php');
$cache = new Cache($app);
$cache->set_dev($config->env() === 'development');
$cache->set_asset($asset);
$ares = $cache->Make_Cache();
if (is_array($ares)) $io->white(implode("\n", $ares['log']), true);
$io->ok("Done.", true);
}
}