Uninstall.

@return bool
493952
public function uninstall()
    {
        ee()->db->where('class', 'Test')->delete('actions');

        $mod_id = ee()->db->select('module_id')->get_where('modules', ['module_name' => 'Test'])->row('module_id');
        ee()->db->where('module_id', $mod_id)->delete('module_member_groups');
        ee()->db->where('module_name', 'Test')->delete('modules');

        // Custom Tables Uninstall
        /*
        ee()->load->dbforge();
        ee()->dbforge->drop_table('table_name');
        */

        return true;
    }
1178115
public function delete()
	{
		$this->getLogger()->info('Deleting media ID ' . $this->mediaId);
		$this->doDelete('/library/' . $this->mediaId);
		
		return true;
	}
172592
public function uninstall($module_id)
    {
        try {
            $result = $this->canUninstall($module_id);
        } catch (Exception $ex) {
            $result = $ex->getMessage();
        }

        $this->hook->attach("module.uninstall.before|$module_id", $result, $this);

        if ($result !== true) {
            return $result;
        }

        $this->module->delete($module_id);
        $this->setOverrideConfig();

        $this->hook->attach("module.uninstall.after|$module_id", $result, $this);
        return $result;
    }
724224
public function delete()
    {
        if (is_resource($this->handle)) {
            fclose($this->handle);
            $this->handle = null;
        }
        if ($this->exists()) {
            return unlink($this->path);
        }

        return false;
    }
222628
def uninstall(
    ctx,
    state,
    all_dev=False,
    all=False,
    **kwargs
):
    """"""
    from ..core import do_uninstall
    retcode = do_uninstall(
        packages=state.installstate.packages,
        editable_packages=state.installstate.editables,
        three=state.three,
        python=state.python,
        system=state.system,
        lock=not state.installstate.skip_lock,
        all_dev=all_dev,
        all=all,
        keep_outdated=state.installstate.keep_outdated,
        pypi_mirror=state.pypi_mirror,
        ctx=ctx
    )
    if retcode:
        sys.exit(retcode)
1248268
protected function uninstallExtension()
    {
        $extensionEntity = $this->getExtensionEntity();

        $this->executeAction(ExtensionManager::UNINSTALL, array(
                'id' => $extensionEntity->get('id'),
                'skipSystemRebuild' => true,
                'skipAfterScript' => true,
            )
        );
    }
452588
protected function _uninstall()
    {
        $allThemes = plugin()
            ->filter(function ($plugin) {
                return $plugin->isTheme;
            })
            ->toArray();
        $index = 1;
        $this->out();
        foreach ($allThemes as $plugin) {
            $allThemes[$index] = $plugin;
            $this->out(__d('installer', '[{0, number}] {1}', [$index, $plugin->humanName]));
            $index++;
        }
        $this->out();

        $message = __d('installer', "Which theme would you like to uninstall?\n[Q]uit");
        while (true) {
            $in = trim($this->in($message));
            if (strtoupper($in) === 'Q') {
                $this->err(__d('installer', 'Operation aborted'));
                break;
            } elseif (intval($in) < 1 || !isset($allThemes[intval($in)])) {
                $this->err(__d('installer', 'Invalid option'));
            } else {
                $plugin = plugin($allThemes[$in]->name());
                $this->hr();
                $this->out(__d('installer', '<info>The following theme will be uninstalled</info>'));
                $this->hr();
                $this->out(__d('installer', 'Name:        {0}', $plugin->name));
                $this->out(__d('installer', 'Description: {0}', $plugin->composer['description']));
                $this->out(__d('installer', 'Path:        {0}', $plugin->path));
                $this->hr();
                $this->out();

                $confirm = $this->in(__d('installer', 'Please type in "{0}" to uninstall', $allThemes[$in]->name));
                if ($confirm === $allThemes[$in]->name) {
                    $task = $this->dispatchShell("Installer.plugins uninstall -p {$allThemes[$in]->name}");

                    if ($task === 0) {
                        $this->out(__d('installer', 'Plugin uninstalled!'));
                        Plugin::dropCache();
                    } else {
                        $this->err(__d('installer', 'Plugin could not be uninstalled.'), 2);
                        $this->out();
                    }
                } else {
                    $this->err(__d('installer', 'Confirmation failure, operation aborted!'));
                }
                break;
            }
        }

        $this->out();
    }
527439
public function cmdUninstallModule()
    {
        $result = $this->module_model->uninstall($this->getParam(0));

        if ($result !== true) {
            $this->errorAndExit($result);
        }

        $this->output();
    }
