From 14786d88c624bb00e19f2451e964bffb2e7bd8ea Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Wed, 24 Oct 2012 22:19:34 +0200 Subject: Part of #35: show paste owner --- src/phorkie/Repository.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/phorkie/Repository.php') diff --git a/src/phorkie/Repository.php b/src/phorkie/Repository.php index 0cc279b..ba3079a 100644 --- a/src/phorkie/Repository.php +++ b/src/phorkie/Repository.php @@ -235,6 +235,27 @@ class Repository file_put_contents($this->gitDir . '/description', $description); } + /** + * @return array Array with keys "email" and "name" + */ + public function getOwner() + { + try { + $name = $this->getVc()->getCommand('config') + ->addArgument('owner.name')->execute(); + } catch (\VersionControl_Git_Exception $e) { + $name = $GLOBALS['phorkie']['auth']['anonymousName']; + } + try { + $email = $this->getVc()->getCommand('config') + ->addArgument('owner.email')->execute(); + } catch (\VersionControl_Git_Exception $e) { + $email = $GLOBALS['phorkie']['auth']['anonymousEmail']; + } + + return array('name' => trim($name), 'email' => trim($email)); + } + /** * Get a link to the repository * -- cgit v1.2.3