Example #1
0
 /**
  * Instanciate a PDO-based backend from a t41_Backend_Uri object 
  *
  * @param t41_Backend_Uri $uri
  * @param string $alias
  * @throws t41_Backend_Exception
  */
 public function __construct(Backend\BackendUri $uri, $alias = null)
 {
     if (!extension_loaded('ldap')) {
         throw new Exception(array("BACKEND_REQUIRED_EXT", 'ldap'));
     }
     parent::__construct($uri, $alias);
     $this->_baseDN = $uri->getUrl();
 }
Example #2
0
 /**
  * Instanciate a PDO-based backend from a t41_Backend_Uri object 
  *
  * @param \t41\Backed\BackendUri $uri
  * @param string $alias
  * @throws \t41\Backend\Adapter\Exception
  */
 public function __construct(Backend\BackendUri $uri, $alias = null)
 {
     parent::__construct($uri, $alias);
     $url = explode('/', $uri->getUrl());
     if (isset($url[0])) {
         $this->_database = $url[0];
     } else {
         require_once 't41/Backend/Exception.php';
         throw new Exception('BACKEND_MISSING_DBNAME_PARAM');
     }
     if (isset($url[1])) {
         $this->_table = $url[1];
     }
 }
Example #3
0
 /**
  * Instanciate a XML backend from a t41_Backend_Uri object 
  *
  * @param t41_Backend_Uri $uri
  * @param string $alias
  * @throws t41_Backend_Exception
  */
 public function __construct(Backend\BackendUri $uri, $alias = null)
 {
     parent::__construct($uri, $alias);
     if ($this->_uri->getUrl()) {
         $this->_path = $this->_uri->getUrl();
         $this->_path = str_replace('{basepath}', t41\Core::$basePath, $this->_path);
         if (substr($this->_path, -1) != DIRECTORY_SEPARATOR) {
             $this->_path .= DIRECTORY_SEPARATOR;
         }
     } else {
         throw new Exception('BACKEND_MISSING_PATH_PARAM');
     }
     if (!is_readable($this->_path)) {
         throw new Exception(array('BACKEND_PATH_UNREADABLE', $this->_path));
     }
     if (!is_writable($this->_path)) {
         throw new Exception(array('BACKEND_PATH_UNWRITABLE', $this->_path));
     }
 }
Example #4
0
 protected function _setLastQuery($literal, $data = null, $context = null)
 {
     return parent::_setLastQuery($literal, $data, array('db' => $this->_database, 'collection' => $this->_collection));
 }
Example #5
0
 /**
  * Initialiser un backend à partir d'une Uri
  *
  * @param t41_Backend_Uri $uri
  * @param string $alias
  */
 public function __construct(Backend\BackendUri $uri, $alias = null)
 {
     parent::__construct($uri, $alias);
 }