Esempio n. 1
0
 /**
  * Set config options (storage , lifetime , cleanupLimit)
  * @param array $options
  * @throws Exception
  */
 public static function setOptions(array $options)
 {
     if (isset($options['storage'])) {
         if ($options['storage'] instanceof Store_Interface) {
             static::$_storage = $options['storage'];
         } else {
             throw new Exception('invalid storage');
         }
     }
     if (isset($options['lifetime'])) {
         static::$_lifetime = intval($options['lifetime']);
     }
     if (isset($options['cleanupLimit'])) {
         static::$_cleanupLimit = intval($options['cleanupLimit']);
     }
 }
Esempio n. 2
0
 public static function getStorage()
 {
     if (static::$_storage === null) {
         static::$_storage = Storage::factory('ItemKOR', Config::get('path.itemkor'));
     }
     return static::$_storage;
 }
Esempio n. 3
0
	/**
	 * Initializes the session class.
	 *
	 * @return void
	 */
	public static function __init() {
		static::$_storage = static::$_classes['session'];
	}
Esempio n. 4
0
 protected static function initStorage()
 {
     if (static::$_storage === false) {
         $config = ArrayHelper::getValue(Yii::$app->params, 'mdm.logger.storage');
         if ($config === null || $config instanceof BaseStorage) {
             static::$_storage = $config;
         } else {
             static::$_storage = Yii::createObject($config);
         }
     }
 }