/** * Remove a group * * @param string $groupname * * @return bool True if the action was performed */ public static function remove($groupname) { $blueprints = new Blueprints('blueprints://'); $blueprint = $blueprints->get('user/group'); $groups = self::getGrav()['config']->get("groups"); unset($groups[$groupname]); self::getGrav()['config']->set("groups", $groups); $type = 'groups'; $obj = new Data(self::getGrav()['config']->get($type), $blueprint); $file = CompiledYamlFile::instance(self::getGrav()['locator']->findResource("config://{$type}.yaml")); $obj->file($file); $obj->save(); return true; }
/** * Toggle the gpm.releases setting */ protected function taskGpmRelease() { if (!$this->authorizeTask('configuration', ['admin.configuration', 'admin.super'])) { return false; } // Default release state $release = 'stable'; $reload = false; // Get the testing release value if set if ($this->post['release'] == 'testing') { $release = 'testing'; } $config = $this->grav['config']; $current_release = $config->get('system.gpm.releases'); // If the releases setting is different, save it in the system config if ($current_release != $release) { $data = new Data\Data($config->get('system')); $data->set('gpm.releases', $release); // Get the file location $file = CompiledYamlFile::instance($this->grav['locator']->findResource("config://system.yaml")); $data->file($file); // Save the configuration $data->save(); $config->reload(); $reload = true; } $this->admin->json_response = ['status' => 'success', 'reload' => $reload]; return true; }