[Xerte-dev] Re: upgrading and ldap

Ron Mitchell ronm at mitchellmedia.co.uk
Wed Sep 5 21:22:22 BST 2012


Did anyone try this? If so did it work?

View the code here:
http://code.google.com/p/xerteonlinetoolkits/source/browse/trunk/upgrade.php
?spec=svn418&r=418

I've been testing on a local install and it seems to work up to line 205
e.g. I can see the select is working but the insert into the ldap table
doesn't work. If I drop the ldap table it re-creates it correctly but again
doesn't copy any values yet the values are being picked up in the select.

So the relevant section of code that isn't working seems to be:

$fields = array_keys($ldap_details);
        $qmarks = '';
        $comma = '';
        foreach($fields as $field) {
            $qmarks .= $comma . '?';
            $comma = ',';
        }
        _debug("Running SQL to copy sitedetails stuff into the ldap table -
" . print_r($ldap_details, true));
        $ok = db_query_one("INSERT INTO {$ldaptable} ($fields)
VALUES($qmarks)", array_values($ldap_details));
        return "Migrated LDAP settings from sitedetails to ldap - ok ? " . (
$ok ? 'true' : 'false' );
    }
}

Should $qmarks .= $comma . '?'; be $qmarks = $comma . '?'; e.g. without the
dot before the equals? Not that removing that fixes the main problem.
What else is wrong?

Ron


-----Original Message-----
From: xerte-dev-bounces at lists.nottingham.ac.uk
[mailto:xerte-dev-bounces at lists.nottingham.ac.uk] On Behalf Of David Goodwin
Sent: 30 August 2012 10:51
To: For Xerte technical developers
Subject: [Xerte-dev] Re: upgrading and ldap


On 30 Aug 2012, at 10:37, Julian Tenney wrote:

> Brill, thanks,

Hi,

Try running svn update and then run / point a browser at 'upgrade.php'.


It may work; or be very close to working. 

You'll need to modify config.php to specify you want an LDAP backend etc. 

I'd strongly suggest you try it on a demo/non-live environment first.

David.


