PDA

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


Pottsy
21 Dec 2007, 07:32
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
21 Dec 2007, 07:37
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
21 Dec 2007, 10:02
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
21 Dec 2007, 11:01
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
21 Dec 2007, 11:59
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
21 Dec 2007, 12:08
Remove this line in tpup.php:if ($table_prefix != "") {$table_prefix .= ".";}And change:FROM forum");to:FROM " . $table_prefix . "forum");

Pottsy
21 Dec 2007, 12:15
Dalazar,

Just updated it.

Pottsy
21 Dec 2007, 12:20
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
21 Dec 2007, 12:26
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
21 Dec 2007, 12:35
Aha!

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

I'll make the appropriate changes.

Delazar
21 Dec 2007, 12:45
Thanks Pottsy and Mystics,

itīs working now:up:

regards
Delazar

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

daFish
21 Dec 2007, 14:55
Great converter - works perfectly on my testboard.
Thanks for this.

Snake
21 Dec 2007, 15:11
Thanks for this!

rellek
21 Dec 2007, 16:05
Okay, tested, working well, nominated for MOTM :)

Thank you again!

DS MrSinister
21 Dec 2007, 18:39
thanks for sharing... works great..

:D:D:D

Trigr
21 Dec 2007, 23:18
just so im understanding .......

i must have your original from http://www.vbulletin.org/forum/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
22 Dec 2007, 09:04
just so im understanding .......

i must have your original from http://www.vbulletin.org/forum/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
22 Dec 2007, 09:55
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
22 Dec 2007, 10:43
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
22 Dec 2007, 10:50
just so im understanding .......

i must have your original from http://www.vbulletin.org/forum/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
22 Dec 2007, 13:52
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
23 Dec 2007, 11:47
Nice, I'll be looking at this for the upgrade of vb.org to 3.7 as we use prefixes.

Kaleem
23 Dec 2007, 19:36
Worked perfectly great :)

Rageem
23 Dec 2007, 23:19
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 "?????"

http://www.vbulletin.org/forum/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
30 Dec 2007, 08:56
Rageem, I'm sorry I have no experience with non-Roman characters in databases like this.

Alfa1
17 Jan 2008, 10:13
Pottsy, do you have ideas about how to merge prefixes or prefix sets?

Pottsy
17 Jan 2008, 15:26
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
18 Jan 2008, 05:56
That would be a big enhancement. Is it possible to add a feature where the admin can select which sets to merge?

Alfa1
06 Apr 2008, 14:36
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:
http://www.vbulletin.org/forum/showthread.php?p=1484367
Before vbulletin 3.7 I used this hack: Thread Prefixes (http://www.vbulletin.org/forum/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 (http://www.vbulletin.org/forum/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
30 Apr 2008, 22:38
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
10 May 2008, 20:04
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
15 May 2008, 20:16
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
15 Jun 2008, 20:58
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
15 Jun 2008, 21:00
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
15 Jun 2008, 21:02
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
27 Jun 2008, 20:19
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
28 Jun 2008, 05:00
This script does not work with the Unicode Character, it will make a lot prefix become empty and error.

Any ideas ?

Birched
19 Jan 2009, 12:40
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
19 Jan 2009, 18:19
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?