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

(-)a/debian/scripts/koha-functions.sh (-4 / +50 lines)
Lines 185-190 is_indexer_running() Link Here
185
    fi
185
    fi
186
}
186
}
187
187
188
is_plack_enabled_opac()
189
{
190
    local instancefile=$1
191
192
    if [ "$instancefile" = "" ]; then
193
        return 1
194
    fi
195
196
    # remember 0 means success/true in bash.
197
    if grep -q '^[[:space:]]*Include /etc/koha/apache-shared-opac-plack.conf' \
198
            "$instancefile" ; then
199
        return 0
200
    else
201
        return 1
202
    fi
203
}
204
205
is_plack_enabled_intranet()
206
{
207
    local instancefile=$1
208
209
    if [ "$instancefile" = "" ]; then
210
        return 1
211
    fi
212
213
    # remember 0 means success/true in bash.
214
    if grep -q '^[[:space:]]*Include /etc/koha/apache-shared-intranet-plack.conf' \
215
            "$instancefile" ; then
216
        return 0
217
    else
218
        return 1
219
    fi
220
}
221
188
is_plack_enabled()
222
is_plack_enabled()
189
{
223
{
190
    local site=$1
224
    local site=$1
Lines 194-203 is_plack_enabled() Link Here
194
        return 1
228
        return 1
195
    fi
229
    fi
196
230
197
    if grep -q '^[[:space:]]*Include /etc/koha/apache-shared-opac-plack.conf' \
231
    if is_plack_enabled_opac $instancefile ; then
198
            "$instancefile" && \
232
        enabledopac=1
199
       grep -q '^[[:space:]]*Include /etc/koha/apache-shared-intranet-plack.conf' \
233
    else
200
            "$instancefile" ; then
234
        enabledopac=0
235
    fi
236
    if is_plack_enabled_intranet $instancefile ; then
237
        enabledintra=1
238
    else
239
        enabledintra=0
240
    fi
241
242
    # remember 0 means success/true in bash.
243
    if [ "$enabledopac" != "$enabledintra" ] ; then
244
        echo "$site has a plack configuration error. Enable or disable plack to correct this."
245
        return 0
246
    elif [ "$enabledopac" = "1" ] ; then
201
        return 0
247
        return 0
202
    else
248
    else
203
        return 1
249
        return 1
(-)a/debian/scripts/koha-plack (-9 / +76 lines)
Lines 176-189 enable_plack() Link Here
176
    local instancename=$1
176
    local instancename=$1
177
    local instancefile=$(get_apache_config_for "$instancename")
177
    local instancefile=$(get_apache_config_for "$instancename")
178
178
179
    if ! is_plack_enabled $instancename; then
179
    alreadyopac=0
180
        # Uncomment the plack related lines for OPAC and intranet
180
    alreadyintra=0
181
    failopac=0
182
    failintra=0
183
    if ! is_plack_enabled_opac $instancefile; then
184
        # Uncomment the plack related lines for OPAC
181
        sed -i 's:^\s*#\(\s*Include /etc/koha/apache-shared-opac-plack.conf\)$:\1:' "$instancefile"
185
        sed -i 's:^\s*#\(\s*Include /etc/koha/apache-shared-opac-plack.conf\)$:\1:' "$instancefile"
186
        if ! is_plack_enabled_opac $instancefile; then
187
            [ "${quiet}" != "yes" ] && warn "Plack not enabled for ${instancename} OPAC"
188
            failopac=1
189
        else
190
            [ "${quiet}" != "yes" ] && warn "Plack enabled for ${instancename} OPAC"
191
        fi
192
    else
193
        [ "${quiet}" != "yes" ] && warn "Plack already enabled for ${instancename} OPAC"
194
        alreadyopac=1
195
    fi
196
    if ! is_plack_enabled_intranet $instancefile; then
197
        # Uncomment the plack related lines for intranet
182
        sed -i 's:^\s*#\(\s*Include /etc/koha/apache-shared-intranet-plack.conf\)$:\1:' "$instancefile"
198
        sed -i 's:^\s*#\(\s*Include /etc/koha/apache-shared-intranet-plack.conf\)$:\1:' "$instancefile"
183
        [ "${quiet}" != "yes" ] && warn "Plack enabled for ${instancename}"
199
        if ! is_plack_enabled_intranet $instancefile; then
200
            [ "${quiet}" != "yes" ] && warn "Plack not enabled for ${instancename} Intranet"
201
            failintra=1
202
        else
203
            [ "${quiet}" != "yes" ] && warn "Plack enabled for ${instancename} Intranet"
204
        fi
205
    else
206
        [ "${quiet}" != "yes" ] && warn "Plack already enabled for ${instancename} Intranet"
207
        alreadyintra=1
208
    fi
209
210
    # Fail if it was already plack enabled.
211
    if [ $alreadyopac -eq 1 ] && [ $alreadyintra -eq 1 ] ; then
212
        return 1
213
    elif [ "$alreadyopac" != "$alreadyintra" ]; then
214
        [ "${quiet}" != "yes" ] && warn "$instancename had a plack configuration error. Please confirm it is corrected."
215
    fi
216
217
    # Succeed if both or any plack were turned on.
218
    if [ $failopac -eq 0 ] ||  [ $failintra -eq 0 ] ; then
184
        return 0
219
        return 0
185
    else
220
    else
186
        [ "${quiet}" != "yes" ] && warn "Plack already enabled for ${instancename}"
187
        return 1
221
        return 1
188
    fi
222
    fi
189
}
223
}
Lines 193-206 disable_plack() Link Here
193
    local instancename=$1
