static function init() { sys_io_File::saveContent("log.txt", ""); me_cunity_debug_Out::$log = sys_io_File::write("log.txt", true); me_cunity_debug_Out::$log->flush(); haxe_Log::$trace = isset(me_cunity_debug_Out::$_trace) ? me_cunity_debug_Out::$_trace : array("me_cunity_debug_Out", "_trace"); }
static function cached_query($sql_cmd, $args = null, $dirty_pages = null) { $s_args = $args->join(":"); $header = _hx_string_or_null($sql_cmd) . _hx_string_or_null($s_args); $filename = _hx_string_or_null(system_base_Wet_base::$cache_path) . _hx_string_rec(system_base_Hashes::do_hash($header), ""); $resultset = null; $cached_results = null; $rows = new HList(); $data = null; $total_rows = null; $results = null; $return_data = _hx_anonymous(array("rows" => $rows, "total_rows" => 0)); if (strtoupper(_hx_substr(ltrim($sql_cmd), 0, 6)) !== "SELECT") { system_base_Database::get_instance(null, null, null, null, null, null, null, null); $resultset = system_base_Database::query($sql_cmd, $args, null); return _hx_anonymous(array("rows" => $resultset->results(), "total_rows" => $resultset->get_length())); } if (file_exists($filename)) { $fin = sys_io_File::read($filename, false); $results = $fin->readLine(); if ($results === $header) { $cached_results = $fin->readLine(); $return_data = haxe_Unserializer::run($cached_results); } else { $m = "Database cache collision running query: " . _hx_string_or_null($sql_cmd) . "\n"; $m = Std::string(Date::now()) . ": " . _hx_string_or_null($m); system_base_Database::get_instance(null, null, null, null, null, null, null, null); $resultset = system_base_Database::query($sql_cmd, $args, null); return _hx_anonymous(array("rows" => $resultset->results(), "total_rows" => $resultset->get_length())); } } else { system_base_Database::get_instance(null, null, null, null, null, null, null, null); $resultset = system_base_Database::query($sql_cmd, $args, null); $data = haxe_Serializer::run(_hx_anonymous(array("rows" => $resultset->results(), "total_rows" => $resultset->get_length()))); $fout = sys_io_File::write($filename, false); $fout->writeString(_hx_string_or_null($header) . "\n"); $fout->writeString(_hx_string_or_null($data) . "\n"); $fout->close(); } return $return_data; }
public function writeBinary($bs) { $bytes = haxe_io_Bytes::ofData($bs); $fo = sys_io_File::write($this->location, true); $fo->writeBytes($bytes, 0, $bytes->length); }
static function get_write_handle($fullpath, $binary = null) { if ($binary === null) { $binary = false; } return sys_io_File::write($fullpath, $binary); }
function ufront_web_upload_TmpFileUploadMiddleware_0(&$_g, &$ctx, &$dateStr, &$dir, &$file, &$origFileName, &$postName, &$size, &$tmpFilePath, $pName, $fName) { $postName = $pName; $origFileName = $fName; $size = 0; while ($file === null) { $tmpFilePath = _hx_string_or_null($dir) . _hx_string_or_null($dateStr) . "-" . _hx_string_or_null(ufront_core_Uuid::create()) . ".tmp"; if (!file_exists($tmpFilePath)) { $file = sys_io_File::write($tmpFilePath, null); } } return ufront_core_SurpriseTools::success(); }
static function cache_to_disk() { $router = null; if (system_base_Router::$instance === null) { system_base_Router::$instance = new system_base_Router(); } $router = system_base_Router::$instance; $hash = $router->query_hash; $query = $router->query_string; $fout = sys_io_File::write(_hx_string_or_null(system_base_Wet_base::$cache_path) . _hx_string_or_null($hash) . ".htm", false); $fout->writeString(_hx_string_or_null($query) . "\n" . _hx_string_or_null(system_base_Cache::$output_buffer->toString())); $fout->close(); $fullpath = _hx_string_or_null(system_base_Wet_base::$cache_path) . _hx_string_or_null($hash) . ".htm"; if (file_exists($fullpath)) { $stats = sys_FileSystem::stat($fullpath); return _hx_string_or_null(StringTools::hex($stats->size, null)) . "-" . _hx_string_or_null(StringTools::hex($stats->ino, null)) . "-" . _hx_string_or_null(_hx_string_call(_hx_string_call($stats->mtime, "toString", array()), "substr", array(17, 2))); } else { return ""; } }
static function saveBytes($path, $bytes) { $f = sys_io_File::write($path, null); $f->write($bytes); $f->close(); }