Exemple #1
0
if (isset($_REQUEST['features'])) {
    // Feature list or table.
    $set = isset($_REQUEST['cloud']) ? array('core', 'addons', 'cloud') : false;
    $set = vanillaFeatures($set);
    if (isset($_REQUEST['type'])) {
        viewFeatureList($_REQUEST['type'], $set);
    } else {
        viewFeatureTable($set);
    }
} elseif (isset($_POST['type'])) {
    if (array_key_exists($_POST['type'], $supported)) {
        // Mini-Factory for conducting exports.
        $class = ucwords($_POST['type']);
        $controller = new $class();
        if (!method_exists($controller, $method)) {
            echo "This datasource type does not support {$method}.\n";
            exit;
        }
        $controller->{$method}();
    } else {
        echo 'Invalid type specified: ' . $_POST['type'];
    }
} else {
    // Show the web UI to start an export.
    $canWrite = testWrite();
    viewForm(array('Supported' => $supported, 'CanWrite' => $canWrite));
}
// Console output should end in newline.
if (defined('CONSOLE')) {
    echo "\n";
}
 /**
  * Logic for export process.
  */
 public function doExport()
 {
     global $supported;
     // Test connection
     $msg = $this->testDatabase();
     if ($msg === true) {
         // Test src tables' existence structure
         $msg = $this->ex->verifySource($this->sourceTables);
         if ($msg === true) {
             // Good src tables - Start dump
             $this->ex->useCompression(true);
             $this->ex->filenamePrefix = $this->dbInfo['dbname'];
             increaseMaxExecutionTime(3600);
             //            ob_start();
             $this->forumExport($this->ex);
             //            $Errors = ob_get_clean();
             $msg = $this->ex->comments;
             // Write the results.  Send no path if we don't know where it went.
             $relativePath = $this->param('destpath', false) ? false : $this->ex->path;
             viewExportResult($msg, 'Info', $relativePath);
         } 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
 }