WoltLab / WCF

WoltLab Suite Core (previously WoltLab Community Framework)
https://www.woltlab.com
GNU Lesser General Public License v2.1
238 stars 145 forks source link

Installation bug: Packages requiring plugins #603

Closed Gravatronics closed 12 years ago

Gravatronics commented 12 years ago

Let's assume we install a package that looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<package name="com.gravatronics.wcf.test1" xmlns="http://www.woltlab.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.woltlab.com http://www.woltlab.com/XSD/maelstrom/package.xsd">
    <packageinformation>
        <packagename>Test 1</packagename>
        <packagedescription>Test 1</packagedescription>
        <plugin>com.woltlab.wcf.user</plugin>
        <version>1.0.0 Alpha 1</version>
        <date>2012-05-18</date>
    </packageinformation>

    <requiredpackages>
        <requiredpackage minversion="1.0.0 Alpha 1">com.woltlab.wcf.user</requiredpackage>
    </requiredpackages>

    <instructions type="install">
        <instruction type="file">files.tar</instruction>
    </instructions>
</package>

It just requires com.woltlab.wcf.user for which it is also a plugin. Now we want to install a package that extends the plugin above with additional functionality. Since plugins of plugins aren't supported, we choose the second package to be a plugin of com.woltlab.wcf.user again and require our plugin (cf. http://www.woltlab.com/forum/user/blog1336426-alexander-ebert/entry26-plugin-entwicklung-abhängigkeiten-richtig-setzen/?commentID=494#comment494 ):

<?xml version="1.0" encoding="UTF-8"?>
<package name="com.gravatronics.wcf.test2" xmlns="http://www.woltlab.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.woltlab.com http://www.woltlab.com/XSD/maelstrom/package.xsd">
    <packageinformation>
        <packagename>Test 2</packagename>
        <packagedescription>Test 2</packagedescription>
        <plugin>com.woltlab.wcf.user</plugin>
        <version>1.0.0 Alpha 1</version>
        <date>2012-05-18</date>
    </packageinformation>

    <requiredpackages>
        <requiredpackage minversion="1.0.0 Alpha 1">com.woltlab.wcf.user</requiredpackage>
        <requiredpackage minversion="1.0.0 Alpha 1">com.gravatronics.wcf.test1</requiredpackage>
    </requiredpackages>

    <instructions type="install">
        <instruction type="file">files.tar</instruction>
    </instructions>
</package>

which causes an error:

Fatal error: Could not execute prepared statement: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '24-21' for key 'packageID'
Information:
id: 9ee31e588fd72995d192f55d2355dfc43f099fb6
error message: Could not execute prepared statement: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '24-21' for key 'packageID'
error code: 23000
sql type: wcf\system\database\MySQLDatabase
sql error: Duplicate entry '24-21' for key 'packageID'
sql error number: 23000
sql version: 5.5.9
sql query: INSERT INTO  wcf7_package_dependency (packageID, dependency, priority) VALUES     (?, ?, ?)
sql query parameter 0:24
sql query parameter 1:21
sql query parameter 2:5
file: ***/installations/007/wcf/lib/system/database/statement/PreparedStatement.class.php (103)
php version: 5.3.6
wcf version: 2.0.0 Alpha 1 (Maelstrom)
date: Fri, 18 May 2012 17:25:58 +0000
request: ***/installations/007/gtpm/acp/index.php/InstallPackage/?t=537fd5f74b2877f8f0ec0f706c53f247de1eb073&s=7b97aa258968000f5deb7b064d2fa449b5bd8095
referer: http://localhost:8888/***/installations/007/gtpm/acp/index.php/Package/?action=install&queueID=26&s=7b97aa258968000f5deb7b064d2fa449b5bd8095
Stacktrace:
#0 ***/installations/007/wcf/lib/data/package/Package.class.php(456): wcf\system\database\statement\PreparedStatement->execute(Array)
#1 ***/installations/007/wcf/lib/system/package/PackageInstallationDispatcher.class.php(258): wcf\data\package\Package::rebuildPackageDependencies('24')
#2 ***/installations/007/wcf/lib/system/package/PackageInstallationDispatcher.class.php(104): wcf\system\package\PackageInstallationDispatcher->installPackage(Array)
#3 ***/installations/007/wcf/lib/acp/action/InstallPackageAction.class.php(73): wcf\system\package\PackageInstallationDispatcher->install('97c19135')
#4 ***/installations/007/wcf/lib/action/AbstractDialogAction.class.php(70): wcf\acp\action\InstallPackageAction->stepInstall()
#5 ***/installations/007/wcf/lib/action/AbstractAction.class.php(38): wcf\action\AbstractDialogAction->execute()
#6 ***/installations/007/wcf/lib/system/request/Request.class.php(58): wcf\action\AbstractAction->__construct()
#7 ***/installations/007/wcf/lib/system/request/RequestHandler.class.php(38): wcf\system\request\Request->execute()
#8 ***/installations/007/gtpm/acp/index.php(11): wcf\system\request\RequestHandler->handle('gtpm', true)
#9 {main}

The same happens if you omit the plugin node in the second package.

I hope that really is a bug and not some mistake on my part ;).

dtdesign commented 12 years ago

The dependencies look fine so far, I will take a look it, seems to be a bug.

By the way: What is "gtpm"? Is this your secret application designed for world domination? g

Gravatronics commented 12 years ago

@dtdesign Currently not, but that would be a nice enhancement for version 1.1. You got an idea how to implement it? ;)

TimWolla commented 12 years ago

@Gravatronics @dtdesign Divide by zero. When you have the power to destroy the universe by creating a black hole via divison by zero then you have maximum power.

Skynet7 commented 12 years ago

Only by quantum fluctuation ;)

@TimWolla Just watch out! :P Principle of permanence!