Modified: web/php-rmtools/trunk/include/Storage.php =================================================================== --- web/php-rmtools/trunk/include/Storage.php 2010-11-16 09:23:00 UTC (rev 305405) +++ web/php-rmtools/trunk/include/Storage.php 2010-11-16 11:42:26 UTC (rev 305406) @@ -42,7 +42,7 @@ release VARCHAR(32), date VARCHAR(32), author VARCHAR(80), - msg VARCHAR(255), + msg TEXT, status integer, comment TEXT, news TEXT)')) { @@ -57,7 +57,7 @@ } $svn = new Svn; - $dev_last_revision = $svn->update($this->dev_branch); + $dev_last_revision = $svn->update($this->dev_branch, $this->status == Base::STATUS_SNAP_ONLY); if ($this->dev_branch != $this->release_branch) { $release_last_revision = $svn->update($this->release_branch); $status = 0; @@ -75,40 +75,40 @@ $this->base->setLastUpdateForRelease($this->release['name'], $this->release['release_last_update']); return TRUE; } + if ($status == 0) { + $log_xml = $svn->fetchLogFromBranch($this->dev_branch, $this->dev_first_revision); - $log_xml = $svn->fetchLogFromBranch($this->dev_branch, $this->dev_first_revision); + if (!$log_xml) { + return FALSE; + } - if (!$log_xml) { - return FALSE; - } + foreach ($log_xml->logentry as $v) { + $msg = (string) $v->msg; + $msg = substr(substr($msg, 0, strpos($msg . "\n", "\n")), 0, 80); + $rev = (string) $v['revision']; + $author = (string) $v->author; + $date = (string) $v->date; - foreach ($log_xml->logentry as $v) { - $msg = (string) $v->msg; - $msg = substr(substr($msg, 0, strpos($msg . "\n", "\n")), 0, 80); - $rev = (string) $v['revision']; - $author = (string) $v->author; - $date = (string) $v->date; + $res = sqlite_query($this->db, "SELECT status FROM revision WHERE revision='" . $rev . "'"); - $res = sqlite_query($this->db, "SELECT status FROM revision WHERE revision='" . $rev . "'"); - - if ($res && sqlite_num_rows($res) > 0) { - $row = sqlite_fetch_array($res); - if ($row) { - $res = sqlite_query($this->db, "UPDATE revision SET " . - "status=" . $row['status'] . " WHERE revision='" . sqlite_escape_string($rev) . "'"); - if (!$res) { - Throw new \Exception('Update query failed for ' . $rev); + if ($res && sqlite_num_rows($res) > 0) { + $row = sqlite_fetch_array($res); + if ($row) { + $res = sqlite_query($this->db, "UPDATE revision SET " . + "status=" . $row['status'] . " WHERE revision='" . sqlite_escape_string($rev) . "'"); + if (!$res) { + Throw new \Exception('Update query failed for ' . $rev); + } } - } - } else { - $res = sqlite_query($this->db, "INSERT INTO revision (revision, release, date, author, status, msg, comment, news) - VALUES('$rev' , '" . $this->release['name'] . "','" . $date . "','" . $author . "', $status, '" . sqlite_escape_string($msg) . "', '', '');"); + } else { + $res = sqlite_query($this->db, "INSERT INTO revision (revision, release, date, author, status, msg, comment, news) + VALUES('$rev' , '" . $this->release['name'] . "','" . $date . "','" . $author . "', $status, '" . sqlite_escape_string($msg) . "', '', '');"); if (!$res) { Throw new \Exception('Insert query failed for ' . $rev); } + } } } - $this->release['dev_last_revision'] = $dev_last_revision; $this->release['release_last_revision'] = ($this->dev_branch == $this->release_branch) ? $dev_last_revision : $release_last_revision; @@ -129,7 +129,9 @@ throw new \Exception('Snap dir does not exist and cannot be created: ' . SNAPS_PATH); } } - $filename = SNAPS_PATH . '/php-' . $this->release['name'] . '-src-' . date("YmdHi", $time) . '.zip'; +// $filename = SNAPS_PATH . '/php-' . $this->release['name'] . '-src-' . date("YmdHi", $time) . '.zip'; + $filename = SNAPS_PATH . '/php-' . $this->release['name'] . '-src-r' . $this->release['release_last_revision'] . '.zip'; + } $snaps_archive_name = $filename; @@ -177,18 +179,11 @@ } function getAll() { - if ($this->release['dev_last_active_revision'] > 0) { - $sql = "SELECT * FROM revision WHERE release='" . $this->release['name'] . "' AND revision < " . $this->release['dev_last_active_revision'] . " ORDER by revision"; - } else { - $sql = "SELECT * FROM revision WHERE release='" . $this->release['name'] . "' ORDER by revision"; - } - $res = sqlite_query($this->db, $sql, SQLITE_ASSOC); + $res = sqlite_query($this->db, "SELECT * FROM revision WHERE release='" . $this->release['name'] . "' AND revision < " . $this->release['dev_last_active_revision'] . " ORDER by revision", SQLITE_ASSOC); - if ($res && sqlite_num_rows($res) > 0) { return sqlite_fetch_all($res); } - return NULL; } Modified: web/php-rmtools/trunk/include/Svn.php =================================================================== --- web/php-rmtools/trunk/include/Svn.php 2010-11-16 09:23:00 UTC (rev 305405) +++ web/php-rmtools/trunk/include/Svn.php 2010-11-16 11:42:26 UTC (rev 305406) @@ -24,7 +24,7 @@ $log_xml = stream_get_contents($pipes[1]); fclose($pipes[1]); proc_close($process); - +file_put_contents('/home/pierre/t.xml', $log_xml); $sx = new \SimpleXMLElement($log_xml); if (!$sx) { throw new \Exception('svn log failed ' . $path); @@ -32,7 +32,7 @@ return $sx; } - function update($branch) { + function update($branch, $nolog = false) { if (!static::isValidBranch($branch)) { throw new \Exception('Invalid branch name ' . $branch); return FALSE; @@ -44,28 +44,29 @@ ); $cmd = "svn update"; + if ($branch != 'trunk') { + $path = SVN_REPO_PATH . '/php-src/branches/' . $branch; + } else { + $path = SVN_REPO_PATH . '/php-src/trunk'; + } - $path = SVN_REPO_PATH . '/php-src/branches/' . $branch; - $process = proc_open($cmd, $descriptorspec, $pipes, $path); $out = stream_get_contents($pipes[1]); $revision = (int)str_replace('At revision ', '', $out); fclose($pipes[1]); proc_close($process); - $cmd = 'svn info --xml ' . $path; $process = proc_open($cmd, $descriptorspec, $pipes, $path); $out = stream_get_contents($pipes[1]); $revision = (int)str_replace('At revision ', '', $out); fclose($pipes[1]); proc_close($process); - $sx = new \SimpleXMLElement($out); if (!$sx) { throw new \Exception('svn log failed ' . $path); } - +var_dump($sx->entry[0]->commit['revision']); $revision = (int)$sx->entry[0]->commit['revision']; if (!$revision) { throw new \Exception('svn log failed, invalid revision ' . $revision . ' in ' . $path); Modified: web/php-rmtools/trunk/include/config.php =================================================================== --- web/php-rmtools/trunk/include/config.php 2010-11-16 09:23:00 UTC (rev 305405) +++ web/php-rmtools/trunk/include/config.php 2010-11-16 11:42:26 UTC (rev 305406) @@ -10,16 +10,10 @@ } define('MASTER_AUTH_TOKEN', getenv('MASTER_AUTH_TOKEN')); -define('SNAPS_BASEURL', 'http://rmtools.php.net/snaps/'); -define('REST_BASEURL', 'http://rmtools.php.net/json/'); define('SVN_REPO_PATH', $rmtools_base . '/repos/php'); define('SVN_REPO_URL', 'http://svn.php.net/repository/php/php-src'); - define('DB_PATH', $rmtools_base . '/data'); define('TPL_PATH', $rmtools_base . '/template'); define('WWW_ROOT', $rmtools_base . '/docroot'); define('SNAPS_PATH', WWW_ROOT . '/snaps'); define('TMP_DIR', $rmtools_base . '/tmp'); - -define('SNAPS_LOCAL_PATH', '/home/web/rmtools.php.net/public_html/snaps'); - Modified: web/php-rmtools/trunk/script/snapshot.php =================================================================== --- web/php-rmtools/trunk/script/snapshot.php 2010-11-16 09:23:00 UTC (rev 305405) +++ web/php-rmtools/trunk/script/snapshot.php 2010-11-16 11:42:26 UTC (rev 305406) @@ -13,8 +13,9 @@ } $release = filter_var($argv[1], FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW|FILTER_FLAG_STRIP_HIGH); +$force = isset($argv[2]) && $argv[2] == 'force' ? true : false; -if ($argc == 3) { +if (!$force && $argc == 3) { $filename = filter_var($argv[2], FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW|FILTER_FLAG_STRIP_HIGH); } else { $filename = FALSE; @@ -32,7 +33,7 @@ $releases = $base->getAllReleases(); foreach ($releases as $release) { $svn = new rm\Storage($release); - $svn->createSnapshot($filename); + $svn->createSnapshot($filename, $force); } } catch (Exception $e) { echo 'An error occured: ', $e->getMessage(), "\n"; @@ -40,7 +41,7 @@ } else { try { $svn = new rm\Storage($release); - $filename = $svn->createSnapshot($filename); + $filename = $svn->createSnapshot($filename, $force); } catch (Exception $e) { echo 'An error occured: ', $e->getMessage(), "\n"; } Modified: web/php-rmtools/trunk/script/updaterepo.sh =================================================================== --- web/php-rmtools/trunk/script/updaterepo.sh 2010-11-16 09:23:00 UTC (rev 305405) +++ web/php-rmtools/trunk/script/updaterepo.sh 2010-11-16 11:42:26 UTC (rev 305406) @@ -1,3 +1,3 @@ -php /home/web/rmtools.php.net/script/updaterelease.php all -php /home/web/rmtools.php.net/script/snapshot.php all +/usr/local/bin/php /home/web/rmtools.php.net/script/updaterelease.php all +/usr/local/bin/php /home/web/rmtools.php.net/script/snapshot.php all rm -rf /tmp/rmtools* Modified: web/php-rmtools/trunk/script/updatesite.sh =================================================================== --- web/php-rmtools/trunk/script/updatesite.sh 2010-11-16 09:23:00 UTC (rev 305405) +++ web/php-rmtools/trunk/script/updatesite.sh 2010-11-16 11:42:26 UTC (rev 305406) @@ -1 +1 @@ -php /home/web/rmtools.php.net/script/updateusersite.php +/usr/local/bin/php /home/web/rmtools.php.net/script/updateusersite.php Modified: web/php-rmtools/trunk/script/updateusersite.php =================================================================== --- web/php-rmtools/trunk/script/updateusersite.php 2010-11-16 09:23:00 UTC (rev 305405) +++ web/php-rmtools/trunk/script/updateusersite.php 2010-11-16 11:42:26 UTC (rev 305406) @@ -42,7 +42,7 @@ unlink($latest_link); } - $snaps = glob(SNAPS_PATH . "/*$release_name*"); + $snaps = glob(SNAPS_PATH . "/php-$release_name*"); if (empty($snaps)) { continue;