/** * @see PackageInstallationPlugin::uninstall() */ public function uninstall() { // call uninstall event EventHandler::fireAction($this, 'uninstall'); $sql = "DELETE FROM\twcf" . WCF_N . "_" . $this->tableName . "\n\t\t\tWHERE\t\tpackageID = " . $this->installation->getPackageID(); WCF::getDB()->sendQuery($sql); }
/** * @see PackageInstallationQueue::getInstallationInfo() */ protected function getInstallationInfo() { $info = PackageInstallationQueue::getInstallationInfo(); $this->package = $info['packageID'] ? new Package(null, $info) : null; $this->packageArchive = new PackageArchive($info['archive'], $this->package); $this->packageArchive->openArchive(); }
/** * @see Page::show() */ public function show() { $wcfPackageID = WCFACP::getWcfPackageID(); // check package installation queue if ($wcfPackageID == 0) { PackageInstallationQueue::checkPackageInstallationQueue(); } if (WCFACP::getWcfPackageID() == PACKAGE_ID) { $packages = WCF::getCache()->get('packages'); foreach ($packages as $packageID => $package) { break; } if (isset($packageID) && $packageID != PACKAGE_ID) { HeaderUtil::redirect('../' . $packages[$packageID]['packageDir'] . 'acp/index.php' . SID_ARG_1ST, false); exit; } } // show page parent::show(); }
/** * @see Page::show() */ public function show() { parent::show(); // check master password WCFACP::checkMasterPassword(); switch ($this->action) { case 'install': case 'update': if ($this->action == 'install') { WCF::getUser()->checkPermission('admin.system.package.canInstallPackage'); } else { WCF::getUser()->checkPermission('admin.system.package.canUpdatePackage'); } require_once WCF_DIR . 'lib/acp/package/PackageInstallation.class.php'; new PackageInstallation($this->queueID); break; case 'rollback': WCF::getUser()->checkPermission('admin.system.package.canInstallPackage'); require_once WCF_DIR . 'lib/acp/package/PackageInstallationRollback.class.php'; new PackageInstallationRollback($this->queueID); break; case 'uninstall': WCF::getUser()->checkPermission('admin.system.package.canUninstallPackage'); require_once WCF_DIR . 'lib/acp/package/PackageUninstallation.class.php'; new PackageUninstallation($this->queueID); break; case 'openQueue': require_once WCF_DIR . 'lib/acp/package/PackageInstallationQueue.class.php'; PackageInstallationQueue::openQueue($this->parentQueueID, $this->processNo); break; case 'startUninstall': WCF::getUser()->checkPermission('admin.system.package.canUninstallPackage'); require_once WCF_DIR . 'lib/acp/package/PackageUninstallation.class.php'; PackageUninstallation::checkDependencies(); break; } }
/** * @see PackageInstallationQueue::calcProgress() */ protected function calcProgress($currentStep) { if ($this->parentQueueID == 0) { parent::calcProgress($currentStep); } }
/** * Saves the stack of package installations in the package installation queue table. */ public function savePackageInstallationStack() { // get new process no require_once WCF_DIR . 'lib/acp/package/PackageInstallationQueue.class.php'; $processNo = PackageInstallationQueue::getNewProcessNo(); // build inserts $inserts = ''; foreach ($this->packageInstallationStack as $package) { // unzip tar $package['archive'] = PackageArchive::unzipPackageArchive($package['archive']); if (!empty($inserts)) { $inserts .= ','; } $inserts .= "(" . $processNo . ", " . WCF::getUser()->userID . ", '" . escapeString($package['package']) . "', " . $package['packageID'] . ", '" . escapeString($package['archive']) . "', '" . escapeString($package['action']) . "')"; } // save inserts if (!empty($inserts)) { $sql = "INSERT INTO\twcf" . WCF_N . "_package_installation_queue\n\t\t\t\t\t\t(processNo, userID, package, packageID, archive, action)\n\t\t\t\tVALUES\t\t" . $inserts; WCF::getDB()->sendQuery($sql); } return $processNo; }
/** * @see Form::save() */ public function save() { parent::save(); // get new process no require_once WCF_DIR . 'lib/acp/package/PackageInstallationQueue.class.php'; $processNo = PackageInstallationQueue::getNewProcessNo(); // set installationType for redirecting after finish installation $type = 'other'; if ($this->package === null) { $type = 'install'; } // insert queue entry $sql = "INSERT INTO\twcf" . WCF_N . "_package_installation_queue\n\t\t\t\t\t(processNo, userID, package, packageID, archive, action, confirmInstallation, cancelable, installationType)\n\t\t\tVALUES\t\t(" . $processNo . ",\n\t\t\t\t\t" . WCF::getUser()->userID . ",\n\t\t\t\t\t'" . escapeString($this->archive->getPackageInfo('name')) . "',\n\t\t\t\t\t" . $this->packageID . ",\n\t\t\t\t\t'" . escapeString(!empty($this->uploadPackage['tmp_name']) ? $this->uploadPackage['tmp_name'] : $this->downloadPackage) . "',\n\t\t\t\t\t'" . ($this->package != null ? 'update' : 'install') . "',\n\t\t\t\t\t1,\n\t\t\t\t\t" . ($this->package != null ? 0 : 1) . ",\n\t\t\t\t\t'" . $type . "')"; WCF::getDB()->sendQuery($sql); $this->queueID = WCF::getDB()->getInsertID(); $this->saved(); // open queue HeaderUtil::redirect('index.php?page=Package&action=openQueue&processNo=' . $processNo . '&packageID=' . PACKAGE_ID . SID_ARG_2ND_NOT_ENCODED); exit; }
/** * @see PackageInstalltionQueue::calcProgress() */ protected function calcProgress($currentStep) { if (!$this->progressPackage || $this->packageType == 'optional') { return; } parent::calcProgress($currentStep); }