cvs: php4 /pear/Schedule At.php

From: Date: Sun, 31 Mar 2002 03:38:13 +0000
Subject: cvs: php4 /pear/Schedule At.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-2924@lists.php.net to get a copy of this message
ssb Sat Mar 30 22:38:13 2002 EDT Modified files: /php4/pear/Schedule At.php Log: * updated error handling Index: php4/pear/Schedule/At.php diff -u php4/pear/Schedule/At.php:1.6 php4/pear/Schedule/At.php:1.7 --- php4/pear/Schedule/At.php:1.6 Thu Feb 28 03:27:17 2002 +++ php4/pear/Schedule/At.php Sat Mar 30 22:38:13 2002 @@ -16,7 +16,7 @@ // | Author: Colin Viebrock <colin@easydns.com> | // +----------------------------------------------------------------------+ // -// $Id: At.php,v 1.6 2002/02/28 08:27:17 sebastian Exp $ +// $Id: At.php,v 1.7 2002/03/31 03:38:13 ssb Exp $ // // Interface to the UNIX "at" program @@ -85,8 +85,7 @@ $this->_reset(); if ($queue && !preg_match('/^[a-zA-Z]{1,1}$/', $queue) ) { - $this->error = new Schedule_At_Error('Invalid queue specification'); - return $this->error; + return $this->raiseError('Invalid queue specification'); } $cmd = escapeShellCmd($cmd); @@ -102,8 +101,7 @@ $result = $this->_doexec($exec); if (preg_match('/garbled time/i', $result) ) { - $this->error = new Schedule_At_Error('Garbled time'); - return $this->error; + return $this->raiseError('Garbled time'); } if (preg_match('/job (\d+) at (.*)/i', $result, $m) ) { @@ -111,8 +109,7 @@ $this->job = $m[1]; return $this->job; } else { - $this->error = new Schedule_At_Error('Exec Error: '.$result); - return $this->error; + return $this->raiseError('Exec Error: '.$result); } } @@ -139,8 +136,7 @@ $this->_reset(); if ($queue && !preg_match('/^[a-zA-Z]{1,1}$/', $queue) ) { - $this->error = new Schedule_At_Error('Invalid queue specification'); - return $this->error; + return $this->raiseError('Invalid queue specification'); } $exec = sprintf("%s -l %s", @@ -184,15 +180,13 @@ $this->_reset(); if (!$job) { - $this->error = new Schedule_At_Error('No job specified'); - return $this->error; + return $this->raiseError('No job specified'); } $queue = $this->show(); if (!isset($queue[$job]) ) { - $this->error = new Schedule_At_Error('Job ' . $job . ' does not exist'); - return $this->error; + return $this->raiseError('Job ' . $job . ' does not exist'); } $exec = sprintf("%s -d %s", @@ -259,20 +253,5 @@ } } - - - -class Schedule_At_Error extends PEAR_Error -{ - var $classname = 'Schedule_At_Error'; - var $error_message_prepend = 'Error in Schedule_At'; - - function Schedule_At_Error ($message, $code = 0, $mode = PEAR_ERROR_RETURN, $level = E_USER_NOTICE) - { - $this->PEAR_Error ($message, $code, $mode, $level); - } - -} - ?>

« previous php.pear.cvs (#2924) next »