Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File picking rule on FILE FTP Solution [Mydd3] #1035

Open
francescobianco opened this issue Jun 22, 2023 · 2 comments
Open

File picking rule on FILE FTP Solution [Mydd3] #1035

francescobianco opened this issue Jun 22, 2023 · 2 comments
Assignees

Comments

@francescobianco
Copy link
Collaborator

francescobianco commented Jun 22, 2023

On file.php solution the one used to connect over sFTP we have problem related to file picking?

Sometime, depends on the file presents on the watched directory some files are ignored in the readData process.
The only way act for discover the ignored file is to DELETE (manually) from the directory (watched) the last processed file.

What's is the right way to use FTP solution to work without ignoring files?

@simonetravaglini

@Myddleware
Copy link
Owner

Hi @francescobianco ,
Myddleware check if a new file exists or if an existing files has been modified. The reference date is used for that.
For information, the command used to browse the directory is : find . -newermt "'.$date_ref.'" -type f | sort | head -n 1
I see a bug when I try this command. Files could be ignored if several files have a modification date after the reference date. The issue is on the sort command because sort is done on file name instead of modification date.
We will fix this issue.

@Myddleware
Copy link
Owner

@AlexMyddleware @CamillePMyddleware
We need to change the call here

$stream = ssh2_exec($this->sshconnection, 'cd '.$directory.';find . -newermt "'.$date_ref.'" -type f | sort | head -n 1');

The command to be executed is find . -newermt "2023-05-04 00:00:00" -type f -printf "%T+ %p\n" | sort | head -n 1
The $file variable will contains the modification date of the file, you will have to remove to get the filename here :

$file = $this->get_last_file($this->paramConnexion['directory'].'/'.$module, '1970-01-01 00:00:00');
and
$file = $this->get_last_file($this->paramConnexion['directory'].'/'.$param['module'], (!empty($param['query']) ? '1970-01-01 00:00:00' : $param['date_ref']));

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants