summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Dibb <beandog@gentoo.org>2009-12-15 20:49:23 +0000
committerSteve Dibb <beandog@gentoo.org>2009-12-15 20:49:23 +0000
commit02b91d354e1b212418d8c512592d34e723b6126a (patch)
tree887d9abffba7b826696820d3d91bcc0df15a60d0 /class.portage.package.changelog.php
parentinitial commit (diff)
downloadznurt-org-backend-02b91d354e1b212418d8c512592d34e723b6126a.tar.gz
znurt-org-backend-02b91d354e1b212418d8c512592d34e723b6126a.tar.bz2
znurt-org-backend-02b91d354e1b212418d8c512592d34e723b6126a.zip
git-svn-id: file:///var/svn/portage@2 3218660a-b0cf-4799-a991-8ddcc5b9e0f3
Diffstat (limited to 'class.portage.package.changelog.php')
-rw-r--r--class.portage.package.changelog.php65
1 files changed, 65 insertions, 0 deletions
diff --git a/class.portage.package.changelog.php b/class.portage.package.changelog.php
new file mode 100644
index 0000000..bdadbb5
--- /dev/null
+++ b/class.portage.package.changelog.php
@@ -0,0 +1,65 @@
+<?
+
+ class PackageChangelog {
+
+ private $recent_changes;
+ public $recent_date;
+
+ function __construct($str, $date = null) {
+
+ $this->changelog = $str;
+
+ if(!is_null($date))
+ $this->date = $date;
+
+ }
+
+
+ function getRecentChanges() {
+
+ $pattern_date = "/^\d{1,2}\s\w{3}\s\d{4}/";
+// $pattern_dev = "/<\w+@gentoo\.org>/";
+
+ $arr = explode("\n", $this->changelog);
+// print_r($arr);
+
+ // Cut off the header
+ $arr = array_slice($arr, 4);
+
+ // Get the date of the latest changes
+ $str = trim($arr[0]);
+
+ preg_match_all($pattern_date, $str, $matches);
+ $this->recent_date = $date = current(current($matches));
+
+ $start = false;
+
+ $recent_changes = "";
+
+ foreach($arr as $str) {
+
+ $first_char = substr($str, 0, 1);
+ $last_char = substr($str, -1, 1);
+
+ if(($first_char == "*" || empty($str)) && $start) {
+ break;
+ }
+
+ if($start) {
+ $recent_changes .= " ".trim($str);
+ }
+
+ if($last_char == ":") {
+ $start = true;
+ }
+
+ }
+
+ return $recent_changes;
+
+ }
+
+
+ }
+
+?> \ No newline at end of file