public function install($id)
    {
        $plugin = $this->getById($id);
        if (!$plugin) {
            return ['code' => -1, 'message' => 'Plugin not found'];
        }

        if ($this->isInstalled($id)) {
            return ['code' => -2, 'message' => 'Plugin has been installed'];
        }

        $ret = $plugin->install();
        if ($ret['code'] !== 1) {
            return $ret;
        }

        $pluginIds = $this->getInstalledIds();
        $pluginIds[] = $id;
        $this->setInstalledIds($pluginIds);

        $this->getEvents(true);

        return $ret;
    }