Defines if there should be a way to uninstall the plugin via the administration UI.
@return boolean
547419
public function is_uninstall_allowed() {
        if ($this->name === 'upload' || $this->name === 'coursefiles' || $this->name === 'user' || $this->name === 'recent') {
            return false;
        } else {
            return true;
        }
    }
601084
protected function _runTransactional()
    {
        // to avoid any possible issue
        snapshot();

        if (!is_writable(TMP)) {
            $this->err(__d('installer', 'Enable write permissions in /tmp directory before uninstall any plugin or theme.'));

            return false;
        }

        if (!$this->params['plugin']) {
            $this->err(__d('installer', 'No plugin/theme was given to remove.'));

            return false;
        }

        $this->loadModel('System.Plugins');

        try {
            $plugin = plugin($this->params['plugin']);
            $pluginEntity = $this->Plugins
                ->find()
                ->where(['name' => $this->params['plugin']])
                ->limit(1)
                ->first();
        } catch (\Exception $ex) {
            $plugin = $pluginEntity = false;
        }

        if (!$plugin || !$pluginEntity) {
            $this->err(__d('installer', 'Plugin "{0}" was not found.', $this->params['plugin']));

            return false;
        }

        $this->_plugin = $plugin;
        $type = $plugin->isTheme ? 'theme' : 'plugin';
        if ($plugin->isTheme && in_array($plugin->name, [option('front_theme'), option('back_theme')])) {
            $this->err(__d('installer', '{0} "{1}" is currently being used and cannot be removed.', ($type == 'plugin' ? __d('installer', 'The plugin') : __d('installer', 'The theme')), $plugin->humanName));

            return false;
        }

        $requiredBy = Plugin::checkReverseDependency($this->params['plugin']);
        if (!empty($requiredBy)) {
            $names = [];
            foreach ($requiredBy as $p) {
                $names[] = $p->name();
            }

            $this->err(__d('installer', '{0} "{1}" cannot be removed as it is required by: {2}', ($type == 'plugin' ? __d('installer', 'The plugin') : __d('installer', 'The theme')), $plugin->humanName, implode(', ', $names)));

            return false;
        }

        if (!$this->_canBeDeleted($plugin->path)) {
            return false;
        }

        if (!$this->params['no-callbacks']) {
            try {
                $event = $this->trigger("Plugin.{$plugin->name}.beforeUninstall");
                if ($event->isStopped() || $event->result === false) {
                    $this->err(__d('installer', 'Task was explicitly rejected by {0}.', ($type == 'plugin' ? __d('installer', 'the plugin') : __d('installer', 'the theme'))));

                    return false;
                }
            } catch (\Exception $e) {
                $this->err(__d('installer', 'Internal error, {0} did not respond to "beforeUninstall" callback correctly.', ($type == 'plugin' ? __d('installer', 'the plugin') : __d('installer', 'the theme'))));

                return false;
            }
        }

        if (!$this->Plugins->delete($pluginEntity)) {
            $this->err(__d('installer', '{0} "{1}" could not be unregistered from DB.', ($type == 'plugin' ? __d('installer', 'The plugin') : __d('installer', 'The theme')), $plugin->humanName));

            return false;
        }

        $this->_removeOptions();
        $this->_clearAcoPaths();
        $folder = new Folder($plugin->path);
        $folder->delete();
        snapshot();

        if (!$this->params['no-callbacks']) {
            try {
                $this->trigger("Plugin.{$plugin->name}.afterUninstall");
            } catch (\Exception $e) {
                $this->err(__d('installer', '{0} did not respond to "afterUninstall" callback.', ($type == 'plugin' ? __d('installer', 'The plugin') : __d('installer', 'The theme'))));
            }
        }

        Plugin::unload($plugin->name);
        Plugin::dropCache();

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

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

        $this->output();
    }
509152
public static function uninstall($pluginname) {
        global $DB;

        list($a, $b) = core_component::normalize_component($pluginname);
        if (empty($b) || $a === 'core') {
            throw new coding_exception('Core component can not be uninstalled');
        }
        $component = $a . '_' . $b;

        core_tag_tag::delete_instances($component);

        $DB->delete_records('tag_area', array('component' => $component));
        $DB->delete_records('tag_coll', array('component' => $component));
        cache::make('core', 'tags')->delete_many(array('tag_area', 'tag_coll'));
    }
1091243
public function purgePlugin($pluginCode)
    {
        $versions = Db::table('system_plugin_versions')->where('code', $pluginCode);
        if ($countVersions = $versions->count()) {
            $versions->delete();
        }

        $history = Db::table('system_plugin_history')->where('code', $pluginCode);
        if ($countHistory = $history->count()) {
            $history->delete();
        }

        return ($countHistory + $countVersions) > 0;
    }
