Пример #1
0
 $cfg = array();
 // 1 - Shares and exclude settings
 $cfg['RsyncShareName'] = $_POST['sharenames'];
 // Charset
 $cfg['ClientCharset'] = $_POST['encoding'];
 // Splitting excludes by \n
 foreach ($_POST['excludes'] as $key => $value) {
     $_POST['excludes'][$key] = explode("\n", trim($value));
     for ($j = 0; $j < count($_POST['excludes'][$key]); $j++) {
         $_POST['excludes'][$key][$j] = trim($_POST['excludes'][$key][$j]);
     }
 }
 $cfg['BackupFilesExclude'] = array_combine($_POST['sharenames'], $_POST['excludes']);
 // 2 -Backup Period settings
 $cfg['FullPeriod'] = fmtFloat(fmtfloat($_POST['full']) - 0.03);
 $cfg['IncrPeriod'] = fmtFloat(fmtfloat($_POST['incr']) - 0.03);
 // Blackout periods
 $starthours = $_POST['starthour'];
 $endhours = $_POST['endhour'];
 $cfg['BlackoutPeriods'] = array();
 for ($i = 0; $i < count($starthours); $i++) {
     $daystring = implode(', ', $_POST['days' . $i]);
     $cfg['BlackoutPeriods'][] = array('hourBegin' => hhmm2float($starthours[$i]), 'hourEnd' => hhmm2float($endhours[$i]), 'weekDays' => $daystring);
 }
 // Rsync and NmbLookup command lines
 $cfg['NmbLookupCmd'] = '/usr/bin/python /usr/bin/pulse2-uuid-resolver -A $host';
 $cfg['NmbLookupFindHostCmd'] = '/usr/bin/python /usr/bin/pulse2-uuid-resolver $host';
 $cfg['XferMethod'] = 'rsync';
 $cfg['RsyncClientCmd'] = '$sshPath -q -x -o StrictHostKeyChecking=no -l root $hostIP $rsyncPath $argList+';
 $cfg['RsyncClientRestoreCmd'] = '$sshPath -q -x -o StrictHostKeyChecking=no -l root $hostIP $rsyncPath $argList+';
 $cfg['PingCmd'] = '/bin/true';
Пример #2
0
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with MMC; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */
require "localSidebar.php";
require "graph/navbar.inc.php";
require_once "modules/backuppc/includes/xmlrpc.php";
require_once "modules/backuppc/includes/functions.php";
require_once "modules/backuppc/includes/html.inc.php";
// Getting Profile ID (if specified) else 0
$ID = intval(@max($_GET['id'], $_POST['id']));
// Receiving POST DATA
if (isset($_POST['bconfirm'])) {
    $cfg = array('profilename' => $_POST['profilename'], 'full' => fmtFloat(fmtfloat($_POST['full']) - 0.03), 'incr' => fmtFloat(fmtfloat($_POST['incr']) - 0.03), 'exclude_periods' => '');
    // Formatting Exclude periods
    $starthours = $_POST['starthour'];
    $endhours = $_POST['endhour'];
    for ($i = 0; $i < count($starthours); $i++) {
        $daystring = implode(',', $_POST['days' . $i]);
        $cfg['exclude_periods'] .= sprintf("%s=>%s:%s\n", hhmm2float($starthours[$i]), hhmm2float($endhours[$i]), $daystring);
    }
    $cfg['exclude_periods'] = trim($cfg['exclude_periods']);
    // If default profile, we add a new herited one
    if ($ID < 1000) {
        $ID = 0;
    }
    if ($ID) {
        $profile = edit_period_profile($ID, $cfg);
        // APPLY PROFILE TO ALL CONCERNED HOSTS