/** * @see wcf\system\package\plugin\IPackageInstallationPlugin::install() */ public function install() { parent::install(); // get package installation dir $dir = $this->installation->getPackage()->packageDir; if (empty($dir)) { if ($this->installation->getPackage()->isApplication == 1 && $this->installation->getPackage()->package != 'com.woltlab.wcf' && $this->installation->getAction() == 'install') { // application // prompt package dir $dir = $this->promptPackageDir(); } // save package dir if (!empty($dir)) { $package = new Package($this->installation->getPackageID()); $packageEditor = new PackageEditor($package); $packageEditor->update(array('packageDir' => $dir)); $this->installation->getPackage()->packageDir = $dir; } } // absolute path to package dir $packageDir = FileUtil::addTrailingSlash(FileUtil::getRealPath(WCF_DIR.$dir)); // extract files.tar to temp folder $sourceFile = $this->installation->getArchive()->extractTar($this->instruction['value'], 'files_'); // create file handler $fileHandler = new FilesFileHandler($this->installation); // extract content of files.tar $fileInstaller = $this->installation->extractFiles($packageDir, $sourceFile, $fileHandler); // if this a an application, write config.inc.php for this package if ($this->installation->getPackage()->isApplication == 1 && $this->installation->getPackage()->package != 'com.woltlab.wcf' && $this->installation->getAction() == 'install') { // touch file $fileInstaller->touchFile(PackageInstallationDispatcher::CONFIG_FILE); // create file Package::writeConfigFile($this->installation->getPackageID()); // log file $sql = "INSERT INTO wcf".WCF_N."_package_installation_file_log (packageID, filename) VALUES (?, 'config.inc.php')"; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute(array($this->installation->getPackageID())); } // delete temporary sourceArchive @unlink($sourceFile); // update acp style file StyleUtil::updateStyleFile(); }
/** * @see \wcf\system\package\plugin\IPackageInstallationPlugin::install() */ public function install() { parent::install(); $abbreviation = 'wcf'; if (isset($this->instruction['attributes']['application'])) { $abbreviation = $this->instruction['attributes']['application']; } else { if ($this->installation->getPackage()->isApplication) { $abbreviation = Package::getAbbreviation($this->installation->getPackage()->package); } } // absolute path to package dir $packageDir = Application::getDirectory($abbreviation); // extract files.tar to temp folder $sourceFile = $this->installation->getArchive()->extractTar($this->instruction['value'], 'files_'); // create file handler $fileHandler = new FilesFileHandler($this->installation, $abbreviation); // extract content of files.tar $fileInstaller = $this->installation->extractFiles($packageDir, $sourceFile, $fileHandler); // if this a an application, write config.inc.php for this package if ($this->installation->getPackage()->isApplication == 1 && $this->installation->getPackage()->package != 'com.woltlab.wcf' && $this->installation->getAction() == 'install' && $abbreviation != 'wcf') { // touch file $fileInstaller->touchFile(PackageInstallationDispatcher::CONFIG_FILE); // create file Package::writeConfigFile($this->installation->getPackageID()); // log file $sql = "INSERT INTO\twcf" . WCF_N . "_package_installation_file_log\n\t\t\t\t\t\t(packageID, filename, application)\n\t\t\t\tVALUES\t\t(?, ?, ?)"; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute(array($this->installation->getPackageID(), 'config.inc.php', Package::getAbbreviation($this->installation->getPackage()->package))); // load application WCF::loadRuntimeApplication($this->installation->getPackageID()); } // delete temporary sourceArchive @unlink($sourceFile); // update acp style file StyleUtil::updateStyleFile(); }
/** * Installs node components and returns next node. * * @param string $node * @return \wcf\system\package\PackageInstallationStep */ public function install($node) { $nodes = $this->nodeBuilder->getNodeData($node); // invoke node-specific actions foreach ($nodes as $data) { $nodeData = unserialize($data['nodeData']); switch ($data['nodeType']) { case 'package': $step = $this->installPackage($nodeData); break; case 'pip': $step = $this->executePIP($nodeData); break; case 'optionalPackages': $step = $this->selectOptionalPackages($node, $nodeData); break; default: die("Unknown node type: '" . $data['nodeType'] . "'"); break; } if ($step->splitNode()) { $this->nodeBuilder->cloneNode($node, $data['sequenceNo']); break; } } // mark node as completed $this->nodeBuilder->completeNode($node); // assign next node $tmp = $node; $node = $this->nodeBuilder->getNextNode($node); $step->setNode($node); // perform post-install/update actions if ($node == '') { // update "last update time" option $sql = "UPDATE\twcf" . WCF_N . "_option\n\t\t\t\tSET\toptionValue = ?\n\t\t\t\tWHERE\toptionName = ?"; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute(array(TIME_NOW, 'last_update_time')); // update options.inc.php OptionEditor::resetCache(); if ($this->action == 'install') { // save localized package infos $this->saveLocalizedPackageInfos(); // remove all cache files after WCFSetup if (!PACKAGE_ID) { CacheHandler::getInstance()->flushAll(); $sql = "UPDATE\twcf" . WCF_N . "_option\n\t\t\t\t\t\tSET\toptionValue = ?\n\t\t\t\t\t\tWHERE\toptionName = ?"; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute(array(StringUtil::getUUID(), 'wcf_uuid')); if (WCF::getSession()->getVar('__wcfSetup_developerMode')) { $statement->execute(array(1, 'enable_debug_mode')); } // update options.inc.php OptionEditor::resetCache(); } // rebuild application paths ApplicationHandler::rebuild(); ApplicationEditor::setup(); } // remove template listener cache TemplateListenerCodeCacheBuilder::getInstance()->reset(); // reset language cache LanguageFactory::getInstance()->clearCache(); LanguageFactory::getInstance()->deleteLanguageCache(); // reset stylesheets StyleHandler::resetStylesheets(); // clear user storage UserStorageHandler::getInstance()->clear(); // rebuild config files for affected applications $sql = "SELECT\t\tpackage.packageID\n\t\t\t\tFROM\t\twcf" . WCF_N . "_package_installation_queue queue,\n\t\t\t\t\t\twcf" . WCF_N . "_package package\n\t\t\t\tWHERE\t\tqueue.processNo = ?\n\t\t\t\t\t\tAND package.packageID = queue.packageID\n\t\t\t\t\t\tAND package.packageID <> ?\n\t\t\t\t\t\tAND package.isApplication = ?"; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute(array($this->queue->processNo, 1, 1)); while ($row = $statement->fetchArray()) { Package::writeConfigFile($row['packageID']); } EventHandler::getInstance()->fireAction($this, 'postInstall'); // remove archives $sql = "SELECT\tarchive\n\t\t\t\tFROM\twcf" . WCF_N . "_package_installation_queue\n\t\t\t\tWHERE\tprocessNo = ?"; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute(array($this->queue->processNo)); while ($row = $statement->fetchArray()) { @unlink($row['archive']); } // delete queues $sql = "DELETE FROM\twcf" . WCF_N . "_package_installation_queue\n\t\t\t\tWHERE\t\tprocessNo = ?"; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute(array($this->queue->processNo)); } if ($this->requireRestructureVersionTables) { $this->restructureVersionTables(); } return $step; }