[Fusionforge-commits] FusionForge branch master updated. 6.0.4-488-gf2e87c2

Franck Villaume nerville at libremir.placard.fr.eu.org
Sun Jun 5 21:06:29 CEST 2016


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "FusionForge".

The branch, master has been updated
       via  f2e87c26dd59136e307886721912a4a97f80da82 (commit)
       via  342c31b6a96246293cd56cc4e41b15d4436a581c (commit)
       via  e6e526e50906a28e6e84bc9c2ce577a4c9d93eb1 (commit)
       via  61ad2691e532124b0f10831fc04145e4eb40e3d0 (commit)
      from  18c6ed2d52d4d3d7254b0fa1a1a7c9b07a3edad8 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=f2e87c26dd59136e307886721912a4a97f80da82

commit f2e87c26dd59136e307886721912a4a97f80da82
Merge: 61ad269 342c31b
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Sun Jun 5 21:04:08 2016 +0200

    Merge branch '6.0'


https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=61ad2691e532124b0f10831fc04145e4eb40e3d0

commit 61ad2691e532124b0f10831fc04145e4eb40e3d0
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Sun Jun 5 17:49:20 2016 +0200

    docman: fix delete with multiple versions.

diff --git a/src/common/docman/Document.class.php b/src/common/docman/Document.class.php
index 7a00106..aeb8d1f 100644
--- a/src/common/docman/Document.class.php
+++ b/src/common/docman/Document.class.php
@@ -1023,6 +1023,9 @@ class Document extends FFError {
 			return false;
 		}
 
+		db_begin();
+		$dvf = new DocumentVersionFactory($this);
+		$serialids = $dvf->getSerialIDs();
 		$result = db_query_params('DELETE FROM doc_data WHERE docid=$1',
 						array($this->getID()));
 		if (!$result) {
@@ -1030,8 +1033,11 @@ class Document extends FFError {
 			db_rollback();
 			return false;
 		}
-
-		DocumentStorage::instance()->delete($this->getID())->commit();
+		db_commit();
+		
+		foreach ($serialids as $serialid) {
+			DocumentStorage::instance()->delete($serialid)->commit();
+		}
 
 		/** we should be able to send a notice that this doc has been deleted .... but we need to rewrite sendNotice
 		 * $this->sendNotice(false);
diff --git a/src/common/docman/DocumentVersionFactory.class.php b/src/common/docman/DocumentVersionFactory.class.php
index e28d8f6..e06b698 100644
--- a/src/common/docman/DocumentVersionFactory.class.php
+++ b/src/common/docman/DocumentVersionFactory.class.php
@@ -98,4 +98,15 @@ class DocumentVersionFactory extends FFError {
 		db_free_result($res);
 		return $versions;
 	}
+
+	function getSerialIDs() {
+		$serialids = array();
+		$res = db_query_params('SELECT serial_id FROM doc_data_version WHERE docid = $1', array($this->Document->getID()));
+		if ($res) {
+			while ($arr = db_fetch_array($res)) {
+				$serialids[] = $arr[0];
+			}
+		}
+		return $serialids;
+	}
 }

-----------------------------------------------------------------------

Summary of changes:
 src/common/docman/Document.class.php               | 10 ++++++++--
 src/common/docman/DocumentVersionFactory.class.php | 11 +++++++++++
 2 files changed, 19 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
FusionForge



More information about the Fusionforge-commits mailing list