Topic: Install_Mod.php never works on the second database...

Hi Folks,
I have been installing some mods into 2 forums sharing a database.
They each have prefixes (from installation time).

After I run an install_mod.php to one of them I cannot run it on the other one.
The resulting page is always:
- url = http://ww.domain.com/install_mod.php?foo=bar
- page = the same one I came from where I clicked "install".

Of course, I can read the install_mod.php file and then go in to phpmyadmin and manually add the records for the other tables... but what a pain!

Why am I having this problem and what do I do to work around it... without so much work, of course \^P

Cheers,

TwoHawks
Love is the Function
No Form is the Tool

2 (edited by StevenBullen 2006-10-11 09:08)

Re: Install_Mod.php never works on the second database...

Do you put the install_mod.php in the root directory of both your forum installs?
because sounds like your trying to run it twice from same location.

You cant have 2 forums that have the same Base URL.... well at least not with the standard punbb.

3 (edited by twohawks 2006-10-12 01:28)

Re: Install_Mod.php never works on the second database...

Thanks for replying, Steve.
Yes, I put the install_mod.php in the root directory of each forum install.
No, not trying to run from same location, and no, base urls are unique.

Each forum is installed into a separate, i.e. its own, directory, and each forum is running just fine.
One is the 'real' forum, while the other is where I test installations.  If they work and the forum 'proprietor' likes it, I install it for them.

I am thinking, maybe certain install_mod.php coders forget to take into account the possibility of a shared database when they write these, so unique prefixes, or something, are not always allowing for correct functionality in some mods???  I would have to better understand how the install mod code works in order to study and identify that issue. 

Where would I look for instructions on creating a mod and taking into account shared databases using individuated prefixes?  I am thinking maybe I can correct these mods manually in short order when I run into this (?).  (I don't freaking have a clue really.)
Cheers,

TwoHawks
Love is the Function
No Form is the Tool

Re: Install_Mod.php never works on the second database...

Give me an example of a mod that doesn't work properly under your situation

Re: Install_Mod.php never works on the second database...

Thanks Smarty...
Global Announcements was one (there are several, I will list if you wish).
http://punbb.org/forums/viewtopic.php?id=6782

Cheers,

TwoHawks
Love is the Function
No Form is the Tool

Re: Install_Mod.php never works on the second database...

Looks fine to me hmm

Re: Install_Mod.php never works on the second database...

Hmmm.... okay, just in case that was one of the ones that actually happened to work, here's another (would you mind looking?)...
...for sure, this one had the same problem as several others (since its the last one I am working on it is fresh in my feeble little peanut-haid...)
PBB Gallery 2.0Beta, found here: http://xumix.fanstvo.com/PBB_gallery_2.0Beta_mod.zip
Cheers,

TwoHawks
Love is the Function
No Form is the Tool

Re: Install_Mod.php never works on the second database...

Nope, it handles prefixes properly
Can you give us a more detailed description of your setup? Where the forums are, where you're placing the file, etc

9 (edited by twohawks 2006-10-12 15:28)

Re: Install_Mod.php never works on the second database...

Thanks for checking Smarty.
Okay, here're your answers...
Each forum was installed into its own directory on the root of the site installation.  Well, actually, I duplicated forum1... here's the setup, and then the procedure I followed:

Setup:
1) www.domain.com/forum1 and www.domain.com/forum2 are the directory pathways.
2) Essentially, when initial installation was 'performed' a unique prefix was selected for each, so for instance, the database is "ourdatabase", and the prefixes for each table-set during installation are each:   this_  and that_
3) So if you log into the database you might observe under "ourdatabase"  "this_bans", "this_categories" etc., for the 1st forum installation tables, and then observe "that_bans", that_categories" etc. for the 2nd froum installation tables.

