Ferreteria/v0.6/clade/Sys/Data/Engine/aux/ActionRq/Admin/dbase/EngDbExport/@removed

From Woozle Writes Code
< Ferreteria‎ | v0.6‎ | clade‎ | Sys‎ | Data‎ | Engine‎ | aux‎ | ActionRq‎ | Admin‎ | dbase/EngDbExport
Revision as of 03:11, 27 November 2025 by Woozle (talk | contribs) (Created page with "{{fmt/title|Removed Code}} =={{fmt/date|2025|09|26}}== Commented out yesterday: {{fmt/php/block|1= // 2025-09-25 refactoring these traits back out of existence trait tEngDbExport { protected function EngDbExportRequestClass() : string { return cEngDbExport::class; } protected function NewEngDbExportRequest() : RequestIface { return ($this->EngDbExportRequestClass())::FromDbOper($this->ODbOper()); } } }} =={{fmt/date|2025|05|31}}== Commented out on {{fmt/date|2025...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Removed Code

2025-09-26

Commented out yesterday:

// 2025-09-25 refactoring these traits back out of existence
trait tEngDbExport {
    protected function EngDbExportRequestClass() : string { return cEngDbExport::class; }
    protected function NewEngDbExportRequest() : RequestIface { return ($this->EngDbExportRequestClass())::FromDbOper($this->ODbOper()); }
}

2025-05-31

Commented out on 2025-03-25:

#
    // 2025-03-25 Old API
    public function AskEngine(DbConnIface $oEng) {
        // Give the Template access to the Engine object:
        $oTplt = $this->FileSpecTemplate();
        $oTplt->Lookup()->QEngine()->SetIt($oEng);

        $oScrn = self::Screen();
        $oTplt = $this->FileSpecTemplate();
        $oLook = $oTplt->Lookup();  // filename template

        $arSch = $oEng->GetSchemaList();
        $nSch = count($arSch);
        if ($nSch == 0) {
            echo $oScrn->ErrorIt('Problem').': no schemas found.'.CRLF;
            $ok = FALSE;
        } else {
            $ok = TRUE;
            echo $nSch.' schema'.(($nSch==1)?'':'s').' found.'.CRLF;
            foreach ($arSch as $oSchema) {
                $oLook->QSchema()->SetIt($oSchema);
                $this->OSchema($oSchema);
                $fsData = $oTplt->Render();

                $oStat = $oSchema->DoExport($fsData);
                #echo $oStat->RenderMessages(); // 2025-01-25 might be redundant
                if (!$oStat->GetOkay()) {
                    $ok = FALSE;
                }
            }
        }
        if ($ok) {
            echo $oScrn->GreenIt('Ok!').' - Backup complete.'.CRLF;
        } else {
            echo $oScrn->YellowIt('Note').': - one or more issues were found during backup.'.CRLF;
        }

    }

2025-01-08

Obsoleted on 2024-12-28:

#
    /**
     * PROCESS: send the command via an ssh tunnel, and capture the output
     * HISTORY:
     *  2024-11-23 For now, this backs up all DBs. TODO: allow specifying a list
     *  2024-11-24 We *could* open a tunnel for this, but tentatively it's simpler
     *    to pipe a command through:
     *    ssh user@remote_host "mysqldump -u username -p database_name" > local_backup_file.sql
     *  2024-12-27 moved from cMaria to Engine/AdminRq/Backup.php
     */
    protected function DoUtilBackup(EngineIface $oEng) {
        die('This is obsolete now. 2024-12-28'.CRLF);
        $oScrn = self::Screen();

        $oTplt = $this->FileSpecTemplate();

        $doAll = FALSE; // Maybe this should be an input option... but would we ever want to, in production?
        $ok = TRUE;

        if ($doAll) {
            $sDBSpec = '--all-databases'; // TODO 2024-11-24: allow specification of DB list in app command
            $sSchema = '~ALL~'; // TODO: make this a setting
            $oTplt->Schema($sSchema);
            $fsData = $oTplt->Render();
            $oEng->UtilBackupSchema($fsData,$sSchema,$sDBSpec);
        } else {
            $arDBs = $oEng->GetSchemaList();
            $nDBs = count($arDBs);
            echo $nDBs.' schema'.(($nDBs==1)?'':'s').' found.'.CRLF;
            foreach ($arDBs as $sSchema) {
                $oTplt->Schema($sSchema);
                $osfs = $oTplt->Render();
                if ($osfs->HasIt()) {
                    $fsData = $osfs->GetIt();
                    $oStat = $oEng->UtilBackupSchema($fsData,$sSchema,$sSchema);
                    if ($oStat->HasMessage()) {
                        echo $oStat->GetMessage().CRLF;
                    }
                    if (!$oStat->GetOkay()) {
                        $ok = FALSE;
                    }
                } else {
                    die('Something is not set properly in the template.'.CRLF);
                }
            }
            if ($ok) {
                echo $oScrn->GreenIt('Ok!').' - Backup complete.'.CRLF;
            } else {
                echo $oScrn->YellowIt('Note').': - one or more issues were found during backup.'.CRLF;
            }
        }

    }