<?php
+
/////////////////////////////////////////////////////////////////
/// getID3() by James Heinrich <info@getid3.org> //
-// available at http://getid3.sourceforge.net //
-// or http://www.getid3.org //
-// also https://github.com/JamesHeinrich/getID3 //
-/////////////////////////////////////////////////////////////////
+// available at https://github.com/JamesHeinrich/getID3 //
+// or https://www.getid3.org //
+// or http://getid3.sourceforge.net //
// //
// extension.cache.mysql.php - part of getID3() //
// Please see readme.txt for more information //
class getID3_cached_mysql extends getID3
{
-
- // private vars
+ /**
+ * @var resource
+ */
private $cursor;
- private $connection;
+ /**
+ * @var resource
+ */
+ private $connection;
- // public: constructor - see top of this file for cache type and cache_options
+ /**
+ * @var string
+ */
+ private $table;
+
+
+ /**
+ * constructor - see top of this file for cache type and cache_options
+ *
+ * @param string $host
+ * @param string $database
+ * @param string $username
+ * @param string $password
+ * @param string $table
+ *
+ * @throws Exception
+ * @throws getid3_exception
+ */
public function __construct($host, $database, $username, $password, $table='getid3_cache') {
// Check for mysql support
- // public: clear cache
+ /**
+ * clear cache
+ */
public function clear_cache() {
$this->cursor = mysql_query('DELETE FROM `'.mysql_real_escape_string($this->table).'`', $this->connection);
- // public: analyze file
+ /**
+ * analyze file
+ *
+ * @param string $filename
+ * @param int $filesize
+ * @param string $original_filename
+ *
+ * @return mixed
+ */
public function analyze($filename, $filesize=null, $original_filename='') {
+ $filetime = 0;
if (file_exists($filename)) {
// Short-hands
- // private: (re)create sql table
+ /**
+ * (re)create sql table
+ *
+ * @param bool $drop
+ */
private function create_table($drop=false) {
$SQLquery = 'CREATE TABLE IF NOT EXISTS `'.mysql_real_escape_string($this->table).'` (';
$SQLquery .= ', `filetime` INT(11) NOT NULL DEFAULT \'0\'';
$SQLquery .= ', `analyzetime` INT(11) NOT NULL DEFAULT \'0\'';
$SQLquery .= ', `value` LONGTEXT NOT NULL';
- $SQLquery .= ', PRIMARY KEY (`filename`, `filesize`, `filetime`)) ENGINE=MyISAM CHARACTER SET=latin1 COLLATE=latin1_general_ci';
+ $SQLquery .= ', PRIMARY KEY (`filename`, `filesize`, `filetime`))';
$this->cursor = mysql_query($SQLquery, $this->connection);
echo mysql_error($this->connection);
}