SimpleSAML_Logger::warning('Serialize metadata handler: Unable to open directory: '.var_export($this->directory,TRUE));
return$ret;
}
while(($entry=readdir($dh))!==FALSE){
if($entry[0]==='.'){
/* Skip '..', '.' and hidden files. */
continue;
}
$path=$this->directory.'/'.$entry;
if(!is_dir($path)){
SimpleSAML_Logger::warning('Serialize metadata handler: Metadata directory contained a file where only directories should exist: '.var_export($path,TRUE));
continue;
}
$ret[]=rawurldecode($entry);
}
closedir($dh);
return$ret;
}
/**
* Retrieve a list of all available metadata for a given set.
*
* @param string $set The set we are looking for metadata in.
* @return array An associative array with all the metadata for the given set.
*/
publicfunctiongetMetadataSet($set){
assert('is_string($set)');
$ret=array();
$dir=$this->directory.'/'.rawurlencode($set);
if(!is_dir($dir)){
/* Probably some code asked for a metadata set which wasn't available. */
return$ret;
}
$dh=@opendir($dir);
if($dh===FALSE){
SimpleSAML_Logger::warning('Serialize metadata handler: Unable to open directory: '.var_export($dir,TRUE));
return$ret;
}
$extLen=strlen(self::EXTENSION);
while(($file=readdir($dh))!==FALSE){
if(strlen($file)<=$extLen){
continue;
}
if(substr($file,-$extLen)!==self::EXTENSION){
continue;
}
$entityId=substr($file,0,-$extLen);
$entityId=rawurldecode($entityId);
$md=$this->getMetaData($entityId,$set);
if($md!==NULL){
$ret[$entityId]=$md;
}
}
closedir($dh);
return$ret;
}
/**
* Retrieve a metadata entry.
*
* @param string $entityId The entityId we are looking up.
* @param string $set The set we are looking for metadata in.
* @return array An associative array with metadata for the given entity, or NULL if we are unable to