mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-02 22:31:15 +00:00
38 lines
570 B
PHP
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;
|
|
}
|
|
}
|
|
|
|
?>
|