108853
public function uninstall(): OperationResult
    {
        $result = new OperationResult();

        foreach (self::ENV_FILES as $file) {
            $file = "{$this->projectRootDir}/{$file}";
            if (file_exists($file)) {
                $envContent = file_get_contents($file);
                assert(is_string($envContent));

                $startString = "\n###BEGIN-Rikudou-Installer-{$this->packageName}###";
                $endString = "###END-Rikudou-Installer-{$this->packageName}###";

                $startPos = strpos($envContent, $startString);
                if ($startPos === false) {
                    continue;
                }
                $endPos = strpos($envContent, $endString, $startPos);
                if ($endPos === false) {
                    continue;
                }
                $endPos += strlen($endString);

                $resultEnv = substr_replace($envContent, '', $startPos, $endPos - $startPos);
                if (file_put_contents($file, $resultEnv, LOCK_EX) === false) {
                    $result->addErrorMessage("Could not uninstall env variables from {$this->packageName}");
                }
            }
        }

        if ($result->isSuccess()) {
            $result->addStatusMessage("Successfully uninstalled env variables from {$this->packageName}");
        }

        return $result;
    }
688517
public function uninstall($name)
    {
        $name = Container::get('hooks')->fire('model.plugin.uninstall.name', $name);
        $activePlugins = $this->manager->getActivePlugins();

        // Check if plugin is disabled, for security
        if (!in_array($name, $activePlugins)) {
            $plugin = DB::forTable('plugins')->where('name', $name)->find_one();

            if ($plugin) {
                $plugin->delete();
            }

            // Allow additional uninstalling functions
            $this->manager->uninstall($name);

            if (file_exists(ForumEnv::get('FORUM_ROOT').'plugins'.DIRECTORY_SEPARATOR.$name)) {
                AdminUtils::deleteFolder(ForumEnv::get('FORUM_ROOT').'plugins'.DIRECTORY_SEPARATOR.$name);
            }

            $this->manager->setActivePlugins();
        }
        return true;
    }
14360
public function logout()
    {
        // Make sure a TGT exists
        $this->checkTgtExists();

        $this->guzzleClient->delete($this->tgtLocation);
        $this->tgtLocation = null;
        $this->tgt = null;

        // Remove the TGT storage file
        if ($this->tgtStorageLocation) {
            unlink($this->tgtStorageLocation);
        }

        return true;
    }
397776
public function forceDelete()
    {
        $this->forceDeleting = true;

        $deleted = $this->delete();

        $this->forceDeleting = false;

        return $deleted;
    }
812583
private static function uninstallRequest()
    {
        self::$id = self::$config['id'];
        $that = self::getInstance();
        $that->remove();
        $state = 'uninstalled';

        $response = [
            'state' => $state,
            'errors' => self::$errors,
        ];

        echo json_encode($response);
    }
51256
public function delete()
    {
        if ($this->files->exists($path = $this->manifestPath.'/collections.json'))
        {
            return $this->files->delete($path);
        }
        else
        {
            return false;
        }
    }
55219
public function unregister()
    {

        if (!$this->isRegistered())
            return $this;

        if (spl_autoload_unregister($this->handle))
            return parent::unregister();

        return $this;
    }
595287
public function remove()
    {
        if($moduleEvents = $this->module->events())
        {
            $systemEvents = $this->load();
            if (isset($moduleEvents['listen']))
                // for listen event we must check if exists merge if not add it
                foreach ($moduleEvents['listen'] as $event => $listens)
                {
                    if (isset($systemEvents['listen'][$event]))
                    {
                        foreach ($listens as $listen)
                        {
                            $key = array_search($listen, $systemEvents['listen'][$event]);
                            if ($key !== false)
                                unset($listen, $systemEvents['listen'][$event][$key]);
                        }
                    }
                }
            // for subscribe
            if (isset($moduleEvents['subscribe']))
            {
                $key = array_search($moduleEvents['subscribe'], $systemEvents['subscribe'][$event]);
                if($key !==false)
                    unset($systemEvents['subscribe'][$key]);
            }
            return $this->set($systemEvents);
        }
        return true;
    }
583057
public function uninstallFiles(): void
	{
		$isDirEmpty = function ($dir) {
			if (!file_exists($dir) || !is_readable($dir)) {
				return false;
			}
			return count(scandir($dir, SCANDIR_SORT_NONE)) === 2;
		};

		if (!$this->isDevelopmentMode()) {
			foreach ($this->INSTALL_PATHS as $path) {
				$files = $this->getRecursiveFiles($path);
				$dirs = $this->getRecursiveDirs($path);

				foreach ($files as $from => $to) {
					unlink($to);
				}

				foreach ($dirs as $dir) {
					if ($isDirEmpty($dir)) {
						if (!rmdir($dir)) {
							throw new FileDeleteException($dir);
						}
					}
				}
			}
		} else {
			foreach ($this->DEV_LINKS as $link => $target) {
				unlink($link);
			}
		}
	}