/** * Remove a specific publick key * @return void */ function remove_key() { $get_data = $this->request->get(); if (isset($get_data['key_id'])) { $key_id = $get_data['key_id']; $filename = GitoliteAc::get_filename($key_id); if ($filename != "") { $delete_keys = GitoliteAc::remove_keys($key_id); if (!$delete_keys) { throw new Exception("Can't delete key"); } else { $settings = GitoliteAdmin::get_admin_settings(); $dirpath = $settings['gitoliteadminpath'] . "gitolite-admin/keydir/"; $path = $dirpath . $filename . ".pub"; @unlink($path); $active_user = $this->active_user; ProjectGitolite::update_repo_conf_on_public_key($active_user->getId()); $command = "cd " . $dirpath . " && git add * && git commit -am 'deleted key {$filename}.pub' && git push || echo 'Not found'"; exec($command, $output); } } } echo '<script type="text/javascript">window.location.href = "' . $this->active_user->getViewUrl() . '"</script>'; die(0); }