2026/07/12

From WoozleCodes
Jump to navigation Jump to search
Sunday, July 12, 2026 (#193)
Saturday Sunday Monday

References

Main Work

Ferreteria FileSys stuff in order to support sftp in FTM

Apparently there is no way to update the timestamp on a remote file using PHP's ssh2 library; everything seems to recommend phpseclib -- so I guess I'm back to integrating that into Ferreteria.

That said, there are still two options:

  • Execute a "touch" command on the remote via ssh (assumes Linuxish on remote).
  • Mount the remote folder locally and use local touch().
    • This is how the previous version of FTM handled all sftp. It's clumsy but workable.

Side Note: I wonder if scandir() or opendir() / readdir() would work better for large folders than what I'm now using (dir()).

  • Query: Does phpseclib use its own internal resource/stream system, or could I pass it a stream resource created with PHP's ssh2_sftp()?
  • Query: How do I gracefully detect when new SSH2(...); fails?

16:33

The error message «Cannot connect to sameagle.local:. Error 0. Failed to parse address "sameagle.local" at file» actually means that I passed NULL as the port number when constructing the SSH2 object. Despite defaulting to 22, the $port parameter is untyped and will accept a NULL at face value, which apparently causes this error somewhere further down the pipeline (possibly outside of phpseclib, since I can't find this message anywhere in the code).

22:18

I am now discovering that the wrapper-model I wrote around the native SFTP functions will not work for phpseclib, because its API structure is completely different. I do want to come up with a wrapper-model that works for both, but ye gods.