News:

SMF 2.1.6 has been released! Take it for a spin! Read more.

Main Menu

from phpbb2 +category hierarchy TO SMF 1.1 RC3 until 1.1.10

Started by romaruss, October 06, 2006, 01:58:24 PM

Previous topic - Next topic

Oldiesmann

#20
Ok... Try this one... Top-level categories (ie those with a "forum_main" of 0) are converted to regular categories. The rest are converted to boards.

EDIT: See this post for current converter.

romaruss

some board are missed.

i.e.
"consiglio dei graduati"
"Consiglio di guerra"
...

that are sub-category

Oldiesmann

#22
Try this...

EDIT: Converter located at msg1089058

romaruss

worse than before, now neither mai categories are converted...

Oldiesmann

I see what I did. I forgot to remove the restriction to only pull those with "forum_type" of f.

While I'm at it, I'm going to fix a few other things for you to make things easier:

1. Handle the main (top-level) boards first. Since the query won't find anything for items with a "forum_main" of 0, I need to make sure all this stuff gets converted first so the rest will work a bit better.

2. Handle the linked boards - just noticed these. I'll convert them to top-level boards since SMF doesn't have built-in redirection boards (there is a mod for this, and I'm pushing developers to put it in the next version after 1.1...)

3. Properly update ID_CAT, ID_PARENT and childLevel values - these are important since they let SMF know where things are :)

It'll be a little while before I get this done, but I'll post the modified converter when I do finish.

romaruss


Oldiesmann

#26
Alright. Try this one.

romaruss

over all it give an error.

Converting...
Converting ranks... Successful.
Converting groups... Successful.
Converting smileys... Successful.
Converting members... Successful.
Converting additional member groups... Successful.
Converting categories... Successful.
Converting boards (part 1)... Unsuccessful!
This query:

    SELECT
    forum_id AS ID_BOARD, forum_order AS boardOrder, forum_posts AS numPosts,
    forum_last_post_id AS ID_LAST_MSG, SUBSTRING(forum_name, 1, 255) AS name,
    SUBSTRING(forum_desc, 1, 65534) AS description, forum_topics AS numTopics,
    1 AS ID_CAT, forum_main AS ID_PARENT,
    CASE f.auth_read
    WHEN 0 THEN '-1,0,2'
    WHEN 1 THEN '0,2'
    WHEN 3 THEN '2'
    ELSE ''
    END AS memberGroups
    FROM `_mad`.phpbb_forums
    WHERE forum_main = 0 AND forum_type != 'c'
    LIMIT 0, 500;

Caused the error:

    Unknown column 'f.auth_read' in 'field list'


So i tryed to change that row from f.auth_read ... to auth_read

i really don't know what it mean ( :'() but after that modify it apparently works fine.

This version is better than previously.

now as i see all category are converted. but only main categories are converted as category (ok), sub categories are converted as forum (ok) but these are empty and they could have sub forums.

you can look the two version of the forum http://mad.ilbello.com [nofollow] and http://mad.ilbello.com/forum_smf [nofollow]

thanks.

ps. sometimes i think i'm boring, I repet if you are bored from my forum tell me and i stop ask you things.

Oldiesmann

Yes, that was another typo. Sorry about that.

The sub-categories that are converted to boards are supposed to have sub-boards... I'll take another look at my code later on and see if I can track down the problem.

Thanks for your patience and feedback :)

Oldiesmann

#29
Try this one. I fixed the "f.auth_read" issue, and I think I've fixed the other one as well, although I'm not sure.

romaruss

the auth_read fix works, but unfortunately the other one not.

the only sub-forum converted correctly is "problemi TECNICI relativi al forum".

after, sub-categories and sub-forums that have other sub-forums are missed.

i hope my indications are usefull for your work.

[i'm happy if i can be usefull for developing something, i'd like to know more things of php and mysql to be more usefull...]

Oldiesmann

I see what's going on now - sometimes a sub-sub-board's information is updated before its parent board's information is updated, thereby leaving you with a sub-sub-board in the wrong category.

