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  70dcd9be0e68ec0283f7482ad1bdc2fdb698150d (commit)
       via  1b29988dac24a9101515eede951060a4d3804d4d (commit)
      from  f32411210c99bca44152f838255daa869395da8e (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=70dcd9be0e68ec0283f7482ad1bdc2fdb698150d

commit 70dcd9be0e68ec0283f7482ad1bdc2fdb698150d
Author: Franck Villaume <[email protected]>
Date:   Mon May 1 14:15:25 2017 +0200

    forge cli: trackerImport supports artifactImport, artifactImport supports 
attachments

diff --git a/src/bin/forge b/src/bin/forge
index b50ecff..f980717 100755
--- a/src/bin/forge
+++ b/src/bin/forge
@@ -243,7 +243,7 @@ class CliActions {
                if (!$stream) {
                        return false;
                }
-               $group_artifact_id = 
$this->getMappingId($stream['data_array']['group_artifact_id'], 'tracker');
+               $group_artifact_id = 
$this->getMappingId($stream['data_array']['group_artifact_id'], 
'artifact_type');
                $at = artifactType_get_object($group_artifact_id);
                if ($at && is_object($at) && !$at->isError()) {
                        db_begin();
@@ -268,8 +268,30 @@ class CliActions {
                                db_rollback();
                                return false;
                        }
-                       db_commit();
                        
$importRefMapping['artifact'][$stream['data_array']['artifact_id']] = 
$artf->getID();
+                       if (isset($stream['files']) && 
is_array($stream['files'])) {
+                               $path = getcwd();
+                               foreach ($stream['files'] as $file) {
+                                       if (isset($file['storageref']) && 
is_file($path.'/'.$file['storageref'])) {
+                                               $filedataname = 
$path.'/'.$file['storageref'];
+                                               if 
(function_exists('finfo_open')) {
+                                                       $finfo = 
finfo_open(FILEINFO_MIME_TYPE);
+                                                       $filedatatype = 
finfo_file($finfo, $filedataname);
+                                               } else {
+                                                       $filedatatype = 
$file['data_array']['filetype'];
+                                               }
+                                               $af = new ArtifactFile($artf);
+                                               $importFileData['user'] = 
$this->getMappingId($file['data_array']['submitted_by'], 'user');
+                                               $importFileData['time'] = 
$file['data_array']['adddate'];
+                                               if 
(!$af->create($file['data_array']['filename'], $filedatatype, 
$file['data_array']['filesize'], $filedataname, 
$file['data_array']['description'], $importData)) {
+                                                       echo 
$af->getErrorMessage()."\n";
+                                                       db_rollback();
+                                                       return false;
+                                               }
+                                       }
+                               }
+                       }
+                       db_commit();
                        echo _('Artifact injected')."\n";
                        return true;
                } else {
@@ -409,6 +431,7 @@ class CliActions {
                                db_rollback();
                                return false;
                        }
+                       
$importRefMapping['artifact_type'][$stream['setup']['group_artifact_id']] = 
$at->getID();
                        if (isset($stream['setup']['extra_fields']) && 
is_array($stream['setup']['extra_fields'])) {
                                foreach ($stream['setup']['extra_fields'] as 
$extra_field) {
                                        $ef = new ArtifactExtraField($at);
@@ -444,8 +467,19 @@ class CliActions {
                                        }
                                }
                        }
+                       if (isset($stream['data']) && 
is_array($stream['data'])) {
+                               foreach ($stream['data'] as $n_artifact) {
+                                       $filename = 
'artifactDump-'.$n_artifact['data_array']['artifact_id'].'.'.$format;
+                                       $this->createSubfile($filename, 
$n_artifact, $format);
+                                       if (!$this->artifactImport($filename, 
$format)) {
+                                               echo _('Unable to inject child 
artifact')."\n";
+                                               db_rollback();
+                                               return false;
+                                       }
+                                       @unlink($filename);
+                               }
+                       }
                        db_commit();
-                       
$importRefMapping['artifact_type'][$stream['setup']['group_artifact_id']] = 
$at->getID();
                        echo _('Tracker injected')."\n";
                        return true;
                } else {

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

commit 1b29988dac24a9101515eede951060a4d3804d4d
Author: Franck Villaume <[email protected]>
Date:   Mon May 1 14:13:52 2017 +0200

    space & translation

diff --git a/src/common/tracker/ArtifactFile.class.php 
b/src/common/tracker/ArtifactFile.class.php
index 236aa32..01c261b 100644
--- a/src/common/tracker/ArtifactFile.class.php
+++ b/src/common/tracker/ArtifactFile.class.php
@@ -32,7 +32,7 @@ require_once $gfcommon.'include/FFError.class.php';
 * @param       array|bool      $data                   The result array, if 
it's passed in
 * @return      Artifact        object
 */
-function &artifactfile_get_object($artifact_file_id,$data=false) {
+function &artifactfile_get_object($artifact_file_id, $data = false) {
        global $ARTIFACTFILE_OBJ;
        if (!isset($ARTIFACTFILE_OBJ["_".$artifact_file_id."_"])) {
                if ($data) {
@@ -47,7 +47,7 @@ function 
&artifactfile_get_object($artifact_file_id,$data=false) {
                        $data = db_fetch_array($res);
                }
                $Artifact =& artifact_get_object($data["artifact_id"]);
-               $ARTIFACTFILE_OBJ["_".$artifact_file_id."_"]= new 
ArtifactFile($Artifact,$data);
+               $ARTIFACTFILE_OBJ["_".$artifact_file_id."_"] = new 
ArtifactFile($Artifact,$data);
        }
        return $ARTIFACTFILE_OBJ["_".$artifact_file_id."_"];
 }
@@ -73,17 +73,17 @@ class ArtifactFile extends FFError {
         * @param       Artifact        $Artifact       The Artifact object.
         * @param       array|bool      $data           (all fields from 
artifact_file_user_vw) OR id from database.
         */
-       function __construct(&$Artifact, $data=false) {
+       function __construct(&$Artifact, $data = false) {
                parent::__construct();
 
                // Was Artifact legit?
                if (!$Artifact || !is_object($Artifact)) {
-                       $this->setError('ArtifactFile: No Valid Artifact');
+                       $this->setError('ArtifactFile'._(': ')._('No Valid 
Artifact'));
                        return;
                }
-               // Did ArtifactType have an error?
+               // Did Artifact have an error?
                if ($Artifact->isError()) {
-                       $this->setError('ArtifactFile: 
'.$Artifact->getErrorMessage());
+                       $this->setError('ArtifactFile'._(': 
').$Artifact->getErrorMessage());
                        return;
                }
                $this->Artifact =& $Artifact;
@@ -109,7 +109,7 @@ class ArtifactFile extends FFError {
         *                                              array('user' => 127, 
'time' => 1234556789)
         * @return      int|bool                Identifier on success / false 
on failure.
         */
-       function create($filename, $filetype, $filesize, $file, 
$description='None', $importData = array()) {
+       function create($filename, $filetype, $filesize, $file, $description = 
'None', $importData = array()) {
                // Some browsers don't supply mime type if they don't know it
                if (!$filetype) {
                        // Let's be on safe side?
@@ -121,7 +121,7 @@ class ArtifactFile extends FFError {
                //
                if (!$filename || !$filetype || !$filesize || !$file) {
                        //echo 
'<p>|'.$filename.'|'.$filetype.'|'.$filesize.'|'.$file.'|';
-                       $this->setError(_('ArtifactFile: File, name, type, size 
are required'));
+                       $this->setError(_('ArtifactFile')._(': ')._('File, 
name, type, size are required'));
                        return false;
                }
 
@@ -129,9 +129,9 @@ class ArtifactFile extends FFError {
                        $user_id = $importData['user'];
                } else {
                        if (session_loggedin()) {
-                               $user_id=user_getid();
+                               $user_id = user_getid();
                        } else {
-                               $user_id=100;
+                               $user_id = 100;
                        }
                }
 
@@ -153,9 +153,9 @@ class ArtifactFile extends FFError {
                                               $filesize,
                                               $filetype,
                                               $time,
-                                              $user_id)) ;
+                                              $user_id));
 
-               $id=db_insertid($res,'artifact_file','id');
+               $id = db_insertid($res, 'artifact_file', 'id');
 
                ArtifactStorage::instance()->store($id, $file);
 
@@ -177,7 +177,7 @@ class ArtifactFile extends FFError {
 
                        // If time is set, no need to add to history, will be 
done in batch
                        if (!array_key_exists('time', $importData)){
-                               $this->Artifact->addHistory('File Added',$id.': 
'.$filename);
+                               $this->Artifact->addHistory(_('File 
Added'),$id._(': ').$filename);
                        }
                        $this->Artifact->updateLastModified();
                        $this->clearError();
@@ -191,19 +191,18 @@ class ArtifactFile extends FFError {
         * @return      boolean success.
         */
        function delete() {
-               if (!forge_check_perm ('tracker', 
$this->Artifact->ArtifactType->getID(), 'tech')) {
+               if (!forge_check_perm('tracker', 
$this->Artifact->ArtifactType->getID(), 'tech')) {
                        $this->setPermissionDeniedError();
                        return false;
                }
                $res = db_query_params ('DELETE FROM artifact_file WHERE id=$1',
                                        array ($this->getID())) ;
                if (!$res || db_affected_rows($res) < 1) {
-                       $this->setError('ArtifactFile: Unable to Delete');
+                       $this->setError('ArtifactFile'._(': ')._('Unable to 
Delete'));
                        return false;
                } else {
                        
ArtifactStorage::instance()->delete($this->getID())->commit();
-
-                       $this->Artifact->addHistory('File 
Deleted',$this->getID().': '.$this->getName());
+                       $this->Artifact->addHistory(_('File Deleted'), 
$this->getID()._(': ').$this->getName());
                        return true;
                }
        }
@@ -218,7 +217,7 @@ class ArtifactFile extends FFError {
                $res = db_query_params ('SELECT * FROM artifact_file_user_vw 
WHERE id=$1',
                                        array ($id)) ;
                if (!$res || db_numrows($res) < 1) {
-                       $this->setError('ArtifactFile: Invalid ArtifactFile 
ID');
+                       $this->setError('ArtifactFile'._(': ')._('Invalid 
ArtifactFile ID'));
                        return false;
                }
                $this->data_array = db_fetch_array($res);

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

Summary of changes:
 src/bin/forge                             | 40 ++++++++++++++++++++++++++++---
 src/common/tracker/ArtifactFile.class.php | 35 +++++++++++++--------------
 2 files changed, 54 insertions(+), 21 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