aboutsummaryrefslogtreecommitdiff
path: root/src/Phorkie/Repository.php
diff options
context:
space:
mode:
authorChristian Weiske <cweiske@cweiske.de>2012-03-28 17:24:44 +0200
committerChristian Weiske <cweiske@cweiske.de>2012-03-28 17:24:44 +0200
commitcec8f61ab84122a3f4b0702aaad6f7a141f99f7b (patch)
tree829ccddf19eaf25ebf918632228eb96088b250d4 /src/Phorkie/Repository.php
parent2f7659becb40e457872fc45f59ad81bff439722f (diff)
downloadphorkie-cec8f61ab84122a3f4b0702aaad6f7a141f99f7b.tar.gz
phorkie-cec8f61ab84122a3f4b0702aaad6f7a141f99f7b.zip
editing works basically
Diffstat (limited to 'src/Phorkie/Repository.php')
-rw-r--r--src/Phorkie/Repository.php18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/Phorkie/Repository.php b/src/Phorkie/Repository.php
index aeccc72..5273b60 100644
--- a/src/Phorkie/Repository.php
+++ b/src/Phorkie/Repository.php
@@ -82,6 +82,9 @@ class Repository
if ($base != $name) {
throw new Exception('No directories supported for now');
}
+ if ($name == '') {
+ throw new Exception_Input('Empty file name given');
+ }
$path = $this->repoDir . '/' . $base;
if (!is_readable($path)) {
throw new Exception_Input('File does not exist');
@@ -89,6 +92,16 @@ class Repository
return new File($path, $this);
}
+ public function hasFile($name)
+ {
+ try {
+ $this->getFileByName($name);
+ } catch (Exception $e) {
+ return false;
+ }
+ return true;
+ }
+
public function getDescription()
{
if (!is_readable($this->repoDir . '/.git/description')) {
@@ -97,6 +110,11 @@ class Repository
return file_get_contents($this->repoDir . '/.git/description');
}
+ public function setDescription($description)
+ {
+ file_put_contents($this->repoDir . '/.git/description', $description);
+ }
+
/**
* Get a link to the repository
*