aboutsummaryrefslogtreecommitdiff
path: root/src/Phorkie/Repository.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/Phorkie/Repository.php')
-rw-r--r--src/Phorkie/Repository.php14
1 files changed, 14 insertions, 0 deletions
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);