24b44e3e56d8d945b1c78364d90a7a78479ace26

Author: gwoo

Date: 2009-08-18 08:33:49 -0700

updating return values in shells

diff --git a/vendors/shells/git_shell.php b/vendors/shells/git_shell.php index 8274b05..aaad6cf 100644 --- a/vendors/shells/git_shell.php +++ b/vendors/shells/git_shell.php @@ -31,7 +31,7 @@ class GitShellShell extends Shell { function main() { if (empty($this->params['user'])) { $this->err('User not found.'); - return 1; + return false; } $this->args[] = 'git_shell'; @@ -41,7 +41,7 @@ class GitShellShell extends Shell { if (!isset($this->actionMap[$command])) { $this->err('Command not found.'); - return 1; + return false; } $project = @$this->args[1]; @@ -57,7 +57,7 @@ class GitShellShell extends Shell { if ($this->Project->initialize(compact('project', 'fork')) === false || $this->Project->current['url'] !== $project) { $this->err('Invalid project'); - return 1; + return false; } if ($this->actionMap[$command] == 'r') { @@ -71,7 +71,7 @@ class GitShellShell extends Shell { if ($allowed !== true) { $this->err('Authorization failed'); - return 1; + return false; } $this->Project->permit($this->params['user']); diff --git a/vendors/shells/post_commit.php b/vendors/shells/post_commit.php index 1ce509d..7b5c16c 100644 --- a/vendors/shells/post_commit.php +++ b/vendors/shells/post_commit.php @@ -30,7 +30,7 @@ class PostCommitShell extends Shell { if ($this->Project->initialize(compact('project')) === false || $this->Project->current['url'] !== $project) { $this->err('Invalid project'); - return 1; + return false; } $revision = $this->args[2]; diff --git a/vendors/shells/post_receive.php b/vendors/shells/post_receive.php index ee58a20..018f85d 100644 --- a/vendors/shells/post_receive.php +++ b/vendors/shells/post_receive.php @@ -38,7 +38,7 @@ class PostReceiveShell extends Shell { if ($this->Project->initialize(compact('project', 'fork')) === false || $this->Project->current['url'] !== $project) { $this->err('Invalid project'); - return 1; + return false; } $user = $this->Project->User->field('id', array('username' => $_SERVER['PHP_CHAWUSER'])); diff --git a/vendors/shells/pre_commit.php b/vendors/shells/pre_commit.php index 8801fca..b0bcca2 100644 --- a/vendors/shells/pre_commit.php +++ b/vendors/shells/pre_commit.php @@ -37,7 +37,7 @@ class PreCommitShell extends Shell { if ($this->Project->initialize(compact('project')) === false) { $this->err('Invalid project'); - return 1; + return false; } $txn = explode('-', $this->args[2]); diff --git a/vendors/shells/pre_receive.php b/vendors/shells/pre_receive.php index f2e2da6..460249d 100644 --- a/vendors/shells/pre_receive.php +++ b/vendors/shells/pre_receive.php @@ -31,22 +31,22 @@ class PreReceiveShell extends Shell { $newrev = @$this->args[3]; $this->args[] = 'pre-receive'; - //$this->log($this->args, LOG_INFO); + $this->log($this->args, LOG_INFO); $fork = (!empty($this->params['fork']) && $this->params['fork'] != 1) ? $this->params['fork'] : null; if ($this->Project->initialize(compact('project', 'fork')) === false || $this->Project->current['url'] !== $project) { $this->err('Invalid project'); - return 1; + return false; } if (empty($_SERVER['PHP_CHAWUSER'])) { $this->err('User could not be found'); - return 1; + return false; } if ($_SERVER['PHP_CHAWUSER'] == 'chawbacca') { - return 0; + return true; } /* @@ -65,9 +65,9 @@ class PreReceiveShell extends Shell { 'access' => 'w', 'default' => false )); - + if ($allowed === true) { - return 0; + return true; } $master = $this->Permission->check('refs/heads/master', array( @@ -77,11 +77,11 @@ class PreReceiveShell extends Shell { 'default' => false )); if ($master === true) { - return 0; + return true; } $this->err('Authorization failed'); - return 1; + return false; } } \ No newline at end of file