svn: /web/doc-editor/trunk/php/ SvnClient.php

From: Date: Mon, 19 Apr 2010 03:43:37 +0000
Subject: svn: /web/doc-editor/trunk/php/ SvnClient.php
Groups: php.doc.web 
Request: Send a blank email to doc-web+get-1789@lists.php.net to get a copy of this message
mrkschan Mon, 19 Apr 2010 03:43:37 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=298154 Log: svn commit error will be returned, by redirecting stderr to stdout Changed paths: U web/doc-editor/trunk/php/SvnClient.php Modified: web/doc-editor/trunk/php/SvnClient.php =================================================================== --- web/doc-editor/trunk/php/SvnClient.php 2010-04-19 03:11:19 UTC (rev 298153) +++ web/doc-editor/trunk/php/SvnClient.php 2010-04-19 03:43:37 UTC (rev 298154) @@ -442,21 +442,25 @@ $cmd = 'cd '.$appConf[$project]['vcs.path'].'; svn add --non-recursive '.$path.'; svn ci --no-auth-cache --non-interactive -m "Add new folder from Php Docbook Online Editor" --username '.$vcsLogin.' --password '.$vcsPasswd.' '.$path; + $err = 1; $trial_threshold = 3; - while ($trial_threshold-- > 0) { - $output = array(); - exec($cmd, $output); - if (strlen(trim(implode('', $output))) != 0) break; + $output = array(); + for ($trial = 0; $err != 0 && $trial < $trial_threshold; ++$trial) { + array_push($output, "svn ci trial #$trial\n"); + exec("$cmd 2>&1", $output, $err); // if no err, err = 0 + if ($err == 0) array_push($output, "Success.\n"); } $commitLogMessage = array_merge($commitLogMessage, $output); } + if ($err == 0) { // We stock this info into DB - $value = array(); - $value['user'] = $vcsLogin; - $value['lang'] = $vcsLang; - $value['nbFolders'] = count($foldersPath); - RepositoryManager::getInstance()->setStaticValue('info', 'commitFolders', json_encode($value), true); + $value = array(); + $value['user'] = $vcsLogin; + $value['lang'] = $vcsLang; + $value['nbFolders'] = count($foldersPath); + RepositoryManager::getInstance()->setStaticValue('info', 'commitFolders', json_encode($value), true); + } return $commitLogMessage; } @@ -540,20 +544,24 @@ $cmd = 'cd '.$appConf[$project]['vcs.path'].'; ' .$cmd; + $err = 1; $trial_threshold = 3; - while ($trial_threshold-- > 0) { - $output = array(); - exec($cmd, $output); - if (strlen(trim(implode('', $output))) != 0) break; + $output = array(); + for ($trial = 0; $err != 0 && $trial < $trial_threshold; ++$trial) { + array_push($output, "svn ci trial #$trial\n"); + exec("$cmd 2>&1", $output, $err); // if no err, err = 0 + if ($err == 0) array_push($output, "Success.\n"); } // Delete tmp logMessage file $this->deleteCommitLogFile($pathLogFile); - // We stock this info into DB - $info['user'] = $vcsLogin; - $info['lang'] = $vcsLang; - RepositoryManager::getInstance()->setStaticValue('info', 'commitFiles', json_encode($info), true); + if ($err == 0) { + // We stock this info into DB + $info['user'] = $vcsLogin; + $info['lang'] = $vcsLang; + RepositoryManager::getInstance()->setStaticValue('info', 'commitFiles', json_encode($info), true); + } return $output; }

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