Not signed in (Sign In)

Categories

Vanilla 1.1.5 is a product of Lussumo. More Information: Documentation, Community Support.

Help keep Vanilla free:
Welcome Guest!
Want to take part in these discussions? If you have an account, sign in now.
If you don't have an account, apply for one now.
    • CommentAuthoredavis
    • CommentTimeJan 3rd 2008 edited
     # 1
    Right now the function 'GetTableName' adds the database prefix to all tables other than the user table. I integrated Vanilla into a CMS and had to monkey patch this function to prevent the prefix from attaching to the "Role" table. Would it be possible to have a setting that takes a list of tables to skip the prefix and set it to 'User' by default?

    Example configuration:


    // conf/settings.php
    $Configuration['NO_PREFIX'] = array('User','Role');


    Then "Framework.Functions->GetTableName()" could look like this


    function GetTableName($Key, &$TableCollection, $Prefix) {
    // Current code
    // if ($Key == "User") {
    ////

    if (in_array($Key, $Configuration['NO_PREFIX']) {
    return $TableCollection[$Key];
    } else {
    return $Prefix.$TableCollection[$Key];
    }


    The Drupal integration also did a similar patch.

    Eric
    •  
      CommentAuthorDinoboff
    • CommentTimeJun 9th 2008 edited
     # 2
    I forgot at the time to post the link to bug tracker entry.
    http://lussumo.com/bugs/discussion/53/adding-list-of-table-that-does-not-use-any-database-prefix/

    Thanks Eric for the suggestion.
    •  
      CommentAuthorWallPhone
    • CommentTimeJun 9th 2008 edited
     # 3
    You know, one way to work around this would be to have a blank prefix set in the configuration, then put the prefix manually on the table names in the configuration as needed.
  1.  # 4
    @Wallphone, so the appg/database.php could look like this?<?php
    $Prefix = $Configuration['DATABASE_TABLE_PREFIX'] = 'LUM_';

    $DatabaseTables['Category'] = $Prefix.'Category';
    $DatabaseTables['CategoryBlock'] = $Prefix.'CategoryBlock';
    $DatabaseTables['CategoryRoleBlock'] = $Prefix.'CategoryRoleBlock';
    $DatabaseTables['Comment'] = $Prefix.'Comment';
    $DatabaseTables['User'] = $Prefix.'User';
    ?>
    This method would also eliminate the need for the GetTableName() function (Prefix appending would be implemented into SqlBuilder where it belongs). However, that might make a rough upgrade path...
Add your comments
    Username Password
  • Format comments as