Moosh\Command\Generic\Plugin\PluginInstall::get_install_path PHP Method

get_install_path() private method

Get the relative path for a plugin given it's type
private get_install_path ( string $type ) : string
$type string The plugin type (example: 'auth', 'block')
return string The installation path relative to dirroot (example: 'auth', 'blocks', 'course/format')
    private function get_install_path($type)
    {
        global $CFG;
        if ($this->moodlerelease >= 2.6) {
            $types = \core_component::get_plugin_types();
        } else {
            if ($this->moodlerelease >= 2.0) {
                $types = get_plugin_types();
            } else {
                // Moodle 1.9 does not give us a way to determine plugin
                // installation paths.
                $types = array();
            }
        }
        if (empty($types) || !array_key_exists($type, $types)) {
            // Either the moodle version is lower than 2.0, in which case we
            // don't have a reliable way of determining the install path, or the
            // plugin is of an unknown type.
            //
            // Let's fall back to make our best guess.
            return $CFG->dirroot . '/' . $type;
        }
        return $types[$type];
    }