function PclTraceDisplay() { TrDisplay(); }
function extractArchive() { global $mosConfig_absolute_path; $base_Dir = $this->pathName($mosConfig_absolute_path . "/media/"); $archivename = $base_Dir . $this->installArchive(); $tmpdir = uniqid("install_"); if ($this->isWindows()) { $extractdir = str_replace('/', '\\', $this->pathName($base_Dir . "{$tmpdir}")); $archivename = str_replace('/', '\\', $archivename); } else { $extractdir = str_replace('\\', '/', $this->pathName($base_Dir . "{$tmpdir}")); $archivename = str_replace('\\', '/', $archivename); } $this->unpackDir($extractdir); // Find the extension of the file $fileext = substr(strrchr(basename($this->installArchive()), '.'), 1); if ($fileext == "gz" || $fileext == "tar") { PclTarExtract($archivename, $extractdir); if (PclErrorCode() != 1) { echo "<font color=\"red\">" . PclErrorString() . "<br />Updater - error</font>"; TrDisplay(); exit; } $this->installDir($extractdir); } else { $zipfile = new PclZip($archivename); if ($this->isWindows()) { define('OS_WINDOWS', 1); } else { define('OS_WINDOWS', 0); } $ret = $zipfile->extract(PCLZIP_OPT_PATH, $extractdir); if ($ret == 0) { $this->setError(1, "Unrecoverable error '" . $zipfile->errorName(true) . "'", "Updater - error"); return false; } $this->installDir($extractdir); } // Try to find the correct install dir. in case that the package have subdirs // Save the install dir for later cleanup $filesindir = $this->readDirectory($this->installDir(), ""); if (count($filesindir) == 1) { if (is_dir($extractdir . $filesindir[0])) { $this->installDir($extractdir . $filesindir[0]); } } return true; }