View | Details | Raw Unified | Return to bug 10101
Collapse All | Expand All

(-)a/debian/docs/koha-enable.xml (-3 / +3 lines)
Lines 17-34 Link Here
17
17
18
  <refnamediv>
18
  <refnamediv>
19
    <refname>koha-enable</refname>
19
    <refname>koha-enable</refname>
20
    <refpurpose>Enable a Koha instance. New instances are enabled by default. You only need this command if you have previously disabled a site with koha-disable.</refpurpose>
20
    <refpurpose>Enable one or more Koha instances. New instances are enabled by default. You only need this command if you have previously disabled an instance with koha-disable.</refpurpose>
21
    <refclass>UNIX/Linux</refclass>
21
    <refclass>UNIX/Linux</refclass>
22
  </refnamediv>
22
  </refnamediv>
23
23
24
  <refsynopsisdiv>
24
  <refsynopsisdiv>
25
    <cmdsynopsis>
25
    <cmdsynopsis>
26
      <command>koha-enable</command> <arg choice="req" rep="norepeat"><replaceable>instancename</replaceable></arg>
26
      <command>koha-enable</command> <arg choice="req" rep="repeat"><replaceable>instancename</replaceable></arg>
27
    </cmdsynopsis>
27
    </cmdsynopsis>
28
  </refsynopsisdiv>
28
  </refsynopsisdiv>
29
29
30
  <refsect1><title>Description</title>
30
  <refsect1><title>Description</title>
31
  <para>Enable a Koha instance. New instances are enabled by default. You only need this command if you have previously disabled a site with koha-disable.</para>
31
  <para>Enable one or more Koha instances. New instances are enabled by default. You only need this command if you have previously disabled am instance with koha-disable.</para>
32
  </refsect1>
32
  </refsect1>
33
  
33
  
34
  <refsect1><title>See also</title>
34
  <refsect1><title>See also</title>
(-)a/debian/scripts/koha-enable (-6 / +63 lines)
Lines 20-39 Link Here
20
set -e
20
set -e
21
21
22
22
23
die() {
23
die()
24
{
24
    echo "$@" 1>&2
25
    echo "$@" 1>&2
25
    exit 1
26
    exit 1
26
}
27
}
27
28
29
warn()
30
{
31
    echo "$@" 1>&2
32
}
33
34
is_enabled()
35
{
36
    local instancename=$1
37
38
    if ! is_instance $instancename; then
39
        return 1
40
    fi
41
42
    if grep -q '^[[:space:]]*Include /etc/koha/apache-shared-disable.conf' \
43
            "/etc/apache2/sites-available/$instancename" ; then
44
        return 1
45
    else
46
        return 0
47
    fi
48
}
28
49
50
is_instance()
51
{
52
    local instancename=$1
53
54
    if find /etc/koha/sites -mindepth 1 -maxdepth 1 \
55
                         -type d -printf '%f\n'\
56
          | grep -q -x $instancename ; then
57
        return 0
58
    else
59
        return 1
60
    fi
61
}
62
63
enable_instance()
64
{
65
    local instancename=$1
66
67
    if ! is_enabled $instancename; then
68
        sed -i 's:^\(\s*Include /etc/koha/apache-shared-disable.conf\)$:#\1:' \
69
            "/etc/apache2/sites-available/$instancename"
70
        return 0
71
    else
72
        return 1
73
    fi
74
}
29
# Parse command line.
75
# Parse command line.
30
[ "$#" = 1 ] || die "Usage: $0 instancename..."
76
[ "$#" > 1 ] || die "Usage: $0 instancename..."
31
77
78
restart_apache="no"
32
79
33
for name in "$@"
80
for name in "$@"
34
do
81
do
35
    sed -i 's:^\(\s*Include /etc/koha/apache-shared-disable.conf\)$:#\1:' \
82
    if is_instance $name ; then
36
        "/etc/apache2/sites-available/$name"
83
        if enable_instance $name; then
84
            restart_apache="yes"
85
        else
86
            warn "Instance $name already enabled."
87
        fi
88
    else
89
        warn "Unknown instance $name."
90
    fi
37
done
91
done
38
92
39
/etc/init.d/apache2 restart
93
if [ "$restart_apache" = "yes" ]; then
94
    /etc/init.d/apache2 restart
95
fi
96
97
exit 0
40
- 

Return to bug 10101