/*************************************************************************
* UrBackup - Client/Server backup system
* Copyright (C) 2011-2016 Martin Raiber
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
**************************************************************************/
#include "action_header.h"
#include "../../Interface/Pipe.h"
#include "../server_status.h"
#include
namespace
{
bool client_start_backup(IPipe *comm_pipe, std::string backup_type)
{
if(backup_type=="full_file")
comm_pipe->Write("START BACKUP FULL");
else if(backup_type=="incr_file")
comm_pipe->Write("START BACKUP INCR");
else if(backup_type=="full_image")
comm_pipe->Write("START IMAGE FULL");
else if(backup_type=="incr_image")
comm_pipe->Write("START IMAGE INCR");
else
return false;
return true;
}
}
ACTION_IMPL(start_backup)
{
Helper helper(tid, &POST, &PARAMS);
std::string status_rights=helper.getRights("status");
std::vector status_right_clientids;
IDatabase *db=helper.getDatabase();
if(status_rights!="all" && status_rights!="none" )
{
std::vector s_clientid;
Tokenize(status_rights, s_clientid, ",");
for(size_t i=0;i start_client;
std::string start_type=POST["start_type"];
SUser *session=helper.getSession();
if(session!=NULL && session->id==SESSION_ID_INVALID) return;
if(session!=NULL && !s_start_client.empty() && helper.getRights("start_backup")=="all")
{
std::vector client_status=ServerStatus::getStatus();
std::vector sv_start_client;
Tokenize(s_start_client, sv_start_client, ",");
JSON::Array result;
for(size_t i=0;i