Server IP : 85.214.239.14 / Your IP : 3.145.109.231 Web Server : Apache/2.4.62 (Debian) System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.18 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,pcntl_unshare, MySQL : OFF | cURL : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /proc/3/root/proc/2/task/2/root/proc/2/root/usr/share/perl5/Debconf/DbDriver/ |
Upload File : |
#!/usr/bin/perl -w # This file was preprocessed, do not edit! package Debconf::DbDriver::DirTree; use strict; use Debconf::Log qw(:all); use base 'Debconf::DbDriver::Directory'; sub init { my $this=shift; if (! defined $this->{extension} or ! length $this->{extension}) { $this->{extension}=".dat"; } $this->SUPER::init(@_); } sub save { my $this=shift; my $item=shift; return unless $this->accept($item); return if $this->{readonly}; my @dirs=split(m:/:, $this->filename($item)); pop @dirs; # the base filename my $base=$this->{directory}; foreach (@dirs) { $base.="/$_"; next if -d $base; mkdir $base or $this->error("mkdir $base: $!"); } $this->SUPER::save($item, @_); } sub filename { my $this=shift; my $item=shift; $item =~ s/\.\.//g; return $item.$this->{extension}; } sub iterator { my $this=shift; my @stack=(); my $currentdir=""; my $handle; opendir($handle, $this->{directory}) or $this->error("opendir: $this->{directory}: $!"); my $iterator=Debconf::Iterator->new(callback => sub { my $i; while ($handle or @stack) { while (@stack and not $handle) { $currentdir=pop @stack; opendir($handle, "$this->{directory}/$currentdir") or $this->error("opendir: $this->{directory}/$currentdir: $!"); } $i=readdir($handle); if (not defined $i) { closedir $handle; $handle=undef; next; } next if $i eq '.lock' || $i =~ /-old$/; if (-d "$this->{directory}/$currentdir$i") { if ($i ne '..' and $i ne '.') { push @stack, "$currentdir$i/"; } next; } next unless $i=~s/$this->{extension}$//; return $currentdir.$i; } return undef; }); $this->SUPER::iterator($iterator); } sub remove { my $this=shift; my $item=shift; my $ret=$this->SUPER::remove($item); return $ret unless $ret; my $dir=$this->filename($item); while ($dir=~s:(.*)/[^/]*:$1: and length $dir) { rmdir "$this->{directory}/$dir" or last; # not empty, I presume } return $ret; } 1