Older F-Spot database versions are not compatible with new
authorAndreas Unterkircher <unki@netshadow.at>
Sat, 20 Sep 2008 09:48:04 +0000 (11:48 +0200)
committerAndreas Unterkircher <unki@netshadow.at>
Thu, 16 Oct 2008 17:55:14 +0000 (19:55 +0200)
versioning-code. Now on all F-Spot databases before version
9, phpfspot will not cover versioning-topics at all.
fixes #76

Signed-off-by: Andreas Unterkircher <unki@netshadow.at>
phpfspot.class.php

index 11b5292858cc177c443c5a0174cfbeaea6e4ad1b..4acb6473563bd45bd51900364c6f712494d7faa4 100644 (file)
@@ -533,24 +533,24 @@ class PHPFSPOT {
          if(!isset($version_idx) || !$this->is_valid_version($idx, $version_idx))
             $version_idx = $this->get_latest_version($idx);
 
          if(!isset($version_idx) || !$this->is_valid_version($idx, $version_idx))
             $version_idx = $this->get_latest_version($idx);
 
-         /* if an alternative version has been requested */
-         if($version_idx > 0) {
-
+         /* if an alternative version has been requested. But we
+            support this only for F-Spot database versions from
+            v9.
+         */
+         if($version_idx > 0 && $this->dbver >= 9) {
             /* check for alternative versions */
             if($version = $this->db->db_fetchSingleRow("
             /* check for alternative versions */
             if($version = $this->db->db_fetchSingleRow("
-                  SELECT
-                     version_id, name, uri
-                  FROM
-                     photo_versions
-                  WHERE
-                     photo_id LIKE '". $idx ."'
-                  AND
-                     version_id LIKE '". $version_idx ."'
-            ")) {
+               SELECT
+                  version_id, name, uri
+               FROM
+                  photo_versions
+               WHERE
+                  photo_id LIKE '". $idx ."'
+               AND
+                  version_id LIKE '". $version_idx ."'")) {
 
                $row['name'] = $version['name'];
                $row['uri'] = $version['uri'];
 
                $row['name'] = $version['name'];
                $row['uri'] = $version['uri'];
-
             }
          }
 
             }
          }