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  53c2915714915decb558928365455708698c7521 (commit)
      from  1c851724c48c51f0c655ff0e4cc98b00bcc59ebf (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=53c2915714915decb558928365455708698c7521

commit 53c2915714915decb558928365455708698c7521
Author: Franck Villaume <[email protected]>
Date:   Sun Jun 4 19:01:32 2017 +0200

    forge cli: more import functions

diff --git a/src/bin/forge b/src/bin/forge
index 8aa8e86..a612c42 100755
--- a/src/bin/forge
+++ b/src/bin/forge
@@ -638,9 +638,19 @@ class CliActions {
                                                                                
$ndocObject = document_get_object($ndocid);
                                                                                
foreach ($stream_file['associatedToArray'] as $associatedToElement) {
                                                                                
        if (isset($associatedToElement['Artifact']) && 
forge_get_config('use_tracker') && $new_group->usesTracker()) {
-                                                                               
                //TODO: compute it!
+                                                                               
                foreach ($associatedToElement['Artifact'] as $refatid) {
+                                                                               
                        foreach ($refatid as $refaid) {
+                                                                               
                                $nrefaid = $this->getMappingId($refaid, 
'artifact');
+                                                                               
                                $nrefartf = artifact_get_object($nrefaid);
+                                                                               
                                if (!$ndocObject->addAssociationTo($nrefartf)) {
+                                                                               
                                        echo 
$ndocObject->getErrorMessage()."\n";
+                                                                               
                                        db_rollback();
+                                                                               
                                        return false;
+                                                                               
                                }
+                                                                               
                        }
+                                                                               
                }
                                                                                
        }
-                                                                               
        if 
(isset($associatedToElement['Document'][$stream['setup']['data_array']['group_id']])
 && forge_get_config('use_docman') && $new_group->usesTracker() && 
is_array($associatedToElement['Document'][$stream['setup']['data_array']['group_id']]))
 {
+                                                                               
        if 
(isset($associatedToElement['Document'][$stream['setup']['data_array']['group_id']])
 && $new_group->usesTracker() && 
is_array($associatedToElement['Document'][$stream['setup']['data_array']['group_id']]))
 {
                                                                                
                foreach 
($associatedToElement['Document'][$stream['setup']['data_array']['group_id']] 
as $refdocid) {
                                                                                
                        $nrefdocid = $this->getMappingId($refdocid, 'document');
                                                                                
                        $nrefdocObject = document_get_object($nrefdocid);
@@ -660,6 +670,47 @@ class CliActions {
                                                        }
                                                }
                                        }
+                                       if (forge_get_config('use_tracker') && 
isset($stream['trackers']) && is_array($stream['trackers']) {
+                                               foreach ($stream['trackers'] as 
$stream_tracker) {
+                                                       if 
(isset($stream_tracker['data']) && is_array($stream_tracker['data'])) {
+                                                               foreach 
($stream_tracker['data'] as $stream_artifact) {
+                                                                       if 
(isset($stream_artifact['associatedToArray']) && 
is_array($stream_artifact['associatedToArray'])) {
+                                                                               
$nartfid = $this->getMappingId($stream_artifact['data_array']['artifact_id'], 
'artifact');
+                                                                               
$nartfObject = artifact_get_object($nartfid);
+                                                                               
foreach ($stream_file['associatedToArray'] as $associatedToElement) {
+                                                                               
        if (isset($associatedToElement['Artifact']) && 
$new_group->usesTracker()) {
+                                                                               
                foreach ($associatedToElement['Artifact'] as $refatid) {
+                                                                               
                        foreach ($refatid as $refaid) {
+                                                                               
                                $nrefaid = $this->getMappingId($refaid, 
'artifact');
+                                                                               
                                $nrefartf = artifact_get_object($nrefaid);
+                                                                               
                                if (!$nartfObject->addAssociationTo($nrefartf)) 
{
+                                                                               
                                        echo 
$nartfObject->getErrorMessage()."\n";
+                                                                               
                                        db_rollback();
+                                                                               
                                        return false;
+                                                                               
                                }
+                                                                               
                        }
+                                                                               
                }
+                                                                               
        }
+                                                                               
        if 
(isset($associatedToElement['Document'][$stream['setup']['data_array']['group_id']])
 && forge_get_config('use_docman') && $new_group->usesTracker() && 
is_array($associatedToElement['Document'][$stream['setup']['data_array']['group_id']]))
 {
+                                                                               
                foreach 
($associatedToElement['Document'][$stream['setup']['data_array']['group_id']] 
as $refdocid) {
+                                                                               
                        $nrefdocid = $this->getMappingId($refdocid, 'document');
+                                                                               
                        $nrefdocObject = document_get_object($nrefdocid);
+                                                                               
                        if (!$nartfObject->addAssociationTo($nrefdocObject)) {
+                                                                               
                                echo $nartfObject->getErrorMessage()."\n";
+                                                                               
                                db_rollback();
+                                                                               
                                return false;
+                                                                               
                        }
+                                                                               
                }
+                                                                               
        }
+                                                                               
        if (isset($associatedToElement['FRSRelease']) && 
forge_get_config('use_frs') && $new_group->usesFRS() && 
is_array($associatedToElement['FRSRelease'])) {
+                                                                               
                //TODO: compute it!
+                                                                               
        }
+                                                                               
}
+                                                                       }
+                                                               }
+                                                       }
+                                               }
+                                       }
                                }
                                //setup homepage
                                if (isset($stream['setup']['homepage'])) {
@@ -910,6 +961,16 @@ class CliActions {
                return $surveyDump;
        }
 
+       function surveyImport($file, $format = 'json') {
+               global $importRefMapping;
+               $stream = $this->loadFile($file, $format);
+               if (!$stream) {
+                       return false;
+               }
+               echo _('surveyImport to be implemented');
+               return true;
+       }
+
        function forumDump($fid, $format = 'json') {
                $forumDump['id'] = $fid;
                $forum = forum_get_object($fid);
@@ -924,6 +985,16 @@ class CliActions {
                return $forumDump;
        }
 
+       function forumImport($file, $format = 'json') {
+               global $importRefMapping;
+               $stream = $this->loadFile($file, $format);
+               if (!$stream) {
+                       return false;
+               }
+               echo _('forumImport to be implemented');
+               return true;
+       }
+
        function trackerDump($atid, $format = 'json') {
                $trackerDump['id'] = $atid;
                $at = artifactType_get_object($atid);
@@ -1130,9 +1201,10 @@ class CliActions {
                                $importData['nopermcheck'] = true;
                                $importData['nonotice'] = true;
                                $importData['time'] = $version['createdate'];
+                               $description = 
$this->parseStringForReference($version['description']);
                                if ($firstversion == true) {
                                        $d = new Document($group);
-                                       if (!$d->create($version['filename'], 
$filedatatype, $filedataname, $doc_group_id, $version['title'], 
$version['description'], $stream['data_array']['stateid'], 
$version['vcomment'], $importData)) {
+                                       if (!$d->create($version['filename'], 
$filedatatype, $filedataname, $doc_group_id, $version['title'], $description, 
$stream['data_array']['stateid'], $version['vcomment'], $importData)) {
                                                echo 
$version['filename'].':'.$d->getErrorMessage()."\n";
                                                db_rollback();
                                                return false;
@@ -1140,7 +1212,7 @@ class CliActions {
                                                $firstversion = false;
                                        }
                                } else {
-                                       if (!$d->update($version['filename'], 
$filedatatype, $filedataname, $doc_group_id, $version['title'], 
$version['description'], $stream['data_array']['stateid'], 0, 
$version['current_version'], 1, $importData, $version['vcomment'])) {
+                                       if (!$d->update($version['filename'], 
$filedatatype, $filedataname, $doc_group_id, $version['title'], $description, 
$stream['data_array']['stateid'], 0, $version['current_version'], 1, 
$importData, $version['vcomment'])) {
                                                echo 
$version['filename'].':'.$d->getErrorMessage()."\n";
                                                db_rollback();
                                                return false;
@@ -1552,6 +1624,16 @@ class CliActions {
                return $pmDump;
        }
 
+       function pmImport($file, $format = 'json') {
+               global $importRefMapping;
+               $stream = $this->loadFile($file, $format);
+               if (!$stream) {
+                       return false;
+               }
+               echo _('pmImport to be implemented');
+               return true;
+       }
+
        private function print_result($arrayDump, $format = 'json') {
                if (in_array($format, array('json', 'raw', 'return'))) {
                        $lformat = $format;

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

Summary of changes:
 src/bin/forge | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 86 insertions(+), 4 deletions(-)


hooks/post-receive
-- 
FusionForge

_______________________________________________
Fusionforge-commits mailing list
[email protected]
http://lists.fusionforge.org/cgi-bin/mailman/listinfo/fusionforge-commits

Reply via email to