45 lines
1.0 KiB
PHP
45 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 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->white("Processed of {$ares['user_count']} user.", true);
|
|
$io->ok("Done.", true);
|
|
}
|
|
|
|
}
|