diff --git a/airtime_mvc/application/Bootstrap.php b/airtime_mvc/application/Bootstrap.php
index 9acf6f7f6e..ee49b73a89 100644
--- a/airtime_mvc/application/Bootstrap.php
+++ b/airtime_mvc/application/Bootstrap.php
@@ -21,6 +21,7 @@
require_once "Auth.php";
require_once __DIR__ . '/forms/helpers/ValidationTypes.php';
require_once __DIR__ . '/controllers/plugins/RabbitMqPlugin.php';
+require_once __DIR__ . '/upgrade/Upgrades.php';
require_once (APPLICATION_PATH . "logging/Logging.php");
Logging::setLogPath('/var/log/airtime/zendphp.log');
@@ -76,6 +77,14 @@ private function _initTranslationGlobals($view) {
$view->headScript()->appendScript("var USER_MANUAL_URL = '" . USER_MANUAL_URL . "';");
$view->headScript()->appendScript("var COMPANY_NAME = '" . COMPANY_NAME . "';");
}
+
+ protected function _initUpgrade() {
+ Logging::info("Checking if upgrade is needed...");
+ if (AIRTIME_CODE_VERSION > Application_Model_Preference::GetAirtimeVersion()) {
+ $upgradeManager = new UpgradeManager();
+ $upgradeManager->runUpgrades(array(new AirtimeUpgrader252()), (__DIR__ . "/controllers"));
+ }
+ }
protected function _initHeadLink()
{
diff --git a/airtime_mvc/application/configs/conf.php b/airtime_mvc/application/configs/conf.php
index 132605179d..58515e236d 100644
--- a/airtime_mvc/application/configs/conf.php
+++ b/airtime_mvc/application/configs/conf.php
@@ -38,9 +38,6 @@ public static function loadConfig() {
$CC_CONFIG['cache_ahead_hours'] = $values['general']['cache_ahead_hours'];
- $CC_CONFIG['monit_user'] = $values['monit']['monit_user'];
- $CC_CONFIG['monit_password'] = $values['monit']['monit_password'];
-
// Database config
$CC_CONFIG['dsn']['username'] = $values['database']['dbuser'];
$CC_CONFIG['dsn']['password'] = $values['database']['dbpass'];
diff --git a/airtime_mvc/application/controllers/UpgradeController.php b/airtime_mvc/application/controllers/UpgradeController.php
index 2691f270fc..7ff511dee0 100644
--- a/airtime_mvc/application/controllers/UpgradeController.php
+++ b/airtime_mvc/application/controllers/UpgradeController.php
@@ -20,35 +20,25 @@ public function indexAction()
array_push($upgraders, new AirtimeUpgrader254());
*/
$didWePerformAnUpgrade = false;
- try
- {
- for ($i = 0; $i < count($upgraders); $i++)
- {
- $upgrader = $upgraders[$i];
- if ($upgrader->checkIfUpgradeSupported())
- {
- // 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)
- ->appendBody("Upgrade to Airtime " . $upgrader->getNewVersion() . " OK
");
- $i = 0; //Start over, in case the upgrade handlers are not in ascending order.
- }
- }
+ try {
+ $upgradeManager = new UpgradeManager();
+ $didWePerformAnUpgrade = $upgradeManager->runUpgrades($upgraders, __DIR__);
- if (!$didWePerformAnUpgrade)
- {
+ if (!$didWePerformAnUpgrade) {
+ $this->getResponse()
+ ->setHttpResponseCode(200)
+ ->appendBody("No upgrade was performed. The current Airtime version is " . AirtimeUpgrader::getCurrentVersion() . ".
");
+ } else {
$this->getResponse()
- ->setHttpResponseCode(200)
- ->appendBody("No upgrade was performed. The current Airtime version is " . AirtimeUpgrader::getCurrentVersion() . ".
");
+ ->setHttpResponseCode(200)
+ ->appendBody("Upgrade to Airtime " . $upgrader->getNewVersion() . " OK
");
}
}
catch (Exception $e)
{
$this->getResponse()
- ->setHttpResponseCode(400)
- ->appendBody($e->getMessage());
+ ->setHttpResponseCode(400)
+ ->appendBody($e->getMessage());
}
}
diff --git a/airtime_mvc/application/models/Cache.php b/airtime_mvc/application/models/Cache.php
index af4e6417bc..eccc9d4b9b 100644
--- a/airtime_mvc/application/models/Cache.php
+++ b/airtime_mvc/application/models/Cache.php
@@ -28,4 +28,10 @@ public function fetch($key, $isUserValue, $userId = null) {
//$cacheKey = self::createCacheKey($key, $isUserValue, $userId);
return false; //apc_fetch($cacheKey);
}
+
+ public static function clear() {
+ // Disabled on SaaS
+ // apc_clear_cache('user');
+ // apc_clear_cache();
+ }
}
diff --git a/airtime_mvc/application/models/Systemstatus.php b/airtime_mvc/application/models/Systemstatus.php
index 4a0480a048..3872526481 100644
--- a/airtime_mvc/application/models/Systemstatus.php
+++ b/airtime_mvc/application/models/Systemstatus.php
@@ -6,15 +6,15 @@ class Application_Model_Systemstatus
public static function GetMonitStatus($p_ip)
{
$CC_CONFIG = Config::getConfig();
- $monit_user = $CC_CONFIG['monit_user'];
- $monit_password = $CC_CONFIG['monit_password'];
+// $monit_user = $CC_CONFIG['monit_user'];
+// $monit_password = $CC_CONFIG['monit_password'];
$url = "http://$p_ip:2812/_status?format=xml";
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_USERPWD, "$monit_user:$monit_password");
+// curl_setopt($ch, CURLOPT_USERPWD, "$monit_user:$monit_password");
//wait a max of 3 seconds before aborting connection attempt
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 3);
$result = curl_exec($ch);
diff --git a/airtime_mvc/application/upgrade/Upgrades.php b/airtime_mvc/application/upgrade/Upgrades.php
index f95216bd0f..fe083d1aee 100644
--- a/airtime_mvc/application/upgrade/Upgrades.php
+++ b/airtime_mvc/application/upgrade/Upgrades.php
@@ -1,5 +1,32 @@
checkIfUpgradeSupported()) {
+ // pass the given directory to the upgrades, since __DIR__ returns parent dir of file, not executor
+ $upgrader->upgrade($dir); // This will throw an exception if the upgrade fails.
+ $upgradePerformed = true;
+ $i = 0; // Start over, in case the upgrade handlers are not in ascending order.
+ }
+ }
+
+ return $upgradePerformed;
+ }
+
+}
+
abstract class AirtimeUpgrader
{
/** Versions that this upgrader class can upgrade from (an array of version strings). */
diff --git a/airtime_mvc/build/airtime-setup/forms/database-settings.php b/airtime_mvc/build/airtime-setup/forms/database-settings.php
index 6a32dcacfe..d9df0e42e5 100644
--- a/airtime_mvc/build/airtime-setup/forms/database-settings.php
+++ b/airtime_mvc/build/airtime-setup/forms/database-settings.php
@@ -16,25 +16,25 @@