-function get_lockpath() {
- $lockpath = get_config('system','lockpath');
- if (($lockpath != "") AND App::directory_usable($lockpath)) {
- // We have a lock path and it is usable
- return $lockpath;
- }
-
- // We don't have a working preconfigured lock path, so we take the temp path.
- $temppath = get_temppath();
-
- if ($temppath != "") {
- // To avoid any interferences with other systems we create our own directory
- $lockpath = $temppath."/lock";
- if (!is_dir($lockpath)) {
- mkdir($lockpath);
- }
-
- if (App::directory_usable($lockpath)) {
- // The new path is usable, we are happy
- set_config("system", "lockpath", $lockpath);
- return $lockpath;
- } else {
- // We can't create a subdirectory, strange.
- // But the directory seems to work, so we use it but don't store it.
- return $temppath;
- }
- }
-
- // Reaching this point means that the operating system is configured badly.
- return "";
-}
-