<?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 M1ukA; ZSxyV: $lfQtk = ModuleManager::listAllInstalledModules(); goto y6SFs; y6SFs: if ($xGX0s) { goto ZtwBd; ZtwBd: BizException::throwsIf(L('Module not installed'), !isset($lfQtk[$oXHYw])); goto V4oz4; VbfJa: ModuleManager::callHook($oXHYw, 'hookBeforeUninstall'); goto CfwFG; V4oz4: foreach ($lfQtk as $vlgr_ => $n_Lkt) { goto cIxi1; yxs_3: if (empty($K0286)) { break; } goto s4yOf; s4yOf: if (!empty($K0286['require'])) { foreach ($K0286['require'] as $zT0AJ) { list($Ipdv9, $Q0rz2) = VersionUtil::parse($zT0AJ); BizException::throwsIf(L('Module %s depend on %s, uninstall fail', $vlgr_, $oXHYw), $oXHYw == $Ipdv9); } } goto gv2sR; cIxi1: $K0286 = ModuleManager::getModuleBasic($vlgr_); goto yxs_3; gv2sR: } goto VbfJa; CfwFG: } goto nprP8; BnCz5: ModStart::clearCache(); goto u4nBC; nprP8: unset($lfQtk[$oXHYw]); goto Uh3Qw; FxcyL: if (PHP_VERSION_ID >= 80000) { Event::dispatch($zU3b7); } else { Event::fire($zU3b7); } goto EMoVn; Uh3Qw: $this->unPublishAsset($oXHYw); goto UazeA; Qc22_: $zU3b7->name = $oXHYw; goto FxcyL; hHYV1: $xGX0s = ModuleManager::isExists($oXHYw); goto ZSxyV; u4nBC: $zU3b7 = new ModuleUninstalledEvent(); goto Qc22_; UazeA: $this->unPublishRoot($oXHYw); goto UuGZ7; UuGZ7: ModuleManager::saveUserInstalledModules($lfQtk); goto BnCz5; M1ukA: $oXHYw = $this->argument('module'); goto hHYV1; EMoVn: } private function unPublishAsset($oXHYw) { goto iE3qV; mC00x: $this->info("Module Asset UnPublish : {$kn8dk}"); goto FHY8w; uo2Ou: $KXoNz = ModuleManager::path($oXHYw, 'Asset') . '/'; goto ZnH4h; ZnH4h: if (!file_exists($KXoNz)) { return; } goto tZmXS; i3I8J: $j377A->deleteDirectory($kn8dk); goto mC00x; iE3qV: $j377A = $this->laravel['files']; goto uo2Ou; tZmXS: $kn8dk = public_path("vendor/{$oXHYw}/"); goto DaunY; DaunY: if (!file_exists($kn8dk)) { return; } goto i3I8J; FHY8w: } private function unPublishRoot($oXHYw) { goto lge94; lge94: $oIZ4g = ModuleManager::path($oXHYw, 'ROOT'); goto xjoxV; OyrIg: $H7ald = 0; goto MrWJl; BrVRC: $tBbJh = array_filter($tBbJh, function ($Jtt5u) { return $Jtt5u['isFile']; }); goto OyrIg; m11Sd: $this->info("Module Root UnPublish : {$H7ald} item(s)"); goto f6SIQ; xjoxV: if (!file_exists($oIZ4g)) { return; } goto JO9OH; JO9OH: $tBbJh = FileUtil::listAllFiles($oIZ4g); goto BrVRC; MrWJl: foreach ($tBbJh as $Jtt5u) { goto CCwbD; SWlmh: $onzs5 = $HXNHQ . '._delete_.' . $oXHYw; goto w742p; CCwbD: $UEqkF = $Jtt5u['filename']; goto KbG9a; NlAt7: $HXNHQ = base_path($UEqkF); goto SWlmh; KbG9a: $mzQ9x = $UEqkF . '._delete_.' . $oXHYw; goto NlAt7; Kek3i: if (!file_exists($onzs5) && md5_file($HXNHQ) == md5_file($Jtt5u['pathname']) || file_exists($onzs5)) { goto ihXnz; ihXnz: unlink($HXNHQ); goto B5BXT; e4mo6: $H7ald++; goto HNkSP; B5BXT: if (file_exists($onzs5)) { $BWI89 = trim(file_get_contents($onzs5)); if ('__MODSTART_EMPTY_FILE__' == $BWI89) { unlink($onzs5); $this->info("Module Root Publish : {$UEqkF}"); } else { rename($onzs5, $HXNHQ); $this->info("Module Root Publish : {$UEqkF} <- {$mzQ9x}"); } } goto e4mo6; HNkSP: } goto E6Dgm; w742p: if (!file_exists($HXNHQ)) { continue; } goto Kek3i; E6Dgm: } goto m11Sd; f6SIQ: } }