/**
  * Logic for export process
  */
 public function DoExport()
 {
     global $Supported;
     // Test connection
     $Msg = $this->TestDatabase();
     if ($Msg === true) {
         // Create db object
         $Ex = new ExportModel();
         $Ex->SetConnection($this->DbInfo['dbhost'], $this->DbInfo['dbuser'], $this->DbInfo['dbpass'], $this->DbInfo['dbname']);
         $Ex->Prefix = $this->DbInfo['prefix'];
         $Ex->UseStreaming = $this->UseStreaming;
         // Test src tables' existence structure
         $Msg = $Ex->VerifySource($this->SourceTables);
         if ($Msg === true) {
             // Good src tables - Start dump
             $Ex->UseCompression(TRUE);
             $Ex->FilenamePrefix = $this->DbInfo['dbname'];
             set_time_limit(60 * 60);
             $this->ForumExport($Ex);
             // Write the results.
             if ($Ex->UseStreaming) {
                 exit;
             } else {
                 ViewExportResult($Ex->Comments, 'Info', $Ex->Path);
             }
         } else {
             ViewForm(array('Supported' => $Supported, 'Msg' => $Msg, 'Info' => $this->DbInfo));
         }
         // Back to form with error
     } else {
         ViewForm(array('Supported' => $Supported, 'Msg' => $Msg, 'Info' => $this->DbInfo));
     }
     // Back to form with error
 }
示例#2
0
 /**
  * Construct and set the controller's properties from the posted form.
  */
 public function __construct()
 {
     $this->HandleInfoForm();
     $this->Ex = new ExportModel();
     $this->Ex->Controller = $this;
     $this->Ex->SetConnection($this->DbInfo['dbhost'], $this->DbInfo['dbuser'], $this->DbInfo['dbpass'], $this->DbInfo['dbname']);
     $this->Ex->Prefix = $this->DbInfo['prefix'];
     $this->Ex->Destination = $this->Param('dest', 'file');
     $this->Ex->DestDb = $this->Param('destdb', null);
     $this->Ex->TestMode = $this->Param('test', false);
     /**
      * Selective exports
      * 1. Get the comma-separated list of tables and turn it into an array
      * 2. Trim off the whitespace
      * 3. Normalize case to lower
      * 4. Save to the ExportModel instance
      */
     $RestrictedTables = $this->Param('tables', false);
     if (!empty($RestrictedTables)) {
         $RestrictedTables = explode(',', $RestrictedTables);
         if (is_array($RestrictedTables) && !empty($RestrictedTables)) {
             $RestrictedTables = array_map('trim', $RestrictedTables);
             $RestrictedTables = array_map('strtolower', $RestrictedTables);
             $this->Ex->RestrictedTables = $RestrictedTables;
         }
     }
 }