forum SOS! techie left mid-fix, now i dont know where i am

Get help with installation and running phpBB 3.0.x here. Please do not post bug reports, feature requests, or MOD-related questions here.
Scam Warning
Forum rules
END OF SUPPORT: 1 January 2017 (announcement)
drkknght
Registered User
Posts: 49
Joined: Sat Jul 28, 2007 3:12 am

Re: forum SOS! techie left mid-fix, now i dont know where i am

Post by drkknght » Fri Jun 27, 2008 1:36 am

heya jim - as always, thanks for the response

ok, well, i double checked cache folder, and it was 777. but then i cleared out everything except for index.htm and htaccess and hoped for the best.

unfortunately, still no good.

here's a (pretty funny) screen shot of what im dealin with:

Image

time for plan B :)
ToonBarn.com
for all your cartoon needs

User avatar
jimdunn
Registered User
Posts: 1570
Joined: Tue Mar 25, 2008 11:49 am
Location: Australia

Re: forum SOS! techie left mid-fix, now i dont know where i am

Post by jimdunn » Fri Jun 27, 2008 1:45 am

That's not what I see when I go to your forum, though :?

Lots of the forums in that list show up as top-level forums, and some are in Toon-Chats.

Hence my concern that this could be more to do with what the ACP is showing you than what is actually the case.

edit: although you do seem to have an odd forum with 537 topics stuck at the top within at least several of the forums, if I go into them :?

drkknght
Registered User
Posts: 49
Joined: Sat Jul 28, 2007 3:12 am

Re: forum SOS! techie left mid-fix, now i dont know where i am

Post by drkknght » Fri Jun 27, 2008 2:00 am

jimdunn wrote:That's not what I see when I go to your forum, though :?
yeah, the forum looks better. though, it has problems of its own, even before i tried to "no-parent" everything. for example, forums would *poof* disappear after moving them into one another. or they wouldn't show up in the main forum's legend, even though all the settings indicated such.
jimdunn wrote: edit: although you do seem to have an odd forum with 537 topics stuck at the top within at least several of the forums, if I go into them :?
stuff like this, too! :)

whats worse, is now i am unable to move some of the forums, as any place i want to move it is listed, at least in the ACP, as being a subforum of itself

nothing can be easy, huh :)
ToonBarn.com
for all your cartoon needs

User avatar
jimdunn
Registered User
Posts: 1570
Joined: Tue Mar 25, 2008 11:49 am
Location: Australia

Re: forum SOS! techie left mid-fix, now i dont know where i am

Post by jimdunn » Fri Jun 27, 2008 2:10 am

Ok - well I'll give you a link to the topic I found those fix-tree scripts.
http://www.phpbb.com/community/viewtopi ... 6&t=611029

As I said, I have no experience of using them, so I don't know if they will help at all, but so long as you backup your database first, you could try them, and if they don't help, you can restore and be no worse off.

After that, if you're nowhere nearer a solution, it's probably time to make a New Topic for this particular problem. You get better help in here with a single issue per topic, more chance that someone will recognise your problem and be able to help. At the moment, a lot of people will look at this long topic, and either skip it because it's too much to absorb, or just assume it's all going along fine.

drkknght
Registered User
Posts: 49
Joined: Sat Jul 28, 2007 3:12 am

Re: forum SOS! techie left mid-fix, now i dont know where i am

Post by drkknght » Fri Jun 27, 2008 2:27 am

ok, i'll backup the db and give one of those scripts a whirl. any suggestion as to which to try first? (i'm leaning towards the second, jsut because its sposda be faster :)
ToonBarn.com
for all your cartoon needs

User avatar
jimdunn
Registered User
Posts: 1570
Joined: Tue Mar 25, 2008 11:49 am
Location: Australia

Re: forum SOS! techie left mid-fix, now i dont know where i am

Post by jimdunn » Fri Jun 27, 2008 2:33 am

I really don't know - as I said - I don't even know if they work :(
The first one has a response saying it helped, though - so I'd probably lean towards that...

I also suspect there may be a better script, somewhere - give me a little time to have a look...

drkknght
Registered User
Posts: 49
Joined: Sat Jul 28, 2007 3:12 am

Re: forum SOS! techie left mid-fix, now i dont know where i am

Post by drkknght » Fri Jun 27, 2008 2:47 am

doh!

i tried both in the SQL tab of phpmyadmin, but got errors on both -- both relating to the first line (and i'm pretty sure i entered all the correct info where it asked for it)
ToonBarn.com
for all your cartoon needs

User avatar
jimdunn
Registered User
Posts: 1570
Joined: Tue Mar 25, 2008 11:49 am
Location: Australia

Re: forum SOS! techie left mid-fix, now i dont know where i am

Post by jimdunn » Fri Jun 27, 2008 3:02 am

No - they are not SQL queries - you don't run them like that. They need to be run as scripts on the server.

But as I said - if you can give me a while to try and find a working script for you - I'll be back as soon as I have an answer - probably better to hang loose for a while until I have something definite.

drkknght
Registered User
Posts: 49
Joined: Sat Jul 28, 2007 3:12 am

Re: forum SOS! techie left mid-fix, now i dont know where i am

Post by drkknght » Fri Jun 27, 2008 3:05 am

ooOOOooooh. hah. then i guess its good they didn't work! :)

i absolutely appreciate all your help, JD. i don't mind trying these (in the proper way) first, if you'd rather see if they work before heading off to find more stuff. either way, i'll hang out for a bit :)
ToonBarn.com
for all your cartoon needs

User avatar
jimdunn
Registered User
Posts: 1570
Joined: Tue Mar 25, 2008 11:49 am
Location: Australia

Re: forum SOS! techie left mid-fix, now i dont know where i am

Post by jimdunn » Fri Jun 27, 2008 3:09 am

No - I'd rather do some more research - I played with those scripts on my test server and got some odd results - not sure if it was the way I tested them, though...

You have a big forum structure - so I'd like to be a bit more sure of anything I suggest - to avoid wasting both of our time - it just may take a while for me to get an answer.

drkknght
Registered User
Posts: 49
Joined: Sat Jul 28, 2007 3:12 am

Re: forum SOS! techie left mid-fix, now i dont know where i am

Post by drkknght » Fri Jun 27, 2008 3:17 am

understood -- and again, so, so, so appreciated!!
ToonBarn.com
for all your cartoon needs

User avatar
jimdunn
Registered User
Posts: 1570
Joined: Tue Mar 25, 2008 11:49 am
Location: Australia

Re: forum SOS! techie left mid-fix, now i dont know where i am

Post by jimdunn » Fri Jun 27, 2008 12:42 pm

Ok - I tracked down a script which has fixed problems similar to this before:

I've tested it quickly on my test server, and it seems to correct deliberate changes I make to the forum table IDs.

If you want to try the script, you use it like this:

Backup your database first
1 Save all of the code in a file called fixtree.php
2 Upload that file to your forum root directory
3 Browse to forum/fixtree.php in your browser
4 If the script runs, you'll see the word Done. (in your browser.)
5 Clear your cache (for good luck ;) )

Then see if it made any difference.

If it didn't work - restore your database.
Whether it worked or not, delete the script file from your server when you are done.

Code: Select all

<?php
/**
*
* @package phpBB3
* @version $Id: index.php,v 1.176 2007/10/05 14:30:06 acydburn Exp $
* @copyright (c) 2005 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/

/**
*/

/**
* @ignore
*/
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/functions_admin.' . $phpEx);

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('viewforum');

recalc_btree('forum_id' , FORUMS_TABLE);
echo "Done";

function recalc_btree($sql_id, $sql_table, $module_class = '')
{
    global $db;

    if (!$sql_id || !$sql_table)
    {
        return;
    }

    $sql_where = ($module_class) ? " WHERE module_class = '" . $db->sql_escape($module_class) . "'" : '';

    // Reset to minimum possible left and right id
    $sql = "SELECT MIN(left_id) as min_left_id, MIN(right_id) as min_right_id
        FROM $sql_table
        $sql_where";
    $result = $db->sql_query($sql);
    $row = $db->sql_fetchrow($result);
    $db->sql_freeresult($result);

    $substract = (int) (min($row['min_left_id'], $row['min_right_id']) - 1);

    if ($substract > 0)
    {
        $sql = "UPDATE $sql_table
            SET left_id = left_id - $substract, right_id = right_id - $substract
            $sql_where";
        $db->sql_query($sql);
    }

    $sql = "SELECT $sql_id, parent_id, left_id, right_id
        FROM $sql_table
        $sql_where
        ORDER BY left_id ASC, parent_id ASC, $sql_id ASC";
    $f_result = $db->sql_query($sql);

    while ($item_data = $db->sql_fetchrow($f_result))
    {
        if ($item_data['parent_id'])
        {
            $sql = "SELECT left_id, right_id
                FROM $sql_table
                $sql_where " . (($sql_where) ? 'AND' : 'WHERE') . "
                    $sql_id = {$item_data['parent_id']}";
            $result = $db->sql_query($sql);

            if (!$row = $db->sql_fetchrow($result))
            {
                $sql = "UPDATE $sql_table SET parent_id = 0 WHERE $sql_id = " . $item_data[$sql_id];
                $db->sql_query($sql);

                continue;    
            }
            $db->sql_freeresult($result);

            $sql = "UPDATE $sql_table
                SET left_id = left_id + 2, right_id = right_id + 2
                $sql_where " . (($sql_where) ? 'AND' : 'WHERE') . "
                    left_id > {$row['right_id']}";
            $db->sql_query($sql);

            $sql = "UPDATE $sql_table
                SET right_id = right_id + 2
                $sql_where " . (($sql_where) ? 'AND' : 'WHERE') . "
                    {$row['left_id']} BETWEEN left_id AND right_id";
            $db->sql_query($sql);

            $item_data['left_id'] = $row['right_id'];
            $item_data['right_id'] = $row['right_id'] + 1;
        }
        else
        {
            $sql = "SELECT MAX(right_id) AS right_id
                FROM $sql_table
                $sql_where";
            $result = $db->sql_query($sql);
            $row = $db->sql_fetchrow($result);
            $db->sql_freeresult($result);

            $item_data['left_id'] = $row['right_id'] + 1;
            $item_data['right_id'] = $row['right_id'] + 2;
        }
    
        $sql = "UPDATE $sql_table
            SET left_id = {$item_data['left_id']}, right_id = {$item_data['right_id']}
            WHERE $sql_id = " . $item_data[$sql_id];
        $db->sql_query($sql);
    }
    $db->sql_freeresult($f_result);
}

?>

drkknght
Registered User
Posts: 49
Joined: Sat Jul 28, 2007 3:12 am

Re: forum SOS! techie left mid-fix, now i dont know where i am

Post by drkknght » Fri Jun 27, 2008 3:43 pm

woot! man, that worked like a charm. super quick and super easy, and everything was fixed instantly.

you are a god amongst code, JD!! :mrgreen: :mrgreen:
ToonBarn.com
for all your cartoon needs

User avatar
jimdunn
Registered User
Posts: 1570
Joined: Tue Mar 25, 2008 11:49 am
Location: Australia

Re: forum SOS! techie left mid-fix, now i dont know where i am

Post by jimdunn » Fri Jun 27, 2008 4:04 pm

Not my code I'm afraid - I only found it for you :)

It came from an issue fixed in IRC support by Paul.
http://www.phpbb.com/community/viewtopi ... 5#p5757535

Very glad it worked, though :)

drkknght
Registered User
Posts: 49
Joined: Sat Jul 28, 2007 3:12 am

Re: forum SOS! techie left mid-fix, now i dont know where i am

Post by drkknght » Tue Jul 01, 2008 12:19 am

your authoring or not, you've helped a TON!! its now a functioning site because of you :) thanks so much, JD!!

(and i'll post new issues as new threads from now on to let you off the hook! :) )
ToonBarn.com
for all your cartoon needs

Locked

Return to “[3.0.x] Support Forum”