Revert module installation
@throws FileDeleteException
185637
public function doUninstall(): void
	{
		$this->uninstallDB();
		$this->uninstallFiles();
		ModuleManager::unRegisterModule($this->MODULE_ID);
	}
1374868
public function cleanup()
    {
        try {
            $this->driver->flushdb();
        } catch (\Exception $e) {
            throw new ModuleException(
                __CLASS__,
                $e->getMessage()
            );
        }
    }
1371070
def revert(self):
        
        assert atexit.register == self._atexit__register, \
            "AtExitWrapper not installed."
        atexit.register = self.original['register']
338178
private void uninstallLayout(JRootPane root) {
        if (savedOldLayout != null) {
            root.setLayout(savedOldLayout);
            savedOldLayout = null;
        }
    }
1256454
@SuppressWarnings("checkstyle:variabledeclarationusagedistance")
	public static void reset() throws CoreException {
		LOCK.lock();
		try {
			// Clear the SRE configuration stored into the preferences.
			clearSREConfiguration();
			// Reset the internal data structures.
			final ISREInstall previous = getDefaultSREInstall();
			final Map<String, ISREInstall> oldSREs = new HashMap<>(ALL_SRE_INSTALLS);
			ALL_SRE_INSTALLS.clear();
			platformSREInstalls = null;
			defaultSREId = null;
			// Notify about the removals
			for (final ISREInstall sre : oldSREs.values()) {
				fireSRERemoved(sre);
			}
			if (previous != null) {
				fireDefaultSREChanged(previous, null);
			}
			// Re-read the data
			initializeSREs();
		} finally {
			LOCK.unlock();
		}
	}
593257
public void unloadAllModuleRevision(String scriptModuleId) {
        for (ModuleIdentifier revisionId : getAllRevisionIds(scriptModuleId)) {
            if (revisionId.getName().equals(scriptModuleId)) {
                unloadModule(revisionId);
            }
        }
    }
387067
public function uninstall_cleanup() {
        global $DB, $CFG;

        if (!$module = $DB->get_record('modules', array('name' => $this->name))) {
            parent::uninstall_cleanup();
            return;
        }

        // Delete all the relevant instances from all course sections.
        if ($coursemods = $DB->get_records('course_modules', array('module' => $module->id))) {
            foreach ($coursemods as $coursemod) {
                // Do not verify results, there is not much we can do anyway.
                delete_mod_from_section($coursemod->id, $coursemod->section);
            }
        }

        // Increment course.cacherev for courses that used this module.
        // This will force cache rebuilding on the next request.
        increment_revision_number('course', 'cacherev',
            "id IN (SELECT DISTINCT course
                      FROM {course_modules}
                     WHERE module=?)",
            array($module->id));

        // Delete all the course module records.
        $DB->delete_records('course_modules', array('module' => $module->id));

        // Delete module contexts.
        if ($coursemods) {
            foreach ($coursemods as $coursemod) {
                \context_helper::delete_instance(CONTEXT_MODULE, $coursemod->id);
            }
        }

        // Delete the module entry itself.
        $DB->delete_records('modules', array('name' => $module->name));

        // Cleanup the gradebook.
        require_once($CFG->libdir.'/gradelib.php');
        grade_uninstalled_module($module->name);

        // Do not look for legacy $module->name . '_uninstall any more,
        // they should have migrated to db/uninstall.php by now.

        parent::uninstall_cleanup();
    }
943445
public function reset()
    {
        $this->layout = null;
        $this->namedCompilers = [];
        $this->importPaths = [];
        $this->importNodeYielded = false;
        $this->importNode = null;
        $this->parentCompiler = null;
    }
980478
public static void uninstallModule(String moduleName) {
        Module module = INSTALLED_MODULES.get(moduleName);
        if (module != null) {
            try {
                module.uninstall();
                INSTALLED_MODULES.remove(moduleName);
            } catch (Exception e) {
                if (LOGGER.isWarnEnabled()) {
                    LOGGER.warn("Error when uninstall module " + moduleName, e);
                }
            }
        }
    }
1168501
def del_module(self, module):
        """"""
        rev = util.get_latest_revision(module)
        del self.modules[(module.arg, rev)]
286090
protected function postRollback()
    {
        // Unset the inserted entities' Ids
        foreach ($this->scheduledForInsertion as $objectHashId => $index) {
            if (($entity = $this->scheduledActions[$index][1] ?? null) === null) {
                continue;
            }

            $idGenerator = $this->idGeneratorRegistry->getIdGenerator($this->entityRegistry->getClassName($entity));

            if ($idGenerator !== null) {
                $this->idAccessorRegistry->setEntityId(
                    $entity,
                    $idGenerator->getEmptyValue($entity)
                );
            }
        }
    }
