Пример #1
0
 /**
  * @return string
  */
 public static function tmpPathNameRoot()
 {
     if (null === self::$m_tmpPathNameRoot) {
         self::$m_tmpPathNameRoot = sys_get_temp_dir() . DIRECTORY_SEPARATOR . Runtime::getInstanceNamespace() . DIRECTORY_SEPARATOR . date('YW');
     }
     return self::$m_tmpPathNameRoot;
 }
 /**
  * @see \Components\Persistence_Resource::driver() \Components\Persistence_Resource::driver()
  *
  * @return \MongoClient
  */
 public function driver()
 {
     if (null === $this->m_driver) {
         if (Boolean::valueIsTrue($this->m_uri->getQueryParam('isolate'))) {
             $this->m_isolated = true;
             $this->m_uri->removeQueryParam('isolate');
         }
         if ($this->m_uri->getHost()) {
             $this->m_databaseName = $this->m_uri->getPathParam(0);
             $this->m_connectionString = (string) $this->m_uri;
             $this->m_connectionOptions = [];
         } else {
             $this->m_databaseName = $this->m_uri->getFragment();
             $this->m_connectionString = "mongodb://{$this->m_uri->getPath()}";
             $this->m_connectionOptions = $this->m_uri->getQueryParams();
         }
         if ($this->m_isolated) {
             $this->m_databaseNameIsolated = $this->m_databaseName . '_' . Runtime::getInstanceNamespace();
         }
         if (0 !== Persistence::$debugMode & Persistence::BIT_LOG_STATEMENTS) {
             Log::debug('persistence/resource/mongodb', 'Connecting to database [%s].', $this);
         }
         $this->m_driver = new \MongoClient($this->m_connectionString, $this->m_connectionOptions);
     }
     return $this->m_driver;
 }