aboutsummaryrefslogtreecommitdiffstats
path: root/rev.php
diff options
context:
space:
mode:
authorThomas Backlund <tmb@mageia.org>2014-10-12 12:27:45 +0300
committerThomas Backlund <tmb@mageia.org>2014-10-12 12:27:45 +0300
commit9ce6d646ff718cd62f6434c9a4c94e450436612a (patch)
tree3ee82e5db7c0aee44a5573d9d17035c6ecac697d /rev.php
parenta0b2d09125d7911656fe4cb286f20643c4432281 (diff)
downloadwww-9ce6d646ff718cd62f6434c9a4c94e450436612a.tar
www-9ce6d646ff718cd62f6434c9a4c94e450436612a.tar.gz
www-9ce6d646ff718cd62f6434c9a4c94e450436612a.tar.bz2
www-9ce6d646ff718cd62f6434c9a4c94e450436612a.tar.xz
www-9ce6d646ff718cd62f6434c9a4c94e450436612a.zip
Revert "Updated Estonian translation"
Diffstat (limited to 'rev.php')
-rw-r--r--rev.php53
1 files changed, 53 insertions, 0 deletions
diff --git a/rev.php b/rev.php
new file mode 100644
index 000000000..00b9a6d7c
--- /dev/null
+++ b/rev.php
@@ -0,0 +1,53 @@
+<?php
+/**
+ * Place this at the public root of your system and adapt $app_root
+ * so it relates to the app branch root.
+ *
+ * Used for a continuous integration prototype, on various hosts.
+ *
+ * PHP version 5
+ *
+ * @license BSD-2-Clause
+ * @author Romain d'Alverny <rda at mageia.org>
+*/
+
+$app_root = __DIR__;
+
+$vars = array(
+ 'app' => $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'],
+ 'git' => get_git_info($app_root),
+ 'status' => get_status($app_root),
+);
+
+header('Content-Type: application/json; charset=utf-8');
+echo json_encode($vars);
+
+//---
+
+/**
+ * TODO Return app status (tests, config, other?)
+ *
+ * @param string $app_root
+ *
+ * @return string
+*/
+function get_status($app_root)
+{
+ return 'OK';
+}
+
+/**
+ * Return basic Subversion status info. See $keys array.
+ *
+ * @param string $app_root
+ *
+ * @return array
+*/
+function get_git_info($app_root)
+{
+ exec(escapeshellcmd(sprintf('LC_ALL=C %s show %s %s', exec('which git'), '-s --pretty="Revision: %H%nLast Author: %an%nDate Revision: %ar%nTitle: %s"', escapeshellarg($app_root))),
+ $out, $ret);
+
+
+ return $out;
+}