227
    local instancename=$1
194
    local instancefile=$(get_apache_config_for "$instancename")
228
    local instancefile=$(get_apache_config_for "$instancename")
195
229
196
    if is_plack_enabled $instancename; then
230
    alreadyopac=0
197
        # Comment out the plack related lines for OPAC and intranet
231
    alreadyintra=0
232
    failopac=0
233
    failintra=0
234
    if is_plack_enabled_opac $instancefile ; then
235
        # Comment the plack related lines for OPAC
198
        sed -i 's:^\(\s*Include /etc/koha/apache-shared-opac-plack.conf\)$:#\1:' "$instancefile"
236
        sed -i 's:^\(\s*Include /etc/koha/apache-shared-opac-plack.conf\)$:#\1:' "$instancefile"
237
        if is_plack_enabled_opac $instancefile ; then
238
            [ "${quiet}" != "yes" ] && warn "Plack not disabled for ${instancename} OPAC"
239
            failopac=1
240
        else
241
            [ "${quiet}" != "yes" ] && warn "Plack disabled for ${instancename} OPAC"
242
        fi
243
    else
244
        [ "${quiet}" != "yes" ] && warn "Plack already disabled for ${instancename} OPAC"
245
        alreadyopac=1
246
    fi
247
    if is_plack_enabled_intranet $instancefile; then
248
        # Comment the plack related lines for intranet
199
        sed -i 's:^\(\s*Include /etc/koha/apache-shared-intranet-plack.conf\)$:#\1:' "$instancefile"
249
        sed -i 's:^\(\s*Include /etc/koha/apache-shared-intranet-plack.conf\)$:#\1:' "$instancefile"
200
        [ "${quiet}" != "yes" ] && warn "Plack disabled for ${instancename}"
250
        if is_plack_enabled_intranet $instancefile; then
251
            [ "${quiet}" != "yes" ] && warn "Plack not disabled for ${instancename} Intranet"
252
            failintra=1
253
        else
254
            [ "${quiet}" != "yes" ] && warn "Plack disabled for ${instancename} Intranet"
255
        fi
256
    else
257
        [ "${quiet}" != "yes" ] && warn "Plack already disabled for ${instancename} Intranet"
258
        alreadyintra=1
259
    fi
260
261
    # Fail if it was already plack disabled.
262
    if [ $alreadyopac -eq 1 ] &&  [ $alreadyintra -eq 1 ] ; then
263
        return 1
264
    elif [ "$alreadyopac" != "$alreadyintra" ]; then
265
        [ "${quiet}" != "yes" ] && warn "$instancename had a plack configuration error. Please confirm it is corrected."
266
    fi
267
268
    # Succeed if both or any plack were turned off.
269
    if  [ $failopac -eq 0 ] || [ $failintra -eq 0 ] ; then
201
        return 0
270
        return 0
202
    else
271
    else
203
        [ "${quiet}" != "yes" ] && warn "Plack already disabled for ${instancename}"
204
        return 1
272
        return 1
205
    fi
273
    fi
206
}
274
}
207
- 

Return to bug 20692