vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.7 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=228)
-   -   Administrative and Maintenance Tools - Thread Prefixes upgrade from Mystics to 3.7 (https://vborg.vbsupport.ru/showthread.php?t=165761)

Pottsy 12-20-2007 10:00 PM

Thread Prefixes upgrade from Mystics to 3.7
 
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

Code:

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

Quote:

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 Code:

<?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:
Code:

if ($table_prefix != "") {$table_prefix .= ".";}
And change:
Code:

FROM forum");
to:
Code:

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.


All times are GMT. The time now is 08:05 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03021 seconds
  • Memory Usage 1,741KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_code_printable
  • (1)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete