Pre-uninstall hook.
This is intended for disabling of plugin, some DB table purging, etc.
180694
public function uninstall_cleanup() {
        global $DB;

        // Find all definitions and templates.
        $definitions = $DB->get_fieldset_select('grading_definitions', 'id', 'method = ?', [$this->name]);
        if ($definitions) {
            // Delete instances and definitions. Deleting instance will not delete grades because they were
            // already pushed to the module and gradebook.
            list($sqld, $paramsd) = $DB->get_in_or_equal($definitions);
            $DB->delete_records_select('grading_instances', 'definitionid ' . $sqld, $paramsd);
            $DB->delete_records_select('grading_definitions', 'id ' . $sqld, $paramsd);
        }
        // Delete templates for this grading method.
        $DB->delete_records_select('grading_areas', 'component = ? AND activemethod = ?', array('core_grading', $this->name));
        // Update the remaining grading areas to use simple grading method instead of this grading method.
        $DB->execute('UPDATE {grading_areas} SET activemethod = NULL WHERE activemethod = ?', [$this->name]);

        parent::uninstall_cleanup();
    }
837281
function uninstall() {
  installer.uninstall(Array.prototype.slice.call(arguments), function(errs) {
    if (errs) {
      return out.error("error : %j", errs);
    }
    return out.success("plugins uninstalled");
  });
}
1270619
function removeThis()
    {
        $workflowParameters = $this->attribute( 'parameter_list' );
        $cleanupList = array();

        $db = eZDB::instance();
        $db->begin();
        if ( isset( $workflowParameters['cleanup_list'] ) && is_array( $workflowParameters['cleanup_list'] ) )
        {
            $cleanupList = $workflowParameters['cleanup_list'];
            foreach ( $cleanupList as $workflowEventID )
            {
                $workflowEvent = eZWorkflowEvent::fetch( $workflowEventID );
                $workflowType = $workflowEvent->eventType();
                $workflowType->cleanup( $this, eZWorkflowEvent::fetch( $workflowEventID ) );
            }
        }
        eZPersistentObject::removeObject( eZWorkflowProcess::definition(), array( 'id' => $this->attribute( 'id' ) ) );
        $db->commit();
    }
525361
public function uninstall_cleanup() {
        global $DB;

        // Get all instances of this portfolio.
        $count = $DB->count_records('portfolio_instance', array('plugin' => $this->name));
        if ($count > 0) {
            // This portfolio is in use, get the it's ID.
            $rec = $DB->get_record('portfolio_instance', array('plugin' => $this->name));

            // Remove all records from portfolio_instance_config.
            $DB->delete_records('portfolio_instance_config', array('instance' => $rec->id));
            // Remove all records from portfolio_instance_user.
            $DB->delete_records('portfolio_instance_user', array('instance' => $rec->id));
            // Remove all records from portfolio_log.
            $DB->delete_records('portfolio_log', array('portfolio' => $rec->id));
            // Remove all records from portfolio_tempdata.
            $DB->delete_records('portfolio_tempdata', array('instance' => $rec->id));

            // Remove the record from the portfolio_instance table.
            $DB->delete_records('portfolio_instance', array('id' => $rec->id));
        }

        parent::uninstall_cleanup();
    }
372891
void unregisterUse() {
		final int value = this.uses.decrementAndGet();
		if (value == 0) {
			uninstall(UninstallationStage.PRE_DESTROY_EVENT);
			uninstall(UninstallationStage.POST_DESTROY_EVENT);
		}
	}
873603
def removeProductFrom(self, userstore):
        
        def uninstall():
            #this is probably highly insufficient, but i don't know the
            #requirements
            i = userstore.findFirst(Installation,
                                    Installation.types == self.types)
            i.uninstall()
            i.deleteFromStore()
        userstore.transact(uninstall)
1009671
def discard_plugin_preset(self):
        
        if self.has_plugin_preset:
            for name, plugin in list(self._active_plugins.items()):
                if id(plugin) in self._provided_by_preset:
                    self.release_plugin(name)
            self._active_preset.deactivate(self)
        self._active_preset = None
903128
function uninstall( $uninstallParameters = array() )
    {
        if ( $this->Parameters['install_type'] != 'install' )
            return;
        if ( !$this->isInstalled() )
            return;
        $uninstallItems = $this->installItemsList();
        if ( !isset( $installParameters['path'] ) )
            $installParameters['path'] = false;

        $uninstallResult = true;
        foreach ( $uninstallItems as $item )
        {
            if ( !$this->uninstallItem( $item, $uninstallParameters ) )
            {
                $uninstallResult = false;
            }
        }

        $this->InstallData = array();
        $this->setInstalled( false );
        return $uninstallResult;
    }
344159
public function uninstall()
    {
        $_POST['selected'] = [];

        foreach ((array) $this->plugin as $plugin) {
            $_POST['selected'][] = $plugin->name;
        }

        $_POST['edit_method'] = 'delete';
        ob_start();
        plugin_multi_edit();
        ob_end_clean();
    }
