From: Alexander Ebert Date: Mon, 20 Feb 2012 13:30:30 +0000 (+0100) Subject: Database table name is now guessed if not set X-Git-Tag: 2.0.0_Beta_1~1333 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=b0d1f15d9d0602f09544bdd496d6be327fe9b0ff;p=GitHub%2FWoltLab%2FWCF.git Database table name is now guessed if not set --- diff --git a/wcfsetup/install/files/lib/data/DatabaseObject.class.php b/wcfsetup/install/files/lib/data/DatabaseObject.class.php index b2cddd2068..16ade9df48 100644 --- a/wcfsetup/install/files/lib/data/DatabaseObject.class.php +++ b/wcfsetup/install/files/lib/data/DatabaseObject.class.php @@ -112,6 +112,20 @@ abstract class DatabaseObject implements IStorableObject { * @see wcf\data\IStorableObject::getDatabaseTableName() */ public static function getDatabaseTableName() { + if (empty(static::$databaseTableName)) { + $className = get_called_class(); + $className = substr($className, (strrpos($className, '\\') + 1)); + + preg_match_all('~((?:^|[A-Z])[a-z]+)~', $className, $matches); + foreach ($matches[1] as $part) { + if (!empty(static::$databaseTableName)) { + static::$databaseTableName .= '_'; + } + + static::$databaseTableName .= strtolower($part); + } + } + return 'wcf'.WCF_N.'_'.static::$databaseTableName; }