예제 #1
0
 public function tearDown()
 {
     if (!is_null($this->prevValue)) {
         Cache::set($this->cacheVarName, $this->prevValue);
     } else {
         Cache::remove($this->cacheVarName);
     }
 }
예제 #2
0
파일: DB.php 프로젝트: youprofit/casebox
function close()
{
    $rez = false;
    $dbh = \CB\Cache::get('dbh');
    if (!empty($dbh)) {
        \CB\Cache::remove('dbh');
        $rez = $dbh->close();
    }
    return $rez;
}
예제 #3
0
파일: Purify.php 프로젝트: sebbie42/casebox
 /**
  * purify given html value
  * @param  varchar $html
  * @param  array   $options associative array of purify library options
  * @return varchar
  */
 public static final function html($value, $options = array())
 {
     if (empty($value)) {
         return '';
     }
     static::getInstance();
     $value = Util\toUTF8String($value);
     $config = null;
     if (!empty($options)) {
         $config = \HTMLPurifier_Config::createDefault();
         foreach ($options as $k => $v) {
             $config->set($k, $v);
         }
     }
     $value = static::$purifier->purify($value, $config);
     Cache::remove('memory');
     return $value;
 }
예제 #4
0
 /**
  * recalculate security sets marked as updated in db
  * @param  boolean $onlyForUserId specific user or all if false
  * @return void
  */
 public static function calculateUpdatedSecuritySets($onlyForUserId = false)
 {
     if (Cache::get('calculatingSecuritySets', false)) {
         return;
     }
     //set a flag to avoid double call to this function
     Cache::set('calculatingSecuritySets', true);
     DB\startTransaction();
     $res = DB\dbQuery('SELECT id
         FROM tree_acl_security_sets
         WHERE updated = 1');
     while ($r = $res->fetch_assoc()) {
         //calculate for all even if there are sets for non existing obejcts
         try {
             Security::updateSecuritySet($r['id'], $onlyForUserId);
         } catch (\Exception $e) {
         }
     }
     $res->close();
     DB\commitTransaction();
     Cache::remove('calculatingSecuritySets');
 }