This is an old revision of the document!
This page is not fully translated, yet. Please help completing the translation.
(remove this paragraph once the translation is finished)
Normally at this point you really have to do some hard work. Starting from the dump you have to write a lot of lines of beautiful PHP SQL statements by hand, which are then sent individually to the server.
That's too cumbersome for us, so we do that 'a bit' easier:
(To reassure about privacy Concerned: Neither the source nor the target file are stored on the server.)
Nothing easier than that.
The only thing one needs to do is to copy the install-struct.sql into the root directory of the addon (where also install.php can be found). The code below shows the integration of the files install.php, uninstall.php, and upgrade.php into an addon.
<?php // Must include code to stop this file being accessed directly /* -------------------------------------------------------- */ if (!defined('SYSTEM_RUN')) { die('Cannot access this file directly'); } /* -------------------------------------------------------- */ // --- process import file to create addons tables ---------- $sSqlStructFile = __DIR__.'/install-struct.sql'; if (is_readable($sSqlStructFile)) { $oImporter = new SqlImport(WbDatabase::getInstance(), $sSqlStructFile); if ($oImporter->doImport(__FILE__)) { // --- finish process import file --------------------------------- // --- begin all other individual stuff --------------------------- /* * do all other stuff */ // --- end of all other individual stuff -------------------------- } else { $aError[] = $oImporter->getError(); } //endif unset($oImporter); } else { $aError[] = 'missing or not readable file \"'.basename(__DIR__).'/install-struct.sql\"'; } //endif /* **** END INSTALL / UNINSTALL / UPGRADE *********************************** */
<?php // Must include code to stop this file being accessed directly /* -------------------------------------------------------- */ if (!defined('SYSTEM_RUN')) { die('Cannot access this file directly'); } /* -------------------------------------------------------- */ // --- begin all other individual stuff --------------------------- /* * do all other stuff */ // --- end of all other individual stuff -------------------------- // --- process import file to delete addons tables ---------- $sSqlStructFile = __DIR__.'/install-struct.sql'; if (is_readable($sSqlStructFile)) { $oImporter = new SqlImport(WbDatabase::getInstance(), $sSqlStructFile); if (!$oImporter->doImport(__FILE__)) { $aError[] = $oImporter->getError(); } unset($oImporter); } else { $aError[] = 'missing or not readable file \"'.basename(__DIR__).'/install-struct.sql\"'; } //endif // --- finish process import file --------------------------------- /* **** END INSTALL / UNINSTALL / UPGRADE *********************************** */
I'd like to write more, but THAT was already all. There is nothing more to do.
PS: the above code sample can also be downloaded by simply clicking on the label….
— Manuela v.d.Decken 08.09.2014