/**
  * Checks the correctness of the package archive.
  */
 protected function checkArchive()
 {
     if ($this->action == 'install') {
         // check install support
         if (!$this->packageArchive->isValidInstall()) {
             $this->packageArchive->deleteArchive();
             throw new SystemException("'" . $this->packageArchive->getArchive() . "' is not a valid WCF Package.", 13004);
         }
         // TODO: in case this is an installation of a package that brought dependencies
         // and the dependent packages' package.xml contains a misspelled name in the
         // <package> tag, checkArchive will return false here --> "wrong error"!
         // check whether this package is already installed
         if ($this->packageArchive->isAlreadyInstalled()) {
             $this->packageArchive->deleteArchive();
             throw new SystemException("package '" . $this->packageArchive->getPackageInfo('name') . "' is already installed.", 13014);
         }
     } else {
         if ($this->action == 'update') {
             // check update support
             if (!$this->packageArchive->isValidUpdate()) {
                 if ($this->packageArchive->getPackageInfo('name') == $this->package->getPackage() && $this->packageArchive->getPackageInfo('version') == $this->package->getVersion()) {
                     if ($this->parentQueueID == 0) {
                         $this->calcProgress(0);
                         WCF::getTPL()->assign(array('nextStep' => 'finish'));
                         WCF::getTPL()->display('packageInstallationFrame');
                         exit;
                     } else {
                         $this->calcProgress(7);
                         $this->nextStep = $this->finishInstallation();
                         WCF::getTPL()->assign(array('nextStep' => $this->nextStep));
                         WCF::getTPL()->display('packageInstallationNext');
                         exit;
                     }
                 }
                 $this->packageArchive->deleteArchive();
                 throw new SystemException("package '" . $this->packageArchive->getPackageInfo('name') . " v" . $this->packageArchive->getPackageInfo('version') . "' is not a compatible update for package '" . $this->package->getPackage() . " v" . $this->package->getVersion() . "'.", 13005);
             }
         }
     }
 }