Пример #1
0
             $ss = FreePBX::create()->Sipsettings;
             $ss->setConfig('localnets', $backup['localnets']);
             $ss->setConfig('externip', $backup['externip']);
         }
     }
 }
 //  How about ASTDB?
 if (isset($items['astdb']) || isset($items['settings']) && $items['settings'] == 'true') {
     if ($manifest['astdb'] != '') {
         backup_log(_('Restoring astDB...'));
         $cmd[] = fpbx_which('tar');
         $cmd[] = 'zxOf';
         $cmd[] = $vars['restore'];
         $cmd[] = './' . $manifest['astdb'];
         exec(implode(' ', $cmd), $file);
         astdb_put(unserialize($file[0]), array('RINGGROUP', 'BLKVM', 'FM', 'dundi'));
         unset($cmd);
     }
     backup_log(_('Restoring Settings complete'));
 }
 //dbug($file);
 //run hooks
 if (isset($manifest['hooks']['post_restore']) && $manifest['hooks']['post_restore']) {
     backup_log(_('Running post restore script...'));
     exec($manifest['hooks']['post_restore']);
 }
 backup_log(_('Running post-restore hooks, if any...'));
 mod_func_iterator('backup_post_restore_hook', $manifest);
 //ensure that manager username and password are whatever we think they should be
 //the DB is authoritative, fetch whatever we have set there
 backup_log(_('Cleaning up...'));
Пример #2
0
    $b->run_hooks('pre-backup');
    $b->add_items();
    $b->build_manifest();
    $b->save_manifest('local');
    $b->create_backup_file(true);
    exit;
} elseif (isset($vars['astdb']) && $vars['astdb']) {
    switch ($vars['astdb']) {
        case 'dump':
            echo astdb_get(array('RG', 'BLKVM', 'FM', 'dundi'));
            break;
        case 'restore':
            if (is_file($vars['data'])) {
                $vars['data'] = file_get_contents($vars['data']);
            }
            astdb_put(unserialize($vars['data']), array('RINGGROUP', 'BLKVM', 'FM', 'dundi'));
            break;
    }
} else {
    show_opts();
}
exit;
function show_opts()
{
    $e[] = 'backup.php';
    $e[] = '';
    $e[] = 'options:';
    $e[] = "\t" . '--id=<id number> - a valid backup id';
    $e[] = "\t" . '--astdb=<restore|dump> - dump or restore the astdb';
    $e[] = "\t" . '--data=<data> a serilialized string of the astdb dumb to restore.';
    $e[] = "\t\t" . ' Can also point to a file contianing the serializes string';