Archive the current on-disk plugin code.

@param \core\plugiinfo\base $plugin
@return bool
490654
public function archive_plugin_version(\core\plugininfo\base $plugin) {
        return $this->get_code_manager()->archive_plugin_version($plugin->rootdir, $plugin->component, $plugin->versiondisk);
    }
949762
public static function isPluginAvailable($plugin)
    {
        $plugin = ucfirst($plugin);
        $dirs = self::path(self::get('atomik.dirs.plugins'));
        if (self::findFile("$plugin.php", $dirs) === false) {
            return self::findFile($plugin, $dirs) !== false;
        }
        return true;
    }
1029910
public function listNewVersions($plugin)
    {
        $code = is_string($plugin) ? $plugin : $this->pluginManager->getIdentifier($plugin);

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

        $databaseVersion = $this->getDatabaseVersion($code);
        return $this->getNewFileVersions($code, $databaseVersion);
    }
636865
private static function find_slug_by_basename( $plugin_base_name ) {
            $file_slug_map = self::$_accounts->get_option( 'file_slug_map', array() );

            if ( ! array( $file_slug_map ) || ! isset( $file_slug_map[ $plugin_base_name ] ) ) {
                return false;
            }

            return $file_slug_map[ $plugin_base_name ];
        }
124206
protected function update_plugin_instance(assign_plugin $plugin, stdClass $formdata) {
        if ($plugin->is_visible()) {
            $enabledname = $plugin->get_subtype() . '_' . $plugin->get_type() . '_enabled';
            if (!empty($formdata->$enabledname)) {
                $plugin->enable();
                if (!$plugin->save_settings($formdata)) {
                    print_error($plugin->get_error());
                    return false;
                }
            } else {
                $plugin->disable();
            }
        }
        return true;
    }
590710
public static function is_mlbackend_used($plugin) {
        $models = self::get_all_models();
        foreach ($models as $model) {
            $processor = $model->get_predictions_processor();
            $noprefixnamespace = ltrim(get_class($processor), '\\');
            $processorplugin = substr($noprefixnamespace, 0, strpos($noprefixnamespace, '\\'));
            if ($processorplugin == $plugin) {
                return true;
            }
        }

        // Default predictions processor.
        $defaultprocessorclass = get_config('analytics', 'predictionsprocessor');
        $pluginclass = '\\' . $plugin . '\\processor';
        if ($pluginclass === $defaultprocessorclass) {
            return true;
        }

        return false;
    }
1294660
public function registerPlugin(string $plugin)
    {
        if (!in_array($plugin, $this->plugins)) {
            $this->plugins[] = $plugin;
        }

        return true;
    }
484900
protected function activatePlugin(string $plugin): void
    {
        require_once WPMU_PLUGIN_DIR.'/'.$plugin;

        do_action('activate_'.$plugin);

        $plugins = $this->getActivePlugins();
        $plugins[] = $plugin;

        $this->setActivePlugins($plugins);
    }
93556
private function savePlugin(string $handle, array $definition, array $pluginInfo): bool
    {
        if (!$pluginInfo['isInstalled']) {
            Craft::$app->plugins->installPlugin($handle);
        }
        if ($definition['isEnabled']) {
            Craft::$app->plugins->enablePlugin($handle);
        } else {
            Craft::$app->plugins->disablePlugin($handle);
        }
        $plugin = Craft::$app->plugins->getPlugin($handle);

        if ($plugin && $plugin->getSettings()) {
            return Craft::$app->plugins->savePluginSettings($plugin, $definition['settings']);
        }

        return false;
    }
388386
public static function getPlugin($plugin) {
        return self::cache(array(__METHOD__, $plugin), function() use ($plugin) {
            $path = null;

            if ($plugin !== Configure::read('Admin.coreName')) {
                if (!CakePlugin::loaded($plugin)) {
                    return null;
                }

                $path = CakePlugin::path($plugin);
            }

            return array(
                'title' => $plugin,
                'path' => $path,
                'slug' => Inflector::underscore($plugin),
                'models' => Admin::getPluginModels($plugin)
            );
        });
    }
