diff options
author | Klaus Weidenbach <Klaus.Weidenbach@gmx.net> | 2014-06-29 21:15:37 +0200 |
---|---|---|
committer | Klaus Weidenbach <Klaus.Weidenbach@gmx.net> | 2014-06-29 21:15:37 +0200 |
commit | aacb293f2e0e7a6995e66202313856500f503120 (patch) | |
tree | 36e071e5491d47ff7fe5139ab3af8bf16fbd05b2 /include/reddav.php | |
parent | 322091cd12ba972d1f3fee0df47ffb4e49a452ce (diff) | |
download | volse-hubzilla-aacb293f2e0e7a6995e66202313856500f503120.tar.gz volse-hubzilla-aacb293f2e0e7a6995e66202313856500f503120.tar.bz2 volse-hubzilla-aacb293f2e0e7a6995e66202313856500f503120.zip |
Return a correct timestamp when a folder is empty.
If a folder was empty a zero timestamp was returned. Now it will
return the timestamp of the folder itself.
Diffstat (limited to 'include/reddav.php')
-rw-r--r-- | include/reddav.php | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/include/reddav.php b/include/reddav.php index 1eaf7cd02..ba08ec332 100644 --- a/include/reddav.php +++ b/include/reddav.php @@ -356,9 +356,13 @@ class RedDirectory extends DAV\Node implements DAV\ICollection, DAV\IQuota { } /** - * @brief Returns the last modification time for the directory, as a unix + * @brief Returns the last modification time for the directory, as a UNIX * timestamp. * + * It looks for the last edited file in the folder. If it is an empty folder + * it returns the lastmodified time of the folder itself, to prevent zero + * timestamps. + * * @return int last modification time in UNIX timestamp */ public function getLastModified() { @@ -366,9 +370,15 @@ class RedDirectory extends DAV\Node implements DAV\ICollection, DAV\IQuota { dbesc($this->folder_hash), intval($this->auth->owner_id) ); - if ($r) - return datetime_convert('UTC', 'UTC', $r[0]['edited'], 'U'); - return ''; + if (! $r) { + $r = q("SELECT edited FROM attach WHERE hash = '%s' AND uid = %d LIMIT 1", + dbesc($this->folder_hash), + intval($this->auth->owner_id) + ); + if (! $r) + return ''; + } + return datetime_convert('UTC', 'UTC', $r[0]['edited'], 'U'); } /** @@ -997,11 +1007,17 @@ class RedBasicAuth extends DAV\Auth\Backend\AbstractBasic { $this->currentUser = $name; } - function setBrowserPlugin($browser) { + /** + * @brief Set browser plugin. + * + * @see RedBrowser::set_writeable() + * @param DAV\Browser\Plugin $browser + */ + public function setBrowserPlugin($browser) { $this->browser = $browser; } - // internal? loggin function + // internal? logging function function log() { logger('dav: auth: channel_name ' . $this->channel_name, LOGGER_DATA); logger('dav: auth: channel_id ' . $this->channel_id, LOGGER_DATA); @@ -1045,9 +1061,7 @@ class RedBrowser extends DAV\Browser\Plugin { } /** - * Creates the directory listing for the given path. - * - * @todo Why not use RedDirectory for this? + * @brief Creates the directory listing for the given path. * * @param string $path which should be displayed */ |