Esempio n. 1
0
 protected function _initialize(KConfig $config)
 {
     $db = KFactory::get('lib.joomla.database');
     $resource = method_exists($db, 'getConnection') ? $db->getConnection() : $db->_resource;
     $prefix = method_exists($db, 'getPrefix') ? $db->getPrefix() : $db->_table_prefix;
     $config->append(array('connection' => $resource, 'table_prefix' => $prefix));
     parent::_initialize($config);
 }
Esempio n. 2
0
 /**
  * Retrieves the table schema information about the given table
  *
  * This function try to get the table schema from the cache. If it cannot be found the table schema will be
  * retrieved from the database and stored in the cache.
  *
  * @param   string  $table A table name or a list of table names
  * @return  KDatabaseSchemaTable
  */
 public function getTableSchema($table)
 {
     if (!isset($this->_table_schema[$table]) && isset($this->_cache)) {
         $identifier = md5($this->getDatabase() . $table);
         if (!($schema = $this->_cache->get($identifier))) {
             $schema = parent::getTableSchema($table);
             //Store the object in the cache
             $this->_cache->store(serialize($schema), $identifier);
         } else {
             $schema = unserialize($schema);
         }
         $this->_table_schema[$table] = $schema;
     }
     return parent::getTableSchema($table);
 }