当前位置: 首页>>代码示例>>PHP>>正文


PHP getID3::__construct方法代码示例

本文整理汇总了PHP中getID3::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP getID3::__construct方法的具体用法?PHP getID3::__construct怎么用?PHP getID3::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在getID3的用法示例。


在下文中一共展示了getID3::__construct方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 /**
  * __construct()
  * @param string $table holds name of sqlite table
  * @return type
  */
 public function __construct($table = 'getid3_cache', $hide = false)
 {
     $this->table = $table;
     // Set table
     $file = dirname(__FILE__) . '/' . basename(__FILE__, 'php') . 'sqlite';
     if ($hide) {
         $file = dirname(__FILE__) . '/.ht.' . basename(__FILE__, 'php') . 'sqlite';
     }
     $this->db = new SQLite3($file);
     $db = $this->db;
     $this->create_table();
     // Create cache table if not exists
     $version = '';
     $sql = $this->version_check;
     $stmt = $db->prepare($sql);
     $stmt->bindValue(':filename', getID3::VERSION, SQLITE3_TEXT);
     $result = $stmt->execute();
     list($version) = $result->fetchArray();
     if ($version != getID3::VERSION) {
         // Check version number and clear cache if changed
         $this->clear_cache();
     }
     return parent::__construct();
 }
开发者ID:LGBGit,项目名称:tierno,代码行数:29,代码来源:extension.cache.sqlite3.php

示例2: __construct

 public function __construct($host, $database, $username, $password, $table = 'getid3_cache')
 {
     // Check for mysql support
     if (!function_exists('mysql_pconnect')) {
         throw new Exception('PHP not compiled with mysql support.');
     }
     // Connect to database
     $this->connection = mysql_pconnect($host, $username, $password);
     if (!$this->connection) {
         throw new Exception('mysql_pconnect() failed - check permissions and spelling.');
     }
     // Select database
     if (!mysql_select_db($database, $this->connection)) {
         throw new Exception('Cannot use database ' . $database);
     }
     // Set table
     $this->table = $table;
     // Create cache table if not exists
     $this->create_table();
     // Check version number and clear cache if changed
     $version = '';
     $SQLquery = 'SELECT `value`';
     $SQLquery .= ' FROM `' . mysql_real_escape_string($this->table) . '`';
     $SQLquery .= ' WHERE (`filename` = \'' . mysql_real_escape_string(getID3::VERSION) . '\')';
     $SQLquery .= ' AND (`filesize` = -1)';
     $SQLquery .= ' AND (`filetime` = -1)';
     $SQLquery .= ' AND (`analyzetime` = -1)';
     if ($this->cursor = mysql_query($SQLquery, $this->connection)) {
         list($version) = mysql_fetch_array($this->cursor);
     }
     if ($version != getID3::VERSION) {
         $this->clear_cache();
     }
     parent::__construct();
 }
开发者ID:glauberm,项目名称:cinevi,代码行数:35,代码来源:extension.cache.mysql.php

示例3: __construct

 public function __construct($host, $database, $username, $password)
 {
     // Check for mysql support
     if (!function_exists('mysql_pconnect')) {
         throw new getid3_exception('PHP not compiled with mysql support.');
     }
     // Connect to database
     $this->connection = @mysql_pconnect($host, $username, $password);
     if (!$this->connection) {
         throw new getid3_exception('mysql_pconnect() failed - check permissions and spelling.');
     }
     // Select database
     if (!@mysql_select_db($database, $this->connection)) {
         throw new getid3_exception('Cannot use database ' . $database);
     }
     // Create cache table if not exists
     $this->create_table();
     // Check version number and clear cache if changed
     $this->cursor = mysql_query("SELECT `value` FROM `getid3_cache` WHERE (`filename` = '" . getid3::VERSION . "') AND (`filesize` = '-1') AND (`filetime` = '-1') AND (`analyzetime` = '-1')", $this->connection);
     list($version) = @mysql_fetch_array($this->cursor);
     if ($version != getid3::VERSION) {
         $this->clear_cache();
     }
     parent::__construct();
 }
开发者ID:JPisaBrony,项目名称:SonicFlow,代码行数:25,代码来源:extension.cache.mysql.php

示例4: getID3_cached_dbm

 public function getID3_cached_dbm($cache_type, $dbm_filename, $lock_filename)
 {
     // Check for dba extension
     if (!extension_loaded('dba')) {
         throw new Exception('PHP is not compiled with dba support, required to use DBM style cache.');
     }
     // Check for specific dba driver
     if (!function_exists('dba_handlers') || !in_array($cache_type, dba_handlers())) {
         throw new Exception('PHP is not compiled --with ' . $cache_type . ' support, required to use DBM style cache.');
     }
     // Create lock file if needed
     if (!file_exists($lock_filename)) {
         if (!touch($lock_filename)) {
             throw new Exception('failed to create lock file: ' . $lock_filename);
         }
     }
     // Open lock file for writing
     if (!is_writeable($lock_filename)) {
         throw new Exception('lock file: ' . $lock_filename . ' is not writable');
     }
     $this->lock = fopen($lock_filename, 'w');
     // Acquire exclusive write lock to lock file
     flock($this->lock, LOCK_EX);
     // Create dbm-file if needed
     if (!file_exists($dbm_filename)) {
         if (!touch($dbm_filename)) {
             throw new Exception('failed to create dbm file: ' . $dbm_filename);
         }
     }
     // Try to open dbm file for writing
     $this->dba = dba_open($dbm_filename, 'w', $cache_type);
     if (!$this->dba) {
         // Failed - create new dbm file
         $this->dba = dba_open($dbm_filename, 'n', $cache_type);
         if (!$this->dba) {
             throw new Exception('failed to create dbm file: ' . $dbm_filename);
         }
         // Insert getID3 version number
         dba_insert(getID3::VERSION, getID3::VERSION, $this->dba);
     }
     // Init misc values
     $this->cache_type = $cache_type;
     $this->dbm_filename = $dbm_filename;
     // Register destructor
     register_shutdown_function(array($this, '__destruct'));
     // Check version number and clear cache if changed
     if (dba_fetch(getID3::VERSION, $this->dba) != getID3::VERSION) {
         $this->clear_cache();
     }
     parent::__construct();
 }
开发者ID:anandsrijan,项目名称:mahariya-001,代码行数:51,代码来源:extension.cache.dbm.php


注:本文中的getID3::__construct方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。