Beispiel #1
0
 /**
  *	Constructor.
  *	@access		public
  *	@param		string		$path			Path to Cache Files
  *	@param		int			$expires		Seconds until Pairs will be expired
  *	@return		void
  */
 public function __construct($resource = NULL, $context = NULL, $expiration = NULL)
 {
     if (is_null($resource)) {
         throw new \RuntimeException('Path to folder must be given as resource');
     }
     $resource .= substr($resource, -1) == "/" ? "" : "/";
     if (!file_exists($resource)) {
         \FS_Folder_Editor::createFolder($resource, 0770);
         //			throw new RuntimeException( 'Path "'.$resource.'" is not existing' );
     }
     $this->path = $resource;
 }
Beispiel #2
0
 /**
  *	Sets context folder within storage.
  *	If folder is not existing, it will be created.
  *	@access		public
  *	@param		string		$context		Context folder within storage
  *	@return		void
  */
 public function setContext($context)
 {
     if (!strlen(trim($context))) {
         $this->context = NULL;
         return;
     }
     $context = preg_replace("@(.+)/\$@", "\\1", $context) . "/";
     if (!file_exists($this->path . $context)) {
         \FS_Folder_Editor::createFolder($this->path . $context, 0770);
     }
     $this->context = $context;
 }