The easiest way to solve this is to let SMF do it:
Admin -> Forum Maintenance
Click on "Find and Repair Any Errors"
SMF should find a bunch of boards that are in the wrong category. Telling SMF to fix these errors should solve the problem.

romaruss

i tried to do what you said but, however the procedure find 100+ errors and i fix them, the sub-category and sob forum problem remain.



Elenco degli errori del forum
I seguenti errori si sono verificati nel forum:
Il topic #90 contiene (attualmente) nessun messaggio.
Il topic #858 contiene (attualmente) nessun messaggio.
Il topic #860 contiene (attualmente) nessun messaggio.
Il topic #861 contiene (attualmente) nessun messaggio.
Il topic #873 contiene (attualmente) nessun messaggio.
Il topic #877 contiene (attualmente) nessun messaggio.
Il topic #878 contiene (attualmente) nessun messaggio.
Il topic #949 contiene (attualmente) nessun messaggio.
Il topic #1371 contiene (attualmente) nessun messaggio.
Il topic #2338 contiene (attualmente) nessun messaggio.
Il topic #2865 contiene (attualmente) nessun messaggio.
Il topic #3808 contiene (attualmente) nessun messaggio.
Il topic #4434 contiene (attualmente) nessun messaggio.
Il topic #4586 contiene (attualmente) nessun messaggio.
Il topic #90 ha l'ID del primo messaggio 299, che non è corretta.
Il topic #90 ha l'ID dell'ultimo messaggio 416, che non è corretta.
Il topic #90 ha un errato numero di risposte, 3.
Il topic #858 ha l'ID del primo messaggio 3034, che non è corretta.
Il topic #858 ha l'ID dell'ultimo messaggio 3117, che non è corretta.
Il topic #858 ha un errato numero di risposte, 6.
Il topic #860 ha l'ID del primo messaggio 3004, che non è corretta.
Il topic #860 ha l'ID dell'ultimo messaggio 3015, che non è corretta.
Il topic #860 ha un errato numero di risposte, 1.
Il topic #861 ha l'ID del primo messaggio 2980, che non è corretta.
Il topic #861 ha l'ID dell'ultimo messaggio 2980, che non è corretta.
Il topic #861 ha un errato numero di risposte, 0.
Il topic #873 ha l'ID del primo messaggio 2535, che non è corretta.
Il topic #873 ha l'ID dell'ultimo messaggio 2641, che non è corretta.
Il topic #873 ha un errato numero di risposte, 14.
Il topic #877 ha l'ID del primo messaggio 3226, che non è corretta.
Il topic #877 ha l'ID dell'ultimo messaggio 3266, che non è corretta.
Il topic #877 ha un errato numero di risposte, 3.
Il topic #878 ha l'ID del primo messaggio 3230, che non è corretta.
Il topic #878 ha l'ID dell'ultimo messaggio 3268, che non è corretta.
Il topic #878 ha un errato numero di risposte, 1.
Il topic #949 ha l'ID del primo messaggio 3573, che non è corretta.
Il topic #949 ha l'ID dell'ultimo messaggio 3651, che non è corretta.
Il topic #949 ha un errato numero di risposte, 2.
Il topic #1371 ha l'ID del primo messaggio 5160, che non è corretta.
Il topic #1371 ha l'ID dell'ultimo messaggio 5273, che non è corretta.
Il topic #1371 ha un errato numero di risposte, 4.
Il topic #2338 ha l'ID del primo messaggio 8991, che non è corretta.
Il topic #2338 ha l'ID dell'ultimo messaggio 9018, che non è corretta.
Il topic #2338 ha un errato numero di risposte, 3.
Il topic #2865 ha l'ID del primo messaggio 11072, che non è corretta.
Il topic #2865 ha l'ID dell'ultimo messaggio 11072, che non è corretta.
Il topic #2865 ha un errato numero di risposte, 0.
Il topic #3808 ha l'ID del primo messaggio 16285, che non è corretta.
Il topic #3808 ha l'ID dell'ultimo messaggio 16288, che non è corretta.
Il topic #3808 ha un errato numero di risposte, 2.
Il topic #4434 ha l'ID del primo messaggio 20209, che non è corretta.
Il topic #4434 ha l'ID dell'ultimo messaggio 20211, che non è corretta.
Il topic #4434 ha un errato numero di risposte, 1.
Il topic #4586 ha l'ID del primo messaggio 20799, che non è corretta.
Il topic #4586 ha l'ID dell'ultimo messaggio 20835, che non è corretta.
Il topic #4586 ha un errato numero di risposte, 15.
Il topic #2865 è nella board #62, che è mancante.
L'oggetto del topic #2 non è attualmente memorizzato nella cache dell'oggetto.
L'oggetto del topic #5 non è attualmente memorizzato nella cache dell'oggetto.
L'oggetto del topic #6 non è attualmente memorizzato nella cache dell'oggetto.
L'oggetto del topic #7 non è attualmente memorizzato nella cache dell'oggetto.
L'oggetto del topic #9 non è attualmente memorizzato nella cache dell'oggetto.
L'oggetto del topic #12 non è attualmente memorizzato nella cache dell'oggetto.
L'oggetto del topic #15 non è attualmente memorizzato nella cache dell'oggetto.
L'oggetto del topic #16 non è attualmente memorizzato nella cache dell'oggetto.
L'oggetto del topic #17 non è attualmente memorizzato nella cache dell'oggetto.
L'oggetto del topic #18 non è attualmente memorizzato nella cache dell'oggetto.
L'oggetto del topic #19 non è attualmente memorizzato nella cache dell'oggetto.
L'oggetto del topic #21 non è attualmente memorizzato nella cache dell'oggetto.
L'oggetto del topic #23 non è attualmente memorizzato nella cache dell'oggetto.
L'oggetto del topic #24 non è attualmente memorizzato nella cache dell'oggetto.
L'oggetto del topic #25 non è attualmente memorizzato nella cache dell'oggetto.
L'oggetto del topic #26 non è attualmente memorizzato nella cache dell'oggetto.
L'oggetto del topic #27 non è attualmente memorizzato nella cache dell'oggetto.
L'oggetto del topic #28 non è attualmente memorizzato nella cache dell'oggetto.
L'oggetto del topic #29 non è attualmente memorizzato nella cache dell'oggetto.
L'oggetto del topic #33 non è attualmente memorizzato nella cache dell'oggetto.
L'oggetto del topic #34 non è attualmente memorizzato nella cache dell'oggetto.
L'oggetto del topic #35 non è attualmente memorizzato nella cache dell'oggetto.
L'oggetto del topic #37 non è attualmente memorizzato nella cache dell'oggetto.
L'oggetto del topic #38 non è attualmente memorizzato nella cache dell'oggetto.
L'oggetto del topic #40 non è attualmente memorizzato nella cache dell'oggetto.
L'oggetto del topic #41 non è attualmente memorizzato nella cache dell'oggetto.
L'oggetto del topic #42 non è attualmente memorizzato nella cache dell'oggetto.
L'oggetto del topic #43 non è attualmente memorizzato nella cache dell'oggetto.
L'oggetto del topic #44 non è attualmente memorizzato nella cache dell'oggetto.
[***]
L'oggetto del topic #4808 non è attualmente memorizzato nella cache dell'oggetto.
L'oggetto del topic #4809 non è attualmente memorizzato nella cache dell'oggetto.
L'oggetto del topic #4810 non è attualmente memorizzato nella cache dell'oggetto.
L'oggetto del topic #4811 non è attualmente memorizzato nella cache dell'oggetto.
L'oggetto del topic #4812 non è attualmente memorizzato nella cache dell'oggetto.
L'oggetto del topic #4813 non è attualmente memorizzato nella cache dell'oggetto.
L'oggetto del topic #4815 non è attualmente memorizzato nella cache dell'oggetto.
L'oggetto del topic #4816 non è attualmente memorizzato nella cache dell'oggetto.
La parola memorizzata 'benvenuto' è collegata ad un topic che non esiste.
La parola memorizzata 'in' è collegata ad un topic che non esiste.
La parola memorizzata 'smf' è collegata ad un topic che non esiste.

