wesnoth/utils/tests/include/SVNUpdater.php
2008-08-09 19:59:06 +00:00

38 lines
570 B
PHP

<?php
class SVNUpdater {
private $revision;
function __construct()
{
$this->updateSVN();
}
public function getRevision()
{
return $this->revision;
}
private function updateSVN()
{
$success = false;
$m = array();
$tries = 3;
while(!$success && $tries--)
{
$svnlog = shell_exec('svn up 2>&1');
global $db;
if ($db->debug)
echo $svnlog;
$success = preg_match('/At revision ([0-9]*)\./m', $svnlog, $m);
if (!$success)
sleep(5);
}
if ($success)
$this->revision = (int)$m[1];
else
$this->revision = false;
}
}
?>