Index: MediaReadOnlyStreamWrapper.inc =================================================================== --- MediaReadOnlyStreamWrapper.inc (revision 19506) +++ MediaReadOnlyStreamWrapper.inc (working copy) @@ -2,33 +2,6 @@ // $Id: MediaReadOnlyStreamWrapper.inc,v 1.2 2010/04/07 06:29:34 JacobSingh Exp $ /** - * Generic PHP stream wrapper interface. - * - * @see http://www.php.net/manual/en/class.streamwrapper.php - */ -interface MediaReadOnlyStreamWrapperInterface { - public function stream_open($uri, $mode, $options, &$opened_url); - public function stream_close(); - public function stream_lock($operation); - public function stream_read($count); - public function stream_write($data); - public function stream_eof(); - public function stream_seek($offset, $whence); - public function stream_flush(); - public function stream_tell(); - public function stream_stat(); -// public function unlink($uri); -// public function rename($from_uri, $to_uri); -// public function mkdir($uri, $mode, $options); -// public function rmdir($uri, $options); - public function url_stat($uri, $flags); - public function dir_opendir($uri, $options); - public function dir_readdir(); - public function dir_rewinddir(); - public function dir_closedir(); -} - -/** * A base class for Resource Stream Wrappers. * * This class provides a complete stream wrapper implementation. It passes @@ -39,7 +12,7 @@ * interpolateUrl method to rewrite the URL before is it passed back into the * calling function. */ -abstract class MediaReadOnlyStreamWrapper implements MediaReadOnlyStreamWrapperInterface { +abstract class MediaReadOnlyStreamWrapper implements DrupalStreamWrapperInterface { protected $parameters = array(); protected $base_url = NULL; private $_DEBUG_MODE = NULL; @@ -482,6 +455,31 @@ return ''; } + /** + * DrupalStreamWrapperInterface requires that these methods be implemented, + * but none of them apply to a read-only stream wrapper. On failure they + * are expected to return FALSE. + */ + + public function unlink($uri) { + return FALSE; + } + public function rename($from_uri, $to_uri) { + return FALSE; + } + public function mkdir($uri, $mode, $options) { + return FALSE; + } + public function rmdir($uri, $options) { + return FALSE; + } + public function chmod($mode) { + return FALSE; + } + public function dirname($uri = NULL) { + return FALSE; + } + }