[development] DEP - cascading variable system

Moshe Weitzman weitzman at tejasa.com
Wed Nov 30 16:55:11 UTC 2005


  [5] $GLOBALS['override']
> [4] user settings. system table, user domain, userid key.
> [3] theme settings. system table, theme domain, theme name key.
> [2] system settings. system table, system domain.
> [1] $GLOBALS['defaults']
> [0] $default

so variable_get() will return the right value based on the priority 
above? please add that to the DEP if it isn't there already.

about #4. I'd like for user variables to be loaded into the $user object 
  so that we don't go to the DB for them multiple times on a page view. 
For example, lets say we invent a user pref called 'show signatures' and 
I set that to FALSE because I am on a low bandwidth connection. I would 
not want a variable_get('show signatures') to hit the DB every time we 
show a node or comment. maybe a static cache would solve this.

in general, i'm a bit hesitant about storing user variables in the 
variables table. thats what $user object and users.data column and 
$_SESSION are for. Would you get rid of users.data? Maybe get rid of 
that users.data and change users.module to write to variables table 
instead. while you are there, move users.timezone and other non critical 
fields from columns in the users table to records in the variables table.

one other nit - in drupal, higher numbers have lower priority so the 
table above could be numbered in reverse.

FEATURE REQUESTS for a rainy day ...
- have some way to cleanup the variables table of cruft from disabled 
modules
- in variable_get(), return a hint about what layer provided the value, 
so the front end can grey out the form field if necessary.



More information about the development mailing list