/** * Write Archive * */ private function ExtractArchive($archive_path) { global $langmessage, $dataDir; $archive = new \gp\tool\Archive($archive_path); $extract_temp = $dataDir . \gp\tool\FileSystem::TempFile('/data/_temp/addon'); if (!$archive->extractTo($extract_temp)) { $this->message($langmessage['download_failed'] . ' (Package not extracted)'); return false; } //get archive root $archive_root = $archive->GetRoot(); if (is_null($archive_root)) { $this->message($langmessage['download_failed'] . ' (Root not found)'); return false; } //rename to source folder $rename_from = $extract_temp . '/' . ltrim($archive_root, '/'); if (!\gp\tool\Files::Replace($rename_from, $this->source)) { $this->message($langmessage['download_failed'] . ' (Not replaced)'); return false; } return true; }