<?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 t2y1T; KB887: ModuleManager::saveUserInstalledModules($EZWyg); goto HlQd1; PplNS: $this->unPublishAsset($satFX); goto Cx6sW; eCQC1: if (PHP_VERSION_ID >= 80000) { Event::dispatch($BHEro); } else { Event::fire($BHEro); } goto iY0a1; avyqR: unset($EZWyg[$satFX]); goto PplNS; w1__Z: $ycOa4 = ModuleManager::isExists($satFX); goto tcx35; Cx6sW: $this->unPublishRoot($satFX); goto KB887; ijQ7v: $BHEro->name = $satFX; goto eCQC1; HlQd1: ModStart::clearCache(); goto RqA6E; t2y1T: $satFX = $this->argument('module'); goto w1__Z; RqA6E: $BHEro = new ModuleUninstalledEvent(); goto ijQ7v; tcx35: $EZWyg = ModuleManager::listAllInstalledModules(); goto rnJb_; rnJb_: if ($ycOa4) { goto OFVq1; crnaL: ModuleManager::callHook($satFX, 'hookBeforeUninstall'); goto UPlo2; GmRXN: foreach ($EZWyg as $zgizM => $FfhzE) { goto hl9MQ; IcITv: if (!empty($YlbOr['require'])) { foreach ($YlbOr['require'] as $plogN) { list($tDO0Q, $pk5fc) = VersionUtil::parse($plogN); BizException::throwsIf(L('Module %s depend on %s, uninstall fail', $zgizM, $satFX), $satFX == $tDO0Q); } } goto tb6ze; vIY0a: if (empty($YlbOr)) { break; } goto IcITv; hl9MQ: $YlbOr = ModuleManager::getModuleBasic($zgizM); goto vIY0a; tb6ze: } goto crnaL; OFVq1: BizException::throwsIf(L('Module not installed'), !isset($EZWyg[$satFX])); goto GmRXN; UPlo2: } goto avyqR; iY0a1: } private function unPublishAsset($satFX) { goto WYlyl; vM0xJ: $this->info("Module Asset UnPublish : {$hjIzo}"); goto iKPwp; gGMLY: $hjIzo = public_path("vendor/{$satFX}/"); goto zNkwy; Jrw5W: $j6ZyW->deleteDirectory($hjIzo); goto vM0xJ; pDyv1: $FtI8I = ModuleManager::path($satFX, 'Asset') . '/'; goto XLV3S; zNkwy: if (!file_exists($hjIzo)) { return; } goto Jrw5W; XLV3S: if (!file_exists($FtI8I)) { return; } goto gGMLY; WYlyl: $j6ZyW = $this->laravel['files']; goto pDyv1; iKPwp: } private function unPublishRoot($satFX) { goto GXYHA; lVMcl: foreach ($moNxb as $sCmIC) { goto EKSyN; rmOKO: if (!file_exists($gIVSB)) { continue; } goto KbbZw; g8uwm: $gIVSB = base_path($JfXV7); goto rai6t; dmRU8: $yM4U3 = $JfXV7 . '._delete_.' . $satFX; goto g8uwm; rai6t: $AWM7K = $gIVSB . '._delete_.' . $satFX; goto rmOKO; EKSyN: $JfXV7 = $sCmIC['filename']; goto dmRU8; KbbZw: if (!file_exists($AWM7K) && md5_file($gIVSB) == md5_file($sCmIC['pathname']) || file_exists($AWM7K)) { goto jD8_d; HNzft: $HrC1f++; goto cAC5Y; jD8_d: unlink($gIVSB); goto gTnpT; gTnpT: if (file_exists($AWM7K)) { $LTC5O = trim(file_get_contents($AWM7K)); if ('__MODSTART_EMPTY_FILE__' == $LTC5O) { unlink($AWM7K); $this->info("Module Root Publish : {$JfXV7}"); } else { rename($AWM7K, $gIVSB); $this->info("Module Root Publish : {$JfXV7} <- {$yM4U3}"); } } goto HNzft; cAC5Y: } goto CMDG5; CMDG5: } goto KZvA6; ZPgEK: $moNxb = array_filter($moNxb, function ($sCmIC) { return $sCmIC['isFile']; }); goto Y_MiX; GXYHA: $RFcbL = ModuleManager::path($satFX, 'ROOT'); goto owsKz; W5js6: $moNxb = FileUtil::listAllFiles($RFcbL); goto ZPgEK; owsKz: if (!file_exists($RFcbL)) { return; } goto W5js6; Y_MiX: $HrC1f = 0; goto lVMcl; KZvA6: $this->info("Module Root UnPublish : {$HrC1f} item(s)"); goto XalJW; XalJW: } }