summaryrefslogtreecommitdiff
path: root/modules/gallery
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2011-01-16 15:49:34 -0800
committerBharat Mediratta <bharat@menalto.com>2011-01-16 16:58:58 -0800
commitac44e9c930ec83545b37e1e31381919fbd849d26 (patch)
treea3a31e2160e68e1685176466c7ba817558b79a9a /modules/gallery
parent0020f87d6a23ce00200074b678a9293d055e27a3 (diff)
First step in setting up version checking.
We now have two types of packages (release, git). Instead of using constants, we now have gallery::version_string() which returns the current version string. If you're on a release package, then the version string looks like: 3.0 (Santa Fe) If you're on a git package, then the version string looks like this: 3.0.1 (branch 3.0.x build 3) We track the build number in a new file in the gallery3 root called BUILD_NUMBER which we will update periodically with the latest build number for each branch.
Diffstat (limited to 'modules/gallery')
-rw-r--r--modules/gallery/helpers/gallery.php25
-rw-r--r--modules/gallery/helpers/gallery_theme.php2
-rw-r--r--modules/gallery/views/admin_block_stats.html.php2
3 files changed, 26 insertions, 3 deletions
diff --git a/modules/gallery/helpers/gallery.php b/modules/gallery/helpers/gallery.php
index 282289b5..c4a6286c 100644
--- a/modules/gallery/helpers/gallery.php
+++ b/modules/gallery/helpers/gallery.php
@@ -18,7 +18,10 @@
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class gallery_Core {
- const VERSION = "3.0+ (git)";
+ const VERSION = "3.0+";
+ const CODE_NAME = "";
+ const RELEASE_CHANNEL = "git";
+ const RELEASE_BRANCH = "master";
/**
* If Gallery is in maintenance mode, then force all non-admins to get routed to a "This site is
@@ -184,4 +187,24 @@ class gallery_Core {
}
putenv("PATH=" . implode(":", $path_env));
}
+
+ /**
+ * Return a string describing this version of Gallery and the type of release.
+ */
+ static function version_string() {
+ if (gallery::RELEASE_CHANNEL == "git") {
+ return sprintf(
+ "%s (branch %s build %s)", gallery::VERSION, gallery::RELEASE_BRANCH, gallery::build_number());
+ } else {
+ return sprintf("%s (%s)", gallery::VERSION, gallery::CODE_NAME);
+ }
+ }
+
+ /**
+ * Return the contents of the BUILD_NUMBER file, which should be a single integer.
+ */
+ static function build_number() {
+ $lines = file(DOCROOT . "BUILD_NUMBER", FILE_IGNORE_NEW_LINES);
+ return $lines[0];
+ }
} \ No newline at end of file
diff --git a/modules/gallery/helpers/gallery_theme.php b/modules/gallery/helpers/gallery_theme.php
index ebf8f38e..d75c6fc6 100644
--- a/modules/gallery/helpers/gallery_theme.php
+++ b/modules/gallery/helpers/gallery_theme.php
@@ -115,7 +115,7 @@ class gallery_theme_Core {
static function credits() {
$version_string = SafeString::of_safe_html(
- '<bdo dir="ltr">Gallery ' . gallery::VERSION . '</bdo>');
+ '<bdo dir="ltr">Gallery ' . gallery::version_string() . '</bdo>');
return "<li class=\"g-first\">" .
t(module::get_var("gallery", "credits"),
array("url" => "http://gallery.menalto.com",
diff --git a/modules/gallery/views/admin_block_stats.html.php b/modules/gallery/views/admin_block_stats.html.php
index 1dec8ccd..c8c54765 100644
--- a/modules/gallery/views/admin_block_stats.html.php
+++ b/modules/gallery/views/admin_block_stats.html.php
@@ -1,7 +1,7 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<ul>
<li>
- <?= t("Version: %version", array("version" => gallery::VERSION)) ?>
+ <?= t("Version: %version", array("version" => gallery::version_string())) ?>
</li>
<li>
<?= t("Albums: %count", array("count" => $album_count)) ?>