throw new UserInputException('name');
}
else {
- $sql = "SELECT COUNT(*)
- FROM wcf".WCF_N."_devtools_project
- WHERE name = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute([$this->name]);
-
- if ($statement->fetchColumn()) {
- throw new UserInputException('name', 'notUnique');
- }
+ $this->validateUniqueName();
}
// validate path
}
}
+ /**
+ * Checks that the project name is not used by another project.
+ */
+ protected function validateUniqueName() {
+ $sql = "SELECT COUNT(*)
+ FROM wcf".WCF_N."_devtools_project
+ WHERE name = ?";
+ $statement = WCF::getDB()->prepareStatement($sql);
+ $statement->execute([$this->name]);
+
+ if ($statement->fetchColumn()) {
+ throw new UserInputException('name', 'notUnique');
+ }
+ }
+
/**
* Checks that the project path is not used by another project.
*/
}
}
+ /** @noinspection PhpMissingParentCallCommonInspection */
+ /**
+ * @inheritDoc
+ */
+ protected function validateUniqueName() {
+ $sql = "SELECT COUNT(*)
+ FROM wcf".WCF_N."_devtools_project
+ WHERE name = ?
+ AND projectID <> ?";
+ $statement = WCF::getDB()->prepareStatement($sql);
+ $statement->execute([$this->name, $this->objectID]);
+
+ if ($statement->fetchColumn()) {
+ throw new UserInputException('name', 'notUnique');
+ }
+ }
+
/** @noinspection PhpMissingParentCallCommonInspection */
/**
* @inheritDoc
<item name="wcf.acp.devtools.project.delete.confirmMessage"><![CDATA[{if LANGUAGE_USE_INFORMAL_VARIANT}Willst du{else}Wollen Sie{/if} das Projekt <span class="confirmationObject">{$object->name}</span> wirklich löschen?]]></item>
<item name="wcf.acp.devtools.project.list"><![CDATA[Projekte]]></item>
<item name="wcf.acp.devtools.project.name"><![CDATA[Name]]></item>
+ <item name="wcf.acp.devtools.project.name.error.notUnique"><![CDATA[Der Name wird bereits von einem anderen Projekt verwendet.]]></item>
<item name="wcf.acp.devtools.project.path"><![CDATA[Pfad]]></item>
<item name="wcf.acp.devtools.project.path.error.excludedVersion"><![CDATA[Die aktuelle Core-Version wird in der <kbd>package.xml</kbd> explizit ausgeschlossen.]]></item>
<item name="wcf.acp.devtools.project.path.error.missingExclude"><![CDATA[In der <kbd>package.xml</kbd> fehlt die <kbd>>excludedpackage<</kbd>-Anweisung für <kbd>com.woltlab.wcf</kbd>.]]></item>
<item name="wcf.acp.devtools.project.delete.confirmMessage"><![CDATA[Do you really want to delete the project <span class="confirmationObject">{$object->name}</span>?]]></item>
<item name="wcf.acp.devtools.project.list"><![CDATA[Projects]]></item>
<item name="wcf.acp.devtools.project.name"><![CDATA[Name]]></item>
+ <item name="wcf.acp.devtools.project.name.error.notUnique"><![CDATA[The name is already used by another project.]]></item>
<item name="wcf.acp.devtools.project.path"><![CDATA[Path]]></item>
<item name="wcf.acp.devtools.project.path.error.excludedVersion"><![CDATA[The current Core version is explicitly listed as excluded in the <kbd>package.xml</kbd>.]]></item>
<item name="wcf.acp.devtools.project.path.error.missingExclude"><![CDATA[The <kbd>package.xml</kbd> is missing the <kbd>>excludedpackage<</kbd> instruction for <kbd>com.woltlab.wcf</kbd>.]]></item>