Added support to alternate table prefix within PIPs
authorAlexander Ebert <ebert@woltlab.com>
Tue, 28 May 2013 00:56:52 +0000 (02:56 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Tue, 28 May 2013 00:56:52 +0000 (02:56 +0200)
Fixes #1195

wcfsetup/install/files/lib/system/package/plugin/AbstractPackageInstallationPlugin.class.php

index 2dfefe50677326387a3fe547bb4b2f737804d0ce..9fb46080123cd28f8f6a95869ed19b3099a22e77 100644 (file)
@@ -15,6 +15,12 @@ use wcf\system\WCF;
  * @category   Community Framework
  */
 abstract class AbstractPackageInstallationPlugin implements IPackageInstallationPlugin {
+       /**
+        * table application prefix
+        * @var string
+        */
+       public $application = 'wcf';
+       
        /**
         * database table name
         * @var string
@@ -73,7 +79,7 @@ abstract class AbstractPackageInstallationPlugin implements IPackageInstallation
                EventHandler::getInstance()->fireAction($this, 'hasUninstall');
                
                $sql = "SELECT  COUNT(*) AS count
-                       FROM    wcf".WCF_N."_".$this->tableName."
+                       FROM    ".$this->application.WCF_N."_".$this->tableName."
                        WHERE   packageID = ?";
                $statement = WCF::getDB()->prepareStatement($sql);
                $statement->execute(array($this->installation->getPackageID()));
@@ -88,7 +94,7 @@ abstract class AbstractPackageInstallationPlugin implements IPackageInstallation
                // call 'uninstall' event
                EventHandler::getInstance()->fireAction($this, 'uninstall');
                
-               $sql = "DELETE FROM     wcf".WCF_N."_".$this->tableName."
+               $sql = "DELETE FROM     ".$this->application.WCF_N."_".$this->tableName."
                        WHERE           packageID = ?";
                $statement = WCF::getDB()->prepareStatement($sql);
                $statement->execute(array($this->installation->getPackageID()));