PDA

View Full Version : Administrative and Maintenance Tools - Thread Prefixes upgrade from Mystics to 3.7


Pottsy
12-20-2007, 10:00 PM
Thread prefixes upgrade.

This script upgrades the old Thread Prefixes hack by Mystics to the new thread prefixes found in 3.7+. The only guarantee is that it works on my test server, going from 3.6.8 to 3.7.0B3.

It is a one-run operation. The script reads the details of the old thread prefix system from your database, and then writes new entries for the new system into your database. The code is rough and ready (OK, it's my first ever script), so do NOT use it unless you have backed up your database and are prepared to restore it.

It will create a fully populated prefixset for each forum with prefixes, and then assign the prefixes to the threads in that forum.

The rich text format of the new prefix is set to be bold with square brackets around, although if you want to change that you can edit tpup.php (there is a commented out version of the query, that will make the text plain - it should be obvious).

Instructions.

1. Upgrade to 3.7 and revert all templates.
2. Open dp.php in a text editor and enter your database login details.
3. Upload all 4 .php files to a new folder on your server (or test server).
4. Backup your database.
5. Browse to tpup.php in your browser to run it.
6. When it's done, close the browser window and delete the files from your server.
7. Now you must rebuild all languages in AdminCP > Languages & Phrases > Language Manager > Rebuild All Languages. If you miss this step, nothing will work!
8. Please report any success or failure in this thread.

Versions:
1.00 First go.
1.01 Added the facility to specify a database table prefix.
1.04 Got the table prefix right, thanks to Mystics.

Pottsy
12-21-2007, 06:37 AM
I have only tested this on my forum, on a test server.

I would suggest testing this on a test server first, until we have had a bit of feedback. If it works for you, please post your success (or not) here.

Delazar
12-21-2007, 09:02 AM
Hi Pottsy,

for my system your add-on doesn?t work, because the system accept the tableprefix.
My tapleprefix is fantasy.

regards
Delazar

Warning: Table 'vbtest.forum' doesn't exist in /var/www/xxxxx/htdocs/test/ez_sql_mysql.php on line 204

Warning: Invalid argument supplied for foreach() in /var/www/xxxx/htdocs/test/tpup.php on line 9
Done. Now you must rebuild all languages in AdminCP > Languages & Phrases > Language Manager > Rebuild All Languages.

Pottsy
12-21-2007, 10:01 AM
Delazar,

Have a go with ver 1.01. There is now another variable you can specify in db.php where you can enter your table prefix.

Delazar
12-21-2007, 10:59 AM
Sorry, but the tableprefix is still not being accepted.

regards
Delazar

Warning: Table 'vbtest.forum' doesn't exist in /var/www/xxx/htdocs/test/ez_sql_mysql.php on line 204

Warning: Invalid argument supplied for foreach() in /var/www/xxx/htdocs/test/tpup.php on line 10
Done.
Now you MUST rebuild all languages in AdminCP > Languages & Phrases > Language Manager > Rebuild All Languages.

my db.php
<?php

/************************************************** ********************
* ezSQL initialisation for mySQL
*/

// Include ezSQL core
include_once "ez_sql_core.php";

// Include ezSQL database specific component
include_once "ez_sql_mysql.php";

// Initialise database object and establish a connection
// at the same time - db_user / db_password / db_name / db_host
$db = new ezSQL_mysql('my_name','my_password','my_db-name','localhost');

// If you have a database table prefix, please enter it here:
$table_prefix = 'fantasy';


?>

Mystics
12-21-2007, 11:08 AM
Remove this line in tpup.php:if ($table_prefix != "") {$table_prefix .= ".";}And change:FROM forum");to:FROM " . $table_prefix . "forum");

Pottsy
12-21-2007, 11:15 AM
Dalazar,

Just updated it.

Pottsy
12-21-2007, 11:20 AM
Mystics, if I remove that line, then it errors because the table name is tableprefixtable not tableprefix.table. Have I missed something?

PS thanks for dropping by, and many thanks for the original hack!

Mystics
12-21-2007, 11:26 AM
You can't just add "." to the table prefix as the user itself has to choose if and which delimiter he uses. Most users uses "_", not "." :)

Just compare it with the vBulletin Code, they don't add "." to the prefix.
FROM " . TABLE_PREFIX . "forum AS forum

You may define such a prefix for example:
$config['Database']['tableprefix'] = 'vb3_';

Pottsy
12-21-2007, 11:35 AM
Aha!

