* @param string $text
*/
public function setText($text) {
- $text->text = StringUtil::trim($text);
+ $this->text = StringUtil::trim($text);
}
/**
*/
public function getHTML($formName) {
return <<<HTML
-<dl{$this->getErrorClass()}>
+<dl>
<dt><label>{$this->getLabel()}</label></dt>
<dd>
{$this->getText()}
<small>{$this->getDescription()}</small>
- {$this->getErrorField()}
</dd>
</dl>
HTML;
<?php
namespace wcf\system\package;
+use wcf\system\form\FormDocument;
+
use wcf\data\application\Application;
use wcf\data\application\ApplicationEditor;
use wcf\data\language\LanguageEditor;
/**
* Executes a package installation plugin.
*
- * @param array $nodeData
+ * @param array step
* @return boolean
*/
protected function executePIP(array $nodeData) {
- $installationStep = new PackageInstallationStep();
+ $step = new PackageInstallationStep();
// fetch all pips associated with current PACKAGE_ID and include pips
// previously installed by current installation queue
// execute PIP
try {
- $plugin->{$this->action}();
+ $document = $plugin->{$this->action}();
}
catch (SplitNodeException $e) {
- $installationStep->setSplitNode();
+ $step->setSplitNode();
}
- return $installationStep;
+ if ($document !== null && ($document instanceof FormDocument)) {
+ $step->setDocument($document);
+ $step->setSplitNode();
+ }
+
+ return $step;
}
protected function selectOptionalPackages($currentNode, array $nodeData) {
}
}
else {
- if (!isset($this->conflicts[$tableName])) $this->conflicts[$tableName] = array();
- $this->conflicts[$tableName][] = 'CREATE TABLE';
+ if (!isset($this->conflicts['CREATE TABLE'])) $this->conflicts['CREATE TABLE'] = array();
+ $this->conflicts['CREATE TABLE'][] = $tableName;
}
}
}
}
}
else {
- if (!isset($this->conflicts[$tableName])) $this->conflicts[$tableName] = array();
- $this->conflicts[$tableName][] = 'DROP TABLE';
+ if (!isset($this->conflicts['DROP TABLE'])) $this->conflicts['DROP TABLE'] = array();
+ $this->conflicts['DROP TABLE'][] = $tableName;
}
}
}
namespace wcf\system\package\plugin;
use wcf\data\package\Package;
use wcf\system\exception\SystemException;
+use wcf\system\form\container\GroupFormElementContainer;
+use wcf\system\form\element\LabelFormElement;
+use wcf\system\form\FormDocument;
+use wcf\system\package\PackageInstallationFormManager;
use wcf\system\package\PackageInstallationSQLParser;
use wcf\system\WCF;
use wcf\util\StringUtil;
// check queries
$parser = new PackageInstallationSQLParser($queries, $package, $this->installation->getAction());
$conflicts = $parser->test();
- if (count($conflicts)) {
+ if (!empty($conflicts)) {
+ if (isset($conflicts['CREATE TABLE']) || isset($conflicts['DROP TABLE'])) {
+ if (!PackageInstallationFormManager::findForm($this->installation->queue, 'overwriteDatabaseTables')) {
+ $container = new GroupFormElementContainer();
+
+ if (isset($conflicts['CREATE TABLE'])) {
+ $text = implode('<br />', $conflicts['CREATE TABLE']);
+ $label = WCF::getLanguage()->get('wcf.acp.package.error.sql.createTable');
+ $description = WCF::getLanguage()->get('wcf.acp.package.error.sql.createTable.description');
+
+ $element = new LabelFormElement($container);
+ $element->setLabel($label);
+ $element->setText($text);
+ $element->setDescription($description);
+ $container->appendChild($element);
+ }
+
+ if (isset($conflicts['DROP TABLE'])) {
+ $text = implode('<br />', $conflicts['DROP TABLE']);
+ $label = WCF::getLanguage()->get('wcf.acp.package.error.sql.dropTable');
+ $description = WCF::getLanguage()->get('wcf.acp.package.error.sql.dropTable.description');
+
+ $element = new LabelFormElement($container);
+ $element->setLabel($label);
+ $element->setText($text);
+ $element->setDescription($description);
+ $container->appendChild($element);
+ }
+
+ $document = new FormDocument('overwriteDatabaseTables');
+ $document->appendContainer($container);
+
+ PackageInstallationFormManager::registerForm($this->installation->queue, $document);
+ return $document;
+ }
+ else {
+ /*
+ * At this point the user decided to continue the installation (he would called the rollback
+ * otherwise), thus we do not care about the form anymore
+ */
+ }
+ }
+
// ask user here
// search default value in session
if (!WCF::getSession()->getVar('overrideAndDontAskAgain')) {
<item name="wcf.acp.package.dependencies.required.description"><![CDATA[Pakete die zwingend für den Betrieb dieses Paketes benötigt werden]]></item>
<item name="wcf.acp.package.dependencies.title"><![CDATA[Abhängigkeiten]]></item>
<item name="wcf.acp.package.description"><![CDATA[Beschreibung]]></item>
+ <item name="wcf.acp.package.error.sql.createTable"><![CDATA[Existierende Tabellen überschreiben]]></item>
+ <item name="wcf.acp.package.error.sql.createTable.description"><![CDATA[Die oben genannten Tabellen existieren bereits und werden beim fortfahren der Installation überschrieben. Alle Daten dieser Tabellen gehen unwiderruflich verloren.]]></item>
+ <item name="wcf.acp.package.error.sql.dropTable"><![CDATA[Existierende Tabellen löschen]]></item>
+ <item name="wcf.acp.package.error.sql.dropTable.description"><![CDATA[Die oben genannten Tabellen existieren bereits und werden beim fortfahren der Installation entfernt. Alle Daten dieser Tabellen gehen unwiderruflich verloren.]]></item>
<item name="wcf.acp.package.identifier"><![CDATA[Bezeichner]]></item>
<item name="wcf.acp.package.information.properties"><![CDATA[Eigenschaften]]></item>
<item name="wcf.acp.package.information.title"><![CDATA[Informationen]]></item>
<item name="wcf.acp.package.dependencies.required.description"><![CDATA[Packages required for this package to work]]></item>
<item name="wcf.acp.package.dependencies.title"><![CDATA[Dependencies]]></item>
<item name="wcf.acp.package.description"><![CDATA[Description]]></item>
+ <item name="wcf.acp.package.error.sql.createTable"><![CDATA[Overwrite existing tables]]></item>
+ <item name="wcf.acp.package.error.sql.createTable.description"><![CDATA[The tables above will be overwritten once you continue the installation process. All data contained in these tables will be lost.]]></item>
+ <item name="wcf.acp.package.error.sql.dropTable"><![CDATA[Remove existing tables]]></item>
+ <item name="wcf.acp.package.error.sql.dropTable.description"><![CDATA[The tables above will be removed once you continue the installation process. All data contained in these tables will be lost.]]></item>
<item name="wcf.acp.package.identifier"><![CDATA[Identifier]]></item>
<item name="wcf.acp.package.information.properties"><![CDATA[Properties]]></item>
<item name="wcf.acp.package.information.title"><![CDATA[Informations]]></item>