37 assert(
'is_array($config)');
43 $this->directory = $cfgHelp->getString(
'directory');
48 $this->directory =
$globalConfig->resolvePath($this->directory);
62 assert(
'is_string($entityId)');
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) {
88 if ($entry[0] ===
'.') {
93 $path = $this->directory.
'/'.$entry;
97 'Serialize metadata handler: Metadata directory contained a file where only directories should '.
98 'exist: '.var_export(
$path,
true)
103 $ret[] = rawurldecode($entry);
121 assert(
'is_string($set)');
125 $dir = $this->directory.
'/'.rawurlencode($set);
131 $dh = @opendir($dir);
137 $extLen = strlen(self::EXTENSION);
139 while ((
$file = readdir($dh)) !==
false) {
140 if (strlen(
$file) <= $extLen) {
144 if (substr(
$file, -$extLen) !== self::EXTENSION) {
174 assert(
'is_string($entityId)');
175 assert(
'is_string($set)');
179 if (!file_exists($filePath)) {
183 $data = @file_get_contents($filePath);
184 if (
$data ===
false) {
185 $error = error_get_last();
187 'Error reading file '.$filePath.
': '.
$error[
'message']
193 if (
$data ===
false) {
198 if (!array_key_exists(
'entityid',
$data)) {
217 assert(
'is_string($entityId)');
218 assert(
'is_string($set)');
219 assert(
'is_array($metadata)');
222 $newPath = $filePath.
'.new';
224 $dir = dirname($filePath);
227 $res = @mkdir($dir, 0777,
true);
228 if (
$res ===
false) {
229 $error = error_get_last();
239 $res = file_put_contents($newPath,
$data);
240 if (
$res ===
false) {
241 $error = error_get_last();
246 $res = rename($newPath, $filePath);
247 if (
$res ===
false) {
248 $error = error_get_last();
265 assert(
'is_string($entityId)');
266 assert(
'is_string($set)');
270 if (!file_exists($filePath)) {
272 'Attempted to erase nonexistent metadata entry '.
273 var_export(
$entityId,
true).
' in set '.var_export($set,
true).
'.' 278 $res = unlink($filePath);
279 if (
$res ===
false) {
280 $error = error_get_last();
282 'Failed to delete file '.$filePath.
283 ': '.$error[
'message']
$metadata['__DYNAMIC:1__']
foreach($_POST as $key=> $value) $res
Create styles array
The data for the language used.
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
static loadFromArray($config, $location='[ARRAY]', $instance=null)
Loads a configuration from the given array.
static getInstance($instancename='simplesaml')
Get a configuration file by its instance name.