On 12.08.2009 08:12, Zeeshan M. wrote:
Hi,
permUsrPref.table should not be hardcoded, but configurable
I think we discussed this a long time back. [0] I suppose EAV model had "design flaws" as suggested by Marc Delisle, and other developers. Please correct me if I am wrong, or you are referring to something else by "configurable".
i think he was talking about using a config variable to store the table name and hard code it, just like other pma tables:
http://wiki.phpmyadmin.net/pma/Config#pmadb
You copy the same code to several places, it should be rather single include which would provide all what is needed to access preferences.
I created a function in ./libraries/common.lib.php to include common files. Please let me know if there are further improvements you can suggest on this issue.
I also tried to include:
/*
- Creates a $pma_usr_prefs pointer
*/ $pma_usr_prefs = new PMA_PermUsrPref();
but it seems it is not being recognized as an object because of being remotely included in a standalone function: *Fatal error*: Call to a member function fetchSettingValue() on a non-object
you should try to replace this:
+ +/* + * Include common files required by Permanent Storage feature + */ +PMA_permUsrPref(); + +/* + * Creates a $pma_usr_prefs pointer + */ +$pma_usr_prefs = new PMA_PermUsrPref(); + +/* + * Fetch current setting for $cfg['PropertiesNumColumns'] from pmadb + */ + + $propertiesNumColumns = $pma_usr_prefs->fetchSettingValue('propertiesNumColumns'); + +if ($isUsrPrefsEnabled) { + $GLOBALS['cfg']['PropertiesNumColumns'] = $cfg['PropertiesNumColumns'] = $propertiesNumColumns[0]; +} + +unset($pma_usr_prefs); +
with a single function call, e. g.:
$GLOBALS['cfg']['PropertiesNumColumns'] = PMA_permUsrPrefGet('PropertiesNumColumns');