public function Export() {
      $this->Permission('Garden.Export'); // This permission doesn't exist, so only users with Admin == '1' will succeed.

      set_time_limit(60*2);
      $Ex = new ExportModel();
      $Ex->PDO(Gdn::Database()->Connection());
      $Ex->Prefix = Gdn::Database()->DatabasePrefix;

      /// 2. Do the export. ///
      $Ex->UseCompression = TRUE;
      $Ex->BeginExport(PATH_ROOT.DS.'uploads'.DS.'export '.date('Y-m-d His').'.txt.gz', 'Vanilla 2.0');

      $Ex->ExportTable('User', 'select * from :_User'); // ":_" will be replace by database prefix
      $Ex->ExportTable('Role', 'select * from :_Role');
      $Ex->ExportTable('UserRole', 'select * from :_UserRole');

      $Ex->ExportTable('Category', 'select * from :_Category');
      $Ex->ExportTable('Discussion', 'select * from :_Discussion');
      $Ex->ExportTable('Comment', 'select * from :_Comment');

      $Ex->ExportTable('Conversation', 'select * from :_Conversation');
      $Ex->ExportTable('UserConversation', 'select * from :_UserConversation');
      $Ex->ExportTable('ConversationMessage', 'select * from :_ConversationMessage');

      $Ex->EndExport();
   }
 /** 
  * Logic for export process 
  */
 public function DoExport()
 {
     // Test connection
     $Msg = $this->TestDatabase();
     if ($Msg === true) {
         // Create db object
         $Ex = new ExportModel();
         $Dsn = 'mysql:dbname=' . $this->DbInfo['dbname'] . ';host=' . $this->DbInfo['dbhost'];
         $Ex->PDO($Dsn, $this->DbInfo['dbuser'], $this->DbInfo['dbpass']);
         $Ex->Prefix = $this->DbInfo['prefix'];
         // Test src tables' existence structure
         $Msg = $Ex->VerifySource($this->_SourceTables);
         if ($Msg === true) {
             // Good src tables - Start dump
             $Ex->UseCompression = TRUE;
             set_time_limit(60 * 2);
             $this->ForumExport($Ex);
         } else {
             ViewForm($Msg);
         }
         // Back to form with error
     } else {
         ViewForm($Msg);
     }
     // Back to form with error
 }