← Index
NYTProf Performance Profile   « line view »
For /usr/local/libexec/sympa/task_manager-debug.pl
  Run on Tue Jun 1 22:32:51 2021
Reported on Tue Jun 1 22:35:08 2021

Filename/usr/local/libexec/sympa/Sympa/ConfDef.pm
StatementsExecuted 0 statements in 0s
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
0000s0sSympa::ConfDef::::BEGIN@30Sympa::ConfDef::BEGIN@30
0000s0sSympa::ConfDef::::BEGIN@31Sympa::ConfDef::BEGIN@31
0000s0sSympa::ConfDef::::BEGIN@33Sympa::ConfDef::BEGIN@33
0000s0sSympa::ConfDef::::CORE:matchSympa::ConfDef::CORE:match (opcode)
0000s0sSympa::ConfDef::::CORE:sortSympa::ConfDef::CORE:sort (opcode)
0000s0sSympa::ConfDef::::__ANON__Sympa::ConfDef::__ANON__ (xsub)
0000s0sSympa::ConfDef::::_filterSympa::ConfDef::_filter
0000s0sSympa::ConfDef::::by_orderSympa::ConfDef::by_order
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1# -*- indent-tabs-mode: nil; -*-
2# vim:ft=perl:et:sw=4
3# $Id$
4
5# Sympa - SYsteme de Multi-Postage Automatique
6#
7# Copyright (c) 1997, 1998, 1999 Institut Pasteur & Christophe Wolfhugel
8# Copyright (c) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
9# 2006, 2007, 2008, 2009, 2010, 2011 Comite Reseau des Universites
10# Copyright (c) 2011, 2012, 2013, 2014, 2015, 2016, 2017 GIP RENATER
11# Copyright 2017, 2018, 2019, 2020 The Sympa Community. See the AUTHORS.md
12# file at the top-level directory of this distribution and at
13# <https://github.com/sympa-community/sympa.git>.
14#
15# This program is free software; you can redistribute it and/or modify
16# it under the terms of the GNU General Public License as published by
17# the Free Software Foundation; either version 2 of the License, or
18# (at your option) any later version.
19#
20# This program is distributed in the hope that it will be useful,
21# but WITHOUT ANY WARRANTY; without even the implied warranty of
22# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23# GNU General Public License for more details.
24#
25# You should have received a copy of the GNU General Public License
26# along with this program. If not, see <http://www.gnu.org/licenses/>.
27
28package Sympa::ConfDef;
29
30use strict;
31use warnings;
32
33use Sympa::Config::Schema;
34
35our @params;
36
37my $group = '';
38my @pinfo = _filter({%Sympa::Config::Schema::pinfo});
39foreach my $item (@pinfo) {
40 if ($item->{group} and $group ne $item->{group}) {
41 $group = $item->{group};
42 my $title = {
43 %{ $Sympa::Config::Schema::pgroup{$group}
44 // {gettext_id => $group}
45 }
46 };
47 delete $title->{order};
48 delete $title->{gettext_comment} unless $title->{gettext_comment};
49 push @params, $title;
50 }
51 #delete @{$item}{qw(group order)};
52 push @params, $item;
53}
54
55sub _filter {
56 my $pinfo = shift;
57 my $pnames = shift || [];
58
59 return map {
60 my $item = $pinfo->{$_};
61 my $name = join '.', @$pnames, $_;
62
63 my @ret;
64 if (ref $item->{format} eq 'HASH') {
65 (_filter($item->{format}, [@$pnames, $_]));
66 } elsif (
67 $item->{context}
68 and grep {
69 'domain' eq $_
70 } @{$item->{context}}
71 ) {
72 my $i = {
73 %$item,
74 name => $name,
75 vhost => '1',
76 ( ( ($item->{occurrence} // '') =~ /^0/
77 and not defined $item->{default}
78 ) ? (optional => '1') : ()
79 ),
80 ( (($item->{field_type} // '') eq 'password')
81 ? (obfuscated => '1')
82 : ()
83 ),
84 #edit => undef
85 };
86 delete @{$i}{qw(file_format)};
87 ($i);
88 } elsif (
89 not $item->{context}
90 or grep {
91 'site' eq $_
92 } @{$item->{context}}
93 ) {
94 my $i = {
95 %$item,
96 name => $name,
97 ( ( ($item->{occurrence} // '') =~ /^0/
98 and not defined $item->{default}
99 ) ? (optional => '1') : ()
100 ),
101 ( (($item->{field_type} // '') eq 'password')
102 ? (obfuscated => '1')
103 : ()
104 ),
105 #edit => undef
106 };
107 delete @{$i}{qw(file_format)};
108 ($i);
109 } else {
110 ();
111 }
112 } sort {
113 by_order($pinfo, $a, $b)
114 } keys %$pinfo;
115}
116
117sub by_order {
118 my $pinfo = shift;
119 my $a = shift;
120 my $b = shift;
121
122 return (
123 ($pinfo->{$a}->{order} // 9999) <=> ($pinfo->{$b}->{order} // 9999))
124 || (($a // '') cmp($b // ''));
125}
126
1271;
128__END__