[SPIP] v3.2.1-->v3.2.3
[lhc/web/www.git] / www / plugins-dist / medias / lib / getid3 / extension.cache.mysqli.php
index 3299caa..44ea694 100644 (file)
@@ -1,14 +1,14 @@
 <?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.mysqli.php - part of getID3()                //
+// extension.cache.mysqli.php - part of getID3()               //
 // Please see readme.txt for more information                  //
-//                                                            ///
+//                                                             //
 /////////////////////////////////////////////////////////////////
 //                                                             //
 // This extension written by Allan Hansen <ahØartemis*dk>      //
 
 class getID3_cached_mysqli extends getID3
 {
-       // private vars
+       /**
+        * @var mysqli
+        */
        private $mysqli;
-       private $cursor;
 
+       /**
+        * @var mysqli_result
+        */
+       private $cursor;
 
-       // 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 mysqli support
@@ -121,16 +143,27 @@ class getID3_cached_mysqli extends getID3
        }
 
 
-       // public: clear cache
+       /**
+        * clear cache
+        */
        public function clear_cache() {
                $this->mysqli->query('DELETE FROM `'.$this->mysqli->real_escape_string($this->table).'`');
                $this->mysqli->query('INSERT INTO `'.$this->mysqli->real_escape_string($this->table).'` (`filename`, `filesize`, `filetime`, `analyzetime`, `value`) VALUES (\''.getID3::VERSION.'\', -1, -1, -1, \''.getID3::VERSION.'\')');
        }
 
 
-       // 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
@@ -168,7 +201,11 @@ class getID3_cached_mysqli extends getID3
        }
 
 
-       // private: (re)create mysqli table
+       /**
+        * (re)create mysqli table
+        *
+        * @param bool $drop
+        */
        private function create_table($drop=false) {
                $SQLquery  = 'CREATE TABLE IF NOT EXISTS `'.$this->mysqli->real_escape_string($this->table).'` (';
                $SQLquery .=   '`filename` VARCHAR(990) NOT NULL DEFAULT \'\'';
@@ -176,8 +213,8 @@ class getID3_cached_mysqli extends getID3
                $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 = $this->mysqli->query($SQLquery);
                echo $this->mysqli->error;
        }
-}
\ No newline at end of file
+}