[Xerte-dev] Re: 1.9 thinking

Thomas Rochford thomas.rochford at jiscadvance.ac.uk
Wed Jul 4 18:27:04 BST 2012


It's obviously got advantages, as you point out, but we need to find a
way of doing upgrades without trampling over existing settings. As I
recall that was the main reason for keeping it separate, in the database

Kindest regards, Thomas
Sent from my Windows Phone
From: David Goodwin
Sent: 04/07/2012 11:53
To: For Xerte technical developers
Subject: [Xerte-dev] Re: 1.9 thinking
> <snip/>
>
> 1) Restructure / replace the sitedetails table with a more logical structure
>


I'd suggest you use the 'config' table which already has name/value pairs :

e.g.

SELECT value FROM config WHERE name = "site_name"
SELECT value FROM config WHERE name = "site_email"
SELECT value FROM config WHERE name = "ldap_server1"


This will allow you to easily add in additional fields/values later on.

Retrieval would be easiest through something like :

_get_config('some_name') => returns "fish fingers";

_set_config('key_name', 'value')

or

Config::getValue('some_name') => returns 'fish fingers'

Config::setValue('key_name', 'value')

It would be relatively easy to add in an additional method which would
return a data structure like what your legacy code expects -

e.g.

_get_config_all() => …. (as below)

Config::getAllInOne() => returns array('site_name' => 'xxx',
'site_email' => 'xxxx at xxx') and so on.


Whether you want it to be OOified or just a "boring" procedural
function is up to you / whoever writes it.

I'm not sure there's any need for a Config object as such (e.g. $c =
new Config(); $c->setName('xx'); $c->setValue('yy'); $c->save()).


David.


Pale Purple Ltd.  (Company No: 5580814)
'Business Web Application Development and Training in PHP'

http://www.palepurple.co.uk
Office: 0845 0046746     Mobile: 07792380669

Follow us on Twitter: @PalePurpleLtd


_______________________________________________
Xerte-dev mailing list
Xerte-dev at lists.nottingham.ac.uk
http://lists.nottingham.ac.uk/mailman/listinfo/xerte-dev
This message and any attachment are intended solely for the addressee
and may contain confidential information. If you have received this
message in error, please send it back to me, and immediately delete
it.   Please do not use, copy or disclose the information contained in
this message or in any attachment.  Any views or opinions expressed by
the author of this email do not necessarily reflect the views of the
University of Nottingham.

This message has been checked for viruses but the contents of an attachment
may still contain software viruses which could damage your computer system:
you are advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation.



More information about the Xerte-dev mailing list