Can you tell I picked up a "How to program php" book 2 days ago?

I'll make the appropriate changes.

Delazar
12-21-2007, 11:45 AM
Thanks Pottsy and Mystics,

it?s working now:up:

regards
Delazar

rellek
12-21-2007, 12:42 PM
Thanks a lot. Will try it soon - and give my vote for MOTM :)

daFish
12-21-2007, 01:55 PM
Great converter - works perfectly on my testboard.
Thanks for this.

Snake
12-21-2007, 02:11 PM
Thanks for this!

rellek
12-21-2007, 03:05 PM
Okay, tested, working well, nominated for MOTM :)

Thank you again!

DS MrSinister
12-21-2007, 05:39 PM
thanks for sharing... works great..

:D:D:D

Trigr
12-21-2007, 10:18 PM
just so im understanding .......

i must have your original from https://vborg.vbsupport.ru/showthread.php?t=123033 installed on my 3.6.x board before i try the upgrade to 3.7

then once i upgrade to 3.7 i have to use this to convert over so it will work again?

id love to use this .... just want to be clear.

thanks

daFish
12-22-2007, 08:04 AM
just so im understanding .......

i must have your original from https://vborg.vbsupport.ru/showthread.php?t=123033 installed on my 3.6.x board before i try the upgrade to 3.7

then once i upgrade to 3.7 i have to use this to convert over so it will work again?

id love to use this .... just want to be clear.

thanks

Basically, yes.
If you're using Mystics prefix hack a lot in your forums, then this hack is for you if you're upgrading to vB3.7.
Otherwise not. ;)

firstrebel
12-22-2007, 08:55 AM
This is greatly appreciated. At what stage do we:

remove the product

remove the files: threadprefix.php and includes/functions_threadprefix.php

remove the templates: threadprefix_listbit and threadprefix_modify

revert the two templates that are not changed for 3.7: threadbit_announcement and SUBSCRIBE

Bob

Pottsy
12-22-2007, 09:43 AM
I would do that once you know you are never going to need the old data. So for me it will be once I upgrade my live site to 3.7.? and get it happily running, and take a "I'm happy with it" backup.

Pottsy
12-22-2007, 09:50 AM
just so im understanding .......

i must have your original from https://vborg.vbsupport.ru/showthread.php?t=123033 installed on my 3.6.x board before i try the upgrade to 3.7

then once i upgrade to 3.7 i have to use this to convert over so it will work again?

id love to use this .... just want to be clear.

thanks

If you want to continue using Mystics hack with 3.7, then you do NOT need to run this converter. Just revert and re-modify a whole load of templates.

If you want to abandon Mystics hack and start using the native vbulletin thread prefixes, then this script will move your data from Mystics hack into the right place so the native vbulletin system can see it.

Trigr
12-22-2007, 12:52 PM
If you want to continue using Mystics hack with 3.7, then you do NOT need to run this converter. Just revert and re-modify a whole load of templates.

If you want to abandon Mystics hack and start using the native vbulletin thread prefixes, then this script will move your data from Mystics hack into the right place so the native vbulletin system can see it.



gotcha ..... Thanks.

Paul M
12-23-2007, 10:47 AM
Nice, I'll be looking at this for the upgrade of vb.org to 3.7 as we use prefixes.

Kaleem
12-23-2007, 06:36 PM
Worked perfectly great :)

Rageem
12-23-2007, 10:19 PM
I happy for this script :) , and I would be very happy if you fixed this problem ;)

I have Arabic language "UTF-8" and I use Collation "utf8_general_ci" in mysql for my forum.

And I test this script, after the script was used on the characters to "?????"

https://vborg.vbsupport.ru/attachment.php?attachmentid=73665&stc=1&d=1198455472

And see this error in running

Doing forum 2...........
Doing forum 4..........
Doing forum 8...
Warning: Duplicate entry '?????8' for key 1 in /home/_/public_html/forum/ez_sql_mysql.php on line 204

Warning: Duplicate entry 'prefix_?????8_title_rich-0-global' for key 2 in /home/_/public_html/forum/ez_sql_mysql.php on line 204

Warning: Duplicate entry 'prefix_?????8_title_plain-0-global' for key 2 in /home/_/public_html/forum/ez_sql_mysql.php on line 204
......Done.
Now you MUST rebuild all languages in AdminCP > Languages & Phrases > Language Manager > Rebuild All Languages.

Thanks

Pottsy
12-30-2007, 07:56 AM
Rageem, I'm sorry I have no experience with non-Roman characters in databases like this.

