Why use ds_variable_get() and ds_variable_set() in admin section?

pounard - October 14, 2009 - 19:58
Project:DataSync
Version:6.x-1.x-dev
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:active
Description

All is in the title, is there a good reason?

I mean, for administration settings, wouldn't it be simpler to use variable_get() and variable_set() ? Using those will also make the admin section code shorter and more readable (I mean, using the system_settings_form() method in administration pages).

#1

andrewlevine - October 23, 2009 - 21:08
Status:active» closed

the reason ds_variable_get and ds_variable_get are used is twofold:

1. Not to clutter the variable table (which is loaded on every page with drupal) with 100s of job settings.
2. (More importantly) Since the variables are loaded on every page load only, every variable_get retrieves not the most recent variable but the variable when the page was last loaded. Because we run datasync as a daemon, this can be up to an hour ago. If we did not have our own functions, we could get very old results

#2

pounard - October 24, 2009 - 15:39

Ok, understood, but some of the admin settings global variables shouldn't go to the drupal variable table?

#3

andrewlevine - October 24, 2009 - 18:34
Status:closed» active

I'm not sure. which ones?

#4

pounard - October 26, 2009 - 15:47

All variables which are in datasync_admin_settings() function are site wide; and should not be modified while demon is running, am I right?

There is another problem, we can't modify the drupal codebase (e.g. module updates), we have to restart the demon, there should be some kind of button which allow to kill the right php process within the drupal administration interface, what do you think?

#5

andrewlevine - November 15, 2009 - 21:58

These are good questions that I've thought about but never acted on. It does seem like it would be a good feature if global variables could be updated without killing the daemon (this would require using the ds_variable_* fucntions). Otherwise, they probably should be in variable_set().

I do agree there should be a button to kill the php processes.

#6

pounard - December 1, 2009 - 10:41

I found a use case. I want to force the hosts datasync configuration in my settings.php, and I cant because it's not in variable table!

 
 

Drupal is a registered trademark of Dries Buytaert.