[pLog-svn] r6542 - plog/branches/lifetype-1.2/templates/LifeType
oscar at devel.lifetype.net
oscar at devel.lifetype.net
Fri Jun 13 16:41:07 EDT 2008
Author: oscar
Date: 2008-06-13 16:41:07 -0400 (Fri, 13 Jun 2008)
New Revision: 6542
Added:
plog/branches/lifetype-1.2/templates/LifeType/svnupdate.php
Log:
update script for translation guys
Added: plog/branches/lifetype-1.2/templates/LifeType/svnupdate.php
===================================================================
--- plog/branches/lifetype-1.2/templates/LifeType/svnupdate.php (rev 0)
+++ plog/branches/lifetype-1.2/templates/LifeType/svnupdate.php 2008-06-13 20:41:07 UTC (rev 6542)
@@ -0,0 +1,97 @@
+<?php
+
+umask(022);
+
+$dirs[] = "/home/lifetype/www/templates/LifeType/";
+
+
+// did someone hit the update button?
+if(isset($_POST["update"])){
+ $locallyModified = checkSvnStatus(false, true, $dirs);
+ if(!$locallyModified){
+ print "You might know what you are doing, but I'll assume you don't
+ and take the safe route and not do anything since there are
+ locally modified files.<br/><br/><br/>";
+ }
+ else{
+ svnUpdate(true, $dirs);
+ }
+
+}
+
+$check = checkSvnStatus(true, false, $dirs);
+
+if($check){
+ print "Everything is up to date<br/>";
+}
+else{
+ print "<form action='svnupdate.php' method='POST'>
+ <input type='submit' name='update' value='Update'></form>";
+}
+
+
+function svnUpdate($print, $dirs){
+ $success = true;
+
+ if($print){
+ print "Updating...<br/>";
+ }
+ foreach($dirs as $dir){
+ $cmd = "svn up $dir";
+ if($print)
+ print "$dir<br/>";
+ unset($output); unset($ret);
+ exec($cmd, $output, $ret);
+ if($ret){
+ if($print){
+ print "Error: $ret!";
+ }
+ $success = false;
+ }
+ if(count($output) == 0)
+ $success = false;
+ if($print){
+ foreach($output as $line){
+ print $line."<br/>";
+ }
+ print "<br/>";
+ }
+ }
+ return $success;
+}
+
+function checkSvnStatus($print, $localOnly, $dirs){
+ $success = true;
+
+ $cmd = "svn status";
+ if(!$localOnly)
+ $cmd .= " -u";
+
+ foreach($dirs as $dir){
+ if($print)
+ print "$dir<br/>";
+ unset($output);
+ exec($cmd." ".$dir, $output, $ret);
+ if($ret){
+ if($print){
+ print "Error: $ret!";
+ }
+ $success = false;
+ }
+ if(count($output) != ($localOnly ? 0 : 1))
+ $success = false;
+ if($print){
+ print "<pre>";
+ foreach($output as $line){
+ print $line."\n";
+ }
+ print "</pre>";
+ print "<br/>";
+ }
+ }
+ return $success;
+}
+
+
+?>
+
More information about the pLog-svn
mailing list