SimpleSAML_Utilities::writeFile PHP Method

writeFile() public static method

Deprecation: This method will be removed in SSP 2.0. Please use SimpleSAML\Utils\System::writeFile() instead.
public static writeFile ( $filename, $data, $mode = 384 )
    public static function writeFile($filename, $data, $mode = 0600)
    {
        \SimpleSAML\Utils\System::writeFile($filename, $data, $mode);
    }

Usage Example

Ejemplo n.º 1
0
 /**
  * Add an item to the cache.
  *
  * @param string $id  The identifier of this data.
  * @param string $data  The data.
  * @param int $expires  The timestamp the data expires.
  * @param string|NULL $tag  An extra tag that can be used to verify the validity of the cached data.
  */
 public function addCacheItem($id, $data, $expires, $tag = NULL)
 {
     assert('is_string($id)');
     assert('is_string($data)');
     assert('is_int($expires)');
     assert('is_null($tag) || is_string($tag)');
     $cacheFile = $this->cacheDirectory . '/' . $id;
     try {
         SimpleSAML_Utilities::writeFile($cacheFile, $data);
     } catch (Exception $e) {
         SimpleSAML_Logger::warning($this->logLoc . 'Unable to write to cache file ' . var_export($cacheFile, TRUE));
         return;
     }
     $expireInfo = (string) $expires;
     if ($tag !== NULL) {
         $expireInfo .= ':' . $tag;
     }
     $expireFile = $cacheFile . '.expire';
     try {
         SimpleSAML_Utilities::writeFile($expireFile, $expireInfo);
     } catch (Exception $e) {
         SimpleSAML_Logger::warning($this->logLoc . 'Unable to write expiration info to ' . var_export($expireFile, TRUE));
     }
 }
All Usage Examples Of SimpleSAML_Utilities::writeFile