Alfa1
01-17-2008, 09:13 AM
Pottsy, do you have ideas about how to merge prefixes or prefix sets?

Pottsy
01-17-2008, 02:26 PM
Alfa1, it was me at vb.com... I think I know what you want, and shall try to achieve this when I test and re-build on the next beta release. In essence, I shall try to get the script to (optionally) read all prefixes everywhere and make one set, then apply that one set to all forums.

Alfa1
01-18-2008, 04:56 AM
That would be a big enhancement. Is it possible to add a feature where the admin can select which sets to merge?

Alfa1
04-06-2008, 01:36 PM
Alfa1, it was me at vb.com... I think I know what you want, and shall try to achieve this when I test and re-build on the next beta release. In essence, I shall try to get the script to (optionally) read all prefixes everywhere and make one set, then apply that one set to all forums.

Please see this modification request:
https://vborg.vbsupport.ru/showthread.php?p=1484367
Before vbulletin 3.7 I used this hack: Thread Prefixes (https://vborg.vbsupport.ru/showthread.php?t=123033) to have this functionality. Since vbulletin 3.7 thread prefixes are built into vbulletin.
I used this hack to import my thread prefixes into vb 3.7: Thread Prefixes upgrade from Mystics to 3.7 (https://vborg.vbsupport.ru/showthread.php?t=165761)

This hack created one prefixes set per forum, because vbulletin 3.7 introduced prefixes sets. This means that I now have 46 almost identical sets of prefixes. Each set contains between 10 and 25 prefixes. Most sets and most prefixes are almost identical. I would like to merge many thread prefixes and sets, so that I just have a few different prefixes sets left. But I do not want to loose prefixes on the thousands of threads that have been categorized with them.

As far as I understand this would be a simple script to code. I may be wrong. Either way; it will be very helpful to many admins and safe loads of work.

antialiasis
04-30-2008, 09:38 PM
I was just attempting to use this on my 3.7.0 installation, but all the prefixes I get now have no names. Any idea why?

Lucas
05-10-2008, 07:04 PM
Does this work as a stand-alone script or is it just an upgrade? I am looking to have prefixes for my new vB 3.7

Mecho
05-15-2008, 07:16 PM
hmm it doesnt really import all the prefixes for me . just in some forums :( it add prefixes to some forums that i havent any prefix on them !!

also now all the prefixes are like this > [[prefix]]

Any idea ?
i can not open my forum until i can fix this as we are really using prefixes in our forum .

Pottsy
06-15-2008, 07:58 PM
Used this for real now on my forum - went from 3.6.8 PL1 to 3.7.1 PL1 without a hitch.

I suspect that this will fall over if you have special characters in your prefixes, so apologies if it doesn't work for you. Feel free to pick up the code and do what you like with it!

Pottsy
06-15-2008, 08:00 PM
hmm it doesnt really import all the prefixes for me . just in some forums :( it add prefixes to some forums that i havent any prefix on them !!

also now all the prefixes are like this > [[prefix]]

Any idea ?
i can not open my forum until i can fix this as we are really using prefixes in our forum .

You can get rid of the formatting by changing the query in tpup.php (open the file and follow the instructions about commenting out one query and uncommenting the other).

No idea why it should invent prefixes, unless you have old ones in your database that shouldn't be there.

Pottsy
06-15-2008, 08:02 PM
I was just attempting to use this on my 3.7.0 installation, but all the prefixes I get now have no names. Any idea why?

Does this work as a stand-alone script or is it just an upgrade? I am looking to have prefixes for my new vB 3.7

This script converts Mystics prefixes from his TP hack found in 3.6 into prefixes in 3.7 format. You run it once and then delete it.

gullim
06-27-2008, 07:19 PM
I get following error

Warning: Unknown column 'threadprefix' in 'field list' in C:\xampp\htdocs\board\tpup\ez_sql_mysql.php on line 204

Warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\board\tpup\tpup.php on line 10
Done.

The connection through database is correct :( Has anyone some tips?!

hoangminh
06-28-2008, 04:00 AM
This script does not work with the Unicode Character, it will make a lot prefix become empty and error.

Any ideas ?

Birched
01-19-2009, 11:40 AM
Has anyone tried this to do a more drastic upgrade? Like *gulp* go from a 3.0 'category hack' to v. 3.8 integrated prefixes?

Birched
01-19-2009, 05:19 PM
I tried to run this and ran into a problem with any forum that had an apostrophe in the title. What's a good way around that?