<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Command; use Illuminate\Console\Command; use Illuminate\Support\Facades\Event; use ModStart\Core\Events\ModuleUninstalledEvent; use ModStart\Core\Exception\BizException; use ModStart\Core\Util\FileUtil; use ModStart\Core\Util\VersionUtil; use ModStart\ModStart; use ModStart\Module\ModuleManager; class ModuleUninstallCommand extends Command { protected $signature = 'modstart:module-uninstall {module}'; public function handle() { goto d5yY5; y1qCE: $h_uF5->name = $uacrl; goto wKB5d; qVYNl: ModuleManager::saveUserInstalledModules($qaXyg); goto DX2pT; DX2pT: ModStart::clearCache(); goto Jrg5J; THGMi: $Vjp7j = ModuleManager::isExists($uacrl); goto NnFjQ; YqdMX: $this->unPublishRoot($uacrl); goto qVYNl; aKHWr: $this->unPublishAsset($uacrl); goto YqdMX; d5yY5: $uacrl = $this->argument('module'); goto THGMi; wKB5d: if (PHP_VERSION_ID >= 80000) { Event::dispatch($h_uF5); } else { Event::fire($h_uF5); } goto sv2Gc; CeXlB: unset($qaXyg[$uacrl]); goto aKHWr; Jrg5J: $h_uF5 = new ModuleUninstalledEvent(); goto y1qCE; NnFjQ: $qaXyg = ModuleManager::listAllInstalledModules(); goto AsyQM; AsyQM: if ($Vjp7j) { goto mTvEn; mTvEn: BizException::throwsIf(L('Module not installed'), !isset($qaXyg[$uacrl])); goto tLjKM; iCuZT: ModuleManager::callHook($uacrl, 'hookBeforeUninstall'); goto s_my5; tLjKM: foreach ($qaXyg as $B6Xvf => $T7EjN) { goto QBcvY; WQs0e: if (empty($jD2Nx)) { break; } goto PJ06T; QBcvY: $jD2Nx = ModuleManager::getModuleBasic($B6Xvf); goto WQs0e; PJ06T: if (!empty($jD2Nx['require'])) { foreach ($jD2Nx['require'] as $vFCLL) { list($ebM0g, $JiRHR) = VersionUtil::parse($vFCLL); BizException::throwsIf(L('Module %s depend on %s, uninstall fail', $B6Xvf, $uacrl), $uacrl == $ebM0g); } } goto i3Im4; i3Im4: } goto iCuZT; s_my5: } goto CeXlB; sv2Gc: } private function unPublishAsset($uacrl) { goto gw2BT; BJoJ0: if (!file_exists($wZ0QM)) { return; } goto wFof9; eRzRN: if (!file_exists($hKkPV)) { return; } goto fEGiS; gw2BT: $bUESp = $this->laravel['files']; goto NztwY; fEGiS: $bUESp->deleteDirectory($hKkPV); goto HIMDf; HIMDf: $this->info("Module Asset UnPublish : {$hKkPV}"); goto NKe9K; wFof9: $hKkPV = public_path("vendor/{$uacrl}/"); goto eRzRN; NztwY: $wZ0QM = ModuleManager::path($uacrl, 'Asset') . '/'; goto BJoJ0; NKe9K: } private function unPublishRoot($uacrl) { goto kRKaG; kRKaG: $eMsN6 = ModuleManager::path($uacrl, 'ROOT'); goto fNjLh; jZ0lE: $Nia5n = array_filter($Nia5n, function ($fWBvH) { return $fWBvH['isFile']; }); goto MNA4n; TThr0: $Nia5n = FileUtil::listAllFiles($eMsN6); goto jZ0lE; T7seq: $this->info("Module Root UnPublish : {$sHEm1} item(s)"); goto IDCEU; oX3cH: foreach ($Nia5n as $fWBvH) { goto ZQAOX; vNEtE: $QiG0b = base_path($itij1); goto kSs5H; kSs5H: $Z3aKZ = $QiG0b . '._delete_.' . $uacrl; goto S3sK4; ZQAOX: $itij1 = $fWBvH['filename']; goto np3J7; dqg9f: if (!file_exists($Z3aKZ) && md5_file($QiG0b) == md5_file($fWBvH['pathname']) || file_exists($Z3aKZ)) { goto O35lu; O35lu: unlink($QiG0b); goto HHmlO; IYeJu: $sHEm1++; goto d4UJE; HHmlO: if (file_exists($Z3aKZ)) { $ohNZt = trim(file_get_contents($Z3aKZ)); if ('__MODSTART_EMPTY_FILE__' == $ohNZt) { unlink($Z3aKZ); $this->info("Module Root Publish : {$itij1}"); } else { rename($Z3aKZ, $QiG0b); $this->info("Module Root Publish : {$itij1} <- {$c2OrZ}"); } } goto IYeJu; d4UJE: } goto F4V9Z; S3sK4: if (!file_exists($QiG0b)) { continue; } goto dqg9f; np3J7: $c2OrZ = $itij1 . '._delete_.' . $uacrl; goto vNEtE; F4V9Z: } goto T7seq; fNjLh: if (!file_exists($eMsN6)) { return; } goto TThr0; MNA4n: $sHEm1 = 0; goto oX3cH; IDCEU: } }