/** * Test set, getAll, delete * */ function testSetGetAllDelete() { // Force cache clean-up OA_Dal_ApplicationVariables::cleanCache(); $result = OA_Dal_ApplicationVariables::getAll(); $this->assertEqual($result, array()); $aData = array('one' => 'foo', 'two' => 'bar'); foreach ($aData as $k => $v) { $result = OA_Dal_ApplicationVariables::set($k, $v); $this->assertTrue($result); } // Check cached values $result = OA_Dal_ApplicationVariables::getAll(); $this->assertEqual($result, $aData); // Force cache clean-up OA_Dal_ApplicationVariables::cleanCache(); // Check DB-stored values $result = OA_Dal_ApplicationVariables::getAll(); $this->assertEqual($result, $aData); foreach (array_keys($aData) as $name) { $result = OA_Dal_ApplicationVariables::delete($name); $this->assertTrue($result); } }
*/ // Require the initialisation file require_once '../../init.php'; // Required files require_once MAX_PATH . '/lib/OA/Dal.php'; require_once MAX_PATH . '/lib/OA/Sync.php'; require_once MAX_PATH . '/www/admin/config.php'; require_once MAX_PATH . '/www/admin/lib-maintenance.inc.php'; $update_check = false; /*-------------------------------------------------------*/ /* Main code */ /*-------------------------------------------------------*/ // Check for product updates when the admin logs in if (OA_Permission::isAccount(OA_ACCOUNT_ADMIN)) { $aConf = $GLOBALS['_MAX']['CONF']; $aVars = OA_Dal_ApplicationVariables::getAll(); $update_check = false; // Check accordingly to user preferences if (!empty($aConf['sync']['checkForUpdates'])) { if ($aVars['sync_cache']) { $update_check = unserialize($aVars['sync_cache']); } // If cache timestamp not set or older than 24hrs, re-sync if (isset($aVars['sync_timestamp']) && $aVars['sync_timestamp'] + 86400 < time()) { $oSync = new OA_Sync(); $res = $oSync->checkForUpdates(); if ($res[0] == 0) { $update_check = $res[1]; } } if (!is_array($update_check) || $update_check['config_version'] <= $aVars['sync_last_seen']) {