|
Upgrading your MyBB 1.2 plugins for MyBB 1.4
|
|
09-18-2007, 11:37 PM
(This post was last modified: 11-01-2007 09:47 PM by Ryan Gordon.)
Post: #1
|
|||
|
|||
|
Upgrading your MyBB 1.2 plugins for MyBB 1.4
The following is a small tutorial providing information on some changes between MyBB 1.2 and MyBB 1.4:
There are 4 new optional functions for use in MyBB 1.4's plugin architecture: _install, _is_installed and _uninstall - which are all optional There are also two new keys for use in the _info() function: "compatibility" and "guid" - Again these are both optional. Here is the sample MyBB 1.4 hello world plugin for those of you who are visuals: PHP Code: <?phpHere's what you will have to change for most plugins: 1) Remove TABLE_PREFIX. from $db->simple_select, $db->update_query, $db->insert_query, $db->delete_query, $db->table_exists, the second argument in $db->field_exists, $db->optimize_table, $db->analyze_table, $db->show_create_table, $db->show_fields_from, $db->is_fulltext, $db->supports_fulltext, $db->supports_fulltext_boolean, $db->create_fulltext_index, and $db->drop_index $db->query will still use TABLE_PREFIX as we have no way of automatically detecting it in the query and it's more of a lower-level function on the DB Layers; the table prefix can be changed via $db->set_table_prefix(arg1 prefix) (Note: it does NOT redefine TABLE_PREFIX; You will have to do that in your own code if you change it via $db->set_table_prefix) We've added some new functions such as: $db->replace_query(arg1 table, arg2 replacements) $db->fetch_size([arg1 table]) $db->drop_table(arg1 table, [arg2 hard drop, [arg3 table prefix]]) $db->free_result(arg1 query resource) $db->write_query - Acts the SAME as $db->query except write queries are only executed on the master server. This is because we've implemented technologies to allow people to have multiple MySQL servers for huge setups (http://www.ncaabbs.com/forums/ for example) I suggest to anyone who wishes to prepare their code for MyBB 1.4 they use the internal database wrapper functions as much as possible (i.e. $db->update_query) because now that we support SQLite 2, SQLite 3, and PostgreSQL using some MySQL syntax run directly into $db->query will not process correctly. However, using the wrapper functions such as $db->update_query, we can setup the queries for you in the correct syntax. To explain $db->write_query more, it is used for queries that run INSERTS/UPDATES/DELETES/ALTER statements on the database which should only be run the the Master server because of the way MySQL Replication setups works. So if you want your plugin/modification to be used on a large forum like the NCAAbbs and want to prepare your code for MyBB 1.4 I highly suggest you use $db->write_query for any of those queries that are INSERTS/UPDATES/DELETES/ALTER and do not already take advantage of the $db->update_query, $db->insert_query, etc wrappers. For those of you who have queries that cannot fit into the $db->update_query, $db->insert_query wrappers and uses $db->query or $db->write_query and have compatibility problems with either version of SQLite or PostgreSQL then you can take advantage of a new variable in the database class called $db->type; Here is an example: PHP Code: switch($db->type)There are also some DB Engine specific functions to help work around some specific problems in their respective Server Query Languages which we will discuss at a later time If your plugin was built to add a page within the MyBB 1.2 ACP or modify some ACP code on the fly then there is no point in trying to update it now since the amount of changes in the new ACP (after all... it's been rewritten) will require you to rewrite it anyway; Also, unfortunately, at this time we're not releasing any of the new ACP code or pictures or any of that. Note: You do NOT have to change anything related to settings as those still have the same database schema. Getting away from the database changes, the rebuildsettings() function has been renamed to rebuild_settings() BUT rebuildsettings() still exists so plugins will still work for those mod authors who don't change that; But I highly recommend you do change it to rebuild_settings() as rebuildsettings() will likely be removed in the coming versions after MyBB 1.4. Update 10/8/07: Today I'm going to continue to discuss changes made to MyBB that will affect your plugins and how to correct it. All of the yes/no columns have been converted to 1/0 for better storage and search efficiency. So if you have for instance a setting in your plugin that is "yesno" or "onoff" you will now need to check it against 1/0. Please note that this change is still considered in development, and changes may be made at a later time. There is still tons of more stuff that has been changed and could affect your plugin but we are not ready to release documentation on code changes between MyBB 1.2 and MyBB 1.4 and is beyond the scope of this tutorial. I will update with more information on what has been changed as we come closer to release. Hope this helps! Ryan ![]() My Blog - My Mods |
|||
|
09-19-2007, 06:20 AM
Post: #2
|
|||
|
|||
|
RE: Upgrading your MyBB 1.2 plugins for MyBB 1.2
Nice tut but for the title don't you mean "Upgrading your MyBB 1.2 plugins for MyBB 1.4"
![]() |
|||
|
09-19-2007, 03:05 PM
Post: #3
|
|||
|
|||
|
RE: Upgrading your MyBB 1.2 plugins for MyBB 1.4
//starts learning =P
|
|||
|
09-19-2007, 06:53 PM
Post: #4
|
|||
|
|||
|
RE: Upgrading your MyBB 1.2 plugins for MyBB 1.4
hello dear.. is that mean that, the plugins we are using now will not work as well in mybb 1.4 ?
الدعم العربى تطوير منتديات MyBB - كتب ودروس وملحقات الـ Php - دروس وكتب الـ XHTML - تطوير المواقع والمنتديات - ارسال الموقع الى محركات البحث - اشهار المواقع - برامج كمبيوتر - العاب كمبيوتر - برامج الجوالات وتعريبها Cheap Web Hosting |
|||
|
09-19-2007, 08:43 PM
Post: #5
|
|||
|
|||
|
RE: Upgrading your MyBB 1.2 plugins for MyBB 1.4
Most MyBB 1.2 mods WILL NOT work in MyBB 1.4 without being updated using the instructions outlined above.
The little boat gently drifted across the pond exactly the way a bowling ball wouldn't. |
|||
|
09-19-2007, 09:27 PM
Post: #6
|
|||
|
|||
|
RE: Upgrading your MyBB 1.2 plugins for MyBB 1.4
Sorry to point out the obvious... but how did you not expect to have to upgrade your plugins on a huge release update like MyBB 1.4?
![]() My Blog - My Mods |
|||
|
09-20-2007, 03:34 PM
Post: #7
|
|||
|
|||
|
RE: Upgrading your MyBB 1.2 plugins for MyBB 1.4
Good to know, thanks Tiki.
|
|||
|
10-08-2007, 02:55 PM
Post: #8
|
|||
|
|||
|
RE: Upgrading your MyBB 1.2 plugins for MyBB 1.4
See my "Update 10/8/07" for some more information on how to upgrade your plugin.
![]() My Blog - My Mods |
|||
|
10-09-2007, 09:28 AM
Post: #9
|
|||
|
|||
|
RE: Upgrading your MyBB 1.2 plugins for MyBB 1.4
Thanks for instructions.This will help.
->The best web chat International Chat ->My Mods & Plugins |
|||
|
10-10-2007, 05:51 PM
Post: #10
|
|||
|
|||
|
RE: Upgrading your MyBB 1.2 plugins for MyBB 1.4
When is 1.4 will be released?
My ideas: Redirect counter Favourites in administration |
|||
|
« Next Oldest | Next Newest »
|
Search
Member List
Calendar
Help
![[Image: ryangordon.png]](http://files.bellomandesign.com/signatures/mybb/ryangordon.png)




![[Image: sigknuckles.gif]](http://audentio.com/staff/directors/jag/sigknuckles.gif)
![[Image: trans.gif]](http://thingiej.be/brol/trans.gif)