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

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

Return to bug 20692