> 
> -----Original Message-----
> From: xerte-dev-bounces at lists.nottingham.ac.uk 
> [mailto:xerte-dev-bounces at lists.nottingham.ac.uk] On Behalf Of David 
> Goodwin
> Sent: 30 August 2012 10:37
> To: For Xerte technical developers
> Subject: [Xerte-dev] Re: upgrading and ldap
> 
> I am... give me 5 minutes.
> 
> David
> 
> 
> On 30 Aug 2012, at 10:28, Julian Tenney wrote:
> 
>> I know. I'll be blunt - could someone write one?
>> 
>> ;-)
>> 
>> -----Original Message-----
>> From: xerte-dev-bounces at lists.nottingham.ac.uk
>> [mailto:xerte-dev-bounces at lists.nottingham.ac.uk] On Behalf Of Pat 
>> Lockley
>> Sent: 30 August 2012 10:28
>> To: For Xerte technical developers
>> Subject: [Xerte-dev] Re: upgrading and ldap
>> 
>> you need a script with read the values from sitedetails and imported 
>> it into the ldap table
>> 
>> On Thu, Aug 30, 2012 at 10:24 AM, Julian Tenney
<Julian.Tenney at nottingham.ac.uk> wrote:
>>> I meant for upgrade situations where the existing install is working,
and folk (i.e. me) want it to be easy to upgrade...
>>> 
>>> -----Original Message-----
>>> From: xerte-dev-bounces at lists.nottingham.ac.uk
>>> [mailto:xerte-dev-bounces at lists.nottingham.ac.uk] On Behalf Of Pat 
>>> Lockley
>>> Sent: 30 August 2012 10:24
>>> To: For Xerte technical developers
>>> Subject: [Xerte-dev] Re: upgrading and ldap
>>> 
>>> the installer never used to put details into the ldap table, only ever
went into the sitedetails table.
>>> 
>>> Guessing the new auth code only uses the ldap table, and so the 
>>> installer needs to either do both, or just one, depending on what 
>>> the preference is
>>> 
>>> On Thu, Aug 30, 2012 at 10:15 AM, Julian Tenney
<Julian.Tenney at nottingham.ac.uk> wrote:
>>>> How hard would it be to automate step 4?
>>>> 
>>>> 
>>>> 
>>>> From: xerte-dev-bounces at lists.nottingham.ac.uk
>>>> [mailto:xerte-dev-bounces at lists.nottingham.ac.uk] On Behalf Of Ron 
>>>> Mitchell
>>>> Sent: 10 August 2012 09:40
>>>> To: 'For Xerte technical developers'
>>>> Subject: [Xerte-dev] Re: upgrading and ldap
>>>> 
>>>> 
>>>> 
>>>> A quick update..
>>>> 
>>>> This was the process that worked for upgrading an existing 1.7 
>>>> install using LDAP for authentication to 1.8
>>>> 
>>>> 
>>>> 
>>>> 1. backup existing database and directory just in case
>>>> 
>>>> 2. drop 1.8 code over top of existing code (for an upgrade you 
>>>> don't need the setup folder)
>>>> 
>>>> 3. visit the install to test the basics are working ok via guest access
e.g.
>>>> create and test an LO
>>>> 
>>>> 4. manually add the existing ldap details currently in the 
>>>> sitedetails table to the ldap table in the database
>>>> 
>>>> 5. change from guest to ldap in config.php by 
>>>> commenting/un-commenting the relevant line
>>>> 
>>>> 6. refresh index.php and test login via ldap
>>>> 
>>>> 
>>>> 
>>>> As I mentioned previously not sure if there's supposed to be an 
>>>> automated way of transferring ldap details from the sitedetails 
>>>> table to the ldap table?
>>>> 
>>>> 
>>>> 
>>>> The other thing I'm not sure about is that the ldap table contains 
>>>> ldap_knownname as a field that can't be empty and is created by 
>>>> basic.sql in a new install and also exists in a 1.7 install yet I 
>>>> can't find anywhere ldap_knownname is used in either 1.7 or 1.8 code.
>>>> Should this be removed from basic.sql?
>>>> 
>>>> 
>>>> 
>>>> HTH
>>>> 
>>>> Ron
>>>> 
>>>> 
>>>> 
>>>> From: xerte-dev-bounces at lists.nottingham.ac.uk
>>>> [mailto:xerte-dev-bounces at lists.nottingham.ac.uk] On Behalf Of 
>>>> Julian Tenney
>>>> Sent: 09 August 2012 10:39
>>>> To: For Xerte technical developers
>>>> Subject: [Xerte-dev] Re: upgrading and ldap
>>>> 
>>>> 
>>>> 
>>>>> I guess these are questions for David or Pat
>>>> 
>>>> Yep. But we need to make this easy, otherwise people are going to 
>>>> get in a mess / screw up their installs.
>>>> 
>>>> 
>>>> 
>>>> From: xerte-dev-bounces at lists.nottingham.ac.uk
>>>> [mailto:xerte-dev-bounces at lists.nottingham.ac.uk] On Behalf Of Ron 
>>>> Mitchell
>>>> Sent: 09 August 2012 10:31
>>>> To: 'For Xerte technical developers'
>>>> Subject: [Xerte-dev] Re: upgrading and ldap
>>>> 
>>>> 
>>>> 
>>>> Hi Julian
>>>> 
>>>> yes I can see it cropping up regularly once people start trying to 
>>>> upgrade as opposed to a new install. But at the moment I don't have 
>>>> the answers to my two questions and especially question 1.
>>>> 
>>>> 
>>>> 
>>>> Not sure if perhaps 1.8 code should look in sitedetails as well as 
>>>> the ldap table for existing installs or if upgrade.php isn't working as
it should.
>>>> Not even sure if upgrade.php is meant to achieve this transfer of 
>>>> ldap info from sitedetails to ldap? On a new install the values 
>>>> added during install or via management.php go into the ldap table 
>>>> but not sure what's supposed to happen for existing installs?
>>>> 
>>>> 
>>>> 
>>>> In 1.8 /library/xerte/authentication/ldap code the note says:
>>>> 
>>>> 
>>>> 
>>>> * For this to work, you'll need to have at least one entry in the XOT
'ldap'
>>>> table.
>>>> 
>>>> 
>>>> 
>>>> What is supposed to happen for existing installs where the ldap 
>>>> values are in sitedetails and also some field/column names differ?
>>>> 
>>>> 
>>>> 
>>>> I guess these are questions for David or Pat or perhaps Thomas has 
>>>> encountered/resolved this too?
>>>> 
>>>> 
>>>> 
>>>> HTH
>>>> 
>>>> Ron
>>>> 
>>>> 
>>>> 
>>>> From: xerte-dev-bounces at lists.nottingham.ac.uk
>>>> [mailto:xerte-dev-bounces at lists.nottingham.ac.uk] On Behalf Of 
>>>> Julian Tenney
>>>> Sent: 09 August 2012 09:56
>>>> To: For Xerte technical developers
>>>> Subject: [Xerte-dev] Re: upgrading and ldap
>>>> 
>>>> 
>>>> 
>>>> Ron, would you mind documenting this process thoroughly, as you 
>>>> find out how to do it, because this is going to come up a lot. If 
>>>> we get one good, thorough set of instructions it will save us a load of
pain.
>>>> Maybe there is an upgrade script or something we could write?
>>>> 
>>>> 
>>>> 
>>>> Thanks,
>>>> 
>>>> 
>>>> 
>>>> Julian
>>>> 
>>>> 
>>>> 
>>>> From: xerte-dev-bounces at lists.nottingham.ac.uk
>>>> [mailto:xerte-dev-bounces at lists.nottingham.ac.uk] On Behalf Of Ron 
>>>> Mitchell
>>>> Sent: 08 August 2012 18:29
>>>> To: 'For Xerte technical developers'
>>>> Subject: [Xerte-dev] upgrading and ldap
>>>> 
>>>> 
>>>> 
>>>> Hi all
>>>> 
>>>> I had a chance to test an upgrade to 1.8 of a previous 1.7 install 
>>>> which uses ldap today. The previous and working install had the 
>>>> ldap values in site details rather than the separate ldap table.
>>>> 
>>>> 
>>>> 
>>>> Upgrade process:
>>>> 
>>>> drop code over top
>>>> 
>>>> this then defaults to guest access but useful for checking the 
>>>> basics work
>>>> 
>>>> change from guest to ldap in config.php by commenting/un-commenting 
>>>> the relevant line
>>>> 
>>>> refresh index.php and try to login via ldap
>>>> 
>>>> get error message LDAP servers not configured in DB
>>>> 
>>>> visit management.php and check - ldap details displayed but not 
>>>> saved to ldap table in db - clearly coming from site-details
>>>> 
>>>> try running upgrade.php indicates nothing to upgrade
>>>> 
>>>> 
>>>> 
>>>> Questions:
>>>> 
>>>> 1. what's the process for transferring the ldap details from 
>>>> site_details to ldap table for an existing install?
>>>> 
>>>> In this case I can enter direct in the db but that's surely not the 
>>>> intended method?
>>>> 
>>>> 
>>>> 
>>>> 2. In the ldap table what typically goes in ldap_knowname?
>>>> 
>>>> 
>>>> 
>>>> Cheers
>>>> 
>>>> Ron
>>>> 
>>>> 
>>>> 
>>>> 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.
>>>> 
>>>> 
>>>> _______________________________________________
>>>> 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.
>>>> 
>>>> 
>>> 
>>> _______________________________________________
>>> Xerte-dev mailing list
>>> Xerte-dev at lists.nottingham.ac.uk
>>> http://lists.nottingham.ac.uk/mailman/listinfo/xerte-dev
>>> 
>>> _______________________________________________
>>> Xerte-dev mailing list
>>> Xerte-dev at lists.nottingham.ac.uk
>>> http://lists.nottingham.ac.uk/mailman/listinfo/xerte-dev
>> 
>> _______________________________________________
>> Xerte-dev mailing list
>> Xerte-dev at lists.nottingham.ac.uk
>> http://lists.nottingham.ac.uk/mailman/listinfo/xerte-dev
>> 
>> _______________________________________________
>> Xerte-dev mailing list
>> Xerte-dev at lists.nottingham.ac.uk
>> http://lists.nottingham.ac.uk/mailman/listinfo/xerte-dev
> 
> 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
> 
> _______________________________________________
> Xerte-dev mailing list
> Xerte-dev at lists.nottingham.ac.uk
> http://lists.nottingham.ac.uk/mailman/listinfo/xerte-dev

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




More information about the Xerte-dev mailing list