Merge branch 'saas' into saas-dev
This commit is contained in:
commit
999f03ea1e
|
@ -146,9 +146,7 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
||||||
|
|
||||||
$baseUrl = Application_Common_OsPath::getBaseDir();
|
$baseUrl = Application_Common_OsPath::getBaseDir();
|
||||||
|
|
||||||
$view->headLink(array('rel' => 'icon',
|
$view->headLink(array('rel' => 'icon', 'href' => $baseUrl . 'favicon.ico?' . $CC_CONFIG['airtime_version'], 'type' => 'image/x-icon'), 'PREPEND')
|
||||||
'href' => $baseUrl . 'favicon.ico?' . $CC_CONFIG['airtime_version'],
|
|
||||||
'type' => 'image/x-icon'), 'PREPEND')
|
|
||||||
->appendStylesheet($baseUrl . 'css/bootstrap.css?' . $CC_CONFIG['airtime_version'])
|
->appendStylesheet($baseUrl . 'css/bootstrap.css?' . $CC_CONFIG['airtime_version'])
|
||||||
->appendStylesheet($baseUrl . 'css/redmond/jquery-ui-1.8.8.custom.css?' . $CC_CONFIG['airtime_version'])
|
->appendStylesheet($baseUrl . 'css/redmond/jquery-ui-1.8.8.custom.css?' . $CC_CONFIG['airtime_version'])
|
||||||
->appendStylesheet($baseUrl . 'css/pro_dropdown_3.css?' . $CC_CONFIG['airtime_version'])
|
->appendStylesheet($baseUrl . 'css/pro_dropdown_3.css?' . $CC_CONFIG['airtime_version'])
|
||||||
|
|
|
@ -27,17 +27,17 @@ class Application_Model_Preference
|
||||||
private static function setValue($key, $value, $isUserValue = false)
|
private static function setValue($key, $value, $isUserValue = false)
|
||||||
{
|
{
|
||||||
$cache = new Cache();
|
$cache = new Cache();
|
||||||
|
$con = Propel::getConnection(CcPrefPeer::DATABASE_NAME);
|
||||||
try {
|
$con->beginTransaction();
|
||||||
|
|
||||||
$con = Propel::getConnection(CcPrefPeer::DATABASE_NAME);
|
|
||||||
$con->beginTransaction();
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
static::_lock($con);
|
||||||
$userId = self::getUserId();
|
$userId = self::getUserId();
|
||||||
|
|
||||||
if ($isUserValue && is_null($userId))
|
if ($isUserValue && is_null($userId)) {
|
||||||
throw new Exception("User id can't be null for a user preference {$key}.");
|
throw new Exception("User id can't be null for a user preference {$key}.");
|
||||||
|
}
|
||||||
|
|
||||||
//Check if key already exists
|
//Check if key already exists
|
||||||
$sql = "SELECT COUNT(*) FROM cc_pref"
|
$sql = "SELECT COUNT(*) FROM cc_pref"
|
||||||
." WHERE keystr = :key";
|
." WHERE keystr = :key";
|
||||||
|
@ -113,6 +113,28 @@ class Application_Model_Preference
|
||||||
$cache->store($key, $value, $isUserValue, $userId);
|
$cache->store($key, $value, $isUserValue, $userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Given a PDO connection, lock the cc_pref table for the current transaction
|
||||||
|
*
|
||||||
|
* Creates a table level lock, which defaults to ACCESS EXCLUSIVE mode;
|
||||||
|
* see http://www.postgresql.org/docs/9.1/static/explicit-locking.html
|
||||||
|
*
|
||||||
|
* @param PDO $con
|
||||||
|
*/
|
||||||
|
private static function _lock($con) {
|
||||||
|
// If we're not in a transaction, a lock is pointless
|
||||||
|
if (!$con->inTransaction()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Don't specify NOWAIT here; we should block on obtaining this lock
|
||||||
|
// in case we're handling simultaneous requests.
|
||||||
|
// Locks only last until the end of the transaction, so we shouldn't have to
|
||||||
|
// worry about this causing any noticeable difference in request processing speed
|
||||||
|
$sql = "LOCK TABLE cc_pref";
|
||||||
|
$st = $con->prepare($sql);
|
||||||
|
$st->execute();
|
||||||
|
}
|
||||||
|
|
||||||
private static function getValue($key, $isUserValue = false)
|
private static function getValue($key, $isUserValue = false)
|
||||||
{
|
{
|
||||||
$cache = new Cache();
|
$cache = new Cache();
|
||||||
|
|
Loading…
Reference in New Issue