Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

Filesystem.php 23KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705
  1. <?php
  2. /*
  3. +----------------------------------------------------------------------+
  4. | Copyright (c) 2002-2007 Christian Stocker, Hartmut Holzgraefe |
  5. | All rights reserved |
  6. | |
  7. | Redistribution and use in source and binary forms, with or without |
  8. | modification, are permitted provided that the following conditions |
  9. | are met: |
  10. | |
  11. | 1. Redistributions of source code must retain the above copyright |
  12. | notice, this list of conditions and the following disclaimer. |
  13. | 2. Redistributions in binary form must reproduce the above copyright |
  14. | notice, this list of conditions and the following disclaimer in |
  15. | the documentation and/or other materials provided with the |
  16. | distribution. |
  17. | 3. The names of the authors may not be used to endorse or promote |
  18. | products derived from this software without specific prior |
  19. | written permission. |
  20. | |
  21. | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
  22. | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
  23. | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
  24. | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
  25. | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
  26. | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
  27. | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
  28. | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
  29. | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
  30. | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
  31. | ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
  32. | POSSIBILITY OF SUCH DAMAGE. |
  33. +----------------------------------------------------------------------+
  34. */
  35. require_once("../inc/lib_base.php");
  36. oc_require_once("lib_log.php");
  37. oc_require_once("lib_filesystem.php");
  38. oc_require_once("HTTP/WebDAV/Server.php");
  39. oc_require_once("System.php");
  40. /**
  41. * Filesystem access using WebDAV
  42. *
  43. * @access public
  44. * @author Hartmut Holzgraefe <hartmut@php.net>
  45. * @version @package-version@
  46. */
  47. class HTTP_WebDAV_Server_Filesystem extends HTTP_WebDAV_Server
  48. {
  49. /**
  50. * Root directory for WebDAV access
  51. *
  52. * Defaults to webserver document root (set by ServeRequest)
  53. *
  54. * @access private
  55. * @var string
  56. */
  57. var $base = "";
  58. /**
  59. * Serve a webdav request
  60. *
  61. * @access public
  62. * @param string
  63. */
  64. function ServeRequest($base = false)
  65. {
  66. // special treatment for litmus compliance test
  67. // reply on its identifier header
  68. // not needed for the test itself but eases debugging
  69. if (isset($this->_SERVER['HTTP_X_LITMUS'])) {
  70. error_log("Litmus test ".$this->_SERVER['HTTP_X_LITMUS']);
  71. header("X-Litmus-reply: ".$this->_SERVER['HTTP_X_LITMUS']);
  72. }
  73. // set root directory, defaults to webserver document root if not set
  74. if ($base) {
  75. $this->base = realpath($base); // TODO throw if not a directory
  76. } else if (!$this->base) {
  77. $this->base = $this->_SERVER['DOCUMENT_ROOT'];
  78. }
  79. // let the base class do all the work
  80. parent::ServeRequest();
  81. }
  82. /**
  83. * No authentication is needed here
  84. *
  85. * @access private
  86. * @param string HTTP Authentication type (Basic, Digest, ...)
  87. * @param string Username
  88. * @param string Password
  89. * @return bool true on successful authentication
  90. */
  91. function check_auth($type, $user, $pass)
  92. {
  93. return true;
  94. }
  95. /**
  96. * PROPFIND method handler
  97. *
  98. * @param array general parameter passing array
  99. * @param array return array for file properties
  100. * @return bool true on success
  101. */
  102. function PROPFIND(&$options, &$files)
  103. {
  104. // get absolute fs path to requested resource
  105. $fspath = $options["path"];
  106. // sanity check
  107. if (!OC_FILESYSTEM::file_exists($fspath)) {
  108. return false;
  109. }
  110. // prepare property array
  111. $files["files"] = array();
  112. // store information for the requested path itself
  113. $files["files"][] = $this->fileinfo($options["path"]);
  114. // information for contained resources requested?
  115. if (!empty($options["depth"]) && OC_FILESYSTEM::is_dir($fspath) && OC_FILESYSTEM::is_readable($fspath)) {
  116. // make sure path ends with '/'
  117. $options["path"] = $this->_slashify($options["path"]);
  118. // try to open directory
  119. $handle = @OC_FILESYSTEM::opendir($fspath);
  120. if ($handle) {
  121. // ok, now get all its contents
  122. while ($filename = readdir($handle)) {
  123. if ($filename != "." && $filename != "..") {
  124. $files["files"][] = $this->fileinfo($options["path"].$filename);
  125. }
  126. }
  127. // TODO recursion needed if "Depth: infinite"
  128. }
  129. }
  130. // ok, all done
  131. return true;
  132. }
  133. /**
  134. * Get properties for a single file/resource
  135. *
  136. * @param string resource path
  137. * @return array resource properties
  138. */
  139. function fileinfo($path)
  140. {
  141. // map URI path to filesystem path
  142. $fspath =$path;
  143. // create result array
  144. $info = array();
  145. // TODO remove slash append code when base clase is able to do it itself
  146. $info["path"] = OC_FILESYSTEM::is_dir($fspath) ? $this->_slashify($path) : $path;
  147. $info["props"] = array();
  148. // no special beautified displayname here ...
  149. $info["props"][] = $this->mkprop("displayname", strtoupper($path));
  150. // creation and modification time
  151. $info["props"][] = $this->mkprop("creationdate", OC_FILESYSTEM::filectime($fspath));
  152. $info["props"][] = $this->mkprop("getlastmodified", OC_FILESYSTEM::filemtime($fspath));
  153. // Microsoft extensions: last access time and 'hidden' status
  154. $info["props"][] = $this->mkprop("lastaccessed", OC_FILESYSTEM::fileatime($fspath));
  155. $info["props"][] = $this->mkprop("ishidden", ('.' === substr(basename($fspath), 0, 1)));
  156. // type and size (caller already made sure that path exists)
  157. if ( OC_FILESYSTEM::is_dir($fspath)) {
  158. // directory (WebDAV collection)
  159. $info["props"][] = $this->mkprop("resourcetype", "collection");
  160. $info["props"][] = $this->mkprop("getcontenttype", "httpd/unix-directory");
  161. } else {
  162. // plain file (WebDAV resource)
  163. $info["props"][] = $this->mkprop("resourcetype", "");
  164. if ( OC_FILESYSTEM::is_readable($fspath)) {
  165. $info["props"][] = $this->mkprop("getcontenttype", OC_FILESYSTEM::getMimetype($fspath));
  166. } else {
  167. $info["props"][] = $this->mkprop("getcontenttype", "application/x-non-readable");
  168. }
  169. $info["props"][] = $this->mkprop("getcontentlength", OC_FILESYSTEM::filesize($fspath));
  170. }
  171. // get additional properties from database
  172. $query = "SELECT ns, name, value FROM properties WHERE path = '$path'";
  173. $res = OC_DB::select($query);
  174. foreach ($res as $row) {
  175. $info["props"][] = $this->mkprop($row["ns"], $row["name"], $row["value"]);
  176. }
  177. return $info;
  178. }
  179. /**
  180. * HEAD method handler
  181. *
  182. * @param array parameter passing array
  183. * @return bool true on success
  184. */
  185. function HEAD(&$options)
  186. {
  187. // get absolute fs path to requested resource
  188. $fspath = $options["path"];
  189. // sanity check
  190. if (! OC_FILESYSTEM::file_exists($fspath)) return false;
  191. // detect resource type
  192. $options['mimetype'] = OC_FILESYSTEM::getMimetype($fspath);
  193. // detect modification time
  194. // see rfc2518, section 13.7
  195. // some clients seem to treat this as a reverse rule
  196. // requiering a Last-Modified header if the getlastmodified header was set
  197. $options['mtime'] = OC_FILESYSTEM::filemtime($fspath);
  198. // detect resource size
  199. $options['size'] = OC_FILESYSTEM::filesize($fspath);
  200. return true;
  201. }
  202. /**
  203. * GET method handler
  204. *
  205. * @param array parameter passing array
  206. * @return bool true on success
  207. */
  208. function GET(&$options)
  209. {
  210. // get absolute fs path to requested resource)
  211. $fspath = $options["path"];
  212. error_log("get $fspath");
  213. // is this a collection?
  214. if (OC_FILESYSTEM::is_dir($fspath)) {
  215. return $this->GetDir($fspath, $options);
  216. }
  217. // the header output is the same as for HEAD
  218. if (!$this->HEAD($options)) {
  219. return false;
  220. }
  221. // no need to check result here, it is handled by the base class
  222. $options['stream'] = OC_FILESYSTEM::fopen($fspath, "r");
  223. OC_LOG::event($_SESSION['username'],3,$options["path"]);
  224. return true;
  225. }
  226. /**
  227. * GET method handler for directories
  228. *
  229. * This is a very simple mod_index lookalike.
  230. * See RFC 2518, Section 8.4 on GET/HEAD for collections
  231. *
  232. * @param string directory path
  233. * @return void function has to handle HTTP response itself
  234. */
  235. function GetDir($fspath, &$options)
  236. {
  237. $path = $this->_slashify($options["path"]);
  238. if ($path != $options["path"]) {
  239. header("Location: ".$this->base_uri.$path);
  240. exit;
  241. }
  242. // fixed width directory column format
  243. $format = "%15s %-19s %-s\n";
  244. if (!OC_FILESYSTEM::is_readable($fspath)) {
  245. return false;
  246. }
  247. $handle = OC_FILESYSTEM::opendir($fspath);
  248. if (!$handle) {
  249. return false;
  250. }
  251. echo "<html><head><title>Index of ".htmlspecialchars($options['path'])."</title></head>\n";
  252. echo "<h1>Index of ".htmlspecialchars($options['path'])."</h1>\n";
  253. echo "<pre>";
  254. printf($format, "Size", "Last modified", "Filename");
  255. echo "<hr>";
  256. while ($filename = readdir($handle)) {
  257. if ($filename != "." && $filename != "..") {
  258. $fullpath = $fspath."/".$filename;
  259. $name = htmlspecialchars($filename);
  260. printf($format,
  261. number_format(filesize($fullpath)),
  262. strftime("%Y-%m-%d %H:%M:%S", filemtime($fullpath)),
  263. "<a href='$name'>$name</a>");
  264. }
  265. }
  266. echo "</pre>";
  267. closedir($handle);
  268. echo "</html>\n";
  269. exit;
  270. }
  271. /**
  272. * PUT method handler
  273. *
  274. * @param array parameter passing array
  275. * @return bool true on success
  276. */
  277. function PUT(&$options)
  278. {
  279. $fspath = $options["path"];
  280. $dir = dirname($fspath);
  281. if (!OC_FILESYSTEM::file_exists($dir) || !OC_FILESYSTEM::is_dir($dir)) {
  282. return "409 Conflict"; // TODO right status code for both?
  283. }
  284. $options["new"] = ! OC_FILESYSTEM::file_exists($fspath);
  285. if ($options["new"] && !OC_FILESYSTEM::is_writeable($dir)) {
  286. return "403 Forbidden";
  287. }
  288. if (!$options["new"] && !OC_FILESYSTEM::is_writeable($fspath)) {
  289. return "403 Forbidden";
  290. }
  291. if (!$options["new"] && OC_FILESYSTEM::is_dir($fspath)) {
  292. return "403 Forbidden";
  293. }
  294. $fp = OC_FILESYSTEM::fopen($fspath, "w");
  295. OC_LOG::event($_SESSION['username'],4,$options["path"]);
  296. return $fp;
  297. }
  298. /**
  299. * MKCOL method handler
  300. *
  301. * @param array general parameter passing array
  302. * @return bool true on success
  303. */
  304. function MKCOL($options)
  305. {
  306. $path = $options["path"];
  307. $parent = dirname($path);
  308. $name = basename($path);
  309. if (!OC_FILESYSTEM::file_exists($parent)) {
  310. return "409 Conflict";
  311. }
  312. if (!OC_FILESYSTEM::is_dir($parent)) {
  313. return "403 Forbidden";
  314. }
  315. if ( OC_FILESYSTEM::file_exists($parent."/".$name) ) {
  316. return "405 Method not allowed";
  317. }
  318. if (!empty($this->_SERVER["CONTENT_LENGTH"])) { // no body parsing yet
  319. return "415 Unsupported media type";
  320. }
  321. $stat = OC_FILESYSTEM::mkdir($parent."/".$name, 0777);
  322. if (!$stat) {
  323. return "403 Forbidden";
  324. }
  325. return ("201 Created");
  326. }
  327. /**
  328. * DELETE method handler
  329. *
  330. * @param array general parameter passing array
  331. * @return bool true on success
  332. */
  333. function DELETE($options)
  334. {
  335. $path =$options["path"];
  336. if (!OC_FILESYSTEM::file_exists($path)) {
  337. return "404 Not found";
  338. }
  339. if (OC_FILESYSTEM::is_dir($path)) {
  340. $query = "DELETE FROM properties WHERE path LIKE '".$this->_slashify($options["path"])."%'";
  341. OC_DB::query($query);
  342. // System::rm(array("-rf, $path"));
  343. OC_FILESYSTEM::delTree($path);
  344. } else {
  345. OC_FILESYSTEM::unlink($path);
  346. }
  347. $query = "DELETE FROM properties WHERE path = '$options[path]'";
  348. OC_DB::query($query);
  349. return "204 No Content";
  350. }
  351. /**
  352. * MOVE method handler
  353. *
  354. * @param array general parameter passing array
  355. * @return bool true on success
  356. */
  357. function MOVE($options)
  358. {
  359. return $this->COPY($options, true);
  360. }
  361. /**
  362. * COPY method handler
  363. *
  364. * @param array general parameter passing array
  365. * @return bool true on success
  366. */
  367. function COPY($options, $del=false)
  368. {
  369. // TODO Property updates still broken (Litmus should detect this?)
  370. if (!empty($this->_SERVER["CONTENT_LENGTH"])) { // no body parsing yet
  371. return "415 Unsupported media type";
  372. }
  373. // no copying to different WebDAV Servers yet
  374. if (isset($options["dest_url"])) {
  375. return "502 bad gateway";
  376. }
  377. $source = $options["path"];
  378. if (!OC_FILESYSTEM::file_exists($source)) {
  379. return "404 Not found";
  380. }
  381. if (OC_FILESYSTEM::is_dir($source)) { // resource is a collection
  382. switch ($options["depth"]) {
  383. case "infinity": // valid
  384. break;
  385. case "0": // valid for COPY only
  386. if ($del) { // MOVE?
  387. return "400 Bad request";
  388. }
  389. break;
  390. case "1": // invalid for both COPY and MOVE
  391. default:
  392. return "400 Bad request";
  393. }
  394. }
  395. $dest = $options["dest"];
  396. $destdir = dirname($dest);
  397. if (!OC_FILESYSTEM::file_exists($destdir) || !OC_FILESYSTEM::is_dir($destdir)) {
  398. return "409 Conflict";
  399. }
  400. $new = !OC_FILESYSTEM::file_exists($dest);
  401. $existing_col = false;
  402. if (!$new) {
  403. if ($del && OC_FILESYSTEM::is_dir($dest)) {
  404. if (!$options["overwrite"]) {
  405. return "412 precondition failed";
  406. }
  407. $dest .= basename($source);
  408. if (OC_FILESYSTEM::file_exists($dest)) {
  409. $options["dest"] .= basename($source);
  410. } else {
  411. $new = true;
  412. $existing_col = true;
  413. }
  414. }
  415. }
  416. if (!$new) {
  417. if ($options["overwrite"]) {
  418. $stat = $this->DELETE(array("path" => $options["dest"]));
  419. if (($stat{0} != "2") && (substr($stat, 0, 3) != "404")) {
  420. return $stat;
  421. }
  422. } else {
  423. return "412 precondition failed";
  424. }
  425. }
  426. if ($del) {
  427. if (!OC_FILESYSTEM::rename($source, $dest)) {
  428. return "500 Internal server error";
  429. }
  430. $destpath = $this->_unslashify($options["dest"]);
  431. if (is_dir($source)) {
  432. $query = "UPDATE properties
  433. SET path = REPLACE(path, '".$options["path"]."', '".$destpath."')
  434. WHERE path LIKE '".$this->_slashify($options["path"])."%'";
  435. OC_DB::query($query);
  436. }
  437. $query = "UPDATE properties
  438. SET path = '".$destpath."'
  439. WHERE path = '".$options["path"]."'";
  440. OC_DB::query($query);
  441. } else {
  442. if (OC_FILESYSTEM::is_dir($source)) {
  443. $files = OC_FILESYSTEM::find($source);
  444. $files = array_reverse($files);
  445. } else {
  446. $files = array($source);
  447. }
  448. if (!is_array($files) || empty($files)) {
  449. return "500 Internal server error";
  450. }
  451. foreach ($files as $file) {
  452. if (OC_FILESYSTEM::is_dir($file)) {
  453. $file = $this->_slashify($file);
  454. }
  455. $destfile = str_replace($source, $dest, $file);
  456. if (OC_FILESYSTEM::is_dir($file)) {
  457. if (!OC_FILESYSTEM::file_exists($destfile)) {
  458. if (!OC_FILESYSTEM::is_writeable(dirname($destfile))) {
  459. return "403 Forbidden";
  460. }
  461. if (!OC_FILESYSTEM::mkdir($destfile)) {
  462. return "409 Conflict";
  463. }
  464. } else if (!OC_FILESYSTEM::is_dir($destfile)) {
  465. return "409 Conflict";
  466. }
  467. } else {
  468. if (!OC_FILESYSTEM::copy($file, $destfile)) {
  469. error_log("copy $file to $destfile failed");
  470. return "409 Conflict";
  471. }
  472. }
  473. }
  474. $query = "INSERT INTO properties SELECT * FROM properties WHERE path = '".$options['path']."'";
  475. }
  476. return ($new && !$existing_col) ? "201 Created" : "204 No Content";
  477. }
  478. /**
  479. * PROPPATCH method handler
  480. *
  481. * @param array general parameter passing array
  482. * @return bool true on success
  483. */
  484. function PROPPATCH(&$options)
  485. {
  486. global $prefs, $tab;
  487. $msg = "";
  488. $path = $options["path"];
  489. $dir = dirname($path)."/";
  490. $base = basename($path);
  491. foreach ($options["props"] as $key => $prop) {
  492. if ($prop["ns"] == "DAV:") {
  493. $options["props"][$key]['status'] = "403 Forbidden";
  494. } else {
  495. if (isset($prop["val"])) {
  496. $query = "REPLACE INTO properties SET path = '$options[path]', name = '$prop[name]', ns= '$prop[ns]', value = '$prop[val]'";
  497. error_log($query);
  498. } else {
  499. $query = "DELETE FROM properties WHERE path = '$options[path]' AND name = '$prop[name]' AND ns = '$prop[ns]'";
  500. }
  501. OC_DB::query($query);
  502. }
  503. }
  504. return "";
  505. }
  506. /**
  507. * LOCK method handler
  508. *
  509. * @param array general parameter passing array
  510. * @return bool true on success
  511. */
  512. function LOCK(&$options)
  513. {
  514. // get absolute fs path to requested resource
  515. $fspath = $options["path"];
  516. // TODO recursive locks on directories not supported yet
  517. // makes litmus test "32. lock_collection" fail
  518. if (is_dir($fspath) && !empty($options["depth"])) {
  519. return "409 Conflict";
  520. }
  521. $options["timeout"] = time()+300; // 5min. hardcoded
  522. if (isset($options["update"])) { // Lock Update
  523. $where = "WHERE path = '$options[path]' AND token = '$options[update]'";
  524. $query = "SELECT owner, exclusivelock FROM locks $where";
  525. $row = OC_DB::select($query);
  526. if (is_array($row)) {
  527. $query = "UPDATE `locks` SET `expires` = '$options[timeout]', `modified` = ".time()." $where";
  528. OC_DB::query($query);
  529. $options['owner'] = $row['owner'];
  530. $options['scope'] = $row["exclusivelock"] ? "exclusive" : "shared";
  531. $options['type'] = $row["exclusivelock"] ? "write" : "read";
  532. return true;
  533. } else {
  534. return false;
  535. }
  536. }
  537. $query = "INSERT INTO `locks`
  538. SET `token` = '$options[locktoken]'
  539. , `path` = '$options[path]'
  540. , `created` = ".time()."
  541. , `modified` = ".time()."
  542. , `owner` = '$options[owner]'
  543. , `expires` = '$options[timeout]'
  544. , `exclusivelock` = " .($options['scope'] === "exclusive" ? "1" : "0")
  545. ;
  546. OC_DB::query($query);
  547. return OC_DB::affected_rows() ? "200 OK" : "409 Conflict";
  548. }
  549. /**
  550. * UNLOCK method handler
  551. *
  552. * @param array general parameter passing array
  553. * @return bool true on success
  554. */
  555. function UNLOCK(&$options)
  556. {
  557. $query = "DELETE FROM locks
  558. WHERE path = '$options[path]'
  559. AND token = '$options[token]'";
  560. OC_DB::query($query);
  561. return OC_DB::affected_rows() ? "204 No Content" : "409 Conflict";
  562. }
  563. /**
  564. * checkLock() helper
  565. *
  566. * @param string resource path to check for locks
  567. * @return bool true on success
  568. */
  569. function checkLock($path)
  570. {
  571. $result = false;
  572. $query = "SELECT *
  573. FROM locks
  574. WHERE path = '$path'
  575. ";
  576. $res = OC_DB::select($query);
  577. if ($res) {
  578. $row=$res[0];
  579. OC_DB::free_result($res);
  580. if ($row) {
  581. $result = array( "type" => "write",
  582. "scope" => $row["exclusivelock"] ? "exclusive" : "shared",
  583. "depth" => 0,
  584. "owner" => $row['owner'],
  585. "token" => $row['token'],
  586. "created" => $row['created'],
  587. "modified" => $row['modified'],
  588. "expires" => $row['expires']
  589. );
  590. }
  591. }
  592. return $result;
  593. }
  594. /**
  595. * create database tables for property and lock storage
  596. *
  597. * @param void
  598. * @return bool true on success
  599. */
  600. function create_database()
  601. {
  602. // TODO
  603. return false;
  604. }
  605. }
  606. ?>