<?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 XlLXL; R35Px: $f5o2n->name = $vbusR; goto tQcdU; XlLXL: $vbusR = $this->argument('module'); goto HclNT; J7hl_: $f5o2n = new ModuleUninstalledEvent(); goto R35Px; tQcdU: if (PHP_VERSION_ID >= 80000) { Event::dispatch($f5o2n); } else { Event::fire($f5o2n); } goto CoeuN; jqbyL: $this->unPublishRoot($vbusR); goto R7_vJ; R7_vJ: ModuleManager::saveUserInstalledModules($Wnbq_); goto z6ivr; HclNT: $EYvrV = ModuleManager::isExists($vbusR); goto IgsnH; IgsnH: $Wnbq_ = ModuleManager::listAllInstalledModules(); goto VrHa6; z6ivr: ModStart::clearCache(); goto J7hl_; QBtd5: $this->unPublishAsset($vbusR); goto jqbyL; VrHa6: if ($EYvrV) { goto jFh2n; MIenk: ModuleManager::callHook($vbusR, 'hookBeforeUninstall'); goto rK35k; T7sBu: foreach ($Wnbq_ as $xpUer => $DdWoI) { goto OD5fu; XGKge: if (!empty($DI_6G['require'])) { foreach ($DI_6G['require'] as $LIhJr) { list($Q_c7O, $VFelt) = VersionUtil::parse($LIhJr); BizException::throwsIf(L('Module %s depend on %s, uninstall fail', $xpUer, $vbusR), $vbusR == $Q_c7O); } } goto ZiM44; OD5fu: $DI_6G = ModuleManager::getModuleBasic($xpUer); goto Xdsxu; Xdsxu: if (empty($DI_6G)) { break; } goto XGKge; ZiM44: } goto MIenk; jFh2n: BizException::throwsIf(L('Module not installed'), !isset($Wnbq_[$vbusR])); goto T7sBu; rK35k: } goto r7zZd; r7zZd: unset($Wnbq_[$vbusR]); goto QBtd5; CoeuN: } private function unPublishAsset($vbusR) { goto e2Zch; zV8kQ: $this->info("Module Asset UnPublish : {$blQsO}"); goto KP5AT; l534U: $blQsO = public_path("vendor/{$vbusR}/"); goto ywbOt; D04kH: if (!file_exists($SoJ1U)) { return; } goto l534U; BVksU: $LDev7->deleteDirectory($blQsO); goto zV8kQ; ywbOt: if (!file_exists($blQsO)) { return; } goto BVksU; e2Zch: $LDev7 = $this->laravel['files']; goto Gfkhj; Gfkhj: $SoJ1U = ModuleManager::path($vbusR, 'Asset') . '/'; goto D04kH; KP5AT: } private function unPublishRoot($vbusR) { goto hhX56; hhX56: $SksVn = ModuleManager::path($vbusR, 'ROOT'); goto QZu8H; QZu8H: if (!file_exists($SksVn)) { return; } goto Tw_OB; Tw_OB: $GsFul = FileUtil::listAllFiles($SksVn); goto Gfl28; Gfl28: $GsFul = array_filter($GsFul, function ($RLMU5) { return $RLMU5['isFile']; }); goto hjeoz; hjeoz: $bWP0R = 0; goto drY10; be39F: $this->info("Module Root UnPublish : {$bWP0R} item(s)"); goto dbm3M; drY10: foreach ($GsFul as $RLMU5) { goto l7i6v; nPnrr: if (!file_exists($loHkJ) && md5_file($XFXmO) == md5_file($RLMU5['pathname']) || file_exists($loHkJ)) { goto EzOWJ; fC2nd: $bWP0R++; goto aK0b0; EzOWJ: unlink($XFXmO); goto Es6QD; Es6QD: if (file_exists($loHkJ)) { $DTnPC = trim(file_get_contents($loHkJ)); if ('__MODSTART_EMPTY_FILE__' == $DTnPC) { unlink($loHkJ); $this->info("Module Root Publish : {$mj1ut}"); } else { rename($loHkJ, $XFXmO); $this->info("Module Root Publish : {$mj1ut} <- {$ITKlo}"); } } goto fC2nd; aK0b0: } goto hW1C3; IBBFy: $ITKlo = $mj1ut . '._delete_.' . $vbusR; goto QXfTV; QXfTV: $XFXmO = base_path($mj1ut); goto DHeBx; l7i6v: $mj1ut = $RLMU5['filename']; goto IBBFy; NDrFQ: if (!file_exists($XFXmO)) { continue; } goto nPnrr; DHeBx: $loHkJ = $XFXmO . '._delete_.' . $vbusR; goto NDrFQ; hW1C3: } goto be39F; dbm3M: } }