svn: /web/doc-editor/trunk/ php/RepositoryManager.php scripts/cron/check_build.php

From: Date: Wed, 09 Dec 2009 22:34:09 +0000
Subject: svn: /web/doc-editor/trunk/ php/RepositoryManager.php scripts/cron/check_build.php
Groups: php.doc.web 
Request: Send a blank email to doc-web+get-1293@lists.php.net to get a copy of this message
yannick Wed, 09 Dec 2009 22:34:09 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=291935 Log: CleanUp the DB before checkBuild's cron Changed paths: U web/doc-editor/trunk/php/RepositoryManager.php U web/doc-editor/trunk/scripts/cron/check_build.php Modified: web/doc-editor/trunk/php/RepositoryManager.php =================================================================== --- web/doc-editor/trunk/php/RepositoryManager.php 2009-12-09 22:26:56 UTC (rev 291934) +++ web/doc-editor/trunk/php/RepositoryManager.php 2009-12-09 22:34:09 UTC (rev 291935) @@ -64,6 +64,17 @@ } /** + * CleanUp the dataBase before check the build. + * We only stock in DB the last status for one language. + * + * @see checkBuild + */ + public function cleanUpBeforeCheckBuild() + { + DBConnection::getInstance()->query("TRUNCATE TABLE buildLog"); + } + + /** * Update the repository to sync our local copy. * As this exec command take some time, we start by creating a lock file, then run the command, then delete this lock file. * As it, we can test if this command has finish, or not. @@ -161,7 +172,7 @@ * @param $files An array of File instances. */ public function delPendingCommit($files) - { + { for ($i = 0; $i < count($files); $i++) { $query = sprintf('DELETE FROM pendingCommit @@ -170,7 +181,7 @@ path = "%s" AND name = "%s"', $files[$i]->lang, $files[$i]->path, $files[$i]->name - ); + ); DBConnection::getInstance()->query($query); } } @@ -265,12 +276,12 @@ '/(A )/', '/(D )/', '/(property )/', - '/( set on )/' + '/( set on )/' /* '/(bailing)/', '/(Mailing the commit email to)/', '/(Logging in to)/', - '/(new revision)/' + '/(new revision)/' */ ); return preg_replace( @@ -502,10 +513,10 @@ DBConnection::getInstance()->query($s); } else { // lang file - - $en = new File('en', $file->path, $file->name); - $enInfo = $en->getInfo(); + $en = new File('en', $file->path, $file->name); + $enInfo = $en->getInfo(); + $sizeEN = intval(filesize($en->full_path) / 1024); $dateEN = filemtime($en->full_path); @@ -544,7 +555,7 @@ * and put it into database. */ public function updateTranslatorInfo() - { + { foreach ($this->availableLang as $lang) { @@ -591,7 +602,7 @@ DBConnection::getInstance()->real_escape_string($person['email']), DBConnection::getInstance()->real_escape_string($person['vcs']), DBConnection::getInstance()->real_escape_string($person['editor']) - ); + ); DBConnection::getInstance()->query($query); } @@ -648,7 +659,7 @@ if ($dh = @opendir(DOC_EDITOR_VCS_PATH.$lang.$path)) { $dirs = array(); - $files = array(); + $files = array(); while (($name = readdir($dh)) !== false) { $file = new File($lang, $path, $name); @@ -673,7 +684,7 @@ 'INSERT INTO files (lang, path, name, status) VALUES ("%s", "%s", "%s", "%s")', $lang, $f->path, $f->name, 'NotInEN' - ); + ); DBConnection::getInstance()->query($query); } } @@ -742,7 +753,7 @@ $ToolsCheckDocResult['check_noparameters'], $ToolsCheckDocResult['check_noexamples'], $ToolsCheckDocResult['check_noerrors'] - ); + ); DBConnection::getInstance()->query($query); foreach($this->availableLang as $lang) { @@ -773,7 +784,7 @@ $size, $size_diff, $date, $date_diff, $maintainer, $status ); - DBConnection::getInstance()->query($query); + DBConnection::getInstance()->query($query); // Check for error in this file ONLY if this file is uptodate if ($revision == $en_revision ) { @@ -790,7 +801,7 @@ 'INSERT INTO files (lang, path, name) VALUES ("%s", "%s", "%s")', $lang, $lang_file->path, $lang_file->name - ); + ); DBConnection::getInstance()->query($query); } } @@ -810,7 +821,7 @@ * @return Nothing. */ public function delFiles($files) - { + { for ($i = 0; $i < count($files); $i++) { $query = sprintf('DELETE FROM files @@ -819,7 +830,7 @@ path = "%s" AND name = "%s"', $files[$i]->lang, $files[$i]->path, $files[$i]->name - ); + ); DBConnection::getInstance()->query($query); } } Modified: web/doc-editor/trunk/scripts/cron/check_build.php =================================================================== --- web/doc-editor/trunk/scripts/cron/check_build.php 2009-12-09 22:26:56 UTC (rev 291934) +++ web/doc-editor/trunk/scripts/cron/check_build.php 2009-12-09 22:34:09 UTC (rev 291935) @@ -12,6 +12,9 @@ require_once dirname(__FILE__) . '/../../php/LogManager.php'; require_once dirname(__FILE__) . '/../../php/RepositoryManager.php'; +// We cleanUp the DB before this process +RepositoryManager::getInstance()->cleanUpBeforeCheckBuild(); + // For all language, we check the build foreach (RepositoryManager::getInstance()->availableLang as $lang) {

« previous php.doc.web (#1293) next »