Uninstall module and remove assets

@param string $moduleName
@return bool
503462
public function uninstall($moduleName)
    {
        $module = $this->findOrFalse('module_name', $moduleName);
        if ($module)
        {
            $version = $this->def($moduleName, 'version');
            if ($this->checkModuleDepends($moduleName, new Version($version)))
                return false;

            $this->app['events']->fire('modules.uninstall.'.$moduleName, null);

            $module->delete();

            if (!$this->removeAssets($moduleName))
                $this->errors->add('delete_assets', "Unable to delete assets $moduleName");

            if (!$this->removeModuleDirectory($moduleName))
                $this->errors->add('delete_module', "Unable to delete $moduleName");

            return true;
        }
        return false;
    }
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;
    }
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;
    }
1030701
public function deleteOne($moduleName, $entityID)
    {
        // Preprend so-called moduleid if needed
        $entityID = $this->wsClient->modules->getTypedID($moduleName, $entityID);
        return $this->wsClient->invokeOperation('delete', [ 'id' => $entityID ]);
    }
1225191
function byModule($moduleName)
    {
        if (!$this->hasLoaded($moduleName))
            $this->loadModule($moduleName);

        return $this->_c__loadedModules[$moduleName];
    }
638872
public function remove($name)
    {
        $names = (array)$name;

        foreach ($names as $name) {
            if (Arr::key($name, $this->_assets)) {
                unset($this->_assets[$name]);
            }
        }
    }
1049875
public function buildAssets($moduleName)
    {
        $module = $this->getModuleDirectory($moduleName);
        if ($module)
        {
            $module .= '/assets';
            if ($this->files->exists($module))
            {
                if (!@$this->files->copyDirectory($module, $this->getAssetDirectory($moduleName)))
                {
                    $this->errors->add('build_assets', 'Unable to build assets');
                    return false;
                }
            }
            return true;
        }
        return false;
    }
990222
public function disableModule($modulePath)
    {
        $module = oxNew(\OxidEsales\Eshop\Core\Module\Module::class);
        $moduleId = $module->getIdByPath($modulePath);
        $module->load($moduleId);

        $moduleCache = oxNew('oxModuleCache', $module);
        $moduleInstaller = oxNew('oxModuleInstaller', $moduleCache);

        return $moduleInstaller->deactivate($module);
    }
477653
public function removeLast(string $tagName) : bool
    {
        $index = $this->findLastIndex($tagName);
        if ($index === -1) {
            return false;
        }

        $this->removeAt($index);
        return true;
    }
386756
public function uninstall($themeName)
    {
        $theme = plugin($themeName); // throws
        if (!in_array($themeName, [option('front_theme'), option('back_theme')])) {
            if (!$theme->requiredBy()->isEmpty()) {
                $this->Flash->danger(__d('system', 'You cannot remove this theme!'));
            } else {
                $task = (bool)WebShellDispatcher::run("Installer.plugins uninstall -p {$theme->name}");
                if ($task) {
                    $this->Flash->success(__d('system', 'Theme successfully removed!'));
                } else {
                    $this->Flash->set(__d('system', 'Theme could not be removed'), [
                        'element' => 'System.installer_errors',
                        'params' => ['errors' => WebShellDispatcher::output()],
                    ]);
                }
            }
        } else {
            $this->Flash->danger(__d('system', 'This theme cannot be removed as it is currently being used.'));
        }

        $this->title(__d('system', 'Uninstall Theme'));
        $this->redirect($this->referer());
    }
351926
public function uninstallModule($name)
    {
        $return = [];
        if (!($module = CModule::CreateModuleObject($name))) {
            throw new Exception("Module {$name} not found");
        } elseif (!$module->IsInstalled()) {
            throw new Exception("Module {$name} already uninstalled");
        } else {
            $module->DoUninstall();
            $return[] = "Module {$name} uninstalled";
        }

        return $return;
    }
771775
protected function removeCache($cachename){
        $file = $this->cachedir . $cachename . '.cache';
        if ( is_file($file) ) {
            @unlink($file);
        }
        return true;
    }
129056
public function remove()
    {
        if ($this->isRegistered()) {
            $this->unRegister();
        }

        $path = getLocalPath('modules/' . $this->getName());

        if ($path) {
            (new Filesystem())->remove($_SERVER['DOCUMENT_ROOT'] . $path);
        }

        unset($this->object);

        return $this;
    }
368159
public T removeModule(final String moduleName, final String slot, final byte[] existingHash) {
        final ContentItem item = createModuleItem(moduleName, slot, NO_CONTENT);
        addContentModification(createContentModification(item, ModificationType.REMOVE, existingHash));
        return returnThis();
    }
327485
public function removeAllByModule($module)
    {
        $this->initializeOnDemand();

        if ($this->arrayConfig->hasModule($module) && $this->configMapper->deleteAllByModule($module)) {
            $this->arrayConfig->removeAllByModule($module);
            return true;
        } else {
            return false;
        }
    }
389536
public function installed( $name )
	{
		if( ! is_array($name) )
		{
			$name = [$name];
		}

		if( ! count($name) )
		{
			return false;
		}

		foreach( $name as $module_name )
		{
			if( is_numeric($module_name) )
			{
				if( !$this->offsetExists($module_name) )
				{
					return false;
				}
			}
			else if( $this->getId($module_name) === false )
			{
				return false;
			}
		}

		return true;
	}
798782
public function hasInstalledPackage($packageName)
    {
        foreach ($this->contents['packages'] as $packageDetails) {
            if ($packageName === $packageDetails['name']) {
                return true;
            }
        }
        
        return false;
    }