Ejemplo n.º 1
0
<?php

/**
Copyright (c) 2009, Shane Hill <*****@*****.**>
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
    * Redistributions of source code must retain
      the above copyright notice, this list of conditions
      and the following disclaimer.
    * Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
// this is the file that handles the uploads into the HM RUSH system
require_once "WebDFS.php";
require_once "WebDFS/Helper.php";
$config = WebDFS_Helper::getConfig();
$params = WebDFS_Helper::getParams();
$dfs = new WebDFS($config, $params);
$dfs->handleRequest();
Ejemplo n.º 2
0
 public function __construct($config, $params)
 {
     parent::__construct($config, $params);
 }
Ejemplo n.º 3
0
 public function testDelete()
 {
     // create temp file to simulate input
     $tmpFile = tmpfile();
     $fileData = "foooooooooooooooooooooobarrrrrrrrrrrrrrrrr";
     fwrite($tmpFile, $fileData);
     $data = stream_get_meta_data($tmpFile);
     // set the input stream
     $this->data_config['inputStream'] = $data['uri'];
     // first put the file
     $params = $this->getParamsForPut();
     $dfs = new WebDFS($this->data_config, $params);
     $dfs->handleRequest();
     $filePath = join('/', array($this->data_config['data'][0]['storageRoot'], $params['pathHash'], $params['fileName']));
     $this->assertFileExists($filePath);
     // now delete the file we just put
     $params = $this->getParamsForDelete();
     $dfs = new WebDFS($this->data_config, $params);
     $dfs->handleRequest();
     $this->assertFalse(file_exists($filePath));
 }