public function tryConnClosing() { // TODO: Event Loop Implementation if (!$this->cltf && @flose($this->cltf)) { $this->cltf = null; } }
/** * backup::importfromfile() Download and Import a Backup file to DB * * @param string $bfile * @return **/ function importfromfile() { global $GONX, $HTTP_POST_FILES; @set_time_limit(0); $bfile = $HTTP_POST_FILES["backupfile"]; $pathinfo = pathinfo($bfile["name"]); $compression = $pathinfo["extension"]; if ($bfile["error"] == 0) { // File existe, import it switch ($compression) { case "bz2": $bz = bzopen($bfile["tmp_name"], "r"); $contents = bzread($bz, $bfile["size"]); // just a hack coz feof doesn't wrk for me bzclose($bz); break; case "gz": $gz = gzopen($bfile["tmp_name"], "r"); $contents = gzread($gz, $bfile["size"]); // just a hack coz feof doesn't wrk for me bzclose($gz); break; default: $f = fopen($bfile["tmp_name"], "r"); $contents = fread($f, $bfile["size"]); // just a hack coz feof doesn't wrk for me flose($f); break; } // switch preg_match_all("'<xquery[?>]*?>(.*?)</xquery>'si", $contents, $requetes); foreach ($requetes[1] as $key => $val) { $this->query(trim($val)); } return "<font color=green> " . $bfile["name"] . " " . $GONX["iscorrectimport"] . " </font>"; } else { // Erronous file, read dir, and list available backup file. return $this->listbackups(); } }