Permalink
Browse files

Fix SabreDav

  • Loading branch information...
1 parent cf0d688 commit a863f6634183a2fbf2aa8dfc3c78f2251cc3b0ee @cdujeu cdujeu committed May 18, 2016
@@ -63,10 +63,12 @@ public function createFile($name, $data = null)
$name = ltrim($name, "/");
AJXP_Logger::debug("CREATE FILE $name");
- Controller::findActionAndApply("mkfile", array(
+ $request = new \Zend\Diactoros\ServerRequest();
+ $request = $request->withParsedBody([
"dir" => $this->path,
"filename" => $name
- ), array());
+ ])->withAttribute("action", "mkfile")->withAttribute("api", "session");
+ Controller::run($request);
if ( $data != null && is_file($this->getUrl()."/".$name)) {
@@ -110,12 +112,13 @@ public function createDirectory($name)
if (isSet($this->children)) {
$this->children = null;
}
-
- Controller::findActionAndApply("mkdir", array(
+ $request = new \Zend\Diactoros\ServerRequest();
+ $request = $request->withParsedBody([
"dir" => $this->path,
"dirname" => $name
- ), array());
-
+ ])->withAttribute("action", "mkdir")->withAttribute("api", "session");
+ Controller::run($request);
+
}
/**
@@ -105,10 +105,12 @@ public function delete()
{
ob_start();
try {
- Controller::findActionAndApply("delete", array(
+ $request = new \Zend\Diactoros\ServerRequest();
+ $request = $request->withParsedBody([
"dir" => dirname($this->path),
"file_0" => $this->path
- ), array());
+ ])->withAttribute("action", "delete")->withAttribute("api", "session");
+ Controller::run($request);
} catch (Exception $e) {
}
@@ -139,11 +141,13 @@ public function setName($name)
{
$data = $this->getResourceData();
ob_start();
- Controller::findActionAndApply("rename", array(
+ $request = new \Zend\Diactoros\ServerRequest();
+ $request = $request->withParsedBody([
"filename_new" => $name,
"dir" => dirname($this->path),
"file" => $this->path
- ), array());
+ ])->withAttribute("action", "rename")->withAttribute("api", "session");
+ Controller::run($request);
ob_get_flush();
$this->putResourceData(array());
$this->putResourceData($data, dirname($this->getUrl())."/".$name);

0 comments on commit a863f66

Please sign in to comment.