535630
public function list_restorable_archives() {
        global $CFG;

        if (!empty($CFG->disableupdateautodeploy)) {
            return false;
        }

        $codeman = $this->get_code_manager();
        $restorable = array();
        foreach ($this->get_plugins() as $type => $plugins) {
            foreach ($plugins as $plugin) {
                if ($this->can_cancel_plugin_upgrade($plugin)) {
                    $restorable[$plugin->component] = (object)array(
                        'component' => $plugin->component,
                        'zipfilepath' => $codeman->get_archived_plugin_version($plugin->component, $plugin->versiondb)
                    );
                }
            }
        }

        return $restorable;
    }
725358
function get_plugin_basename() {
            if ( ! isset( $this->_plugin_basename ) ) {
                if ( $this->is_plugin() ) {
                    $this->_plugin_basename = plugin_basename( $this->_plugin_main_file_path );
                } else {
                    $this->_plugin_basename = basename( dirname( $this->_plugin_main_file_path ) );
                }
            }

            return $this->_plugin_basename;
        }
172581
public function className($plugin = true) {
		return (($plugin && !empty($this->plugin)) ? $this->plugin . '.' : '') . $this->name;
	}
216651
private function allData(BatchUpdateBasePlugin $plugin, Tree $tree): array
    {
        $tmp = [];

        foreach ($plugin->getRecordTypesToUpdate() as $type) {
            switch ($type) {
                case 'INDI':
                    $rows = DB::table('individuals')
                        ->where('i_file', '=', $tree->id())
                        ->select(['i_id AS xref', DB::raw("'INDI' AS type"), 'i_gedcom AS gedcom'])
                        ->get();

                    $tmp = array_merge($tmp, $rows->all());
                    break;

                case 'FAM':
                    $rows = DB::table('families')
                        ->where('f_file', '=', $tree->id())
                        ->select(['f_id AS xref', DB::raw("'FAM' AS type"), 'f_gedcom AS gedcom'])
                        ->get();

                    $tmp = array_merge($tmp, $rows->all());
                    break;

                case 'SOUR':
                    $rows = DB::table('sources')
                        ->where('s_file', '=', $tree->id())
                        ->select(['s_id AS xref', DB::raw("'SOUR' AS type"), 's_gedcom AS gedcom'])
                        ->get();

                    $tmp = array_merge($tmp, $rows->all());
                    break;

                case 'OBJE':
                    $rows = DB::table('media')
                        ->where('m_file', '=', $tree->id())
                        ->select(['m_id AS xref', DB::raw("'OBJE' AS type"), 'm_gedcom AS gedcom'])
                        ->get();

                    $tmp = array_merge($tmp, $rows->all());
                    break;

                default:
                    $rows = DB::table('other')
                        ->where('o_file', '=', $tree->id())
                        ->where('o_type', '=', $type)
                        ->select(['o_id AS xref', 'o_type AS type', 'o_gedcom AS gedcom'])
                        ->get();

                    $tmp = array_merge($tmp, $rows->all());
                    break;
            }
        }

        $data = [];

        foreach ($tmp as $value) {
            $data[$value->xref] = $value;
        }

        ksort($tmp);

        return $data;
    }
1101754
public static function loadPluginIfAvailable($plugin)
    {
        if (!self::isPluginLoaded($plugin) && self::isPluginAvailable($plugin)) {
            self::loadPlugin($plugin);
        }
    }
135749
public function isSaved(PluginBundleInterface $plugin)
    {
        if (null !== $this->pluginRepository->findOneByBundleFQCN(get_class($plugin))) {
            return true;
        }

        return false;
    }
1242763
protected function _getBasePath($plugin = false)
    {
        if ($plugin !== false) {
            return $this->_getPluginPath($plugin) . 'webroot' . DS;
        }

        return WWW_ROOT;
    }