Files
cmasa/app/commands/CacheCommand.php
T
2026-10-29 13:34:31 +07:00

45 lines
1023 B
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 user:cache
*
*/
class CacheCommand extends AbstractBaseCommand {
/**
* Construct
* @param array<string,mixed> $config From .runway-config.json
*/
public function __construct(array $config) {
parent::__construct('user:cache', '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_asset($asset);
$ares = $cache->Make_Cache();
if (is_array($ares)) $io->info("Processed of {$ares['user_count']} user.", true);
$io->ok("Done.", true);
}
}