From 4d3b1690a86631b4b1abc74dfa4c4e5bde8faf10 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Tue, 27 Mar 2012 07:50:58 +0200 Subject: listing all pastes works --- src/Phorkie/Repository.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/Phorkie/Repository.php') diff --git a/src/Phorkie/Repository.php b/src/Phorkie/Repository.php index f23db7e..aeccc72 100644 --- a/src/Phorkie/Repository.php +++ b/src/Phorkie/Repository.php @@ -42,6 +42,20 @@ class Repository $this->repoDir = $repoDir; } + public function loadById($id) + { + if (!is_numeric($id)) { + throw new Exception_Input('Paste ID not numeric'); + } + $this->id = (int)$id; + + $repoDir = $GLOBALS['phorkie']['cfg']['repos'] . '/' . $this->id; + if (!is_dir($repoDir)) { + throw new Exception_NotFound('Paste not found'); + } + $this->repoDir = $repoDir; + } + public function getVc() { return new \VersionControl_Git($this->repoDir); -- cgit v1.2.3