Installation is all very straightforward, however... 2 UNIQUE THINGS for these installations worthy of note...
Procedure:
4) I exported and then manually edited the database tables for "this_forum", replacing all occurances of "this_" with "that_" and then imported all the "that_forum" tables into the database so I could create an identical setup in forum2 to that of forum1.
5) Rather than running install.php for "forum2", I simply copied all files from forum1 directory into the forum2 directory -- EDITING  the 'prefix' in config.php for "forum2".  NOTE: I kept the cookie the same in case at some point I wish to experiment with sharing database table info between the forums! (I do not know if this might be the snag?)
------------------------------------------
Testing both forums there have been absolutely no flaws or problems.  They function totally independently, and have all the same features as 'the state of forum 1 at the time that I copied it'.

   So now then, I go to install some mods into forum1.  No problem, install, test, troubleshoot if need be.
   When I find a mod is sufficient for the main forum owner's desire/need, I go ahead and install the mod into forum1.
   I do not remember if I am consistently  having the problem described because one or two of the installed items were plugins (which do not require running install_mod.php).  That's why I provided the second consideration for you to check after you blessed the first one as 'okay', because I could actually count on that last one as presenting the problem described, i.e., not installing into forum1 after installing into forum2.

  So it seems that, when I run an install_mod.php on forum2, if afterward I try to run it on forum1 the database 'rejects' it for some reason.  So then I have to go manually recreate the tables and/or the eits to existing tables.

  I think I did not leave anything out.  If there is any other information you require, please ask away.  And thank you, again,  for the time you spend... I see you are the troubleshooting workhorse around here, ...and it doesn't go unnoticed, I am sure.
Cheers,

TwoHawks
Love is the Function
No Form is the Tool

Re: Install_Mod.php never works on the second database...

So you have two identical copies of install_mod.php at
www.domain.com/forum1/install_mod.php
www.domain.com/forum2/install_mod.php

If that's the case, I'm afraid I'm not sure what the issue is. I can have you try some debugging steps though

Re: Install_Mod.php never works on the second database...

Yes, Smartys, ran the same one each time, in each place.
Tell you what, make your debugging suggestions and I will follow them in my next install situation (probably during the next week, as I am just finishing the forums work of this week, and then got some other business over the weekend).
However, if its something I could try/debug outside of doing a new install, by all means I may get to it sooner.
Fire away.
Cheers,

TwoHawks
Love is the Function
No Form is the Tool

Re: Install_Mod.php never works on the second database...

OK
1. Install mod with install_mod.php on 1 forum
2. View install_mod.php on the other forum
3. Upload a new copy of the install_mod.php you're viewing. It should be edited in the following way:
FIND