1187901
public function unlink()
	{
		if ($this->mysql === null)
		{
			return false;
		}

		$query = $this->mysql->prepare('DELETE FROM `' . $this->options['extras']['prefix'] . 'cache_data` WHERE `id` = :id');
		$query->bindValue(':id', $this->id);
		$query2 = $this->mysql->prepare('DELETE FROM `' . $this->options['extras']['prefix'] . 'items` WHERE `feed_id` = :id');
		$query2->bindValue(':id', $this->id);

		return $query->execute() && $query2->execute();
	}
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();
    }
1181440
function _uninstall_plugin_event( $check_user = true ) {
            $this->_logger->entrance( 'slug = ' . $this->_slug );

            if ( $check_user && ! current_user_can( 'activate_plugins' ) ) {
                return;
            }

            $params           = array();
            $uninstall_reason = null;
            if ( isset( $this->_storage->uninstall_reason ) ) {
                $uninstall_reason      = $this->_storage->uninstall_reason;
                $params['reason_id']   = $uninstall_reason->id;
                $params['reason_info'] = $uninstall_reason->info;
            }

            if ( ! $this->is_registered() ) {
                // Send anonymous uninstall event only if user submitted a feedback.
                if ( isset( $uninstall_reason ) ) {
                    if ( isset( $uninstall_reason->is_anonymous ) && ! $uninstall_reason->is_anonymous ) {
                        $this->opt_in( false, false, false, false, true );
                    } else {
                        $params['uid'] = $this->get_anonymous_id();
                        $this->get_api_plugin_scope()->call( 'uninstall.json', 'put', $params );
                    }
                }
            } else {
                $params = array_merge( $params, array(
                    'is_active'      => false,
                    'is_uninstalled' => true,
                ) );

                if ( $this->_is_network_active ) {
                    // Send uninstall event.
                    $this->send_installs_update( $params );
                } else {
                    // Send uninstall event.
                    $this->send_install_update( $params );
                }
            }

            // @todo Decide if we want to delete plugin information from db.
        }
1320993
public function delete()
    {
        $this->userId = $this->getEntityProvider()->getMe()->getId();
        $this->getLogger()->info('Deleting widget ID ' . $this->widgetId);
        $this->doDelete('/playlist/widget/' . $this->widgetId , $this->toArray());

        return true;
    }
1178115
public function delete()
	{
		$this->getLogger()->info('Deleting media ID ' . $this->mediaId);
		$this->doDelete('/library/' . $this->mediaId);
		
		return true;
	}
1237022
protected function unregisterPlugin($name)
    {
        $plugins = $this->loadPlugins();

        if (!isset($plugins[$name])) {
            return null;
        }

        $plugin = $plugins[$name];
        unset($plugins[$name]);
        $this->savePlugins($plugins);
        return $plugin;
    }
1339002
public function isBltAliasInstalled() {
    $cli_config_file = $this->getCliConfigFile();
    if (!is_null($cli_config_file) && file_exists($cli_config_file)) {
      $contents = file_get_contents($cli_config_file);
      if (strstr($contents, 'function blt')) {
        return TRUE;
      }
    }

    return FALSE;
  }
803067
public static function uninstall() {
		$cptp = CPTP::get_instance();

		foreach ( $cptp->modules as $module ) {
			$module->uninstall_hook();
		}
	}
162890
protected function uninstall()
    {
        $uninstallScripts = array();
        if (!empty($this->installedBundles)) {
            foreach ($this->installedBundles as $autoloader) {
                $bundleName = $autoloader->getBundleName();
                $uninstallScripts[$bundleName] = $autoloader->getActionManagerClass();
                $this->filesystem->remove($this->autoloadersPath . '/' . $bundleName . '.json');
                $this->filesystem->remove($this->configPath);
                $this->filesystem->remove($this->routingPath);
            }
        }

        $this->requireCachedClasses();
        $uninstallerScript = $this->scriptFactory->createScript('PreBootUninstaller');
        $uninstallerScript->executeActions($uninstallScripts);
    }
51256
public function delete()
    {
        if ($this->files->exists($path = $this->manifestPath.'/collections.json'))
        {
            return $this->files->delete($path);
        }
        else
        {
            return false;
        }
    }
217013
public function uninstall()
    {
        $handler = $this->stack->pop();

        if ($handler !== $this) {
            if (null !== $handler) {
                $this->stack->push($handler);
            }

            throw new NotInstalledException();
        }
    }
1305292
public function uninstall(Composer $composer, IOInterface $io, $pluginName)
    {
        $plugin = $this->prepare(__FUNCTION__, $composer, $io, $pluginName);
        
        if ($plugin) {
            $result = $this->wp(function () use ($plugin) {
                return uninstall_plugin($plugin);
            });
            
            $this->succeeded(__FUNCTION__, $pluginName, $result === true || $result === null);
        }
    }