1230796
public function revert()
    {
        switch ($this->serviceGroupType) {
            case ServiceTypeGroups::DATABASE:
                if ($this->resourceExists('_schema/' . $this->resource)) {
                    /** @var \DreamFactory\Core\Contracts\ServiceResponseInterface $rs */
                    $rs = ServiceManager::handleRequest(
                        $this->service->getName(),
                        Verbs::DELETE,
                        '_schema/' . $this->resource
                    );
                    if ($rs->getStatusCode() === HttpStatusCodes::HTTP_OK) {
                        return true;
                    }
                    $content = $rs->getContent();
                    Log::error(
                        'Failed to delete table on import failure: ' .
                        (is_array($content) ? print_r($content, true) : $content)
                    );
                    throw new InternalServerErrorException('Failed to delete table on import failure. See log for details.');
                }
                break;
            default:
                throw new InternalServerErrorException('An Unexpected error occurred.');
        }
    }
728472
public function cleanup()
    {
        $aDeletedModules = $this->getDeletedExtensions();

        //collecting deleted extension IDs
        $aDeletedModuleIds = array_keys($aDeletedModules);

        // removing from aModules config array
        $this->_removeExtensions($aDeletedModuleIds);

        // removing from aDisabledModules array
        $this->_removeFromDisabledModulesArray($aDeletedModuleIds);

        // removing from aModulePaths array
        $this->removeFromModulesArray(static::MODULE_KEY_PATHS, $aDeletedModuleIds);

        // removing from aModuleEvents array
        $this->removeFromModulesArray(static::MODULE_KEY_EVENTS, $aDeletedModuleIds);

        // removing from aModuleVersions array
        $this->removeFromModulesArray(static::MODULE_KEY_VERSIONS, $aDeletedModuleIds);

        // removing from aModuleExtensions array
        $this->removeFromModulesArray(static::MODULE_KEY_EXTENSIONS, $aDeletedModuleIds);

        // removing from aModuleFiles array
        $this->removeFromModulesArray(static::MODULE_KEY_FILES, $aDeletedModuleIds);

        // removing from aModuleTemplates array
        $this->removeFromModulesArray(static::MODULE_KEY_TEMPLATES, $aDeletedModuleIds);

        // removing from aModuleControllers array
        $this->removeFromModulesArray(static::MODULE_KEY_CONTROLLERS, $aDeletedModuleIds);

        //removing from config tables and templates blocks table
        $this->_removeFromDatabase($aDeletedModuleIds);

        //Remove from caches.
        \OxidEsales\Eshop\Core\Module\ModuleVariablesLocator::resetModuleVariables();
    }
1148738
@Override
    public void detach() {
        super.detach();
        modules.getFilesModule().unbindFile(location.getFileId(), callback, false);
    }
1228231
public function remove()
    {
        $f = json_decode(file_get_contents(FEnv::get("framework.root").
            "elements/config_files/core/apps.json"));
        foreach ($f as $one => $val) {
            if ($val->name == $this->name) {
                unset($f->$one);
                break;
            }
        }

        $f = json_encode($f, JSON_PRETTY_PRINT);
        file_put_contents(FEnv::get("framework.root")."elements/config_files/core/apps.json", $f);

        Server::delete(FEnv::get("framework.root")."apps/".$this->name, "directory");
        Server::delete(
            FEnv::get("framework.root")."public/components/apps/".strtolower($this->name),
            'directory'
        );
    }
1080097
def unregisterAddonModule(cls, module):
        
        prop = '_{0}__addon_modules'.format(cls.__name__)
        mods = getattr(cls, prop, set())
        try:
            mods.remove(module)
        except KeyError:
            pass
1227352
protected function cleanUp()
    {
        $this->fs->remove(dirname($this->downloadedFilePath));

        try {
            $licenseFile = array($this->projectDir.'/LICENSE');
            $upgradeFiles = glob($this->projectDir.'/UPGRADE*.md');
            $changelogFiles = glob($this->projectDir.'/CHANGELOG*.md');

            $filesToRemove = array_merge($licenseFile, $upgradeFiles, $changelogFiles);
            $this->fs->remove($filesToRemove);
        } catch (\Exception $e) {
            // don't throw an exception in case any of the Symfony-related files cannot
            // be removed, because this is just an enhancement, not something mandatory
            // for the project
        }

        return $this;
    }