Benutzer-Werkzeuge

Webseiten-Werkzeuge


dev:all:devtools:manual-sqlconvert

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen RevisionVorhergehende Überarbeitung
Nächste Überarbeitung
Vorhergehende Überarbeitung
dev:all:devtools:manual-sqlconvert [20.03.2015 23:00] – [3. Einbinden der Strukturdatei] Manuela v.d.Deckendev: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:
 {{ :dev:all:sqldumpconverter.gif?nolink |}} {{ :dev:all:sqldumpconverter.gif?nolink |}}
  
-==== 3. Einbinden der Strukturdatei ====+==== 3. Einbinden der Strukturdatei (nur ab 2.8.4) ====
 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 //install.php//, //uninstall.php// und //upgrade.php// eines Addons. 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 //install.php//, //uninstall.php// und //upgrade.php// eines Addons.
  
-<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__.'/install-struct.sql';     $sSqlStructFile = __DIR__.'/install-struct.sql';
-    if (file_exists($sSqlStructFile) && is_readable($sSqlStructFile)) {+    if (is_readable($sSqlStructFile)) {
         $oImporter = new SqlImport(WbDatabase::getInstance(), $sSqlStructFile);         $oImporter = new SqlImport(WbDatabase::getInstance(), $sSqlStructFile);
         if ($oImporter->doImport(__FILE__)) {         if ($oImporter->doImport(__FILE__)) {
Zeile 45: Zeile 45:
  
 // --- end of all other individual stuff -------------------------- // --- end of all other individual stuff --------------------------
 +        } else {
 +            $aError[] = $oImporter->getError();    
         } //endif         } //endif
 +        unset($oImporter);
 +    } else {
 +        $aError[] = 'missing or not readable file \"'.basename(__DIR__).'/install-struct.sql\"';
     } //endif     } //endif
 /* **** END INSTALL / UNINSTALL / UPGRADE *********************************** */ /* **** END INSTALL / UNINSTALL / UPGRADE *********************************** */
 </code> </code>
 +<code php uninstall.php>
 +<?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 *********************************** */
 +</code>
 +
 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.
  
dev/all/devtools/manual-sqlconvert.1426892404.txt.gz · Zuletzt geändert: 03.06.2015 15:54 (Externe Bearbeitung)