Delete plugin's associated add-ons.

@author   Vova Feldman (@svovaf)
@since    1.0.8

@param bool $store

@return bool
10448
private function _delete_account_addons( $store = true ) {
            $all_addons = self::get_all_account_addons();

            if ( ! isset( $all_addons[ $this->_plugin->id ] ) ) {
                return false;
            }

            unset( $all_addons[ $this->_plugin->id ] );

            self::$_accounts->set_option( 'account_addons', $all_addons, $store );

            return true;
        }
66583
public function purge() {
        $this->get_store()->purge();
        if ($this->get_loader()) {
            $this->get_loader()->purge();
        }
        return true;
    }
100261
public function uploadConfig($store)
    {
        // Upload the config files for this index
        $store->uploadString(
            $this->getIndexName(),
            'schema.xml',
            (string)$this->generateSchema()
        );

        // Upload additional files
        foreach (glob($this->getExtrasPath() . '/*') as $file) {
            if (is_file($file)) {
                $store->uploadFile($this->getIndexName(), $file);
            }
        }
    }
1045607
public function removeAll(self $storage)
    {
        foreach ($this->data as $key => $value) {
            foreach ($storage->data as $object) {
                if ($object === $value) {
                    unset($this->data[$key]);
                    unset($this->info[$key]);
                }
            }
        }
    }
295773
private function deleteStore($key)
    {
        if (isset($this->storage[$key])) {
            unset($this->storage[$key]);
            return $this->save();
        }

        return true;
    }
1074614
public static function uninstall()
	{
		$results = array();

		//see if any mods from jfusion plugins need to be removed
		$plugins = Factory::getPlugins('all', false, 0);
		foreach($plugins as $plugin) {
			$model = new Plugin();
			$result = $model->uninstall($plugin->name);

			$r = new stdClass();
			$result['status'] = 1;
			$r->status = $result['status'];

			if (!$r->status) {
				$r->message = Text::_('UNINSTALL') . ' ' . $plugin->name . ' ' . Text::_('FAILED');
			} else {
				$r->message = Text::_('UNINSTALL') . ' ' . $plugin->name . ' ' . Text::_('SUCCESS');
			}

			$results[] = $r;
		}

		//remove the jfusion tables.
		$db = Factory::getDBO();
		$query = 'DROP TABLE IF EXISTS #__jfusion';
		$db->setQuery($query);
		$db->execute();

		$query = 'DROP TABLE IF EXISTS #__jfusion_sync';
		$db->setQuery($query);
		$db->execute();

		$query = 'DROP TABLE IF EXISTS #__jfusion_sync_details';
		$db->setQuery($query);
		$db->execute();

		$query = 'DROP TABLE IF EXISTS #__jfusion_users';
		$db->setQuery($query);
		$db->execute();
		return $results;
	}
927796
private function _store_plans( $store = true ) {
            $this->_logger->entrance();

            $plans = self::get_all_plans( $this->_module_type );

            // Copy plans.
            $encrypted_plans = array();
            for ( $i = 0, $len = count( $this->_plans ); $i < $len; $i ++ ) {
                $encrypted_plans[] = self::_encrypt_entity( $this->_plans[ $i ] );
            }

            $plans[ $this->_slug ] = $encrypted_plans;

            $this->set_account_option( 'plans', $plans, $store );
        }
1242340
function _delete_site( $store = true, $blog_id = null ) {
            return self::_delete_site_by_slug( $this->_slug, $this->_module_type, $store, $blog_id );
        }
1221825
public static function unload($plugin = null)
    {
        deprecationWarning('Plugin::unload() will be removed in 4.0. Use PluginCollection::remove() or clear()');
        if ($plugin === null) {
            static::getCollection()->clear();
        } else {
            static::getCollection()->remove($plugin);
        }
    }
984910
public function deleteAction(array $storage)
    {
        $this->storageRepository->remove($storage);
        $this->addFlashMessage('Your Page was removed.');
        $this->redirect('list');
    }
