Hi,
I'm running a command-line script in which I want to use smcFunc['db_create_table'](...) to create a table.
However, i get the error "Notice: Undefined index: db_create_table in ...."
I did a var_dump($smcFunc) and sure enough, none of the "Database Package Functions" (listed here -http://wiki.simplemachines.org/smf/$smcFunc) are in the $smcFunc variable. Only the db_query, db_fetch_row, etc are there.
I include the following files in my php script:
require('../SSI.php');
include('../Sources/DbPackages-mysql.php');
DbPackages-mysql.php is where db_create_table is defined, but that doesn't update $smcFunc.
Is there something else I need to include or something I need to execute? It might even be a php thing vs smf thing...
Thanks,
Josh
Try db_extend('packages');
That's the ticket!
Thanks andershz! Made my day. Progress is definitely now at hand.
For my edification - do you know of any official smf documentation about that?
Josh
There is, but not easy to find:
http://dev.simplemachines.org/smcfunctions.php
I also think the text is misleading:
Database Package functions were also introduced in SMF 2.0. These special functions allow customization creators to easily modify a database that will support multiple database types. The below functions only exist when using db_extend('packages');. By Default this is automatically called in the Package Manager.
I interpret that as the extra functions should always be available when installing a mod, but apparently "in the Package Manager" means something else.
As far as I remember it is, but the OP is using SSI (at least from the code he posted).
About documentation, you can take a look at:
http://wiki.simplemachines.org/smf/$smcFunc (http://wiki.simplemachines.org/smf/$smcFunc)
ETA: fixed link.
You remember correctly, I forgot about the SSI bit.
The $smcFunc wiki link is good, but it doesn't mention that db_extend is needed for the Database Package Functions, (when using SSI).
There is an "edit" button over there, you can add it. :P ;)
Lainaus käyttäjältä: emanuele - lokakuu 16, 2013, 07:48:58 AP
There is an "edit" button over there, you can add it. :P ;)
Done.
Great, thanks! :)