Vuoi correggere questi errori?
Si - No
Powered by MySQL Powered by PHP Powered by SMF 1.1 RC3 | SMF © 2001-2006, Lewis Media
Traduzione Italiana a cura di SMItalia XHTML 1.0 Valido! CSS Valido!
Caricando...

Oldiesmann

Try running this script from your forum directory:

<?php
include_once('SSI.php');

// Get all the top-level boards...
$query = db_query("SELECT ID_BOARD, ID_CAT FROM {$db_prefix}boards WHERE ID_PARENT = 0 AND childLevel = 0", __FILE__, __LINE__);

// Update things...
while($results = mysql_fetch_assoc($query))
{
   
// Find all the sub-boards of this board
   
$query2 = db_query("SELECT ID_BOARD FROM {$db_prefix}boards WHERE ID_PARENT = $results[ID_BOARD]", __FILE__, __LINE__);

   
// Update sub-boards and sub-sub-boards at the same time...
   
while($results2 = mysql_fetch_assoc($query2))
   {
       
$query3 = db_query("UPDATE {$db_prefix}boards SET ID_CAT = $results[ID_CAT] WHERE ID_PARENT = $results[ID_BOARD] OR ID_PARENT = $results2[ID_BOARD]", __FILE__, __LINE__);
   }
   
// Done with this
   
mysql_free_result($query2);
}

