/** * @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(); }