public function onBulkAction()
    {
        if (($bulkAction = post('action')) &&
            ($checkedIds = post('checked')) &&
            is_array($checkedIds) &&
            count($checkedIds)
        ) {
            $manager = PluginManager::instance();

            foreach ($checkedIds as $pluginId) {
                if (!$plugin = PluginVersion::find($pluginId)) {
                    continue;
                }

                $savePlugin = true;
                switch ($bulkAction) {
                    // Enables plugin's updates.
                    case 'freeze':
                        $plugin->is_frozen = 1;
                        break;

                    // Disables plugin's updates.
                    case 'unfreeze':
                        $plugin->is_frozen = 0;
                        break;

                    // Disables plugin on the system.
                    case 'disable':
                        $plugin->is_disabled = 1;
                        $manager->disablePlugin($plugin->code, true);
                        break;

                    // Enables plugin on the system.
                    case 'enable':
                        $plugin->is_disabled = 0;
                        $manager->enablePlugin($plugin->code, true);
                        break;

                    // Rebuilds plugin database migrations.
                    case 'refresh':
                        $savePlugin = false;
                        $manager->refreshPlugin($plugin->code);
                        break;

                    // Rollback and remove plugins from the system.
                    case 'remove':
                        $savePlugin = false;
                        $manager->deletePlugin($plugin->code);
                        break;
                }

                if ($savePlugin) {
                    $plugin->save();
                }
            }
        }

        Flash::success(Lang::get("system::lang.plugins.{$bulkAction}_success"));
        return $this->listRefresh('manage');
    }
public function onBulkAction()
    {
        if (($bulkAction = post('action')) &&
            ($checkedIds = post('checked')) &&
            is_array($checkedIds) &&
            count($checkedIds)
        ) {
            $manager = PluginManager::instance();

            foreach ($checkedIds as $pluginId) {
                if (!$plugin = PluginVersion::find($pluginId)) {
                    continue;
                }

                $savePlugin = true;
                switch ($bulkAction) {
                    // Enables plugin's updates.
                    case 'freeze':
                        $plugin->is_frozen = 1;
                        break;

                    // Disables plugin's updates.
                    case 'unfreeze':
                        $plugin->is_frozen = 0;
                        break;

                    // Disables plugin on the system.
                    case 'disable':
                        $plugin->is_disabled = 1;
                        $manager->disablePlugin($plugin->code, true);
                        break;

                    // Enables plugin on the system.
                    case 'enable':
                        $plugin->is_disabled = 0;
                        $manager->enablePlugin($plugin->code, true);
                        break;

                    // Rebuilds plugin database migrations.
                    case 'refresh':
                        $savePlugin = false;
                        $manager->refreshPlugin($plugin->code);
                        break;

                    // Rollback and remove plugins from the system.
                    case 'remove':
                        $savePlugin = false;
                        $manager->deletePlugin($plugin->code);
                        break;
                }

                if ($savePlugin) {
                    $plugin->save();
                }
            }
        }

        Flash::success(Lang::get("system::lang.plugins.{$bulkAction}_success"));
        return $this->listRefresh('manage');
    }
public function onBulkAction ( ) { if ( ( $ bulkAction = post ( 'action' ) ) && ( $ checkedIds = post ( 'checked' ) ) && is_array ( $ checkedIds ) && count ( $ checkedIds ) ) { $ manager = PluginManager :: instance ( ) ; foreach ( $ checkedIds as $ pluginId ) { if ( ! $ plugin = PluginVersion :: find ( $ pluginId ) ) { continue ; } $ savePlugin = true ; switch ( $ bulkAction ) { // Enables plugin's updates. case 'freeze' : $ plugin -> is_frozen = 1 ; break ; // Disables plugin's updates. case 'unfreeze' : $ plugin -> is_frozen = 0 ; break ; // Disables plugin on the system. case 'disable' : $ plugin -> is_disabled = 1 ; $ manager -> disablePlugin ( $ plugin -> code , true ) ; break ; // Enables plugin on the system. case 'enable' : $ plugin -> is_disabled = 0 ; $ manager -> enablePlugin ( $ plugin -> code , true ) ; break ; // Rebuilds plugin database migrations. case 'refresh' : $ savePlugin = false ; $ manager -> refreshPlugin ( $ plugin -> code ) ; break ; // Rollback and remove plugins from the system. case 'remove' : $ savePlugin = false ; $ manager -> deletePlugin ( $ plugin -> code ) ; break ; } if ( $ savePlugin ) { $ plugin -> save ( ) ; } } } Flash :: success ( Lang :: get ( "system::lang.plugins.{$bulkAction}_success" ) ) ; return $ this -> listRefresh ( 'manage' ) ; }
Perform a bulk action on the provided plugins
@return void
Perform a bulk action on the provided plugins