PHP Classes

Bug fix and enhancement

Recommend this page to a friend!

      Installation Automation  >  Installation Automation package blog  >  About Installation Au...  >  All threads  >  Bug fix and enhancement  >  (Un) Subscribe thread alerts  
Subject:Bug fix and enhancement
Summary:Bug fix and enhancement request
Messages:11
Author:John Haywood
Date:2009-05-17 07:25:32
Update:2010-09-15 08:14:05
 
  1 - 10   11 - 11  

  1. Bug fix and enhancement   Reply   Report abuse  
Picture of John Haywood John Haywood - 2009-05-17 07:25:32
Really nice class, thank you!!
The examples files do not work due to a typo in the main class (install.php)
var $stages = array('stage 1','stage 2','stage 3');
should read
var $stages = array('stage_1','stage_2','stage_3'); (note the underscores) to ensure they match the file names built dynamically in
function setup()

I know these are merely example files but stage_1.php presentation could be vastly improved by putting the input form into a table so the input text area's line up nicely.

Although this Class is for "install" ing, a lot of users would probably want to use it for updating their scripts (updating script versions) too and I think it would be a nice to to be able to specify the location of an existing file which contains DB connection information so the form (stage_1.php) could potentially be auto-populated with those fields.

Thanks again for this excellent Class. I will be using it regularly.

  2. Re: Bug fix and enhancement   Reply   Report abuse  
Picture of Bogdan Lupandin Bogdan Lupandin - 2009-05-19 02:44:33 - In reply to message 1 from John Haywood
Thanks

I fixed the typo which I must have seeing since it was fixed on my computer version... must have fixed that after uploading it here.

I'm working on the enhancement idea... could you please explain what you are talking about better?

Sorry, English is not my mother tongue, and I find it hard to understand it sometimes... and I'm forgetting my mother tongue as well... don't know how I will communicate later on in life lol

  3. Re: Bug fix and enhancement   Reply   Report abuse  
Picture of Bogdan Lupandin Bogdan Lupandin - 2009-05-19 03:35:25 - In reply to message 1 from John Haywood
lol I just figured out what you were saying


Why can't you do this?

$inst->global_file = "includes/global.xml";
<input type="text" name="host" value="<?php $inst->get_xml('host'); ?>" />
etc; etc;

  4. Re: Bug fix and enhancement   Reply   Report abuse  
Picture of John Haywood John Haywood - 2009-05-19 08:44:47 - In reply to message 3 from Bogdan Lupandin
I had already modified the Class to do that but PHP beginners might not have the knowledge to work it out :)

  5. Re: Bug fix and enhancement   Reply   Report abuse  
Picture of Bogdan Lupandin Bogdan Lupandin - 2009-05-21 05:29:56 - In reply to message 4 from John Haywood
If you had to modify the class, then I must have misunderstood you... what did you do?

  6. Re: Bug fix and enhancement   Reply   Report abuse  
Picture of John Haywood John Haywood - 2009-05-21 07:40:21 - In reply to message 5 from Bogdan Lupandin
My database connection file is a PHP file (config.php) that holds the connection variables.
$dhhost , $duser etc
So I just did
$inst->global_file = 'config.php';
Then I globalise the vars
$global $dbhost, $dbuser, ... ;
Then pass them to the form so the form is pre-populated but the user can change the values by typing in the form if they are not correct.

I am using your installer when I develop plug-in modules for a CMS

  7. Re: Bug fix and enhancement   Reply   Report abuse  
Picture of Bogdan Lupandin Bogdan Lupandin - 2009-05-22 05:16:17 - In reply to message 6 from John Haywood
Ahh. Makes sense.


Good luck... glad to hear it's working out for you :)

  8. Re: Bug fix and enhancement   Reply   Report abuse  
Picture of Bogdan Lupandin Bogdan Lupandin - 2009-05-22 05:44:42 - In reply to message 6 from John Haywood
Sorry, by global do you mean $GLOBAL[$user] or:

function func_name()
{
global $dbname, $dbuser, $dbpass;
// code
}

?

  9. Re: Bug fix and enhancement   Reply   Report abuse  
Picture of John Haywood John Haywood - 2009-05-22 08:32:45 - In reply to message 8 from Bogdan Lupandin
Sorry that was a typo for me.
I just use
global $dbhost, $dbuser etc;

It is used like that throughout the content management system so that the connection details can be passed inside different functions.
I could be wrong (I'm a beginner with PHP) but using a super global like
$GLOBAL['dbhost'] might be a bad thing.

I prefer your way of using an XML file (object) or even using a CONSTANT for db connection but I am stuck with what the CMS maker has provided.

  10. Re: Bug fix and enhancement   Reply   Report abuse  
Picture of Bogdan Lupandin Bogdan Lupandin - 2009-05-23 02:11:43 - In reply to message 9 from John Haywood
No, you're right... $GLOBALS are a security thread, and are not recommended to use.

I'm sorry, maybe your not such a beginner in PHP as you thought, but how did you get global $dbhost, $dbuser, etc. to fill in the fields?

As far as I'm aware, global $dbuser, $dbhost is good for the function it was set in and not the whole class or something else entirely...

 
  1 - 10   11 - 11