function mkFile($mount, $relativePath) { return XApp_File_Utils::createEmptyFile(XApp_Path_Utils::securePath(self::toAbsolutePath($mount) . DIRECTORY_SEPARATOR . $relativePath)); }
public function setContent($scopeName, $path, $content) { xapp_import('xapp.Directory.Utils'); xapp_import('xapp.Path.Utils'); xapp_import('xapp.VFS.Local'); xapp_import('xapp.Commons.Exceptions'); $scope = $this->getScope($scopeName); if ($scope == null) { return false; } $return = null; $fullPath = XApp_Path_Utils::normalizePath($this->resolvePath($scopeName, DIRECTORY_SEPARATOR . $path, null, true, false), true, false); if (!file_exists($fullPath)) { XApp_File_Utils::createEmptyFile($fullPath); } $content = xapp_prettyPrint($content); if (file_exists($fullPath)) { if (!is_writeable($fullPath)) { throw new Xapp_Util_Exception_Storage(vsprintf('File: %s is not writable', array(basename($fullPath))), 1640102); } else { //write out $fp = fopen($fullPath, "w"); fputs($fp, $content); fclose($fp); clearstatcache(true, $fullPath); $return = true; } } else { throw new Xapp_Util_Exception_Storage('unable to write storage to file : ' . $path . ' at : ' . $fullPath, 1640104); } return $return; }