![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/vendor/captainhook/captainhook/src/Runner/ |
<?php /** * This file is part of CaptainHook * * (c) Sebastian Feldmann <[email protected]> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ declare(strict_types=1); namespace CaptainHook\App\Runner; use CaptainHook\App\Console\IOUtil; /** * Class Uninstaller * * @package CaptainHook * @author Sebastian Feldmann <[email protected]> * @link https://github.com/captainhookphp/captainhook * @since Class available since Release 5.17.0 */ class Uninstaller extends Files { /** * Execute installation * * @return void */ public function run(): void { foreach ($this->getHooksToHandle() as $hook => $ask) { $this->uninstallHook($hook, ($ask && !$this->force)); } } /** * Install given hook * * @param string $hook * @param bool $ask */ private function uninstallHook(string $hook, bool $ask): void { if (!$this->repository->hookExists($hook)) { return; } $doIt = true; if ($ask) { $answer = $this->io->ask(' <info>Remove \'' . $hook . '\' hook?</info> <comment>[y,n]</comment> ', 'y'); $doIt = IOUtil::answerToBool($answer); } if ($doIt) { if ($this->shouldHookBeMoved()) { $this->backupHook($hook); return; } unlink($this->repository->getHooksDir() . DIRECTORY_SEPARATOR . $hook); } } }