2011-06-10 21:55:32 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* This file is part of MySQLDumper released under the GNU/GPL 2 license
|
|
|
|
* http://www.mysqldumper.net
|
|
|
|
*
|
|
|
|
* @package MySQLDumper
|
|
|
|
* @subpackage Controllers
|
|
|
|
* @version SVN: $Rev$
|
|
|
|
* @author $Author$
|
|
|
|
*/
|
|
|
|
/**
|
|
|
|
* Dump Controller
|
|
|
|
*
|
|
|
|
* Controller to handle actions triggered on dump screen
|
|
|
|
*
|
|
|
|
* @package MySQLDumper
|
|
|
|
* @subpackage Controllers
|
|
|
|
*/
|
2012-08-04 17:09:48 +00:00
|
|
|
class DumpController extends Msd_Controller_Action
|
2011-06-10 21:55:32 +00:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Show dump page
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function indexAction()
|
|
|
|
{
|
|
|
|
$dump = new Msd_Dump();
|
|
|
|
$dump->prepareDumpProcess();
|
2012-11-05 19:30:10 +00:00
|
|
|
$this->view->dumpData = new StdClass();
|
|
|
|
$this->view->dumpData->nrOfDatabasesToBackup = count($dump->dbsToBackup);
|
|
|
|
$this->view->dumpData->databasesToBackup = implode(', ', array_keys($dump->dbsToBackup));
|
|
|
|
$this->view->dumpData->sumTotal = $dump->sumTotal;
|
2011-06-10 21:55:32 +00:00
|
|
|
//TODO get comment from config profile
|
|
|
|
$this->view->dumpData->comment = '';
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Start dump action
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function startDumpAction()
|
|
|
|
{
|
2012-11-05 19:30:10 +00:00
|
|
|
$taskList = Msd_TaskManager::getInstance('backupTasks');
|
|
|
|
$tasks = $taskList->getTasks();
|
2011-06-10 21:55:32 +00:00
|
|
|
$this->view->sessionId = Zend_Session::getId();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Do dump action
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function doDumpAction()
|
|
|
|
{
|
|
|
|
Zend_Layout::getMvcInstance()->disableLayout();
|
|
|
|
Zend_Controller_Front::getInstance()->setParam('noViewRenderer', true);
|
|
|
|
$taskList = Msd_TaskManager::getInstance('backupTasks');
|
2012-11-05 19:30:10 +00:00
|
|
|
$tasks = $taskList->getTasks();
|
|
|
|
$ret = array(
|
2011-06-10 21:55:32 +00:00
|
|
|
'backup_in_progress' => false,
|
2012-11-05 19:30:10 +00:00
|
|
|
'config_file' => $this->view->dynamicConfig->getParam('configFile')
|
2011-06-10 21:55:32 +00:00
|
|
|
);
|
|
|
|
echo json_encode($ret);
|
|
|
|
}
|
|
|
|
}
|