function upload($incVersion) { $vs = qg::remoteGet($this->name); if (!is_dir(sysPATH . $this->name)) { return false; } $v = explode('.', $vs['version']); $v = @array((int) $v[0], (int) $v[1], (int) $v[2]); foreach ($v as $i => $vp) { if ($i >= $incVersion) { $v[$i] = 0; } } isset($v[$incVersion - 1]) && ++$v[$incVersion - 1]; $vs['version'] = implode('.', $v); $tmpFile = appPATH . 'cache/tmp/module_export1.zip'; is_file($tmpFile) && unlink($tmpFile); // zzz unlink??? require_once sysPATH . 'core/lib/file/zip.php'; $zip = new qgZipArchive(); $zip->open($tmpFile, ZipArchive::CREATE); $zip->addDir(sysPATH . $this->name, null, '/(\\.svn)|(zzz)|(yyy)/'); $zip->close(); $vs['size'] = filesize($tmpFile); $this->local_version = $vs['version']; @qg::Ftp()->mkdir('/module/' . $this->name . '/'); qg::Ftp()->put('/module/' . $this->name . '/' . $vs['version'] . '.zip', $tmpFile, FTP_BINARY); qg::remoteSet($this->name, $vs); return $vs['version']; }
/* add mysql export */ $structExport = ''; @mkdir('/tmp/'); @mkdir('/tmp/qgdbexport1/'); chmod('/tmp/qgdbexport1/', 0777); foreach (D()->Tables() as $T) { $file = realpath('/tmp/qgdbexport1/') . '/' . $T . '.csv'; @unlink($file); D()->query("SELECT * INTO OUTFILE " . D()->quote($file) . " FROM " . $T); $zip->addFile($file, 'mysql/' . $T); $tmp = D()->row("SHOW CREATE TABLE " . $T); $structExport .= $tmp['Create Table'] . ";\n\n"; } $zip->addFromString('mysql.struct.sql', $structExport); $zip->close(); /* send */ header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: private", false); header("Content-Type: application/force-download"); header("Content-Disposition: attachment; filename=\"export.zip\";"); header("Content-Transfer-Encoding: binary"); while (ob_get_level()) { ob_end_clean(); } readfile($tmpFile); abort(); /**/ }