/** * @see PackageInstallationPlugin::install() */ public function install() { parent::install(); $dir = $this->installation->getPackage()->getDir(); if (empty($dir)) { if ($this->installation->getPackage()->getParentPackageID() > 0) { // plugin // use parents package dir $dir = $this->installation->getPackage()->getParentPackage()->getDir(); } else { if ($this->installation->getPackage()->isStandalone() == 1 && $this->installation->getPackage()->getPackage() != 'com.woltlab.wcf' && $this->installation->getAction() == 'install') { // standalone package // prompt package dir $dir = $this->promptPackageDir(); } } // save package dir if (!empty($dir)) { $sql = "UPDATE\twcf" . WCF_N . "_package\n\t\t\t\t\tSET\tpackageDir = '" . escapeString($dir) . "'\n\t\t\t\t\tWHERE\tpackageID = " . $this->installation->getPackageID(); WCF::getDB()->sendQuery($sql); $this->installation->getPackage()->setDir($dir); } } // absolute path to package dir $packageDir = FileUtil::addTrailingSlash(FileUtil::getRealPath(WCF_DIR . $dir)); // extract files.tar to temp folder $tag = $this->installation->getXMLTag('files'); $sourceFile = $this->installation->getArchive()->extractTar($tag['cdata'], 'files_'); // create file handler $fileHandler = new FilesFileHandler($this->installation); // extract content of files.tar try { $fileInstaller = $this->installation->extractFiles($packageDir, $sourceFile, $fileHandler); } catch (SystemException $e) { if (!@file_exists(WCF_DIR . 'acp/templates/packageInstallationFileInstallationFailed.tpl')) { // workaround for wcf 1.0 to 1.1 update throw $e; } else { WCF::getTPL()->assign(array('exception' => $e)); WCF::getTPL()->display('packageInstallationFileInstallationFailed'); exit; } } // if this a standalone package, write config.inc.php for this package if ($this->installation->getPackage()->isStandalone() == 1 && $this->installation->getPackage()->getPackage() != 'com.woltlab.wcf' && $this->installation->getAction() == 'install') { // touch file $fileInstaller->touchFile(PackageInstallation::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)\n\t\t\t\tVALUES\t\t(" . $this->installation->getPackageID() . ", 'config.inc.php')"; WCF::getDB()->sendQuery($sql); } // delete temporary sourceArchive @unlink($sourceFile); // update acp style file StyleUtil::updateStyleFile(); }
@unlink(WCF_DIR . 'acp/style/containers.css'); @unlink(WCF_DIR . 'acp/style/forms.css'); @unlink(WCF_DIR . 'acp/style/global.css'); @unlink(WCF_DIR . 'acp/style/header.css'); @unlink(WCF_DIR . 'acp/style/ie6Fix.css'); @unlink(WCF_DIR . 'acp/style/ie7Fix.css'); @unlink(WCF_DIR . 'acp/style/inlineCalendar.css'); @unlink(WCF_DIR . 'acp/style/messages.css'); @unlink(WCF_DIR . 'acp/style/pageMenu.css'); @unlink(WCF_DIR . 'acp/style/pageNavigation.css'); @unlink(WCF_DIR . 'acp/style/setupStyle.css'); @unlink(WCF_DIR . 'acp/style/setupWindowStyle.css'); @unlink(WCF_DIR . 'acp/style/tabbedMenus.css'); @unlink(WCF_DIR . 'acp/style/tables.css'); // update acp style file StyleUtil::updateStyleFile(); // init package install and update timestamps $sql = "UPDATE\twcf" . WCF_N . "_package\n\tSET\tinstallDate = packageDate\n\tWHERE\tinstallDate = 0"; WCF::getDB()->sendQuery($sql); $sql = "UPDATE\twcf" . WCF_N . "_package\n\tSET\tupdateDate = packageDate\n\tWHERE\tupdateDate = 0"; WCF::getDB()->sendQuery($sql); // remove obsolete package com.woltlab.wcf.system.template.pack // get wcf id $wcfPackageID = $this->installation->getPackageID(); // get id of template pack package $sql = "SELECT packageID FROM wcf" . WCF_N . "_package WHERE package = 'com.woltlab.wcf.system.template.pack'"; $row = WCF::getDB()->getFirstRow($sql); if (!empty($row['packageID'])) { $tplPackageID = $row['packageID']; // modify table $sql = "ALTER TABLE wcf" . WCF_N . "_template_pack ADD parentTemplatePackID INT(10) NOT NULL DEFAULT 0";
/** * Converts the file of this style to a RTL ("right-to-left") version. */ public function writeStyleFileRTL() { // get contents of LTR version $contents = file_get_contents(WCF_DIR . 'style/style-' . $this->styleID . '.css'); // convert ltr to rtl $contents = StyleUtil::convertCSSToRTL($contents); // write file $file = new File(WCF_DIR . 'style/style-' . $this->styleID . '-rtl.css'); $file->write($contents); $file->close(); @chmod(WCF_DIR . 'style/style-' . $this->styleID . '-rtl.css', 0777); }
/** * Converts the file of this style to a RTL ("right-to-left") version. */ public static function updateStyleFileRTL() { // get contents of LTR version $contents = file_get_contents(WCF_DIR . 'acp/style/style-ltr.css'); // convert ltr to rtl $contents = StyleUtil::convertCSSToRTL($contents); // write file $file = new File(WCF_DIR . 'acp/style/style-rtl.css'); $file->write($contents); // close file $file->close(); @chmod(WCF_DIR . 'acp/style/style-rtl.css', 0777); }