public static function getHandle() { if (!self::$dbh) { $cfg = new \Hubzero\Config\Repository(); self::$dbh = new PDO('mysql:host=localhost;dbname=' . $cfg->get('db'), $cfg->get('user'), $cfg->get('password'), array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION)); } return self::$dbh; }
/** * Create a new file cache store instance. * * @param array $options * @return void */ public function __construct(array $options = array()) { $this->options = array_merge($this->options, $options); if (!isset($this->options['client'])) { $this->options['client'] = ''; } if (!isset($this->options['language'])) { $this->options['language'] = 'en-GB'; } if (!isset($this->options['hash'])) { $config = new \Hubzero\Config\Repository('site'); $this->options['hash'] = md5($config->get('secret')); } }
/** * Test to see if the cache storage is available. * * @return boolean True on success, false otherwise. */ public static function isAvailable() { $conf = new \Hubzero\Config\Repository('site'); return is_writable($conf->get('cache_path', PATH_APP . '/cache')); }