issue82, read out F-Spot DB version to differ between different databases schemas
authorAndreas Unterkircher <unki@netshadow.at>
Sun, 30 Dec 2007 10:17:16 +0000 (11:17 +0100)
committerAndreas Unterkircher <unki@netshadow.at>
Sun, 30 Dec 2007 10:17:16 +0000 (11:17 +0100)
phpfspot.class.php
phpfspot_db.php
themes/default/templates/credits.tpl

index e2b24a861b6296589511f8487c05c112e1af721f..6d357e5ad155902320f42b722de050868df2a744 100644 (file)
@@ -32,6 +32,7 @@ class PHPFSPOT {
    var $tmpl;
    var $tags;
    var $avail_tags;
    var $tmpl;
    var $tags;
    var $avail_tags;
+   private $dbver;
 
    /**
     * class constructor
 
    /**
     * class constructor
@@ -58,7 +59,9 @@ class PHPFSPOT {
          print $this->cfg->fspot_db ." is not writeable for user ". $this->getuid() ."\n";
          exit(1);
       }
          print $this->cfg->fspot_db ." is not writeable for user ". $this->getuid() ."\n";
          exit(1);
       }
-      
+
+      $this->dbver = $this->getFspotDBVersion();
+
       if(!is_writeable(dirname($this->cfg->phpfspot_db))) {
          print dirname($this->cfg->phpfspot_db) .": directory is not writeable!";
          exit(1);
       if(!is_writeable(dirname($this->cfg->phpfspot_db))) {
          print dirname($this->cfg->phpfspot_db) .": directory is not writeable!";
          exit(1);
@@ -1051,6 +1054,7 @@ class PHPFSPOT {
    {
       $this->tmpl->assign('version', $this->cfg->version);
       $this->tmpl->assign('product', $this->cfg->product);
    {
       $this->tmpl->assign('version', $this->cfg->version);
       $this->tmpl->assign('product', $this->cfg->product);
+      $this->tmpl->assign('db_version', $this->dbver);
       $this->tmpl->show("credits.tpl");
 
    } // showCredits()
       $this->tmpl->show("credits.tpl");
 
    } // showCredits()
@@ -2102,6 +2106,26 @@ class PHPFSPOT {
 
    } // checkDbIndices()
 
 
    } // checkDbIndices()
 
-}
+   /**
+    * retrive F-Spot database version
+    *
+    * this function will return the F-Spot database version number
+    * It is stored within the sqlite3 database in the table meta
+    */
+   public function getFspotDBVersion()
+   {
+      if($result = $this->db->db_fetchSingleRow("
+         SELECT data as version
+         FROM meta
+         WHERE
+            name LIKE 'F-Spot Database Version'
+      "))
+         return $result['version'];
+
+      return null;
+
+   } // getFspotDBVersion()
+
+} // class PHPFSPOT
 
 ?>
 
 ?>
index 4e87cf9c87927978eb2ed671d7554cc5e2fe5458..e9c99ce62ad906e5345a154c275f1d5d6959bd59 100644 (file)
@@ -202,7 +202,7 @@ class PHPFSPOT_DB {
          $result = $this->db_query($query);
          switch($this->parent->cfg->db_access) {
             case 'native':
          $result = $this->db_query($query);
          switch($this->parent->cfg->db_access) {
             case 'native':
-               $row = $result->fetchRow();
+               $row = $this->db_fetch_object($result);
                break;
             case 'pdo':
                $row = $result[0];
                break;
             case 'pdo':
                $row = $result[0];
index becdeefd0040480c5d61586c1d0eaff592b60c05..cb01edb44941c7af48aa9e55f3fc236b9f15f184 100644 (file)
@@ -17,6 +17,8 @@
       <a href="http://wiki.bluga.net/HTML_AJAX/HomePage">HTML_AJAX</a>
       <hr />
       PHP tag-cloud code by <a href="http://prism-perfect.net/archive/php-tag-cloud-tutorial/">Jenny Ferenc</a>.
       <a href="http://wiki.bluga.net/HTML_AJAX/HomePage">HTML_AJAX</a>
       <hr />
       PHP tag-cloud code by <a href="http://prism-perfect.net/archive/php-tag-cloud-tutorial/">Jenny Ferenc</a>.
+      <hr />
+      F-Spot database version: {$db_version}
      </td>
     </tr>
    </table>
      </td>
     </tr>
    </table>