cvs: pear /Sqlite_Tools Tools.php
| From: | David Costa | Date: | Sat, 14 Aug 2004 04:21:51 +0000 |
| Subject: | cvs: pear /Sqlite_Tools Tools.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-22886@lists.php.net to get a copy of this message | ||
gurugeek Sat Aug 14 00:21:51 2004 EDT
Modified files:
/pear/Sqlite_Tools Tools.php
Log:
renamed the exception as suggested by Alan
http://cvs.php.net/diff.php/pear/Sqlite_Tools/Tools.php?r1=1.1&r2=1.2&ty=u Index: pear/Sqlite_Tools/Tools.php diff -u pear/Sqlite_Tools/Tools.php:1.1 pear/Sqlite_Tools/Tools.php:1.2 --- pear/Sqlite_Tools/Tools.php:1.1 Sat Aug 14 00:09:55 2004 +++ pear/Sqlite_Tools/Tools.php Sat Aug 14 00:21:51 2004 @@ -17,7 +17,7 @@ // | Authors: David Costa <gurugeek@php.net> | // +----------------------------------------------------------------------+ // -// \$Id: Tools.php,v 1.1 2004/08/14 04:09:55 gurugeek Exp $ $ +// \$Id: Tools.php,v 1.2 2004/08/14 04:21:51 gurugeek Exp $ $ /** * Class to manage sqlite database. On object-oriented interface to @@ -29,7 +29,7 @@ * @author Ashley Hewson <morbidness@gmail.com> * @license http://www.php.net/license/3_0.txt PHP License 3.0 * @version @VER@ - * @version $Id: Tools.php,v 1.1 2004/08/14 04:09:55 gurugeek Exp $ + * @version $Id: Tools.php,v 1.2 2004/08/14 04:21:51 gurugeek Exp $ * */ @@ -52,7 +52,7 @@ * @author David Costa <gurugeek@php.net> * @license http://www.php.net/license/3_0.txt PHP License 3.0 * @version @VER@ - * @version $Id: Tools.php,v 1.1 2004/08/14 04:09:55 gurugeek Exp $ + * @version $Id: Tools.php,v 1.2 2004/08/14 04:21:51 gurugeek Exp $ * * @ */ @@ -236,7 +236,7 @@ * before attemping to change their cache value. * * @param int $pages number of pages to hold in the updated memory allocation - * @throws PEAR_Exception + * @throws Sqlite_Tools_Exception * @return return true */ @@ -249,7 +249,7 @@ } } else { if (!eregi("[[:digit:]]", $pages)) { - throw new PEAR_Exception(self::DB_SQLITE_TOOLS_NNU."$pages", -1); + throw new Sqlite_Tools_Exception(self::DB_SQLITE_TOOLS_NNU."$pages", -1); } else { foreach($this->database as $databases) { $this->sqliteConnect($databases); @@ -276,7 +276,7 @@ * value for each of the databases. * * @param sting $value - * @throws PEAR_Exception + * @throws Sqlite_Tools_Exception * @return return true */ @@ -293,7 +293,7 @@ if (eregi("FULL|NORMAL|OFF", $value)) { $this->sqliteQuery("PRAGMA default_synchronous =$value"); } else { - throw new PEAR_Exception(self::DB_SQLITE_TOOLS_NAV."$value", -1); + throw new Sqlite_Tools_Exception(self::DB_SQLITE_TOOLS_NAV."$value", -1); } } } @@ -308,7 +308,7 @@ * version, the size of the database, last time it was modified, blocks and generally * every possible information on the database files * @param string $multiple checks one or multiple databases - * @throws PEAR_Exception + * @throws Sqlite_Tools_Exception * @return true */ @@ -359,7 +359,7 @@ * database and the suffix .bkp * * @param string $path destination path - * @throws PEAR_Exception + * @throws Sqlite_Tools_Exception * @return */ @@ -369,27 +369,27 @@ $this->backupp = $path; if (!count($this->database)) { - throw new PEAR_Exception(self::DB_SQLITE_TOOLS_NAR."$this->database",-1); + throw new Sqlite_Tools_Exception(self::DB_SQLITE_TOOLS_NAR."$this->database",-1); } else { foreach($this->database as $databases) { $fopenlock = @fopen($databases, 'r'); if (!@$fopenlock) { - throw new PEAR_Exception(self::DB_SQLITE_TOOLS_COFL,-1); + throw new Sqlite_Tools_Exception(self::DB_SQLITE_TOOLS_COFL,-1); } $lock = @flock($fopenlock, LOCK_EX); if (!@$lock) { - throw new PEAR_Exception(self::DB_SQLITE_TOOLS_CLF,-1); + throw new Sqlite_Tools_Exception(self::DB_SQLITE_TOOLS_CLF,-1); } $clone = @copy($databases, $path.$databases.'.bkp'); if (!@$clone) { - throw new PEAR_Exception(self::DB_SQLITE_TOOLS_CSF,-1); + throw new Sqlite_Tools_Exception(self::DB_SQLITE_TOOLS_CSF,-1); } else { $this->sqliteConnect($path.$databases.'.bkp'); $this->sqliteQuery('PRAGMA integrity_check'); } $release = @flock($fopenlock, LOCK_UN); if (!@$release) { - throw new PEAR_Exception(self::DB_SQLITE_TOOLS_CCFL,-1); + throw new Sqlite_Tools_Exception(self::DB_SQLITE_TOOLS_CCFL,-1); } } } @@ -402,7 +402,7 @@ * * It looks for previously backed up files with extension .bkp * - * @throws PEAR_Exception on failure + * @throws Sqlite_Tools_Exception on failure * @return true */ @@ -412,7 +412,7 @@ $scanned = @scandir($this->backupp,0); if (!@$scanned) { - throw new PEAR_Exception(self::DB_SQLITE_TOOLS_CSD,-1); + throw new Sqlite_Tools_Exception(self::DB_SQLITE_TOOLS_CSD,-1); } foreach ($scanned as $this->parsed) { @@ -440,7 +440,7 @@ * @param string $username ftp username * @param string $password ftp password * @param string $path remote ftp path - * @throws PEAR_Exception on failure + * @throws Sqlite_Tools_Exception on failure * @return true */ @@ -448,7 +448,7 @@ public function ftpBackup($server, $username, $password, $path = '') { if ($this->safecopy == false) { - throw new PEAR_Exception(self::DB_SQLITE_TOOLS_INSC, -1); + throw new Sqlite_Tools_Exception(self::DB_SQLITE_TOOLS_INSC, -1); } $this->scanBackupDir(); $this->ftpConnect($server, $username, $password); @@ -456,7 +456,7 @@ $this->ftpConnect($server, $username, $password); $put = ftp_put($this->ftpconnection, "$path/$ftpdatabase", $this->backupp.$ftpdatabase, FTP_BINARY); if (!@$put) { - throw new PEAR_Exception(self::DB_SQLITE_TOOLS_CUFS); + throw new Sqlite_Tools_Exception(self::DB_SQLITE_TOOLS_CUFS); } else { $this->logs[] = new Sqlite_Tools_LogObject(__CLASS__, __FUNCTION__, "$this->backupp.$ftpdatabase uploaded"); } @@ -470,19 +470,19 @@ * @param string $server remote ftp server * @param string $username ftp username * @param string $password ftp password - * @throws PEAR_Exception on failure + * @throws Sqlite_Tools_Exception on failure */ private function ftpConnect ($server,$username,$password) { $this->ftpconnection = @ftp_connect($server); if (!@$this->ftpconnection) { - throw new PEAR_Exception (self::DB_SQLITE_TOOLS_CCFS,-1); + throw new Sqlite_Tools_Exception (self::DB_SQLITE_TOOLS_CCFS,-1); } $logged = ftp_login($this->ftpconnection, $username, $password); if (!@$logged) { - throw new PEAR_Exception (self::DB_SQLITE_TOOLS_CLFS,-1); + throw new Sqlite_Tools_Exception (self::DB_SQLITE_TOOLS_CLFS,-1); } } @@ -492,7 +492,7 @@ * Creates a local backup of the database file and * checks for its integrity * @param string $destination local backup path - * @throws PEAR_Exception on failure + * @throws Sqlite_Tools_Exception on failure */ @@ -502,15 +502,15 @@ $backupfile = $destination.'/'.$databases.'.bkp'; $fopenlock = @fopen($databases, 'r'); if (!@$fopenlock) { - throw new PEAR_Exception(self::DB_SQLITE_TOOLS_COFL, -1); + throw new Sqlite_Tools_Exception(self::DB_SQLITE_TOOLS_COFL, -1); } $lock = @flock($fopenlock, LOCK_EX); if (!@$lock) { - throw new PEAR_Exception(self::DB_SQLITE_TOOLS_CLF, -1); + throw new Sqlite_Tools_Exception(self::DB_SQLITE_TOOLS_CLF, -1); } $clone = @copy($databases, "$backupfile"); if (!@$clone) { - throw new PEAR_Exception(self::DB_SQLITE_TOOLS_CSF, -1); + throw new Sqlite_Tools_Exception(self::DB_SQLITE_TOOLS_CSF, -1); } else { $this->logs[] = new Sqlite_Tools_LogObject(__CLASS__, __FUNCTION__, "$backupfile successfully copied"); $this->sqliteConnect("$backupfile"); @@ -518,7 +518,7 @@ } $release = @flock($fopenlock, LOCK_UN); if (!@$release) { - throw new PEAR_Exception(self::DB_SQLITE_TOOLS_CCFL, -1); + throw new Sqlite_Tools_Exception(self::DB_SQLITE_TOOLS_CCFL, -1); } } if ($this->debug) var_export($this->logs); @@ -532,7 +532,7 @@ * @param string $databasesPath Path to the databases folder to sync locally * @param string $backupsPath Sync Destionation path * @param string $options rsync options - * @throws PEAR_Exception on failure + * @throws Sqlite_Tools_Exception on failure */ @@ -592,17 +592,17 @@ $cffile = "$configfilepath/$configfile"; $sfile=@fopen($cffile,'w+'); if (!@$sfile){ - throw new PEAR_Exception (self::DB_SQLITE_TOOLS_RSE,-1); + throw new Sqlite_Tools_Exception (self::DB_SQLITE_TOOLS_RSE,-1); } $sfilew=@fwrite($sfile,$rsynconfig); if (!@$sfilew){ - throw new PEAR_Exception (self::DB_SQLITE_TOOLS_RSE,-1); + throw new Sqlite_Tools_Exception (self::DB_SQLITE_TOOLS_RSE,-1); } $sfileclose=fclose($sfile); if (!@$sfileclose){ - throw new PEAR_Exception (self::DB_SQLITE_TOOLS_RSE,-1); + throw new Sqlite_Tools_Exception (self::DB_SQLITE_TOOLS_RSE,-1); } print_r($cffile); @@ -645,7 +645,7 @@ * @param string $db Logs database * @param string $maketable create a default log table * @param string $table table name - * @throws PEAR_Exception on failure + * @throws Sqlite_Tools_Exception on failure */ public function sqliteLogs($db, $maketable = true, $table) { @@ -696,7 +696,7 @@ $this->opendb = @sqlite_open ("$db", 0666, $this->error); if (!@$this->opendb){ - throw new PEAR_Exception (self::DB_SQLITE_TOOLS_COD."$this->error",-1); + throw new Sqlite_Tools_Exception (self::DB_SQLITE_TOOLS_COD."$this->error",-1); } } @@ -818,12 +818,12 @@ foreach($this->database as $database) { $XMLFile = @fopen("$database.xml", "w"); if (!$XMLFile) { - throw new PEAR_Exception(self::DB_SQLITE_TOOLS_CCXML."$database.xml", -1); + throw new Sqlite_Tools_Exception(self::DB_SQLITE_TOOLS_CCXML."$database.xml", -1); } $this->performXMLDump($database, $XMLFile); $XMLclose = @fclose($XMLFile); if (!$XMLclose) { - throw new PEAR_Exception(self::DB_SQLITE_TOOLS_CCLXML."$database.xml", -1); + throw new Sqlite_Tools_Exception(self::DB_SQLITE_TOOLS_CCLXML."$database.xml", -1); } if ($this->debug) echo "$database.xml successfully created\n"; $this->logs[] = new Sqlite_Tools_LogObject(__CLASS__, __FUNCTION__, "$database.xml successfully created");
http://cvs.php.net/diff.php/pear/Sqlite_Tools/Tools.php?r1=1.1&r2=1.2&ty=u Index: pear/Sqlite_Tools/Tools.php diff -u pear/Sqlite_Tools/Tools.php:1.1 pear/Sqlite_Tools/Tools.php:1.2 --- pear/Sqlite_Tools/Tools.php:1.1 Sat Aug 14 00:09:55 2004 +++ pear/Sqlite_Tools/Tools.php Sat Aug 14 00:21:51 2004 @@ -17,7 +17,7 @@ // | Authors: David Costa <gurugeek@php.net> | // +----------------------------------------------------------------------+ // -// \$Id: Tools.php,v 1.1 2004/08/14 04:09:55 gurugeek Exp $ $ +// \$Id: Tools.php,v 1.2 2004/08/14 04:21:51 gurugeek Exp $ $ /** * Class to manage sqlite database. On object-oriented interface to @@ -29,7 +29,7 @@ * @author Ashley Hewson <morbidness@gmail.com> * @license http://www.php.net/license/3_0.txt PHP License 3.0 * @version @VER@ - * @version $Id: Tools.php,v 1.1 2004/08/14 04:09:55 gurugeek Exp $ + * @version $Id: Tools.php,v 1.2 2004/08/14 04:21:51 gurugeek Exp $ * */ @@ -52,7 +52,7 @@ * @author David Costa <gurugeek@php.net> * @license http://www.php.net/license/3_0.txt PHP License 3.0 * @version @VER@ - * @version $Id: Tools.php,v 1.1 2004/08/14 04:09:55 gurugeek Exp $ + * @version $Id: Tools.php,v 1.2 2004/08/14 04:21:51 gurugeek Exp $ * * @ */ @@ -236,7 +236,7 @@ * before attemping to change their cache value. * * @param int $pages number of pages to hold in the updated memory allocation - * @throws PEAR_Exception + * @throws Sqlite_Tools_Exception * @return return true */ @@ -249,7 +249,7 @@ } } else { if (!eregi("[[:digit:]]", $pages)) { - throw new PEAR_Exception(self::DB_SQLITE_TOOLS_NNU."$pages", -1); + throw new Sqlite_Tools_Exception(self::DB_SQLITE_TOOLS_NNU."$pages", -1); } else { foreach($this->database as $databases) { $this->sqliteConnect($databases); @@ -276,7 +276,7 @@ * value for each of the databases. * * @param sting $value - * @throws PEAR_Exception + * @throws Sqlite_Tools_Exception * @return return true */ @@ -293,7 +293,7 @@ if (eregi("FULL|NORMAL|OFF", $value)) { $this->sqliteQuery("PRAGMA default_synchronous =$value"); } else { - throw new PEAR_Exception(self::DB_SQLITE_TOOLS_NAV."$value", -1); + throw new Sqlite_Tools_Exception(self::DB_SQLITE_TOOLS_NAV."$value", -1); } } } @@ -308,7 +308,7 @@ * version, the size of the database, last time it was modified, blocks and generally * every possible information on the database files * @param string $multiple checks one or multiple databases - * @throws PEAR_Exception + * @throws Sqlite_Tools_Exception * @return true */ @@ -359,7 +359,7 @@ * database and the suffix .bkp * * @param string $path destination path - * @throws PEAR_Exception + * @throws Sqlite_Tools_Exception * @return */ @@ -369,27 +369,27 @@ $this->backupp = $path; if (!count($this->database)) { - throw new PEAR_Exception(self::DB_SQLITE_TOOLS_NAR."$this->database",-1); + throw new Sqlite_Tools_Exception(self::DB_SQLITE_TOOLS_NAR."$this->database",-1); } else { foreach($this->database as $databases) { $fopenlock = @fopen($databases, 'r'); if (!@$fopenlock) { - throw new PEAR_Exception(self::DB_SQLITE_TOOLS_COFL,-1); + throw new Sqlite_Tools_Exception(self::DB_SQLITE_TOOLS_COFL,-1); } $lock = @flock($fopenlock, LOCK_EX); if (!@$lock) { - throw new PEAR_Exception(self::DB_SQLITE_TOOLS_CLF,-1); + throw new Sqlite_Tools_Exception(self::DB_SQLITE_TOOLS_CLF,-1); } $clone = @copy($databases, $path.$databases.'.bkp'); if (!@$clone) { - throw new PEAR_Exception(self::DB_SQLITE_TOOLS_CSF,-1); + throw new Sqlite_Tools_Exception(self::DB_SQLITE_TOOLS_CSF,-1); } else { $this->sqliteConnect($path.$databases.'.bkp'); $this->sqliteQuery('PRAGMA integrity_check'); } $release = @flock($fopenlock, LOCK_UN); if (!@$release) { - throw new PEAR_Exception(self::DB_SQLITE_TOOLS_CCFL,-1); + throw new Sqlite_Tools_Exception(self::DB_SQLITE_TOOLS_CCFL,-1); } } } @@ -402,7 +402,7 @@ * * It looks for previously backed up files with extension .bkp * - * @throws PEAR_Exception on failure + * @throws Sqlite_Tools_Exception on failure * @return true */ @@ -412,7 +412,7 @@ $scanned = @scandir($this->backupp,0); if (!@$scanned) { - throw new PEAR_Exception(self::DB_SQLITE_TOOLS_CSD,-1); + throw new Sqlite_Tools_Exception(self::DB_SQLITE_TOOLS_CSD,-1); } foreach ($scanned as $this->parsed) { @@ -440,7 +440,7 @@ * @param string $username ftp username * @param string $password ftp password * @param string $path remote ftp path - * @throws PEAR_Exception on failure + * @throws Sqlite_Tools_Exception on failure * @return true */ @@ -448,7 +448,7 @@ public function ftpBackup($server, $username, $password, $path = '') { if ($this->safecopy == false) { - throw new PEAR_Exception(self::DB_SQLITE_TOOLS_INSC, -1); + throw new Sqlite_Tools_Exception(self::DB_SQLITE_TOOLS_INSC, -1); } $this->scanBackupDir(); $this->ftpConnect($server, $username, $password); @@ -456,7 +456,7 @@ $this->ftpConnect($server, $username, $password); $put = ftp_put($this->ftpconnection, "$path/$ftpdatabase", $this->backupp.$ftpdatabase, FTP_BINARY); if (!@$put) { - throw new PEAR_Exception(self::DB_SQLITE_TOOLS_CUFS); + throw new Sqlite_Tools_Exception(self::DB_SQLITE_TOOLS_CUFS); } else { $this->logs[] = new Sqlite_Tools_LogObject(__CLASS__, __FUNCTION__, "$this->backupp.$ftpdatabase uploaded"); } @@ -470,19 +470,19 @@ * @param string $server remote ftp server * @param string $username ftp username * @param string $password ftp password - * @throws PEAR_Exception on failure + * @throws Sqlite_Tools_Exception on failure */ private function ftpConnect ($server,$username,$password) { $this->ftpconnection = @ftp_connect($server); if (!@$this->ftpconnection) { - throw new PEAR_Exception (self::DB_SQLITE_TOOLS_CCFS,-1); + throw new Sqlite_Tools_Exception (self::DB_SQLITE_TOOLS_CCFS,-1); } $logged = ftp_login($this->ftpconnection, $username, $password); if (!@$logged) { - throw new PEAR_Exception (self::DB_SQLITE_TOOLS_CLFS,-1); + throw new Sqlite_Tools_Exception (self::DB_SQLITE_TOOLS_CLFS,-1); } } @@ -492,7 +492,7 @@ * Creates a local backup of the database file and * checks for its integrity * @param string $destination local backup path - * @throws PEAR_Exception on failure + * @throws Sqlite_Tools_Exception on failure */ @@ -502,15 +502,15 @@ $backupfile = $destination.'/'.$databases.'.bkp'; $fopenlock = @fopen($databases, 'r'); if (!@$fopenlock) { - throw new PEAR_Exception(self::DB_SQLITE_TOOLS_COFL, -1); + throw new Sqlite_Tools_Exception(self::DB_SQLITE_TOOLS_COFL, -1); } $lock = @flock($fopenlock, LOCK_EX); if (!@$lock) { - throw new PEAR_Exception(self::DB_SQLITE_TOOLS_CLF, -1); + throw new Sqlite_Tools_Exception(self::DB_SQLITE_TOOLS_CLF, -1); } $clone = @copy($databases, "$backupfile"); if (!@$clone) { - throw new PEAR_Exception(self::DB_SQLITE_TOOLS_CSF, -1); + throw new Sqlite_Tools_Exception(self::DB_SQLITE_TOOLS_CSF, -1); } else { $this->logs[] = new Sqlite_Tools_LogObject(__CLASS__, __FUNCTION__, "$backupfile successfully copied"); $this->sqliteConnect("$backupfile"); @@ -518,7 +518,7 @@ } $release = @flock($fopenlock, LOCK_UN); if (!@$release) { - throw new PEAR_Exception(self::DB_SQLITE_TOOLS_CCFL, -1); + throw new Sqlite_Tools_Exception(self::DB_SQLITE_TOOLS_CCFL, -1); } } if ($this->debug) var_export($this->logs); @@ -532,7 +532,7 @@ * @param string $databasesPath Path to the databases folder to sync locally * @param string $backupsPath Sync Destionation path * @param string $options rsync options - * @throws PEAR_Exception on failure + * @throws Sqlite_Tools_Exception on failure */ @@ -592,17 +592,17 @@ $cffile = "$configfilepath/$configfile"; $sfile=@fopen($cffile,'w+'); if (!@$sfile){ - throw new PEAR_Exception (self::DB_SQLITE_TOOLS_RSE,-1); + throw new Sqlite_Tools_Exception (self::DB_SQLITE_TOOLS_RSE,-1); } $sfilew=@fwrite($sfile,$rsynconfig); if (!@$sfilew){ - throw new PEAR_Exception (self::DB_SQLITE_TOOLS_RSE,-1); + throw new Sqlite_Tools_Exception (self::DB_SQLITE_TOOLS_RSE,-1); } $sfileclose=fclose($sfile); if (!@$sfileclose){ - throw new PEAR_Exception (self::DB_SQLITE_TOOLS_RSE,-1); + throw new Sqlite_Tools_Exception (self::DB_SQLITE_TOOLS_RSE,-1); } print_r($cffile); @@ -645,7 +645,7 @@ * @param string $db Logs database * @param string $maketable create a default log table * @param string $table table name - * @throws PEAR_Exception on failure + * @throws Sqlite_Tools_Exception on failure */ public function sqliteLogs($db, $maketable = true, $table) { @@ -696,7 +696,7 @@ $this->opendb = @sqlite_open ("$db", 0666, $this->error); if (!@$this->opendb){ - throw new PEAR_Exception (self::DB_SQLITE_TOOLS_COD."$this->error",-1); + throw new Sqlite_Tools_Exception (self::DB_SQLITE_TOOLS_COD."$this->error",-1); } } @@ -818,12 +818,12 @@ foreach($this->database as $database) { $XMLFile = @fopen("$database.xml", "w"); if (!$XMLFile) { - throw new PEAR_Exception(self::DB_SQLITE_TOOLS_CCXML."$database.xml", -1); + throw new Sqlite_Tools_Exception(self::DB_SQLITE_TOOLS_CCXML."$database.xml", -1); } $this->performXMLDump($database, $XMLFile); $XMLclose = @fclose($XMLFile); if (!$XMLclose) { - throw new PEAR_Exception(self::DB_SQLITE_TOOLS_CCLXML."$database.xml", -1); + throw new Sqlite_Tools_Exception(self::DB_SQLITE_TOOLS_CCLXML."$database.xml", -1); } if ($this->debug) echo "$database.xml successfully created\n"; $this->logs[] = new Sqlite_Tools_LogObject(__CLASS__, __FUNCTION__, "$database.xml successfully created");