| 1 file_example_session_streams.inc | public FileExampleSessionStreamWrapper::unlink($uri) | 
Support for unlink().
Parameters
string $uri: A string containing the uri to the resource to delete.
Return value
bool: TRUE if resource was successfully deleted.
Overrides StreamWrapperInterface::unlink
See also
http://php.net/manual/en/streamwrapper.unlink.php
File
- modules/examples/ file_example/ file_example_session_streams.inc, line 454 
- Provides a demonstration session:// stream-wrapper.
Class
- FileExampleSessionStreamWrapper
- Example stream wrapper class to handle session:// streams.
Code
public function unlink($uri) {
  $path = $this->getLocalPath($uri);
  $path_components = preg_split('/\//', $path);
  $fail = FALSE;
  $unset = '$_SESSION[\'file_example\']';
  foreach ($path_components as $component) {
    $unset .= '[\'' . $component . '\']';
  }
  // TODO: Is there a better way to delete from an array?
  // backdrop_array_get_nested_value() doesn't work because it only returns
  // a reference; unsetting a reference only unsets the reference.
  eval("unset($unset);");
  return TRUE;
}
