fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [7912] import: testing


From: Sigurd Nes
Subject: [Fmsystem-commits] [7912] import: testing
Date: Fri, 21 Oct 2011 12:06:07 +0000

Revision: 7912
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=7912
Author:   sigurdne
Date:     2011-10-21 12:06:06 +0000 (Fri, 21 Oct 2011)
Log Message:
-----------
import: testing

Modified Paths:
--------------
    trunk/property/inc/cron/default/Import_fra_basware_X205.php

Modified: trunk/property/inc/cron/default/Import_fra_basware_X205.php
===================================================================
--- trunk/property/inc/cron/default/Import_fra_basware_X205.php 2011-10-21 
11:22:02 UTC (rev 7911)
+++ trunk/property/inc/cron/default/Import_fra_basware_X205.php 2011-10-21 
12:06:06 UTC (rev 7912)
@@ -257,15 +257,45 @@
                                        echo "okay: logged in...<br/>";
 
                                        // execute a command
-                                       //if (!($stream = 
ssh2_exec($connection, "ls -al {$directory_remote}" )))
-                                       if (!($stream = ssh2_exec($connection, 
"dir {$directory_remote}" )))
+/*
+                                       if (!($stream = ssh2_exec($connection, 
"ls -al {$directory_remote}" )))
                                        {
                                                echo "fail: unable to execute 
command\n";
                                        }
+*/
+                                       // Enter "sftp" mode
+                                       $sftp = @ssh2_sftp($connection);
 
+                                       // Scan directory
+                                       $arr = array();
+                                       echo "Scanning $remote_dir\n";
+                                       $dir = "ssh2.sftp://$sftp$remote_dir";;
+                                       $handle = opendir($dir);
+                                       while (false !== ($file = 
readdir($handle)))
+                                       {
+                                               if (is_dir($file))
+                                               {
+                                                       echo "Directory: 
$file\n";
+                                                       continue;
+                                               }
+
+                                               $size = 
filesize("ssh2.sftp://$sftp$remote_dir/$file";);
+                                               echo "File $file Size: $size\n";
+
+                                               $stream = 
@fopen("ssh2.sftp://$sftp$remote_dir/$file";, 'r');
+                                               $contents = fread($stream, 
filesize("ssh2.sftp://$sftp$remote_dir/$file";));
+                                               @fclose(@stream);
+
+                                               echo "CONTENTS: $contents\n\n";
+                                               $arr[] = $file;
+                                       }
+
                                        echo "collect returning data from 
command\n";
                                        if ($debug)
                                        {
+
+                                               _debug_array($arr);
+
                                                stream_set_blocking($stream, 
true);
                                                $data = "";
                                                while ($buf = 
fread($stream,4096))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]