561965
public function uninstall()
    {
        $manager = new Manager($this->app);
        $categories = $manager->getPackageItemCategories();
        $package = $this->getPackageEntity();
        foreach ($categories as $category) {
            if ($category->hasItems($package)) {
                $category->removeItems($package);
            }
        }

        $this->app->make('config')->clearNamespace($this->getPackageHandle());
        $this->app->make('config/database')->clearNamespace($this->getPackageHandle());

        $em = $this->getPackageEntityManager();
        if ($em !== null) {
            $this->destroyProxyClasses($em);
        }

        $em = $this->app->make(EntityManagerInterface::class);
        $em->remove($package);
        $em->flush();

        Localization::clearCache();
    }
862251
def uninstall(ctx, yes, integrations):
    """"""
    logger.debug("running command %s (%s)", ctx.command.name, ctx.params,
                 extra={"command": ctx.command.name, "params": ctx.params})

    home = ctx.obj["HOME"]

    for integration in integrations:
        integration_path = plugin_utils.get_plugin_path(home, INTEGRATIONS, integration)
        plugin_utils.uninstall_plugin(integration_path, yes)
1258629
@Override
    @Deprecated
    public void uninstall(LocalExtension localExtension, String namespace, Request request) throws UninstallException
    {
        uninstall((InstalledExtension) localExtension, namespace, request);
    }
774770
def uninstall(self):
    """"""
    if not self._uninstallable:
      _tracer().log('Not uninstalling {}'.format(self), V=9)
      return

    if self in sys.meta_path:
      sys.meta_path.remove(self)
      maybe_exposed = frozenset(os.path.join(self._root, importable.path)
                                for importable in self._importables)
      sys.path[:] = [path_item for path_item in sys.path if path_item not in maybe_exposed]
      for loader in self._loaders:
        loader.unload()
      _tracer().log('Uninstalled {}'.format(self), V=3)
645966
function uninstall(names, callback) {
  callback = utils.defineCallback(callback);
  if (_.isString(names)) {
    names = [ names ];
  }
  var errs = [ ];
  var numPlugins = 0;
  names.forEach(function(name) {
    rimraf(pluginsDir + "/" + name, cb);
  });

  function cb(err) {
    if (err) {
      errs.push(err);
    }
    if (++numPlugins === names.length) {
      return callback(errs.length === 0 ? null : errs);
    }
  }
}
955658
public function uninstall_cleanup() {
        global $CFG;

        if (!empty($CFG->antiviruses)) {
            $antiviruses = explode(',', $CFG->antiviruses);
            $antiviruses = array_unique($antiviruses);
        } else {
            $antiviruses = array();
        }
        if (($key = array_search($this->name, $antiviruses)) !== false) {
            unset($antiviruses[$key]);
            set_config('antiviruses', implode(',', $antiviruses));
        }
        parent::uninstall_cleanup();
    }
300474
public function uninstall_cleanup() {
        global $DB, $CFG;

        // NOTE: this is a bit brute force way - it will not trigger events and hooks properly.

        // Nuke all role assignments.
        role_unassign_all(array('component'=>'enrol_'.$this->name));

        // Purge participants.
        $DB->delete_records_select('user_enrolments', "enrolid IN (SELECT id FROM {enrol} WHERE enrol = ?)", array($this->name));

        // Purge enrol instances.
        $DB->delete_records('enrol', array('enrol'=>$this->name));

        // Tweak enrol settings.
        if (!empty($CFG->enrol_plugins_enabled)) {
            $enabledenrols = explode(',', $CFG->enrol_plugins_enabled);
            $enabledenrols = array_unique($enabledenrols);
            $enabledenrols = array_flip($enabledenrols);
            unset($enabledenrols[$this->name]);
            $enabledenrols = array_flip($enabledenrols);
            if (is_array($enabledenrols)) {
                set_config('enrol_plugins_enabled', implode(',', $enabledenrols));
            }
        }

        parent::uninstall_cleanup();
    }
252671
public function cleanup() {
    $this->say("Removing deprecated files and directories...");
    $this->taskFilesystemStack()
      ->remove([
        "build",
        "docroot/sites/default/settings/apcu_fix.yml",
        "docroot/sites/default/settings/base.settings.php",
        "docroot/sites/default/settings/blt.settings.php",
        "docroot/sites/default/settings/cache.settings.php",
        "docroot/sites/default/settings/filesystem.settings.php",
        "docroot/sites/default/settings/logging.settings.php",
        "docroot/sites/default/settings/travis.settings.php",
        "docroot/sites/default/settings/pipelines.settings.php",
        "docroot/sites/default/settings/tugboat.settings.php",
        "docroot/sites/settings/global.settings.default.php",
        "tests/phpunit/blt",
        "tests/phpunit/Bolt",
        "scripts/blt",
        "scripts/drupal",
        "scripts/drupal-vm",
        "scripts/git-hooks",
        "scripts/release-notes",
        "scripts/tugboat",
        "blt.sh",
        "project.yml",
        "project.local.yml",
        "example.project.local.yml",
        "readme/acsf-setup.md",
        "readme/architecture.md",
        "readme/best-practices.md",
        "readme/deploy.md",
        "readme/dev-workflow.md",
        "readme/features-workflow.md",
        "readme/local-development.md",
        "readme/onboarding.md",
        "readme/project-tasks.md",
        "readme/release-process.md",
        "readme/repo-architecture.md",
        "readme/views.md",
        "drush/policy.drush.inc",
      ])
      ->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERBOSE)
      ->run();
  }