if (isset($_POST['form_sent']))
{
    if (isset($_POST['install']))
    {
        // Run the install function (defined above)
        install();

REPLACE WITH

if (isset($_POST['form_sent']))
{
    die('this is a test');
    if (isset($_POST['install']))
    {
        // Run the install function (defined above)
        install();

I want to see if data is even getting properly POSTed

Re: Install_Mod.php never works on the second database...

Okay Smartys,
Did what you requested.
    Got an error when initially running it for forum2 stating: "Parse error: syntax error, unexpected $end in /pathwayto/install_mod.php on line 113 code" ...which, of course, is the line number following the very last line of install_mod.php.  I think you meant to include a bracket at the end of your code, no?  Well after 'fixing' that...,
     I ran the mod in forum 2 with the same results as previously described.  It simply re-displays the install mod page, with the following as the last portion of the url in the addressbar: "/install_mod.php?foo=bar"  I look in the database and the tables are created/updated for forum1 (did the first install there), but nothing done to forum2.
   I am using the calendar install_mod.php file. Simple enough.
Look forward to your response(s) {and thanks}.
Cheers,

TwoHawks
Love is the Function
No Form is the Tool

Re: Install_Mod.php never works on the second database...

No, if you replaced the proper text you shouldn't need to add a }. wink
What I asked you to replace didn't have a closing } wink

15 (edited by twohawks 2006-10-13 21:12)

Re: Install_Mod.php never works on the second database...

Well I guess what threw me is the origianl code is different from what you posted, and I failed to notice that..
It goes like this (little larger snippet  included here)...

if (isset($_POST['form_sent']))
{
    // Run the install function (defined above)
    install();

?>
<div class="block">
    <h2><span>Installation successful</span></h2>
    <div class="box">
        <div class="inbox">
            <p>Your database has been successfully prepared for <?php echo pun_htmlspecialchars($mod_title) ?>. See readme.txt for further instructions.</p>
        </div>
    </div>
</div>
<?php


}
else

...So the code you had me replace required adding an extra closing bracket... or the calendar install_mod.php is constructed incorrectly to begin with, ...but it worked in the original forum1 installation ;^)

TwoHawks
Love is the Function
No Form is the Tool

Re: Install_Mod.php never works on the second database...

I only wanted you to replace EXACTLY what I asked you to replace, not the whole statement wink

17 (edited by twohawks 2006-10-13 21:27)

Re: Install_Mod.php never works on the second database...

Yes, I realize this.  All I was meaning to point out was this...

Original code in the original install_mod.php is:

if (isset($_POST['form_sent']))
{
    // Run the install function (defined above)
    install();

Not the origianl code to be replaced, as you posted it:

if (isset($_POST['form_sent']))
{
    if (isset($_POST['install']))
    {
        // Run the install function (defined above)
        install();

If you read my post carefully you will see I am only meaning to be pointing this out "within the greater context" of where the closing bracket occurs in that particular construction of install_mod.php (for calendar mod) because this line "if (isset($_POST['install']))" is not used there.

Trying to be as clear as possible, sorry if my statements appear ambiguous.  I am certain I am following you, though.  Does this make sense?
Cheers,

TwoHawks
Love is the Function
No Form is the Tool

Re: Install_Mod.php never works on the second database...

Ah, sorry, I copied that code from the Global Announcements mod (I just assumed they would be the same)
Then the CORRECT changes are:

FIND

if (isset($_POST['form_sent']))
{
    // Run the install function (defined above)
    install();

REPLACE WITH

if (isset($_POST['form_sent']))
{
    die('this is a test');
    // Run the install function (defined above)
    install();

Re: Install_Mod.php never works on the second database...

No worries.
Heh... why didn't I think of that?!
Anyway, did what you asked...  same results. \^|

TwoHawks
Love is the Function
No Form is the Tool

Re: Install_Mod.php never works on the second database...

Mmm, can I get a link to the two install_mod.php files? It looks like the request isn't even being submitted for one of them hmm

Re: Install_Mod.php never works on the second database...

I am unsure if you wish for me to upload them somewhere for you to download andinspect them, or if you wish to have one or both of them at the intended installation site?

TwoHawks
Love is the Function
No Form is the Tool

Re: Install_Mod.php never works on the second database...

I'd like their URLs so I can see them where they are smile

23 (edited by twohawks 2006-10-13 22:38)

Re: Install_Mod.php never works on the second database...

Okay, I have replaced the one I used to install into forum 1 (remember, it is already installed, so when you cick 'install' it will naturally take you to the error page....
Forum1:  http://www.sacredreflections.com/test_n … ll_mod.php

Here is...
Forum2: http://nbhealers.sacredreflections.com/install_mod.php

BTW... I have installed several mods with no problems onto forum2.  It is only when I first do it at forum1 that I then cannot do it at forum2.
Cheers, (and thanks for your time and effort)

PS: Sorry for the delays on my end, we have a meeting coming up tonite, so the 'girls' got me "busy-working" 8^P
Obviously you are being present here now, and so I will try to stay on top of watching this adn communicating back with you in a timely manner, and then let you know when I have to bug out.

TwoHawks
Love is the Function
No Form is the Tool

Re: Install_Mod.php never works on the second database...

I'm not sure why it only fails under certain circumstances for you, but I do have the reason why Forum2 doesn't work.
Forum2's install_mod.php submits to

http://nbhealers.sacredreflections.com/nbhforum/install_mod.php?foo=bar

which returns a 301 to

http://nbhealers.sacredreflections.com/install_mod.php?foo=bar

The issue is that install_mod.php shouldn't try and add that extra path.

25 (edited by twohawks 2006-10-13 22:43)

Re: Install_Mod.php never works on the second database...

hmmm.. ,snip/edit> got it...

TwoHawks
Love is the Function
No Form is the Tool