<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Command; use Illuminate\Console\Command; use ModStart\Admin\Auth\Admin; use ModStart\Core\Dao\ModelUtil; use ModStart\Core\Input\Response; use ModStart\ModStart; use ModStart\Module\ModuleManager; class ModuleInstallAllCommand extends Command { protected $signature = 'modstart:module-install-all'; public function handle() { goto mXN5u; o62RS: $nVfg_ = config('env.MS_INIT_ADMIN_USERS', ''); goto vxV8e; ULetQ: foreach (ModuleManager::listAllInstalledModulesInRequiredOrder() as $CiBrR) { goto GQ_WE; QoAUE: $this->info(''); goto UdBWm; DqEgu: $this->warn(">>> Module {$CiBrR} Installing"); goto xB3To; GQ_WE: if (!ModuleManager::isExists($CiBrR)) { continue; } goto DqEgu; xB3To: $pTwJr = ModuleManager::install($CiBrR); goto Ta_xA; Ta_xA: if (Response::isSuccess($pTwJr)) { $this->info($pTwJr['data']['output']); } else { $this->error($pTwJr['msg']); } goto QoAUE; UdBWm: } goto o62RS; XPSdS: $this->publishHotfixFiles(); goto bXako; mXN5u: $this->info('ModuleInstallAll
'); goto ULetQ; bXako: $this->warn('ModuleInstallAll Run Finished'); goto b9sFR; vxV8e: if ($nVfg_) { goto HQlwc; JboIU: $nVfg_ = array_map(function ($uTz0e) { list($Y1NF_, $Y6QUz) = explode(':', $uTz0e); $Y1NF_ = trim($Y1NF_); $Y6QUz = trim($Y6QUz); if (empty($Y1NF_) || empty($Y6QUz)) { return null; } return array('user' => $Y1NF_, 'password' => $Y6QUz); }, $nVfg_); goto WjkTw; WjkTw: $nVfg_ = array_filter($nVfg_); goto QxrLz; QxrLz: if (!empty($nVfg_)) { if (ModelUtil::count('admin_user') <= 0) { foreach ($nVfg_ as $cuToL) { Admin::add($cuToL['user'], $cuToL['password']); $this->warn(">>> Init User: {$cuToL['user']}"); } } } goto IF5Ix; HQlwc: $nVfg_ = explode(';', $nVfg_); goto JboIU; IF5Ix: } goto XPSdS; b9sFR: } private function publishHotfixFiles() { goto YwRVR; dnzkH: $zZymY = ModStart::env(); goto GAaO1; gvJI7: $this->info(''); goto ydBVQ; GAaO1: $vfCsl = rtrim(base_path('vendor/modstart/modstart/resources/hot_fix'), '/') . '/'; goto StzDO; Qa443: if (!file_exists($KQw2k)) { return; } goto lZl27; cxcty: foreach ($f8Hsc as $gyP3E => $LclBr) { goto tWFGu; Xdngm: $this->info('Hotfix: ' . $LclBr); goto M2Mem; tWFGu: $cgjRu = file_get_contents($vfCsl . $zZymY . '/' . $gyP3E); goto h8Dh1; h8Dh1: @file_put_contents(base_path($LclBr), $cgjRu); goto Xdngm; M2Mem: } goto gvJI7; StzDO: $KQw2k = $vfCsl . $zZymY . '.json'; goto Qa443; lZl27: $f8Hsc = @json_decode(file_get_contents($KQw2k), true); goto cxcty; YwRVR: $this->warn('>>> Publish Hotfix'); goto dnzkH; ydBVQ: } }