<?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 qI06N; u2Zya: $aHEo6 = new ModuleUninstalledEvent(); goto CtOJz; qI06N: $h8H9D = $this->argument('module'); goto nezsO; WjAgJ: if (PHP_VERSION_ID >= 80000) { Event::dispatch($aHEo6); } else { Event::fire($aHEo6); } goto T0MFY; WzBI2: unset($acEAc[$h8H9D]); goto W0NZp; BgRyN: ModuleManager::saveUserInstalledModules($acEAc); goto mEI05; mEI05: ModStart::clearCache(); goto u2Zya; GdJsA: $acEAc = ModuleManager::listAllInstalledModules(); goto TqoDR; TqoDR: if ($Qrmyb) { goto ukSfH; ukSfH: BizException::throwsIf(L('Module not installed'), !isset($acEAc[$h8H9D])); goto TDx9C; TDx9C: foreach ($acEAc as $Kv8zY => $vn2QN) { goto Dyl14; MHDlU: if (!empty($gm6dM['require'])) { foreach ($gm6dM['require'] as $SWjUs) { list($JJRD4, $F6Fus) = VersionUtil::parse($SWjUs); BizException::throwsIf(L('Module %s depend on %s, uninstall fail', $Kv8zY, $h8H9D), $h8H9D == $JJRD4); } } goto z57yn; Dyl14: $gm6dM = ModuleManager::getModuleBasic($Kv8zY); goto tM946; tM946: if (empty($gm6dM)) { break; } goto MHDlU; z57yn: } goto B7HTY; B7HTY: ModuleManager::callHook($h8H9D, 'hookBeforeUninstall'); goto Nf0tI; Nf0tI: } goto WzBI2; Xm07O: $this->unPublishRoot($h8H9D); goto BgRyN; nezsO: $Qrmyb = ModuleManager::isExists($h8H9D); goto GdJsA; CtOJz: $aHEo6->name = $h8H9D; goto WjAgJ; W0NZp: $this->unPublishAsset($h8H9D); goto Xm07O; T0MFY: } private function unPublishAsset($h8H9D) { goto S1GM_; S1GM_: $hu_IA = $this->laravel['files']; goto AR09v; ABjfi: $hu_IA->deleteDirectory($RP3dD); goto hBijr; U2Ygb: $RP3dD = public_path("vendor/{$h8H9D}/"); goto eDDIp; hBijr: $this->info("Module Asset UnPublish : {$RP3dD}"); goto FSg35; gw9_z: if (!file_exists($L_a53)) { return; } goto U2Ygb; eDDIp: if (!file_exists($RP3dD)) { return; } goto ABjfi; AR09v: $L_a53 = ModuleManager::path($h8H9D, 'Asset') . '/'; goto gw9_z; FSg35: } private function unPublishRoot($h8H9D) { goto sxrnl; I6JZI: if (!file_exists($SGkWN)) { return; } goto PhhhZ; z1MQa: foreach ($vQMyn as $aYJAK) { goto acgFo; acgFo: $y02c7 = $aYJAK['filename']; goto AjNq1; SYhJD: $QnS8E = $V90P5 . '._delete_.' . $h8H9D; goto KPUJX; OTizT: $V90P5 = base_path($y02c7); goto SYhJD; KPUJX: if (!file_exists($V90P5)) { continue; } goto eENGz; AjNq1: $cgjIi = $y02c7 . '._delete_.' . $h8H9D; goto OTizT; eENGz: if (!file_exists($QnS8E) && md5_file($V90P5) == md5_file($aYJAK['pathname']) || file_exists($QnS8E)) { goto bRLKh; bRLKh: unlink($V90P5); goto gVpZG; gVpZG: if (file_exists($QnS8E)) { $Afv_G = trim(file_get_contents($QnS8E)); if ('__MODSTART_EMPTY_FILE__' == $Afv_G) { unlink($QnS8E); $this->info("Module Root Publish : {$y02c7}"); } else { rename($QnS8E, $V90P5); $this->info("Module Root Publish : {$y02c7} <- {$cgjIi}"); } } goto Be0SN; Be0SN: $vUXQX++; goto C62GJ; C62GJ: } goto ltFY3; ltFY3: } goto up33c; sxrnl: $SGkWN = ModuleManager::path($h8H9D, 'ROOT'); goto I6JZI; Eqnp_: $vQMyn = array_filter($vQMyn, function ($aYJAK) { return $aYJAK['isFile']; }); goto eVhAN; PhhhZ: $vQMyn = FileUtil::listAllFiles($SGkWN); goto Eqnp_; up33c: $this->info("Module Root UnPublish : {$vUXQX} item(s)"); goto ARKTa; eVhAN: $vUXQX = 0; goto z1MQa; ARKTa: } }