lib/Dropbox/Client.php
function getMetadataWithChildrenIfChanged($path, $previousFolderHash)
    {
        Path::checkArg("path", $path);
        Checker::argStringNonEmpty("previousFolderHash", $previousFolderHash);

        $params = array("list" => "true", "file_limit" => "25000", "hash" => $previousFolderHash);

        $response = $this->doGet(
            $this->apiHost,
            $this->appendFilePath("1/metadata", $path),
            $params);

        if ($response->statusCode === 304) return array(false, null);
        if ($response->statusCode === 404) return array(true, null);
        if ($response->statusCode !== 200) throw RequestUtil::unexpectedStatus($response);

        $metadata = RequestUtil::parseResponseJson($response->body);
        if (array_key_exists("is_deleted", $metadata) && $metadata["is_deleted"]) {
            return array(true, null);
        }
        return array(true, $metadata);
    }
function getMetadataWithChildrenIfChanged($path, $previousFolderHash)
    {
        Path::checkArg("path", $path);
        Checker::argStringNonEmpty("previousFolderHash", $previousFolderHash);

        $params = array("list" => "true", "file_limit" => "25000", "hash" => $previousFolderHash);

        $response = $this->doGet(
            $this->apiHost,
            $this->appendFilePath("1/metadata", $path),
            $params);

        if ($response->statusCode === 304) return array(false, null);
        if ($response->statusCode === 404) return array(true, null);
        if ($response->statusCode !== 200) throw RequestUtil::unexpectedStatus($response);

        $metadata = RequestUtil::parseResponseJson($response->body);
        if (array_key_exists("is_deleted", $metadata) && $metadata["is_deleted"]) {
            return array(true, null);
        }
        return array(true, $metadata);
    }
function getMetadataWithChildrenIfChanged ( $ path , $ previousFolderHash ) { Path :: checkArg ( "path" , $ path ) ; Checker :: argStringNonEmpty ( "previousFolderHash" , $ previousFolderHash ) ; $ params = array ( "list" => "true" , "file_limit" => "25000" , "hash" => $ previousFolderHash ) ; $ response = $ this -> doGet ( $ this -> apiHost , $ this -> appendFilePath ( "1/metadata" , $ path ) , $ params ) ; if ( $ response -> statusCode === 304 ) return array ( false , null ) ; if ( $ response -> statusCode === 404 ) return array ( true , null ) ; if ( $ response -> statusCode !== 200 ) throw RequestUtil :: unexpectedStatus ( $ response ) ; $ metadata = RequestUtil :: parseResponseJson ( $ response -> body ) ; if ( array_key_exists ( "is_deleted" , $ metadata ) && $ metadata [ "is_deleted" ] ) { return array ( true , null ) ; } return array ( true , $ metadata ) ; }
If you've previously retrieved the metadata for a folder and its children, this method will
retrieve updated metadata only if something has changed.  This is more efficient than
calling {@link getMetadataWithChildren} if you have a cache of previous results.

<code>
$client = ...;
$md = $client->getMetadataWithChildren("/Photos");
print_r($md);
assert($md["is_dir"], "expecting \"/Photos\" to be a folder");

sleep(10);

// Now see if anything changed...
list($changed, $new_md) = $client->getMetadataWithChildrenIfChanged(
"/Photos", $md["hash"]);
if ($changed) {
echo "Folder changed.\n";
print_r($new_md);
} else {
echo "Folder didn't change.\n";
}
</code>

@param string $path
The Dropbox path to a folder (UTF-8).

@param string $previousFolderHash
The "hash" field from the previously retrieved folder metadata.

@return array
A `list(boolean $changed, array $metadata)`.  If the metadata hasn't changed,
you'll get `list(false, null)`.  If the metadata of the folder or any of its
children has changed, you'll get `list(true, $newMetadata)`.  $metadata is a
<a href="https://www.dropbox.com/developers/core/docs#metadata-details">metadata object</a>.

@throws Exception
If you ve previously retrieved the metadata for a folder and its children this method will retrieve updated metadata only if something has changed . This is more efficient than calling { @link getMetadataWithChildren } if you have a cache of previous results .