[LON-CAPA-cvs] cvs: loncom /imspackages imsprocessor.pm

raeburn lon-capa-cvs-allow@mail.lon-capa.org
Sat, 23 Aug 2008 21:08:29 -0000


raeburn		Sat Aug 23 17:08:29 2008 EDT

  Modified files:              
    /loncom/imspackages	imsprocessor.pm 
  Log:
  - Keep count of files renamed to report as files copied when reporting results of IMS import into CSTR. 
  
  
Index: loncom/imspackages/imsprocessor.pm
diff -u loncom/imspackages/imsprocessor.pm:1.42 loncom/imspackages/imsprocessor.pm:1.43
--- loncom/imspackages/imsprocessor.pm:1.42	Sat Aug 23 13:47:44 2008
+++ loncom/imspackages/imsprocessor.pm	Sat Aug 23 17:08:29 2008
@@ -409,7 +409,7 @@
 }
 
 sub copy_resources {
-    my ($context,$cms,$hrefs,$tempdir,$targets,$url,$crs,$cdom,$destdir,$timenow,$assessmentfiles) = @_;
+    my ($context,$cms,$hrefs,$tempdir,$targets,$url,$crs,$cdom,$destdir,$timenow,$assessmentfiles,$total) = @_;
     if ($context eq 'DOCS') {
         foreach my $key (sort keys %{$hrefs}) {
             if (grep/^$key$/,@{$targets}) {
@@ -472,7 +472,11 @@
                         } elsif ($cms eq 'bb5' || $cms eq 'bb6') {
                             $renameres = rename("$tempdir/$key/$file","$destdir/resfiles/$key/$file");
                         }
-                        if (!$renameres) {
+                        if ($renameres) {
+                            if (ref($total) eq 'HASH') {
+                                $$total{'file'} ++;
+                            }
+                        } else {
                             &Apache::lonnet::logthis("IMS import error: $cms - renaming failed for file $file");
                         }
                     } elsif ($cms eq 'webctce4') {
@@ -491,7 +495,11 @@
                             }
                             if (-e "$tempdir/$file") {
                                 my $renameres = rename("$tempdir/$file","$destdir/resfiles/$copyfile");
-                                if (!$renameres) {
+                                if ($renameres) {
+                                    if (ref($total) eq 'HASH') {
+                                        $$total{'file'} ++;
+                                    }
+                                } else {
                                     &Apache::lonnet::logthis("IMS import error: WebCT4 - renaming failed for file $file");
                                 }
                             }