コード例 #1
0
ファイル: WebDavClient.php プロジェクト: samizdam/WebDAV
 /**
  * Refresh an existing lock by resetting its timeout.
  *
  * Performs a <tt>LOCK</tt> request as defined in the
  * {@link http://tools.ietf.org/html/rfc4918#section-9.10.2 Section 9.10.2 of RFC-4918}.
  *
  * Note that the timeout value may be suggested when refreshing the lock, but that the server
  * ultimately chooses the timeout value.
  *
  * @param string $uri
  *            Resource URI
  * @param string $lockToken
  *            The lock token identifying the lock to be refreshed
  * @param int $timeout
  *            Number of seconds remaining until lock expiration
  *            
  * @return Lock Returns the refreshed lock on success, or <tt>null</tt> on failure
  */
 public function refreshLock($uri, $lockToken, $timeout = null)
 {
     $headers = array('If' => "(<{$lockToken}>)");
     if ($timeout) {
         $headers['Timeout'] = (string) TimeoutHeader::parse($timeout);
     }
     $request = $this->createRequest('LOCK', $uri, $headers);
     $response = $this->doRequest($request);
     return $response->isSuccessful() ? Lock::parse($this, $response->getBody()) : null;
 }