43        $this->directory = $cfgHelp->getString(
'directory');
 
   48        $this->directory = 
$globalConfig->resolvePath($this->directory);
 
   63        assert(is_string($set));
 
   65        return $this->directory.
'/'.rawurlencode($set).
'/'.rawurlencode(
$entityId).self::EXTENSION;
 
   78        $dh = @opendir($this->directory);
 
   81                'Serialize metadata handler: Unable to open directory: '.var_export($this->directory, 
true)
 
   86        while (($entry = readdir($dh)) !== 
false) {
 
   87            if ($entry[0] === 
'.') {
 
   92            $path = $this->directory.
'/'.$entry;
 
   96                    'Serialize metadata handler: Metadata directory contained a file where only directories should '.
 
   97                    'exist: '.var_export(
$path, 
true)
 
  102            $ret[] = rawurldecode($entry);
 
  120        assert(is_string($set));
 
  124        $dir = $this->directory.
'/'.rawurlencode($set);
 
  130        $dh = @opendir($dir);
 
  136        $extLen = strlen(self::EXTENSION);
 
  138        while (($file = readdir($dh)) !== 
false) {
 
  139            if (strlen($file) <= $extLen) {
 
  143            if (substr($file, -$extLen) !== self::EXTENSION) {
 
  174        assert(is_string($set));
 
  178        if (!file_exists($filePath)) {
 
  182        $data = @file_get_contents($filePath);
 
  183        if (
$data === 
false) {
 
  184            $error = error_get_last();
 
  186                'Error reading file '.$filePath.
': '.$error[
'message']
 
  192        if (
$data === 
false) {
 
  197        if (!array_key_exists(
'entityid', 
$data)) {
 
  217        assert(is_string($set));
 
  221        $newPath = $filePath.
'.new';
 
  223        $dir = dirname($filePath);
 
  226            $res = @mkdir($dir, 0777, 
true);
 
  227            if (
$res === 
false) {
 
  228                $error = error_get_last();
 
  238        $res = file_put_contents($newPath, 
$data);
 
  239        if (
$res === 
false) {
 
  240            $error = error_get_last();
 
  245        $res = rename($newPath, $filePath);
 
  246        if (
$res === 
false) {
 
  247            $error = error_get_last();
 
  265        assert(is_string($set));
 
  269        if (!file_exists($filePath)) {
 
  271                'Attempted to erase nonexistent metadata entry '.
 
  272                var_export(
$entityId, 
true).
' in set '.var_export($set, 
true).
'.' 
  277        $res = unlink($filePath);
 
  278        if (
$res === 
false) {
 
  279            $error = error_get_last();
 
  281                'Failed to delete file '.$filePath.
 
  282                ': '.$error[
'message']
 
$metadata['__DYNAMIC:1__']
An exception for terminatinating execution or to throw for unit testing.
static getInstance($instancename='simplesaml')
Get a configuration file by its instance name.
static loadFromArray($config, $location='[ARRAY]', $instance=null)
Loads a configuration from the given array.
foreach($_POST as $key=> $value) $res