List of changed var/array/function names
A lot of things changed in 3.5 and you might find yourself lost for awhile as you figure out how to work with the new var/array/function names. This list should help you port your old 3.0.x hacks quicker, if you have anything to add to the list reply to this thread and I will edit the first post! :)
Note that some of these might not work in some parts of the new code, OOP changes a lot of things, in some cases you might be using $this-> or some other alternative to get to these. On the front end they will work for the most part. Do remember that there are hooks littered in the 'build' functions like the one that builds postbit. For an example of working with such hooks you can check out a plug-in I released, I spend 5 minutes wondering why $post would not work until I realized I was begin an idiot! Anyway check out the .xml file: https://vborg.vbsupport.ru/showthread.php?t=82623 Turned out I needed to use $this->post because that hook was inside of a function! Doh! [high]The big list...[/high] 3.0.x version of the var will be on the left, 3.5 on the right as so: 3.0.x => 3.5 [high]Global[/high] $DB_site-> => $db-> $bbuserinfo[] => $vbulletin->userinfo[] $vboptions[] => $vbulletin->options[] $_GET/$_REQUEST/$_POST/$_COOKIE => $vbulletin->GPC[] globalize() => $vbulletin->input->clean_array_gpc() |
$DB_site->query(); => $db->query_read();
|
Hmm ... not always.
Only for SELECT. For REPLACE/UPDATE/INSERT it would be query_write(), to support mySQL 4.1 Master/Slave. To keep compatibility, query() is also available and will call the correct connection. |
Yea I'll need to add that one, will cause alot of questions when this goes public, thanks guys and keep adding them as you find them :)
|
The following was written by Kier for the developers. He has agreed to release it here.
Variables in the $vbulletin (vB_Registry) class Just about all the variables that used to get set up by init.php have now been migrated to the $vbulletin class. When migrating the old code, I don't want to see this sort of thing unless there's a specific reason for it: PHP Code:
PHP Code:
The MySQL database class has been totally rewritten, and the object is now called $db, rather than the old $DB_site. You can also reference the database object via $vbulletin->db, so there is no real need to put $db into the list of globals in functions. PHP Code:
Whereas we used to have a single $DB_site->query() function to run SQL queries, there are now three public functions to execute SQL. They are: $db->query_read Use this function to execute SELECT and SHOW queries only. If the user is using MySQL replication, these queries will execute on their slave server. PHP Code:
Use this function to execute UPDATE, ALTER and all other data-modifying queries. query_write() will execute on the master server in a replication situation. PHP Code:
addslashes() and addslashes_like() should be dropped in query strings, as it's problematic for some non-MySQL systems. Right now, the correct way to replace these functions is to use the newly defined functions in the database class, like this: PHP Code:
Datastore All items from the datastore now get fed directly into the $vbulletin class. They become $vbulletin->itemname. If their title is in the $unserialize array in the datastore class, they will be automatically unserialized when they are fetched. Note that the code currently has a lot of code that is equivalent to PHP Code:
Therefore, instead of checking 'isset' you will need to check PHP Code:
The old $_BITFIELDS, $_FORUMOPTIONS, $_USEROPTIONS etc. arrays no longer exist as individual entities. They are now part of the $vbulletin data registry object and go by different names. All the data they contained is still there, but you'll need to talk to them differently. If you look at the top of includes/class_core.php I have left a 'translation lookup table' so that it's easier to see where the data you are looking for has gone. To avoid too much $object->array[key1][key2][key3][key4] stuff, there are references set up to allow you to talk to deep elements quickly. For example, $vbulletin->bf_ugp_adminpermissions is a reference to $vbulletin->bf_ugp['adminpermissions']... it makes more sense when you start using them Oh... 'ugp' stands for usergroup permissions. vB_Input Class If you read includes/class_core.php, you'll notice that there's a class called vB_Input. This class deals with input into vBulletin and stuff that's related to the superglobal arrays ($_REQUEST, $_ENV, $_SERVER etc.) Misc As lots of variables have been shuffled around, you'll need to keep your eyes open for them. For example, $scriptpath is now $vbulletin->scriptpath and $nozip is now $vbulletin->nozip. I strongly suggest that you read and familiarize yourself with the new init.php and the contents of includes/class_core.php before diving in. |
Thank you for this update, Wayne. It helped me answer my question about query_read vs query_write :)
[Removed question as more indepth studies of the files answered it] |
You can use query_first() as this basically does the same as query_read() and fetch_array().
|
You can also use the old school query();, but it preforms a preg call to check for the query type (SELECT = read, everything else = write). Really you should not use query(); anymore, but there is nothing stoping you from doing it ;)
|
Ah I see, thanks :)
I really wish they didn't add support for the old query(), this will only lead to lazy coders writing shi'ite stuff that keeps using these old, outdated versions, forcing vB to sacrifice performance in order to determine the correct function which again leads to a performance hit. :(. I guess this means I will have to be more selective and conservative with the stuff I install, as I like things running fast and smooth :) |
god everything i have worked for has to be rewritten, damn u!!!!
also is $vbulletin->bbuserinfo[] now used in templates and where is official vbulletin.com documentation? |
Quote:
As far as I can see $bbuserinfo/$vboptions/$session is being unsed in the Templates. But I am not sure if this will be changed. |
Quote:
|
if you're not in the mood to re-write all the variables, you can put stuff like:
$bbuserinfo = $vbulletin->userinfo; unset($vbulletin->userinfo); At the top of your files (after you've included the files you require), ofcourse if your embedding code into an existing vB 3.5 php file, like forumdisplay, i wouldn't use the unset function. It's a quick and easy method, until you get time to properly convert everything :) - Zero Tolerance |
*cough* functions_legacy.php, enable_legacy() *cough*
|
Quote:
- Zero Tolerance |
Quote:
|
I doubt so. But to get a definitive answer you should ask the developers :)
|
Quote:
|
Quote:
|
Quote:
|
Very good explainations, thanks.
|
When using something like this for an example:
PHP Code:
|
What's the reason for changing the $_GET, $_POST, etc.? Is there any benefit to using the new versions?
|
Quote:
|
Quote:
|
Quote:
|
Then again, as far as I can see theres nothing stopping a lazy coder from just using the superglobals.
|
Quote:
|
Quote:
|
In 3.0.7 I put this code in phpinclude_start:
PHP Code:
In 3.5 I made a global_start plugin using this code: PHP Code:
Also the u=$userinfo[userid] doesn't seem to work in the postbit either. :ermm: |
Thanks for the how-to's :up:
I needed to use $session outside the templates, it's now: $session => $vbulletin->session->vars |
Quote:
$vbulletin->session->vars['sessionurl'] |
Quote:
|
Quote:
I was not trying to start an argument. |
Quote:
|
what is the new array for $userinfo (not $bbuserinfo)
|
Quote:
I just checked the memberinfo template, and it hasn't changed there... |
Yeah, I mentioned that u=$userinfo[userid] wasn't working in the postbit a few posts ago. I think we might have to wait for the documentation to find out all the new conditionals.
|
userinfo is not a global variable like bbuserinfo. So it won't be part of the new $vbulletin object and other globals. The variable name for userinfo will be different depending on the script or template being edited.
|
Quote:
Do you have any idea how I can solve this problem? Is there a replacement for $GLOBALS? |
All times are GMT. The time now is 11:02 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 | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|