// Done with this as well
mysql_free_result($query);

// Now get all the boards we just updated
$query = db_query("SELECT ID_BOARD, ID_CAT FROM {$db_prefix}boards WHERE childLevel = 2", __FILE__, __LINE__);

// Update sub-sub-sub-boards and sub-sub-sub-sub-boards (if there are any)...
while($results = mysql_fetch_assoc($query))
{
   
// Any sub-sub-sub-boards?
   
$query2 = db_query("SELECT ID_BOARD FROM {$db_prefix}boards WHERE ID_PARENT = $results[ID_BOARD]", __FILE__, __LINE__);

   if(
db_num_rows($query2) > 0)
   {
       while(
$results2 = mysql_fetch_assoc($query2))
       {
           
$query3 = db_query("UPDATE {$db_prefix}boards SET ID_CAT = $results[ID_CAT] WHERE ID_PARENT = $results[ID_BOARD] OR ID_PARENT = $results2[ID_BOARD]", __FILE__, __LINE__);
       }
   }
   else
   {
       
$query3 = db_query("UPDATE {$db_prefix}boards SET ID_CAT = $results[ID_CAT] WHERE ID_PARENT = $results[ID_BOARD]", __FILE__, __LINE__);
   }
}
?>


That should fix everything, unless you have boards that are nested more than 4 levels deep (which I don't think you do).

romaruss

sorry, but i try also the script... and it don't change anything.

i tryied also to re-convert the board and apply the scritp and LATER by forum admin repair the forum.

the result is always the same.


:(

Oldiesmann

If you run this query in phpMyAdmin, what does it return?

SELECT COUNT(ID_BOARD) FROM smf_boards WHERE childLevel > 1;

Since it seems that those are the boards that are missing, that should at least return something (other than 0).

If that still doesn't return anything, I'll have to take a look at the converter again and see if I can figure out what's causing the issue. As far as I can tell the ID_PARENT value should always be correct since we know what board each one is a child of - we just don't always know what category they belong to.

romaruss


Oldiesmann

Run the query from my last post in phpMyAdmin and let me know what results you get.

romaruss

ok sorry i didn't understand.

i run the query and the result is 0

Quote

COUNT(ID_BOARD)
0

Oldiesmann

Weird... It either didn't convert any sub-sub-boards or it messed up the childLevel values. I'll take a look at it later and see if I can figure out what's going on.

Advertisement: