Skip to content

Commit

Permalink
add option to debug hasUpdated check for sftp
Browse files Browse the repository at this point in the history
Signed-off-by: Robin Appelman <[email protected]>
  • Loading branch information
icewind1991 committed Aug 30, 2023
1 parent 6f520f2 commit 638cbac
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions apps/files_external/lib/Lib/Storage/SFTP.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@

use Icewind\Streams\IteratorDirectory;
use Icewind\Streams\RetryWrapper;
use OCP\IRequest;
use phpseclib\Net\SFTP\Stream;

/**
Expand Down Expand Up @@ -476,4 +477,16 @@ public function constructUrl($path) {
$url = 'sftp://' . urlencode($this->user) . '@' . $this->host . ':' . $this->port . $this->root . $path;
return $url;
}

public function hasUpdated($path, $time) {
$storageTime = $this->filemtime($path);
$updated = $storageTime > $time;
if ($updated) {
$req = \OC::$server->get(IRequest::class);
if ($req->getHeader('x-debug-updated')) {
header("x-debug-updated: '$path' updated $storageTime > $time", false);
}
}
return $updated;
}
}

0 comments on commit 638cbac

Please sign in to comment.