Unverified Commit 9bbfe580 authored by Luc Didry's avatar Luc Didry
Browse files

Create subfolders for exported pads

parent c5ab6abe
requires 'Etherpad';
requires 'Etherpad', '>= 1.2.14.0';
requires 'IO::Socket::SSL';
requires 'inc::Module::Install';
requires 'Config::YAML';
# carton snapshot format: version 1.0
DISTRIBUTIONS
CPAN-Meta-2.150010
pathname: D/DA/DAGOLDEN/CPAN-Meta-2.150010.tar.gz
provides:
CPAN::Meta 2.150010
CPAN::Meta::Converter 2.150010
CPAN::Meta::Feature 2.150010
CPAN::Meta::History 2.150010
CPAN::Meta::Merge 2.150010
CPAN::Meta::Prereqs 2.150010
CPAN::Meta::Spec 2.150010
CPAN::Meta::Validator 2.150010
Parse::CPAN::Meta 2.150010
requirements:
CPAN::Meta::Requirements 2.121
CPAN::Meta::YAML 0.011
Carp 0
Encode 0
Exporter 0
ExtUtils::MakeMaker 6.17
File::Spec 0.80
JSON::PP 2.27300
Scalar::Util 0
perl 5.008001
strict 0
version 0.88
warnings 0
Class-Method-Modifiers-2.12
pathname: E/ET/ETHER/Class-Method-Modifiers-2.12.tar.gz
provides:
Class::Method::Modifiers 2.12
requirements:
B 0
Carp 0
Exporter 0
ExtUtils::MakeMaker 0
base 0
perl 5.006
strict 0
warnings 0
Config-JSON-1.5202
pathname: R/RI/RIZEN/Config-JSON-1.5202.tar.gz
provides:
Config::JSON 1.5202
requirements:
ExtUtils::MakeMaker 6.30
File::Temp 0.18
JSON 2.16
List::Util 1.19
Moo 0
Test::Deep 0.095
Test::More 0.7
Config-YAML-1.42
pathname: M/MD/MDXI/Config-YAML-1.42.tar.gz
provides:
......@@ -59,29 +8,29 @@ DISTRIBUTIONS
ExtUtils::MakeMaker 0
Test::More 0
YAML 0.35
Devel-GlobalDestruction-0.14
pathname: H/HA/HAARG/Devel-GlobalDestruction-0.14.tar.gz
Etherpad-1.2.14.0
pathname: L/LD/LDIDRY/Etherpad-1.2.14.0.tar.gz
provides:
Devel::GlobalDestruction 0.14
Etherpad 1.002014000
requirements:
ExtUtils::MakeMaker 0
Sub::Exporter::Progressive 0.001011
perl 5.006
Etherpad-1.2.13.0
pathname: L/LD/LDIDRY/Etherpad-1.2.13.0.tar.gz
Mojolicious 8.0
File-Remove-1.58
pathname: S/SH/SHLOMIF/File-Remove-1.58.tar.gz
provides:
Etherpad 1.002013000
File::Remove 1.58
requirements:
Cwd 3.29
ExtUtils::MakeMaker 0
Mojolicious 6.0
IO-Socket-IP-0.38
pathname: P/PE/PEVANS/IO-Socket-IP-0.38.tar.gz
provides:
IO::Socket::IP 0.38
requirements:
IO::Socket 0
Socket 1.97
Test::More 0.88
File::Glob 0
File::Path 0
File::Spec 3.29
Module::Build 0.28
constant 0
perl 5.006
strict 0
vars 0
warnings 0
IO-Socket-SSL-2.038
pathname: S/SU/SULLR/IO-Socket-SSL-2.038.tar.gz
provides:
......@@ -96,26 +45,9 @@ DISTRIBUTIONS
IO::Socket::SSL::Utils 2.014
requirements:
ExtUtils::MakeMaker 0
Mozilla::CA 0
Net::SSLeay 1.46
Scalar::Util 0
JSON-2.90
pathname: M/MA/MAKAMAKA/JSON-2.90.tar.gz
provides:
JSON 2.90
JSON::Backend::PP 2.90
JSON::Boolean 2.90
requirements:
ExtUtils::MakeMaker 0
Test::More 0
JSON-PP-2.27400
pathname: M/MA/MAKAMAKA/JSON-PP-2.27400.tar.gz
provides:
JSON::PP 2.27400
JSON::PP::Boolean 2.27400
JSON::PP::IncrParser 2.27400
requirements:
ExtUtils::MakeMaker 0
Test::More 0
Module-Build-0.4220
pathname: L/LE/LEONT/Module-Build-0.4220.tar.gz
provides:
......@@ -166,18 +98,77 @@ DISTRIBUTIONS
Text::ParseWords 0
perl 5.006001
version 0.87
Module-Runtime-0.014
pathname: Z/ZE/ZEFRAM/Module-Runtime-0.014.tar.gz
Module-Install-1.19
pathname: E/ET/ETHER/Module-Install-1.19.tar.gz
provides:
Module::Runtime 0.014
Module::AutoInstall 1.19
Module::Install 1.19
Module::Install::Admin 1.19
Module::Install::Admin::Bundle 1.19
Module::Install::Admin::Compiler 1.19
Module::Install::Admin::Find 1.19
Module::Install::Admin::Include 1.19
Module::Install::Admin::Makefile 1.19
Module::Install::Admin::Manifest 1.19
Module::Install::Admin::Metadata 1.19
Module::Install::Admin::ScanDeps 1.19
Module::Install::Admin::WriteAll 1.19
Module::Install::AutoInstall 1.19
Module::Install::Base 1.19
Module::Install::Base::FakeAdmin 1.19
Module::Install::Bundle 1.19
Module::Install::Can 1.19
Module::Install::Compiler 1.19
Module::Install::DSL 1.19
Module::Install::Deprecated 1.19
Module::Install::External 1.19
Module::Install::Fetch 1.19
Module::Install::Include 1.19
Module::Install::Inline 1.19
Module::Install::MakeMaker 1.19
Module::Install::Makefile 1.19
Module::Install::Metadata 1.19
Module::Install::PAR 1.19
Module::Install::Run 1.19
Module::Install::Scripts 1.19
Module::Install::Share 1.19
Module::Install::Win32 1.19
Module::Install::With 1.19
Module::Install::WriteAll 1.19
inc::Module::Install 1.19
inc::Module::Install::DSL 1.19
requirements:
Module::Build 0
Test::More 0
Devel::PPPort 3.16
ExtUtils::Install 1.52
ExtUtils::MakeMaker 6.59
ExtUtils::ParseXS 2.19
File::Path 0
File::Remove 1.42
File::Spec 3.28
Module::Build 0.29
Module::CoreList 2.17
Module::ScanDeps 1.09
Parse::CPAN::Meta 1.4413
Test::Harness 3.13
Test::More 0.86
YAML::Tiny 1.38
autodie 0
perl 5.006
strict 0
warnings 0
Mojolicious-7.10
pathname: S/SR/SRI/Mojolicious-7.10.tar.gz
Module-ScanDeps-1.27
pathname: R/RS/RSCHUPP/Module-ScanDeps-1.27.tar.gz
provides:
Module::ScanDeps 1.27
requirements:
ExtUtils::MakeMaker 0
File::Spec 0
File::Temp 0
Getopt::Long 0
Module::Metadata 0
Text::ParseWords 0
perl 5.008001
version 0
Mojolicious-8.42
pathname: S/SR/SRI/Mojolicious-8.42.tar.gz
provides:
Mojo undef
Mojo::Asset undef
......@@ -197,8 +188,10 @@ DISTRIBUTIONS
Mojo::DOM::CSS undef
Mojo::DOM::HTML undef
Mojo::Date undef
Mojo::DynamicMethods undef
Mojo::EventEmitter undef
Mojo::Exception undef
Mojo::File undef
Mojo::Headers undef
Mojo::HelloWorld undef
Mojo::Home undef
......@@ -208,6 +201,7 @@ DISTRIBUTIONS
Mojo::IOLoop::Server undef
Mojo::IOLoop::Stream undef
Mojo::IOLoop::Subprocess undef
Mojo::IOLoop::TLS undef
Mojo::JSON undef
Mojo::JSON::Pointer undef
Mojo::Loader undef
......@@ -217,6 +211,7 @@ DISTRIBUTIONS
Mojo::Message::Response undef
Mojo::Parameters undef
Mojo::Path undef
Mojo::Promise undef
Mojo::Reactor undef
Mojo::Reactor::EV undef
Mojo::Reactor::Poll undef
......@@ -225,8 +220,9 @@ DISTRIBUTIONS
Mojo::Server::Daemon undef
Mojo::Server::Hypnotoad undef
Mojo::Server::Morbo undef
Mojo::Server::Morbo::Backend undef
Mojo::Server::Morbo::Backend::Poll undef
Mojo::Server::PSGI undef
Mojo::Server::PSGI::_IO undef
Mojo::Server::Prefork undef
Mojo::Template undef
Mojo::Transaction undef
......@@ -241,37 +237,34 @@ DISTRIBUTIONS
Mojo::UserAgent::Transactor undef
Mojo::Util undef
Mojo::WebSocket undef
Mojolicious 7.10
Mojolicious 8.42
Mojolicious::Command undef
Mojolicious::Command::Author::cpanify undef
Mojolicious::Command::Author::generate undef
Mojolicious::Command::Author::generate::app undef
Mojolicious::Command::Author::generate::lite_app undef
Mojolicious::Command::Author::generate::makefile undef
Mojolicious::Command::Author::generate::plugin undef
Mojolicious::Command::Author::inflate undef
Mojolicious::Command::cgi undef
Mojolicious::Command::cpanify undef
Mojolicious::Command::daemon undef
Mojolicious::Command::eval undef
Mojolicious::Command::generate undef
Mojolicious::Command::generate::app undef
Mojolicious::Command::generate::lite_app undef
Mojolicious::Command::generate::makefile undef
Mojolicious::Command::generate::plugin undef
Mojolicious::Command::get undef
Mojolicious::Command::inflate undef
Mojolicious::Command::prefork undef
Mojolicious::Command::psgi undef
Mojolicious::Command::routes undef
Mojolicious::Command::test undef
Mojolicious::Command::version undef
Mojolicious::Commands undef
Mojolicious::Controller undef
Mojolicious::Lite undef
Mojolicious::Plugin undef
Mojolicious::Plugin::Config undef
Mojolicious::Plugin::Config::Sandbox undef
Mojolicious::Plugin::DefaultHelpers undef
Mojolicious::Plugin::EPLRenderer undef
Mojolicious::Plugin::EPRenderer undef
Mojolicious::Plugin::HeaderCondition undef
Mojolicious::Plugin::JSONConfig undef
Mojolicious::Plugin::Mount undef
Mojolicious::Plugin::PODRenderer undef
Mojolicious::Plugin::TagHelpers undef
Mojolicious::Plugins undef
Mojolicious::Renderer undef
......@@ -290,37 +283,16 @@ DISTRIBUTIONS
ExtUtils::MakeMaker 0
IO::Socket::IP 0.37
JSON::PP 2.27103
Pod::Simple 3.09
List::Util 1.41
Time::Local 1.2
Moo-2.002005
pathname: H/HA/HAARG/Moo-2.002005.tar.gz
perl 5.010001
Mozilla-CA-20200520
pathname: A/AB/ABH/Mozilla-CA-20200520.tar.gz
provides:
Method::Generate::Accessor undef
Method::Generate::BuildAll undef
Method::Generate::Constructor undef
Method::Generate::DemolishAll undef
Moo 2.002005
Moo::HandleMoose undef
Moo::HandleMoose::FakeConstructor undef
Moo::HandleMoose::FakeMetaClass undef
Moo::HandleMoose::_TypeMap undef
Moo::Object undef
Moo::Role 2.002005
Moo::_Utils undef
Moo::_mro undef
Moo::_strictures undef
Moo::sification undef
Sub::Defer 2.002005
Sub::Quote 2.002005
oo undef
Mozilla::CA 20200520
requirements:
Class::Method::Modifiers 1.1
Devel::GlobalDestruction 0.11
Exporter 5.57
ExtUtils::MakeMaker 0
Module::Runtime 0.014
Role::Tiny 2.000004
Scalar::Util 0
Test 0
perl 5.006
Net-SSLeay-1.78
pathname: M/MI/MIKEM/Net-SSLeay-1.78.tar.gz
......@@ -332,79 +304,6 @@ DISTRIBUTIONS
MIME::Base64 0
Test::More 0.60_01
perl 5.005
Role-Tiny-2.000005
pathname: H/HA/HAARG/Role-Tiny-2.000005.tar.gz
provides:
Role::Tiny 2.000005
Role::Tiny::With 2.000005
requirements:
Exporter 5.57
perl 5.006
Sub-Exporter-Progressive-0.001013
pathname: F/FR/FREW/Sub-Exporter-Progressive-0.001013.tar.gz
provides:
Sub::Exporter::Progressive 0.001013
requirements:
ExtUtils::MakeMaker 0
Test-Deep-1.123
pathname: R/RJ/RJBS/Test-Deep-1.123.tar.gz
provides:
Test::Deep 1.123
Test::Deep::All undef
Test::Deep::Any undef
Test::Deep::Array undef
Test::Deep::ArrayEach undef
Test::Deep::ArrayElementsOnly undef
Test::Deep::ArrayLength undef
Test::Deep::ArrayLengthOnly undef
Test::Deep::Blessed undef
Test::Deep::Boolean undef
Test::Deep::Cache undef
Test::Deep::Cache::Simple undef
Test::Deep::Class undef
Test::Deep::Cmp undef
Test::Deep::Code undef
Test::Deep::Hash undef
Test::Deep::HashEach undef
Test::Deep::HashElements undef
Test::Deep::HashKeys undef
Test::Deep::HashKeysOnly undef
Test::Deep::Ignore undef
Test::Deep::Isa undef
Test::Deep::ListMethods undef
Test::Deep::MM undef
Test::Deep::Methods undef
Test::Deep::NoTest undef
Test::Deep::None undef
Test::Deep::Number undef
Test::Deep::Obj undef
Test::Deep::Ref undef
Test::Deep::RefType undef
Test::Deep::Regexp undef
Test::Deep::RegexpMatches undef
Test::Deep::RegexpOnly undef
Test::Deep::RegexpRef undef
Test::Deep::RegexpRefOnly undef
Test::Deep::RegexpVersion undef
Test::Deep::ScalarRef undef
Test::Deep::ScalarRefOnly undef
Test::Deep::Set undef
Test::Deep::Shallow undef
Test::Deep::Stack undef
Test::Deep::String undef
Test::Deep::SubHash undef
Test::Deep::SubHashElements undef
Test::Deep::SubHashKeys undef
Test::Deep::SubHashKeysOnly undef
Test::Deep::SuperHash undef
Test::Deep::SuperHashElements undef
Test::Deep::SuperHashKeys undef
Test::Deep::SuperHashKeysOnly undef
requirements:
ExtUtils::MakeMaker 0
List::Util 1.09
Scalar::Util 1.09
Test::Builder 0
YAML-1.18
pathname: T/TI/TINITA/YAML-1.18.tar.gz
provides:
......@@ -433,3 +332,17 @@ DISTRIBUTIONS
requirements:
ExtUtils::MakeMaker 0
perl 5.008001
YAML-Tiny-1.73
pathname: E/ET/ETHER/YAML-Tiny-1.73.tar.gz
provides:
YAML::Tiny 1.73
requirements:
B 0
Carp 0
Exporter 0
ExtUtils::MakeMaker 0
Fcntl 0
Scalar::Util 0
perl 5.008001
strict 0
warnings 0
......@@ -4,9 +4,11 @@ use Mojo::Base -strict;
use Getopt::Long;
use File::Spec;
use File::Path qw(make_path);
use Config::YAML;
use Mojo::Collection 'c';
use Mojo::Util qw(slurp spurt encode);
use Mojo::File;
use Mojo::Util qw(encode);
use Etherpad;
use Data::Dumper;
......@@ -32,7 +34,7 @@ print_usage(1) unless ($instance && $c->{$instance});
my ($last, $instance_last);
my $process = 1;
if (-e 'last.'.$instance) {
$last = slurp('last.'.$instance);
$last = Mojo::File->new('last.'.$instance)->slurp;
$process = 0;
chomp $last;
}
......@@ -49,7 +51,7 @@ print_usage(3) unless ($delay && $delay > 0);
my $text = $c->{$instance}->{text} || 'The content of this pad has been deleted since it was older than the configured delay.';
my $dir = File::Spec->catdir($c->{$instance}->{dir}, 'deleted_pads');
mkdir $dir unless (-e $dir);
make_path $dir unless (-e $dir);
print_usage(4) unless (-d $dir && -w $dir);
if ($daemon) {
......@@ -95,11 +97,34 @@ sub delete_after_delay {
my $html = $ec->get_html($e);
if ($html) {
my $file = File::Spec->catfile($c->{$instance}->{dir}, 'deleted_pads', $e.'-'.$time.'.html');
my $length = length($e);
my @dirs = ($c->{$instance}->{dir}, 'deleted_pads');
if ($length == 1) {
my $a = $e;
$a = '_' if $a eq ' ';
push @dirs, $a;
} elsif ($length == 2) {
my $a = substr($e, 0, 1);
$a = '_' if $a eq ' ';
my $b = substr($e, 1, 1);
$b = '_' if $b eq ' ';
push @dirs, $a, $b;
} else {
my $a = substr($e, 0, 1);
$a = '_' if $a eq ' ';
my $b = substr($e, 1, 1);
$b = '_' if $b eq ' ';
my $c = substr($e, 2, 1);
$c = '_' if $c eq ' ';
push @dirs, $a, $b, $c;
}
my $dir = File::Spec->catdir(@dirs);
make_path $dir unless (-d $dir);
my $file = File::Spec->catfile($dir, $e.'-'.$time.'.html');
say 'Putting HTML version of '.$e.' in '.$file if $verbose;
spurt encode('UTF-8', $html), $file;
Mojo::File->new($file)->spurt(encode('UTF-8', $html));
say 'Deleting '.$e if $verbose;
......@@ -167,7 +192,7 @@ EOF
sub INT_handler {
if (defined($instance_last)) {
spurt $instance_last, 'last.'.$instance;
Mojo::File->new('last.'.$instance)->spurt($instance_last);
}
exit(0);
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment