aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain d'Alverny <rda@mageia.org>2011-07-07 21:40:07 +0000
committerRomain d'Alverny <rda@mageia.org>2011-07-07 21:40:07 +0000
commit5efd52aacb14a2a2dd02e70f35edcc389f970ba1 (patch)
tree9dae9d0b28fe190b6e5bb7af1cdffcad3d6f8f2c
parent5a8ba0b6bfcb118c7585e3891604870811420148 (diff)
downloadwww-5efd52aacb14a2a2dd02e70f35edcc389f970ba1.tar
www-5efd52aacb14a2a2dd02e70f35edcc389f970ba1.tar.gz
www-5efd52aacb14a2a2dd02e70f35edcc389f970ba1.tar.bz2
www-5efd52aacb14a2a2dd02e70f35edcc389f970ba1.tar.xz
www-5efd52aacb14a2a2dd02e70f35edcc389f970ba1.zip
svn report script for continuous integration prototype
-rw-r--r--en/index.php28
-rw-r--r--rev.php72
2 files changed, 92 insertions, 8 deletions
diff --git a/en/index.php b/en/index.php
index bfa8e343e..e0003f7d2 100644
--- a/en/index.php
+++ b/en/index.php
@@ -44,24 +44,32 @@ $_t = i18n::get_strings($_t, $locale, $i18n_fallback_rules);
<div id="mgacount"><h2><a href="./1/"><?php echo $_t['mageia-is-here']; ?></a></h2></div>
<a href="./1/" title="Mageia 1"><img src="/g/1/screenshots/opt-mageia.jpg" alt="Mageia 1 Desktop" class="rel-desktop-home"></a>
<div id="bd" role="main">
- <div class="yui-g"><div class="para">
- <p><div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:facepile href="facebook.com/Mageia" width="200" max_rows="1"></fb:facepile>
- <a href="http://twitter.com/mageia_org" class="twitter-follow-button" data-lang="<?php echo $locale; ?>">Follow @mageia_org</a>
- <script src="http://platform.twitter.com/widgets.js" type="text/javascript"></script></p>
- </div></div>
-
- <div class="yui-g">
- <div class="para bb1" id="news">
+ <div class="yui-g bb1">
+ <div class="para" id="news">
<?php
include '../lib/news.php';
echo sprintf('<h2><a href="%s">%s</a></h2>', blog_link($locale), $_t['news']);
echo html_news($locale);
?>
</div>
+ </div>
+ <div class="yui-g">
<div class="para bb1"><p><?php echo $_t['about'][0]; ?></p>
<p><?php echo $_t['about'][1]; ?></p>
</div>
</div>
+ <div class="yui-gb">
+ <div class="yui-u first"><div class="para">
+ <script src="http://platform.twitter.com/widgets.js" type="text/javascript"></script></p>
+ <a href="http://twitter.com/mageia_org" class="twitter-follow-button" data-lang="<?php echo $locale; ?>">Follow @mageia_org</a>
+ </div></div>
+ <div class="yui-u"><div class="para">
+ <div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:facepile href="facebook.com/Mageia" width="200" max_rows="1"></fb:facepile>
+ </div></div>
+ <div class="yui-u"><div class="para">
+ <g:plusone href="http://mageia.org/"></g:plusone>
+ </div></div>
+ </div>
<?php /*
<div class="yui-g bb1">
<div class="yui-u first rb1">
@@ -102,5 +110,9 @@ $_t = i18n::get_strings($_t, $locale, $i18n_fallback_rules);
*/ ?>
</div>
</div>
+ <script type="text/javascript" src="https://apis.google.com/js/plusone.js">
+ {lang: '<?php echo $locale; ?>'}
+ </script>
+
</body>
</html>
diff --git a/rev.php b/rev.php
new file mode 100644
index 000000000..2b40a3cfb
--- /dev/null
+++ b/rev.php
@@ -0,0 +1,72 @@
+<?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'],
+ 'svn' => get_svn_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_svn_info($app_root)
+{
+ exec(escapeshellcmd(sprintf('LC_ALL=C %s info %s', exec('which svn'), escapeshellarg($app_root))),
+ $out, $ret);
+
+ $vars = array();
+ $keys = array(
+ 'URL',
+ 'Revision',
+ 'Last Changed Author',
+ 'Last Changed Rev',
+ 'Last Changed Date'
+ );
+ foreach ($out as $l) {
+ $l = explode(':', trim($l));
+ $k = trim(array_shift($l));
+ if (in_array($k, $keys))
+ $vars[strtolower(str_replace(' ', '_', $k))] = trim(implode(':', $l));
+ }
+
+ // remove scheme & user; keep it?
+ $u = $vars['url'];
+ $u = parse_url($u);
+ $vars['url'] = sprintf('%s%s', $u['host'], $u['path']);
+
+ return $vars;
+}