diff options
Diffstat (limited to 'class.portage.ebuild.php')
-rw-r--r-- | class.portage.ebuild.php | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/class.portage.ebuild.php b/class.portage.ebuild.php index 3f3bfb5..188263a 100644 --- a/class.portage.ebuild.php +++ b/class.portage.ebuild.php @@ -48,6 +48,7 @@ private $dir; private $filename; private $filename_cache; + private $filesize; private $source; private $portage; private $cache; @@ -69,7 +70,7 @@ private $cache_mtime; // hash sums - private $sha1sum; + private $hash; @@ -175,12 +176,16 @@ return $this->filename; break; + case 'filesize': + return $this->getFilesize(); + break; + case 'source': return $this->source = file_get_contents($this->filename); break; - case 'sha1sum': - return $this->sha1sum = $this->getSha1Sum(); + case 'hash': + return $this->hash = $this->getHash(); break; } @@ -455,15 +460,24 @@ } - function getSha1Sum() { + function getHash() { - require_once 'class.portage.package.manifest.php'; + if(!$this->hash) { + $contents = file_get_contents($this->filename); + $this->hash = sha1($contents); + } + + return $this->hash; - $manifest = new PackageManifest($this->manifest_filename); + } + + public function getFilesize() { - $str = $manifest->getFilenameSha1Sum($this->basename); + if(!$this->filesize) { + $this->filesize = filesize($this->filename); + } - return $str; + return $this->filesize; } @@ -528,7 +542,7 @@ } - function getMtime() { + public function getMtime() { if(file_exists($this->filename)) return filemtime($this->filename); |