* Fix: Update tx_templavoila_ds fields on pages and tt_content too
authorChristian Opitz <christian.opitz@netresearch.de>
Wed, 5 Sep 2012 08:34:34 +0000 (08:34 +0000)
committerChristian Opitz <christian.opitz@netresearch.de>
Fri, 31 May 2013 13:22:24 +0000 (15:22 +0200)
provider/class.tvstaticds.php

index 3b55199..3407d29 100644 (file)
@@ -96,6 +96,12 @@ class tx_t3build_provider_tvstaticds extends tx_t3build_provider_abstract
 
     protected $staticDirs = array();
 
+    protected $updateColumns = array(
+        'tx_templavoila_tmplobj' => 'datastructure',
+        'pages' => array('tx_templavoila_ds', 'tx_templavoila_next_ds'),
+        'tt_content' => 'tx_templavoila_ds'
+    );
+
     public function tvstaticdsAction()
     {
         if (!t3lib_extMgm::isLoaded('templavoila')) {
@@ -134,11 +140,19 @@ class tx_t3build_provider_tvstaticds extends tx_t3build_provider_abstract
                 file_put_contents($path, $row['dataprot']);
             }
             if ($this->update) {
-                $this->db->exec_UPDATEquery(
-                       'tx_templavoila_tmplobj',
-                       'datastructure='.$row['uid'],
-                    array('datastructure' => $extRelPath.$file)
-                );
+                foreach ($this->updateColumns as $table => $columns) {
+                    foreach ((array) $columns as $column) {
+                        $this->_debug('Updating column '.$column.' on table '.$table);
+                        $res = $this->db->exec_UPDATEquery(
+                               $table,
+                               $column.'='.$row['uid'],
+                            array($column => $extRelPath.$file)
+                        );
+                        if (!$res) {
+                            $this->_die('Could not update '.$table.'.'.$column.' for ds '.$row['uid']);
+                        }
+                    }
+                }
             }
             if ($this->delete) {
                 $this->db->exec_UPDATEquery(