862428
private function sync_addons( $flush = false ) {
            $this->_logger->entrance();

            $api = $this->get_api_site_or_plugin_scope();

            $path = $this->add_show_pending( '/addons.json?enriched=true' );

            /**
             * @since 1.2.1
             *
             * If there's a cached version of the add-ons and not asking
             * for a flush, just use the currently stored add-ons.
             */
            if ( ! $flush && $api->is_cached( $path ) ) {
                $addons = self::get_all_addons();

                return $addons[ $this->_plugin->id ];
            }

            $result = $api->get( $path, $flush );

            $addons = array();
            if ( $this->is_api_result_object( $result, 'plugins' ) &&
                 is_array( $result->plugins )
            ) {
                for ( $i = 0, $len = count( $result->plugins ); $i < $len; $i ++ ) {
                    $addons[ $i ] = new FS_Plugin( $result->plugins[ $i ] );
                }

                $this->_store_addons( $addons, true );
            }

            return $addons;
        }
1103427
public function delete($conditions = false)
    {
        $this->andWhere($conditions);
        $this->type = self::DELETE;
        return $this->execute();
    }
35172
function remove( $removeAttributes = false, $version = eZContentClass::VERSION_STATUS_DEFINED )
    {
        // If we are not allowed to remove just return false
        if ( $this->Version == eZContentClass::VERSION_STATUS_DEFINED && !$this->isRemovable() )
            return false;

        if ( is_array( $removeAttributes ) or $removeAttributes )
            $this->removeAttributes( $removeAttributes );

        $this->NameList->remove( $this );
        parent::remove();
    }
475373
public function isSandboxModeSet($store = null)
    {
        return $this->getScopeConfig()->isSetFlag(
            self::XML_PATH_SANDBOX_MODE,
            ScopeInterface::SCOPE_STORE,
            $store
        );
    }
360819
private static function uninstall( $plugin_base_name ) {
		$app = self::find_plugin( $plugin_base_name );
		if ( ! isset( $app ) ) {
			return;
		}

		$app->_is_uninstall = true;
		$app->plugins_loaded();
		$app->main_init();
		$app->uninstall->uninstall();
	}
819687
public function removePlugin($plugin, $stopOnVersion = null)
    {
        $code = is_string($plugin) ? $plugin : $this->pluginManager->getIdentifier($plugin);

        if (!$this->hasVersionFile($code)) {
            return false;
        }

        $pluginHistory = $this->getDatabaseHistory($code);
        $pluginHistory = array_reverse($pluginHistory);

        $stopOnNextVersion = false;
        $newPluginVersion = null;

        foreach ($pluginHistory as $history) {
            if ($stopOnNextVersion && $history->version !== $stopOnVersion) {
                // Stop if the $stopOnVersion value was found and
                // this is a new version. The history could contain
                // multiple items for a single version (comments and scripts).
                $newPluginVersion = $history->version;
                break;
            }

            if ($history->type == self::HISTORY_TYPE_COMMENT) {
                $this->removeDatabaseComment($code, $history->version);
            }
            elseif ($history->type == self::HISTORY_TYPE_SCRIPT) {
                $this->removeDatabaseScript($code, $history->version, $history->detail);
            }

            if ($stopOnVersion === $history->version) {
                $stopOnNextVersion = true;
            }
        }

        $this->setDatabaseVersion($code, $newPluginVersion);

        if (isset($this->fileVersions[$code])) {
            unset($this->fileVersions[$code]);
        }
        if (isset($this->databaseVersions[$code])) {
            unset($this->databaseVersions[$code]);
        }
        if (isset($this->databaseHistory[$code])) {
            unset($this->databaseHistory[$code]);
        }
        return true;
    }
520440
public function delete($entity)
    {
        if (($entity instanceof Model) === false) {
            $entity = $this->find($entity);
        }

        if ($entity->delete()) {
            $this->flushCache();

            return true;
        }

        return false;
    }