cvs: pearweb / pearweb.php
| From: | Greg Beaver | Date: | Tue, 20 Feb 2007 03:02:42 +0000 |
| Subject: | cvs: pearweb / pearweb.php | ||
| Groups: | php.pear.cvs php.pear.core | ||
| Request: | Send a blank email to pear-core+get-5451@lists.php.net to get a copy of this message | ||
cellog Tue Feb 20 03:02:42 2007 UTC
Modified files:
/pearweb pearweb.php
Log:
use updateDatabase() if the database exists
# won't work for me - I think MDB2_Schema may be borked
# for upgrade purposes
http://cvs.php.net/viewvc.cgi/pearweb/pearweb.php?r1=1.8&r2=1.9&diff_format=u
Index: pearweb/pearweb.php
diff -u pearweb/pearweb.php:1.8 pearweb/pearweb.php:1.9
--- pearweb/pearweb.php:1.8 Tue Feb 20 02:48:26 2007
+++ pearweb/pearweb.php Tue Feb 20 03:02:42 2007
@@ -151,15 +151,21 @@
$this->_ui->outputData('invalid data returned from previous
version');
}
// get a database diff (MDB2_Schema is very useful here)
+ PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
$c = $a->compareDefinitions($c, $curdef);
+ if (PEAR::isError($c)) {
+ $this->_ui->outputData($err->getMessage());
+ $this->_ui->outputData($err->getUserInfo());
+ $this->_ui->outputData('Unable to automatically update database');
+ return false;
+ }
+ $err = $a->updateDatabase($curdef, $c);
+ PEAR::staticPopErrorHandling();
+ } else {
+ PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
+ $err = $a->createDatabase($c);
+ PEAR::staticPopErrorHandling();
}
- if ($c == array()) {
- $this->_ui->outputData('No difference, no changes made to database');
- return true;
- }
- PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
- $err = $a->createDatabase($c);
- PEAR::staticPopErrorHandling();
if (PEAR::isError($err)) {
$this->_ui->outputData($err->getUserInfo());
$this->_ui->outputData($err->getMessage());