Server IP : 195.201.23.43 / Your IP : 3.149.255.21 Web Server : Apache System : Linux webserver2.vercom.be 5.4.0-192-generic #212-Ubuntu SMP Fri Jul 5 09:47:39 UTC 2024 x86_64 User : kdecoratie ( 1041) PHP Version : 7.1.33-63+ubuntu20.04.1+deb.sury.org+1 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /usr/share/webmin/bacula-backup/ |
Upload File : |
#!/usr/bin/perl # Create, update or delete a device device require './bacula-backup-lib.pl'; &ReadParse(); $conf = &get_storage_config(); $parent = &get_storage_config_parent(); @devices = &find("Device", $conf); if (!$in{'new'}) { $device = &find_by("Name", $in{'old'}, \@devices); $device || &error($text{'device_egone'}); } else { $device = { 'type' => 1, 'name' => 'Device', 'members' => [ ] }; } &lock_file($parent->{'file'}); if ($in{'delete'}) { # Just delete this one $name = &find_value("Name", $device->{'members'}); $child = &find_dependency("Device", $name, [ "Job", "JobDefs" ], $conf); $child && &error(&text('device_echild', $child)); &save_directive($conf, $parent, $device, undef, 0); } else { # Validate and store inputs &error_setup($text{'device_err'}); $in{'name'} =~ /\S/ || &error($text{'device_ename'}); if ($in{'new'} || $in{'name'} ne $in{'old'}) { $clash = &find_by("Name", $in{'name'}, \@devices); $clash && &error($text{'device_eclash'}); } &save_directive($conf, $device, "Name", $in{'name'}, 1); -r $in{'device'} || -d $in{'device'} || &error($text{'device_edevice'}); &save_directive($conf, $device, "Archive Device", $in{'device'}, 1); $in{'media'} =~ /\S/ || &error($text{'device_emedia'}); &save_directive($conf, $device, "Media Type", $in{'media'}, 1); # Save yes/no options &save_directive($conf, $device, "LabelMedia", $in{'label'} || undef, 1); &save_directive($conf, $device, "Random Access", $in{'random'} || undef, 1); &save_directive($conf, $device, "AutomaticMount", $in{'auto'} || undef, 1); &save_directive($conf, $device, "RemovableMedia", $in{'removable'} || undef, 1); &save_directive($conf, $device, "AlwaysOpen", $in{'always'} || undef, 1); # Create or update if ($in{'new'}) { &save_directive($conf, $parent, undef, $device, 0); } } &flush_file_lines(); &unlock_file($parent->{'file'}); &auto_apply_configuration(); &webmin_log($in{'new'} ? "create" : $in{'delete'} ? "delete" : "modify", "device", $in{'old'} || $in{'name'}); &redirect("list_devices.cgi");Private