<?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 ZDIf_; eOT3n: unset($ebzwB[$tUxPr]); goto jRxvF; ASt1M: ModStart::clearCache(); goto nmUts; ZDIf_: $tUxPr = $this->argument('module'); goto Y1Eki; hR6ng: if ($iLN9q) { goto dksal; m2DiA: ModuleManager::callHook($tUxPr, 'hookBeforeUninstall'); goto in5Bq; xzKWd: foreach ($ebzwB as $m9qPA => $UMqQ0) { goto DmJwP; DmJwP: $nwa63 = ModuleManager::getModuleBasic($m9qPA); goto EJzA7; EJzA7: if (empty($nwa63)) { break; } goto kPSj_; kPSj_: if (!empty($nwa63['require'])) { foreach ($nwa63['require'] as $d9Rlu) { list($Xo2Ly, $Xz28r) = VersionUtil::parse($d9Rlu); BizException::throwsIf(L('Module %s depend on %s, uninstall fail', $m9qPA, $tUxPr), $tUxPr == $Xo2Ly); } } goto q_GD6; q_GD6: } goto m2DiA; dksal: BizException::throwsIf(L('Module not installed'), !isset($ebzwB[$tUxPr])); goto xzKWd; in5Bq: } goto eOT3n; Y1Eki: $iLN9q = ModuleManager::isExists($tUxPr); goto HVFK3; Ff0we: $D8UxC->name = $tUxPr; goto nA4_o; nA4_o: if (PHP_VERSION_ID >= 80000) { Event::dispatch($D8UxC); } else { Event::fire($D8UxC); } goto iYf_R; HVFK3: $ebzwB = ModuleManager::listAllInstalledModules(); goto hR6ng; nmUts: $D8UxC = new ModuleUninstalledEvent(); goto Ff0we; jRxvF: $this->unPublishAsset($tUxPr); goto adMqZ; IrnLm: ModuleManager::saveUserInstalledModules($ebzwB); goto ASt1M; adMqZ: $this->unPublishRoot($tUxPr); goto IrnLm; iYf_R: } private function unPublishAsset($tUxPr) { goto E21pv; PfCFd: $this->info("Module Asset UnPublish : {$WLsPA}"); goto rS2I3; AlK_r: if (!file_exists($lmF4G)) { return; } goto w4piW; w4piW: $WLsPA = public_path("vendor/{$tUxPr}/"); goto UuS4x; ItnOe: $lmF4G = ModuleManager::path($tUxPr, 'Asset') . '/'; goto AlK_r; E21pv: $LyqAf = $this->laravel['files']; goto ItnOe; IwChz: $LyqAf->deleteDirectory($WLsPA); goto PfCFd; UuS4x: if (!file_exists($WLsPA)) { return; } goto IwChz; rS2I3: } private function unPublishRoot($tUxPr) { goto yLczs; Gh569: foreach ($zdxah as $ypGny) { goto CTR6u; rE6WV: $W1YKc = base_path($agY_i); goto EMAWv; PG0sn: $xm_JA = $agY_i . '._delete_.' . $tUxPr; goto rE6WV; lH42r: if (!file_exists($wzlWP) && md5_file($W1YKc) == md5_file($ypGny['pathname']) || file_exists($wzlWP)) { goto m2Qtw; Ztw2i: $XtaaS++; goto o2oBH; m2Qtw: unlink($W1YKc); goto ZRlrC; ZRlrC: if (file_exists($wzlWP)) { $vVYCS = trim(file_get_contents($wzlWP)); if ('__MODSTART_EMPTY_FILE__' == $vVYCS) { unlink($wzlWP); $this->info("Module Root Publish : {$agY_i}"); } else { rename($wzlWP, $W1YKc); $this->info("Module Root Publish : {$agY_i} <- {$xm_JA}"); } } goto Ztw2i; o2oBH: } goto ATc28; QD02j: if (!file_exists($W1YKc)) { continue; } goto lH42r; CTR6u: $agY_i = $ypGny['filename']; goto PG0sn; EMAWv: $wzlWP = $W1YKc . '._delete_.' . $tUxPr; goto QD02j; ATc28: } goto NePmd; m0nfG: $zdxah = FileUtil::listAllFiles($Av85E); goto BJI4T; VBnqp: if (!file_exists($Av85E)) { return; } goto m0nfG; BJI4T: $zdxah = array_filter($zdxah, function ($ypGny) { return $ypGny['isFile']; }); goto Ljn1h; NePmd: $this->info("Module Root UnPublish : {$XtaaS} item(s)"); goto LtdEj; yLczs: $Av85E = ModuleManager::path($tUxPr, 'ROOT'); goto VBnqp; Ljn1h: $XtaaS = 0; goto Gh569; LtdEj: } }