[SPIP] v3.2.1-->v3.2.3
[lhc/web/www.git] / www / plugins-dist / medias / lib / getid3 / extension.cache.dbm.php
index a9332b9..2d72d95 100644 (file)
@@ -1,10 +1,10 @@
 <?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.dbm.php - part of getID3()                  //
 // Please see readme.txt for more information                  //
 
 class getID3_cached_dbm extends getID3
 {
-
-       // public: constructor - see top of this file for cache type and cache_options
+       /**
+        * @var resource
+        */
+       private $dba;
+
+       /**
+        * @var resource|bool
+        */
+       private $lock;
+
+       /**
+        * @var string
+        */
+       private $cache_type;
+
+       /**
+        * @var string
+        */
+       private $dbm_filename;
+
+       /**
+        * constructor - see top of this file for cache type and cache_options
+        *
+        * @param string $cache_type
+        * @param string $dbm_filename
+        * @param string $lock_filename
+        *
+        * @throws Exception
+        * @throws getid3_exception
+        */
        public function __construct($cache_type, $dbm_filename, $lock_filename) {
 
                // Check for dba extension
@@ -141,7 +169,9 @@ class getID3_cached_dbm extends getID3
 
 
 
-       // public: destructor
+       /**
+        * destructor
+        */
        public function __destruct() {
 
                // Close dbm file
@@ -156,7 +186,11 @@ class getID3_cached_dbm extends getID3
 
 
 
-       // public: clear cache
+       /**
+        * clear cache
+        *
+        * @throws Exception
+        */
        public function clear_cache() {
 
                // Close dbm file
@@ -178,8 +212,16 @@ class getID3_cached_dbm extends getID3
 
 
 
-       // public: analyze file
-       public function analyze($filename) {
+       /**
+        * clear cache
+        *
+        * @param string $filename
+        * @param int    $filesize
+        * @param string $original_filename
+        *
+        * @return mixed
+        */
+       public function analyze($filename, $filesize=null, $original_filename='') {
 
                if (file_exists($filename)) {
 
@@ -199,7 +241,7 @@ class getID3_cached_dbm extends getID3
                $result = parent::analyze($filename);
 
                // Save result
-               if (file_exists($filename)) {
+               if (isset($key) && file_exists($filename)) {
                        dba_insert($key, serialize($result), $this->dba);
                }