{event name='rowButtons'}
</td>
<td class="columnID">{@$template->templateID}</td>
- <td class="columnTitle columnTemplateName">{if $template->packageDir}[{$template->getPackageAbbreviation()}] {/if}{if $template->templateGroupID}<a href="{link controller='TemplateEdit' id=$template->templateID}{/link}">{$template->templateName}</a>{else}{$template->templateName}{/if}</td>
+ <td class="columnTitle columnTemplateName">{if $template->application != 'wcf'}[{$template->application}] {/if}{if $template->templateGroupID}<a href="{link controller='TemplateEdit' id=$template->templateID}{/link}">{$template->templateName}</a>{else}{$template->templateName}{/if}</td>
<td class="columnDate columnLastModificationTime">{@$template->lastModificationTime|time}</td>
{event name='columns'}
public function readData() {
parent::readData();
- // get template groups
+ // get template groups
$templateGroupList = new TemplateGroupList();
$templateGroupList->readObjects();
$this->availableTemplateGroups = $templateGroupList->getObjects();
<?php
namespace wcf\data\application;
+use wcf\data\package\Package;
+use wcf\data\package\PackageList;
use wcf\data\DatabaseObject;
use wcf\system\request\RouteHandler;
+use wcf\system\exception\SystemException;
+use wcf\util\FileUtil;
/**
* Represents an application.
* @category Community Framework
*/
class Application extends DatabaseObject {
+ /**
+ * absolute page URL
+ * @var string
+ */
+ protected $pageURL = '';
+
/**
* @see wcf\data\DatabaseObject::$databaseTableName
*/
protected static $databaseTableIndexIsIdentity = false;
/**
- * absolute page URL
- * @var string
+ * list of all available application directories
+ * @var array<string>
*/
- protected $pageURL = '';
+ protected static $directories = null;
/**
* Returns absolute page URL.
return $this->pageURL;
}
+
+ /**
+ * Returns the directory of the application with the given abbrevation.
+ *
+ * @param string $abbreviation
+ * @return string
+ */
+ public static function getDirectory($abbreviation) {
+ if (static::$directories === null) {
+ static::$directories = array();
+
+ // read application directories
+ $packageList = new PackageList();
+ $packageList->getConditionBuilder()->add('package.isApplication = ?', array(1));
+ $packageList->readObjects();
+ foreach ($packageList as $package) {
+ static::$directories[Package::getAbbreviation($package->package)] = FileUtil::addTrailingSlash(FileUtil::getRealPath(WCF_DIR.$package->packageDir));
+ }
+ }
+
+ if (!isset(static::$directories[$abbreviation])) {
+ throw new SystemException("Unknown application '".$abbreviation."'");
+ }
+
+ return static::$directories[$abbreviation];
+ }
}
return @file_get_contents($this->getPath());
}
- /**
- * Returns the abbreviation of the package name.
- *
- * @return string
- */
- public function getPackageAbbreviation() {
- return Package::getAbbreviation($this->package);
- }
-
/**
* Searches in templates.
*
// save acp template log
if (!empty($acpTemplateInserts)) {
$sql = "INSERT INTO wcf".WCF_N."_acp_template
- (templateName)
- VALUES (?)";
+ (templateName, application)
+ VALUES (?, ?)";
$statement = self::getDB()->prepareStatement($sql);
self::getDB()->beginTransaction();
foreach ($acpTemplateInserts as $acpTemplate) {
- $statement->executeUnbuffered(array($acpTemplate));
+ $statement->executeUnbuffered(array($acpTemplate, 'wcf'));
}
self::getDB()->commitTransaction();
}
// save file log
if (!empty($fileInserts)) {
$sql = "INSERT INTO wcf".WCF_N."_package_installation_file_log
- (filename)
- VALUES (?)";
+ (filename, application)
+ VALUES (?, ?)";
$statement = self::getDB()->prepareStatement($sql);
self::getDB()->beginTransaction();
foreach ($fileInserts as $file) {
- $statement->executeUnbuffered(array($file));
+ $statement->executeUnbuffered(array($file, 'wcf'));
}
self::getDB()->commitTransaction();
}
/**
* File handler implementation for the installation of ACP template files.
*
- * @author Alexander Ebert
+ * @author Alexander Ebert, Matthias Schmidt
* @copyright 2001-2013 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @package com.woltlab.wcf
*/
public function checkFiles(array $files) {
if ($this->packageInstallation->getPackage()->package != 'com.woltlab.wcf') {
- $packageID = $this->packageInstallation->getPackageID();
-
- // build sql string with ACP-templateNames
- $fileNames = array();
- foreach ($files as $file) {
- $fileNames[] = substr($file, 0, -4);
- }
-
// check if files are existing already
- if (!empty($fileNames)) {
+ if (!empty($files)) {
+ foreach ($files as &$file) {
+ $file = substr($file, 0, -4);
+ }
+ unset($file);
+
// get by other packages registered files
$conditions = new PreparedStatementConditionBuilder();
- $conditions->add("packageID <> ?", array($packageID));
- $conditions->add("packageID IN (SELECT packageID FROM wcf".WCF_N."_package WHERE packageDir = ? AND isApplication = ?)", array($this->packageInstallation->getPackage()->packageDir, 0));
- $conditions->add("templateName IN (?)", array($fileNames));
+ $conditions->add('packageID <> ?', array($this->packageInstallation->getPackageID()));
+ $conditions->add('templateName IN (?)', array($files));
+ $conditions->add('application = ?', array($this->application));
- $sql = "SELECT *
- FROM wcf".WCF_N."_".$this->tableName."
+ $sql = "SELECT packageID, templateName
+ FROM wcf".WCF_N."_".$this->tableName."
".$conditions;
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute($conditions->getParameters());
$lockedFiles[$row['templateName']] = $row['packageID'];
}
- // check if files from installing package are in conflict with already installed files
+ // check if acp templates from the package beeing
+ // installed are in conflict with already installed
+ // files
if (!$this->packageInstallation->getPackage()->isApplication && !empty($lockedFiles)) {
- foreach ($fileNames as $key => $file) {
- if (isset($lockedFiles[$file]) && $packageID != $lockedFiles[$file]) {
+ foreach ($files as $file) {
+ if (isset($lockedFiles[$file])) {
$owningPackage = new Package($lockedFiles[$file]);
- throw new SystemException("A non-application package can't overwrite template files. Only an update from the package which owns the template can do that. (Package '".$this->packageInstallation->getPackage()->package."' tries to overwrite template '".$file."', which is owned by package '".$owningPackage->package."')");
+
+ throw new SystemException("A package can't overwrite templates from other packages. Only an update from the package which owns the template can do that. (Package '".$this->packageInstallation->getPackage()->package."' tries to overwrite template '".$file."', which is owned by package '".$owningPackage->package."')");
}
}
}
* @see wcf\system\setup\IFileHandler::logFiles()
*/
public function logFiles(array $files) {
- $packageID = $this->packageInstallation->getPackageID();
-
// remove file extension
foreach ($files as &$file) {
$file = substr($file, 0, -4);
}
unset($file);
- // get existing templates
+ // fetch already installed acp templates
+ $conditions = new PreparedStatementConditionBuilder();
+ $conditions->add('packageID = ?', array($this->packageInstallation->getPackageID()));
+ $conditions->add('templateName IN (?)', array($files));
+ $conditions->add('application = ?', array($this->application));
+
$sql = "SELECT templateName
FROM wcf".WCF_N."_".$this->tableName."
- WHERE packageID = ?";
+ ".$conditions;
$statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute(array($packageID));
+ $statement->execute($conditions->getParameters());
- while ($row = $statement->fetchArray()) {
- $index = array_search($row['templateName'], $files);
+ while ($templateName = $statement->fetchColumn()) {
+ $index = array_search($templateName, $files);
if ($index !== false) {
unset($files[$index]);
if (!empty($files)) {
$sql = "INSERT INTO wcf".WCF_N."_".$this->tableName."
- (packageID, templateName)
- VALUES (?, ?)";
+ (packageID, templateName, application)
+ VALUES (?, ?, ?)";
$statement = WCF::getDB()->prepareStatement($sql);
foreach ($files as $file) {
$statement->execute(array(
- $packageID,
- $file
+ $this->packageInstallation->getPackageID(),
+ $file,
+ $this->application
));
}
}
<?php
namespace wcf\system\package;
+use wcf\data\package\Package;
use wcf\system\database\util\PreparedStatementConditionBuilder;
+use wcf\system\exception\SystemException;
use wcf\system\WCF;
/**
* File handler implementation for the installation of regular files.
*
- * @author Marcel Werk
- * @copyright 2001-2012 WoltLab GmbH
+ * @author Matthias Schmidt, Marcel Werk
+ * @copyright 2001-2013 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @package com.woltlab.wcf
* @subpackage system.package
public function checkFiles(array $files) {
if ($this->packageInstallation->getPackage()->package != 'com.woltlab.wcf') {
if (!empty($files)) {
- // get by other packages registered files
+ // get registered files of other packages for the
+ // same application
$conditions = new PreparedStatementConditionBuilder();
- $conditions->add("file_log.packageID <> ?", array($this->packageInstallation->getPackageID()));
- $conditions->add("file_log.filename IN (?)", array($files));
+ $conditions->add('packageID <> ?', array($this->packageInstallation->getPackageID()));
+ $conditions->add('filename IN (?)', array($files));
+ $conditions->add('application = ?', array($this->application));
- $sql = "SELECT file_log.filename, package.packageDir
- FROM wcf".WCF_N."_package_installation_file_log file_log
- LEFT JOIN wcf".WCF_N."_package package
- ON (package.packageID = file_log.packageID)
+ $sql = "SELECT filename, packageID
+ FROM wcf".WCF_N."_package_installation_file_log
".$conditions;
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute($conditions->getParameters());
$lockedFiles = array();
while ($row = $statement->fetchArray()) {
- $lockedFiles[$row['packageDir'].$row['filename']] = true;
+ $lockedFiles[$row['filename']] = $row['packageID'];
}
// check delivered files
if (!empty($lockedFiles)) {
- $dir = $this->packageInstallation->getPackage()->packageDir;
foreach ($files as $key => $file) {
- if (isset($lockedFiles[$dir.$file])) {
- unset($files[$key]);
+ if (isset($lockedFiles[$file])) {
+ $owningPackage = new Package($lockedFiles[$file]);
+
+ throw new SystemException("A package can't overwrite files from other packages. Only an update from the package which owns the file can do that. (Package '".$this->packageInstallation->getPackage()->package."' tries to overwrite file '".$file."', which is owned by package '".$owningPackage->package."')");
}
}
}
// fetch already installed files
$conditions = new PreparedStatementConditionBuilder();
- $conditions->add("packageID = ?", array($this->packageInstallation->getPackageID()));
- $conditions->add("filename IN (?)", array($files));
+ $conditions->add('packageID = ?', array($this->packageInstallation->getPackageID()));
+ $conditions->add('filename IN (?)', array($files));
+ $conditions->add('application = ?', array($this->application));
$sql = "SELECT filename
FROM wcf".WCF_N."_package_installation_file_log
".$conditions;
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute($conditions->getParameters());
- $installedFiles = array();
- while ($row = $statement->fetchArray()) {
- $installedFiles[] = $row['filename'];
- }
- // ignore files which have already been installed
- $installFiles = array();
- foreach ($files as $file) {
- if (in_array($file, $installedFiles)) {
- continue;
- }
+ while ($filename = $statement->fetchColumn()) {
+ $index = array_search($filename, $files);
- $installFiles[] = $file;
+ if ($index !== false) {
+ unset($files[$index]);
+ }
}
- if (!empty($installFiles)) {
+ if (!empty($files)) {
$sql = "INSERT INTO wcf".WCF_N."_package_installation_file_log
- (packageID, filename)
- VALUES (?, ?)";
+ (packageID, filename, application)
+ VALUES (?, ?, ?)";
$statement = WCF::getDB()->prepareStatement($sql);
- foreach ($installFiles as $file) {
+ foreach ($files as $file) {
$statement->execute(array(
$this->packageInstallation->getPackageID(),
- $file
+ $file,
+ $this->application
));
}
}
* installation.
*
* @author Marcel Werk
- * @copyright 2001-2012 WoltLab GmbH
+ * @copyright 2001-2013 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @package com.woltlab.wcf
* @subpackage system.package
* @category Community Framework
*/
abstract class PackageInstallationFileHandler implements IFileHandler {
+ /**
+ * abbrevation of the application the files belong to
+ * @var array<string>
+ */
+ protected $application = '';
+
/**
* active package installation dispatcher
* @var wcf\system\package\PackageInstallationDispatcher
*
* @param wcf\system\package\PackageInstallationDispatcher $packageInstallation
*/
- public function __construct(PackageInstallationDispatcher $packageInstallation) {
+ public function __construct(PackageInstallationDispatcher $packageInstallation, $application) {
$this->packageInstallation = $packageInstallation;
+ $this->application = $application;
}
}
$sql = "SELECT templateName, templateID
FROM wcf".WCF_N."_template
WHERE packageID = ?
+ AND application = ?
AND templateGroupID IS NULL";
$statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute(array($packageID));
+ $statement->execute(array($packageID, $this->application));
while ($row = $statement->fetchArray()) {
$existingTemplates[$row['templateName']] = $row['templateID'];
}
// save new templates
$sql = "INSERT INTO wcf".WCF_N."_template
- (packageID, templateName, lastModificationTime)
- VALUES (?, ?, ?)";
+ (packageID, templateName, lastModificationTime, application)
+ VALUES (?, ?, ?, ?)";
$statement = WCF::getDB()->prepareStatement($sql);
foreach ($files as $file) {
if (isset($existingTemplates[$file])) {
$statement->execute(array(
$packageID,
$file,
- TIME_NOW
+ TIME_NOW,
+ $this->application
));
}
<?php
namespace wcf\system\package\plugin;
-use wcf\system\exception\SystemException;
+use wcf\data\application\Application;
+use wcf\data\package\Package;
use wcf\system\package\ACPTemplatesFileHandler;
use wcf\system\WCF;
-use wcf\util\FileUtil;
/**
* Installs, updates and deletes ACP templates.
*
- * @author Alexander Ebert
+ * @author Alexander Ebert, Matthias Schmidt
* @copyright 2001-2013 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @package com.woltlab.wcf
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'], 'acptemplates_');
// create file handler
- $fileHandler = new ACPTemplatesFileHandler($this->installation);
-
- // extract content of files.tar
- $packageDir = FileUtil::addTrailingSlash(FileUtil::getRealPath(WCF_DIR.$this->installation->getPackage()->packageDir));
+ $fileHandler = new ACPTemplatesFileHandler($this->installation, $abbreviation);
- try {
- $fileInstaller = $this->installation->extractFiles($packageDir.'acp/templates/', $sourceFile, $fileHandler);
- }
- catch (SystemException $e) {
- WCF::getTPL()->assign(array(
- 'exception' => $e
- ));
- WCF::getTPL()->display('packageInstallationFileInstallationFailed');
- exit;
- }
+ // extract templates
+ $this->installation->extractFiles($packageDir.'acp/templates/', $sourceFile, $fileHandler);
// delete temporary sourceArchive
@unlink($sourceFile);
* @see wcf\system\package\plugin\IPackageInstallationPlugin::uninstall()
*/
public function uninstall() {
- // create ACP-templates list
- $templates = array();
-
- // get ACP-templates from log
- $sql = "SELECT *
+ // fetch ACP templates from log
+ $sql = "SELECT templateName, application
FROM wcf".WCF_N."_acp_template
WHERE packageID = ?";
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute(array($this->installation->getPackageID()));
+
+ $templates = array();
while ($row = $statement->fetchArray()) {
- // store acp template with suffix (_$packageID)
- $templates[] = 'acp/templates/'.$row['templateName'].'.tpl';
+ if (!isset($templates[$row['application']])) {
+ $templates[$row['application']] = array();
+ }
+
+ $templates[$row['application']][] = 'acp/templates/'.$row['templateName'].'.tpl';
}
- if (!empty($templates)) {
- // delete template files
- $packageDir = FileUtil::addTrailingSlash(FileUtil::getRealPath(WCF_DIR.$this->installation->getPackage()->packageDir));
- $deleteEmptyDirectories = $this->installation->getPackage()->isApplication;
- $this->installation->deleteFiles($packageDir, $templates, false, $deleteEmptyDirectories);
+ foreach ($templates as $application => $templateNames) {
+ $this->installation->deleteFiles(Application::getDirectory($application), $templateNames, false, $this->installation->getPackage()->isApplication);
// delete log entries
parent::uninstall();
<?php
namespace wcf\system\package\plugin;
+use wcf\data\application\Application;
use wcf\data\package\Package;
use wcf\system\package\FilesFileHandler;
use wcf\system\package\PackageInstallationDispatcher;
use wcf\system\WCF;
-use wcf\util\FileUtil;
use wcf\util\StyleUtil;
/**
* Installs, updates and deletes files.
*
- * @author Marcel Werk
- * @copyright 2001-2012 WoltLab GmbH
+ * @author Matthias Schmidt, Marcel Werk
+ * @copyright 2001-2013 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @package com.woltlab.wcf
* @subpackage system.package.plugin
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 = FileUtil::addTrailingSlash(FileUtil::getRealPath(WCF_DIR.$this->installation->getPackage()->packageDir));
+ $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);
+ $fileHandler = new FilesFileHandler($this->installation, $abbreviation);
// extract content of files.tar
$fileInstaller = $this->installation->extractFiles($packageDir, $sourceFile, $fileHandler);
// log file
$sql = "INSERT INTO wcf".WCF_N."_package_installation_file_log
- (packageID, filename)
- VALUES (?, 'config.inc.php')";
+ (packageID, filename, application)
+ VALUES (?, ?, ?)";
$statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute(array($this->installation->getPackageID()));
+ $statement->execute(array(
+ $this->installation->getPackageID(),
+ 'config.inc.php',
+ Package::getAbbreviation($this->installation->getPackage()->package)
+ ));
}
// delete temporary sourceArchive
* @see wcf\system\package\plugin\IPackageInstallationPlugin::uninstall()
*/
public function uninstall() {
- // get absolute package dir
- $packageDir = FileUtil::addTrailingSlash(FileUtil::unifyDirSeperator(realpath(WCF_DIR.$this->installation->getPackage()->packageDir)));
-
- // create file list
- $files = array();
-
- // get files from log
- $sql = "SELECT *
+ // fetch files from log
+ $sql = "SELECT filename, application
FROM wcf".WCF_N."_package_installation_file_log
WHERE packageID = ?";
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute(array($this->installation->getPackageID()));
+
+ $files = array();
while ($row = $statement->fetchArray()) {
- $files[] = $row['filename'];
+ if (!isset($files[$row['application']])) {
+ $files[$row['application']] = array();
+ }
+
+ $files[$row['application']][] = $row['filename'];
}
- if (!empty($files)) {
- // delete files
- $this->installation->deleteFiles($packageDir, $files);
+ foreach ($files as $application => $filenames) {
+ $this->installation->deleteFiles(Application::getDirectory($application), $filenames);
// delete log entries
parent::uninstall();
<?php
namespace wcf\system\package\plugin;
+use wcf\data\application\Application;
+use wcf\data\package\Package;
use wcf\system\package\TemplatesFileHandler;
use wcf\system\WCF;
-use wcf\util\FileUtil;
/**
* Installs, updates and deletes templates.
*
- * @author Alexander Ebert
- * @copyright 2001-2011 WoltLab GmbH
+ * @author Alexander Ebert, Matthias Schmidt
+ * @copyright 2001-2013 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @package com.woltlab.wcf
* @subpackage system.package.plugin
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'], 'templates_');
// create file handler
- $fileHandler = new TemplatesFileHandler($this->installation);
-
- // extract content of files.tar
- $packageDir = FileUtil::addTrailingSlash(FileUtil::getRealPath(WCF_DIR.$this->installation->getPackage()->packageDir));
+ $fileHandler = new TemplatesFileHandler($this->installation, $abbreviation);
- $fileInstaller = $this->installation->extractFiles($packageDir.'templates/', $sourceFile, $fileHandler);
+ $this->installation->extractFiles($packageDir.'templates/', $sourceFile, $fileHandler);
// delete temporary sourceArchive
@unlink($sourceFile);
* Uninstalls the templates of this package.
*/
public function uninstall() {
- // create templates list
- $templates = array();
-
- // get templates from log
- $sql = "SELECT templateName
+ // fetch templates from log
+ $sql = "SELECT templateName, application
FROM wcf".WCF_N."_template
WHERE packageID = ?";
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute(array($this->installation->getPackageID()));
+
+ $templates = array();
while ($row = $statement->fetchArray()) {
- $templates[] = 'templates/'.$row['templateName'].'.tpl';
+ if (!isset($templates[$row['application']])) {
+ $templates[$row['application']] = array();
+ }
+
+ $templates[$row['application']][] = 'templates/'.$row['templateName'].'.tpl';
}
- if (!empty($templates)) {
- // delete template files
- $packageDir = FileUtil::addTrailingSlash(FileUtil::getRealPath(WCF_DIR.$this->installation->getPackage()->packageDir));
- $deleteEmptyDirectories = $this->installation->getPackage()->isApplication;
- $this->installation->deleteFiles($packageDir, $templates, false, $deleteEmptyDirectories);
+ foreach ($templates as $application => $templateNames) {
+ $this->installation->deleteFiles(Application::getDirectory($application), $templateNames, false, $this->installation->getPackage()->isApplication);
// delete log entries
parent::uninstall();
CREATE TABLE wcf1_acp_template (
templateID INT(10) NOT NULL AUTO_INCREMENT PRIMARY KEY,
packageID INT(10),
- templateName VARCHAR(255) NOT NULL DEFAULT '',
- UNIQUE KEY (packageID, templateName)
+ templateName VARCHAR(255) NOT NULL,
+ application VARCHAR(255) NOT NULL,
+ UNIQUE KEY applicationTemplate (application, templateName)
);
DROP TABLE IF EXISTS wcf1_application;
DROP TABLE IF EXISTS wcf1_package_installation_file_log;
CREATE TABLE wcf1_package_installation_file_log (
packageID INT(10),
- filename VARCHAR(255) NOT NULL DEFAULT '',
- UNIQUE KEY packageID (packageID, filename)
+ filename VARCHAR(255) NOT NULL,
+ application VARCHAR(255) NOT NULL,
+ UNIQUE KEY applicationFile (application, filename)
);
DROP TABLE IF EXISTS wcf1_package_installation_form;
CREATE TABLE wcf1_template (
templateID INT(10) NOT NULL AUTO_INCREMENT PRIMARY KEY,
packageID INT(10) NOT NULL,
- templateName VARCHAR(255) NOT NULL DEFAULT '',
+ templateName VARCHAR(255) NOT NULL,
+ application VARCHAR(255) NOT NULL,
templateGroupID INT(10),
lastModificationTime INT(10) NOT NULL DEFAULT 0,
- KEY packageID (packageID, templateName),
- KEY templateGroupID (packageID, templateGroupID, templateName)
+ UNIQUE KEY applicationTemplate (application, templateName),
+ UNIQUE KEY templateGroupID (application, templateGroupID, templateName)
);
DROP TABLE IF EXISTS wcf1_template_group;