Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Beide Seiten der vorigen RevisionVorhergehende ÜberarbeitungNächste Überarbeitung | Vorhergehende Überarbeitung | ||
dev:all:devtools:manual-sqlconvert [20.03.2015 23:00] – [3. Einbinden der Strukturdatei] Manuela v.d.Decken | dev:all:devtools:manual-sqlconvert [29.01.2016 09:48] (aktuell) – [3. Einbinden der Strukturdatei (nur bis zur 2.8.4)] Manuela v.d.Decken | ||
---|---|---|---|
Zeile 22: | Zeile 22: | ||
{{ : | {{ : | ||
- | ==== 3. Einbinden der Strukturdatei ==== | + | ==== 3. Einbinden der Strukturdatei |
Nichts einfacher als das.\\ | Nichts einfacher als das.\\ | ||
Dazu muss einfach nur die install-struct.sql in das Hauptverzeichnis des Addons (dort wo auch die install.php zu finden ist) kopiert werden. Der nachfolgende Code zeigt die Einbindung in die Dateien // | Dazu muss einfach nur die install-struct.sql in das Hauptverzeichnis des Addons (dort wo auch die install.php zu finden ist) kopiert werden. Der nachfolgende Code zeigt die Einbindung in die Dateien // | ||
- | <code php install-uninstall-upgrade.php> | + | <code php install-upgrade.php> |
<?php | <?php | ||
// Must include code to stop this file being accessed directly | // Must include code to stop this file being accessed directly | ||
Zeile 34: | Zeile 34: | ||
// --- process import file to create addons tables ---------- | // --- process import file to create addons tables ---------- | ||
$sSqlStructFile = __DIR__.'/ | $sSqlStructFile = __DIR__.'/ | ||
- | if (file_exists($sSqlStructFile) && | + | if (is_readable($sSqlStructFile)) { |
$oImporter = new SqlImport(WbDatabase:: | $oImporter = new SqlImport(WbDatabase:: | ||
if ($oImporter-> | if ($oImporter-> | ||
Zeile 45: | Zeile 45: | ||
// --- end of all other individual stuff -------------------------- | // --- end of all other individual stuff -------------------------- | ||
+ | } else { | ||
+ | $aError[] = $oImporter-> | ||
} //endif | } //endif | ||
+ | unset($oImporter); | ||
+ | } else { | ||
+ | $aError[] = ' | ||
} //endif | } //endif | ||
/* **** END INSTALL / UNINSTALL / UPGRADE *********************************** */ | /* **** END INSTALL / UNINSTALL / UPGRADE *********************************** */ | ||
</ | </ | ||
+ | <code php uninstall.php> | ||
+ | <?php | ||
+ | // Must include code to stop this file being accessed directly | ||
+ | /* -------------------------------------------------------- */ | ||
+ | if (!defined(' | ||
+ | /* -------------------------------------------------------- */ | ||
+ | // --- begin all other individual stuff --------------------------- | ||
+ | |||
+ | /* | ||
+ | * do all other stuff | ||
+ | */ | ||
+ | |||
+ | // --- end of all other individual stuff -------------------------- | ||
+ | // --- process import file to delete addons tables ---------- | ||
+ | $sSqlStructFile = __DIR__.'/ | ||
+ | if (is_readable($sSqlStructFile)) { | ||
+ | $oImporter = new SqlImport(WbDatabase:: | ||
+ | if (!$oImporter-> | ||
+ | $aError[] = $oImporter-> | ||
+ | } | ||
+ | unset($oImporter); | ||
+ | } else { | ||
+ | $aError[] = ' | ||
+ | } //endif | ||
+ | // --- finish process import file --------------------------------- | ||
+ | /* **** END INSTALL / UNINSTALL / UPGRADE *********************************** */ | ||
+ | </ | ||
+ | |||
Ich würde dazu gerne noch mehr schreiben, aber DAS war es bereits. Mehr gibt es nicht zu tun. | Ich würde dazu gerne noch mehr schreiben, aber DAS war es bereits. Mehr gibt es nicht zu tun. | ||