<?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 kJbFC; sfVL7: $this->unPublishAsset($GVDx3); goto vqQop; kJbFC: $GVDx3 = $this->argument('module'); goto Lxxbu; rLn7Z: unset($ENyP_[$GVDx3]); goto sfVL7; hIBrj: if ($H8puP) { goto ZwQQ0; ZwQQ0: BizException::throwsIf(L('Module not installed'), !isset($ENyP_[$GVDx3])); goto H3CSI; H3CSI: foreach ($ENyP_ as $AGNhb => $n8Afx) { goto zC8lr; u0CtS: if (empty($KALZg)) { break; } goto p6BEO; zC8lr: $KALZg = ModuleManager::getModuleBasic($AGNhb); goto u0CtS; p6BEO: if (!empty($KALZg['require'])) { foreach ($KALZg['require'] as $h3YdJ) { list($f3czO, $tHq0l) = VersionUtil::parse($h3YdJ); BizException::throwsIf(L('Module %s depend on %s, uninstall fail', $AGNhb, $GVDx3), $GVDx3 == $f3czO); } } goto bOn2w; bOn2w: } goto z2UYK; z2UYK: ModuleManager::callHook($GVDx3, 'hookBeforeUninstall'); goto Pi9WU; Pi9WU: } goto rLn7Z; k8peU: if (PHP_VERSION_ID >= 80000) { Event::dispatch($lefmL); } else { Event::fire($lefmL); } goto UCPjI; HHWds: $ENyP_ = ModuleManager::listAllInstalledModules(); goto hIBrj; k8ZYv: $lefmL->name = $GVDx3; goto k8peU; XF73Q: ModStart::clearCache(); goto nrFZS; Lxxbu: $H8puP = ModuleManager::isExists($GVDx3); goto HHWds; ojQd5: ModuleManager::saveUserInstalledModules($ENyP_); goto XF73Q; vqQop: $this->unPublishRoot($GVDx3); goto ojQd5; nrFZS: $lefmL = new ModuleUninstalledEvent(); goto k8ZYv; UCPjI: } private function unPublishAsset($GVDx3) { goto Httok; woAix: $S7Ck8 = ModuleManager::path($GVDx3, 'Asset') . '/'; goto kHaVE; Uw1sI: $this->info("Module Asset UnPublish : {$ygeGW}"); goto Gl8B_; NrIlj: $ygeGW = public_path("vendor/{$GVDx3}/"); goto aSs4P; Httok: $sYmSQ = $this->laravel['files']; goto woAix; DKacs: $sYmSQ->deleteDirectory($ygeGW); goto Uw1sI; aSs4P: if (!file_exists($ygeGW)) { return; } goto DKacs; kHaVE: if (!file_exists($S7Ck8)) { return; } goto NrIlj; Gl8B_: } private function unPublishRoot($GVDx3) { goto x4JU2; Oz7eD: $jByvU = FileUtil::listAllFiles($VHhEW); goto NBgC4; Wg510: foreach ($jByvU as $qsQD8) { goto BtPeY; yGUF0: $w5NJ1 = $emMWK . '._delete_.' . $GVDx3; goto hkaeT; EKYx9: $emMWK = base_path($SsWGv); goto yGUF0; BtPeY: $SsWGv = $qsQD8['filename']; goto zTvuc; zTvuc: $pOiym = $SsWGv . '._delete_.' . $GVDx3; goto EKYx9; xU_En: if (!file_exists($w5NJ1) && md5_file($emMWK) == md5_file($qsQD8['pathname']) || file_exists($w5NJ1)) { goto eT3Qy; NiVNA: $gB1Rg++; goto W1771; PFXX1: if (file_exists($w5NJ1)) { $rFmqf = trim(file_get_contents($w5NJ1)); if ('__MODSTART_EMPTY_FILE__' == $rFmqf) { unlink($w5NJ1); $this->info("Module Root Publish : {$SsWGv}"); } else { rename($w5NJ1, $emMWK); $this->info("Module Root Publish : {$SsWGv} <- {$pOiym}"); } } goto NiVNA; eT3Qy: unlink($emMWK); goto PFXX1; W1771: } goto jEOmf; hkaeT: if (!file_exists($emMWK)) { continue; } goto xU_En; jEOmf: } goto EIjWv; fktjz: if (!file_exists($VHhEW)) { return; } goto Oz7eD; EIjWv: $this->info("Module Root UnPublish : {$gB1Rg} item(s)"); goto HEG8b; x4JU2: $VHhEW = ModuleManager::path($GVDx3, 'ROOT'); goto fktjz; Dhogy: $gB1Rg = 0; goto Wg510; NBgC4: $jByvU = array_filter($jByvU, function ($qsQD8) { return $qsQD8['isFile']; }); goto Dhogy; HEG8b: } }