Updated upgrade functions to have a directory parameter, since __DIR__

This commit is contained in:
Duncan Sommerville 2014-09-19 12:58:31 -04:00
parent 0a0c6911f8
commit 28d2bdbbec
2 changed files with 5 additions and 6 deletions

View File

@ -26,7 +26,8 @@ class UpgradeController extends Zend_Controller_Action
$upgrader = $upgraders[$i];
if ($upgrader->checkIfUpgradeSupported())
{
$upgrader->upgrade(); //This will throw an exception if the upgrade fails.
// pass __DIR__ to the upgrades, since __DIR__ returns parent dir of file, not executor
$upgrader->upgrade(__DIR__); //This will throw an exception if the upgrade fails.
$didWePerformAnUpgrade = true;
$this->getResponse()
->setHttpResponseCode(200)

View File

@ -64,7 +64,7 @@ class AirtimeUpgrader253 extends AirtimeUpgrader
return '2.5.3';
}
public function upgrade()
public function upgrade($dir = __DIR__)
{
Cache::clear();
assert($this->checkIfUpgradeSupported());
@ -104,7 +104,6 @@ class AirtimeUpgrader253 extends AirtimeUpgrader
$password = $values['database']['dbpass'];
$host = $values['database']['host'];
$database = $values['database']['dbname'];
$dir = __DIR__;
passthru("export PGPASSWORD=$password && psql -h $host -U $username -q -f $dir/upgrade_sql/airtime_".$this->getNewVersion()."/upgrade.sql $database 2>&1 | grep -v \"will create implicit index\"");
@ -219,7 +218,7 @@ class AirtimeUpgrader255 extends AirtimeUpgrader {
return '2.5.5';
}
public function upgrade() {
public function upgrade($dir = __DIR__) {
Cache::clear();
assert($this->checkIfUpgradeSupported());
@ -237,7 +236,6 @@ class AirtimeUpgrader255 extends AirtimeUpgrader {
$password = $values['database']['dbpass'];
$host = $values['database']['host'];
$database = $values['database']['dbname'];
$dir = __DIR__;
passthru("export PGPASSWORD=$password && psql -h $host -U $username -q -f $dir/upgrade_sql/airtime_"
.$this->getNewVersion()."/upgrade.sql $database 2>&1 | grep -v \"will create implicit index\"");