From: Alexander Ebert Date: Fri, 12 Oct 2012 17:33:41 +0000 (+0200) Subject: Added ability to export styles as package X-Git-Tag: 2.0.0_Beta_1~902 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=1266a7c11475bb0daf7ee799ee470959011ca702;p=GitHub%2FWoltLab%2FWCF.git Added ability to export styles as package --- diff --git a/wcfsetup/install/files/lib/data/style/StyleEditor.class.php b/wcfsetup/install/files/lib/data/style/StyleEditor.class.php index 593c76d993..c2bcdc7fa7 100644 --- a/wcfsetup/install/files/lib/data/style/StyleEditor.class.php +++ b/wcfsetup/install/files/lib/data/style/StyleEditor.class.php @@ -1,5 +1,7 @@ create(); - readfile($styleTarName); + + // export as style package + if (empty($packageName)) { + readfile($styleTarName); + } + else { + // export as package + + // create package tar + $packageTarName = FileUtil::getTemporaryFilename('package_', '.tar.gz'); + $packageTar = new TarWriter($packageTarName, true); + + // append style tar + $styleTarName = FileUtil::unifyDirSeperator($styleTarName); + $packageTar->add($styleTarName, '', dirname($styleTarName)); + + // create package.xml + $string = "\n\n"; + + $string .= "\t\n"; + $string .= "\t\tstyleName)."]]>\n"; + $string .= "\t\tstyleDescription)."]]>\n"; + $string .= "\t\tstyleVersion)."]]>\n"; + $string .= "\t\tstyleDate)."]]>\n"; + $string .= "\t\n"; + + $string .= "\t\n"; + $string .= "\t\tauthorName)."]]>\n"; + if ($this->authorURL) $string .= "\t\tauthorURL)."]]>\n"; + $string .= "\t\n"; + + $string .= "\t\n"; + $string .= "\t\t".basename($styleTarName)."\n"; + $string .= "\t\n"; + + $string .= "\n"; + + // append package info file to package tar + $packageTar->addString(PackageArchive::INFO_FILE, $string); + + $packageTar->create(); + readfile($packageTarName); + @unlink($packageTarName); + } + @unlink($styleTarName); }