Navigation Menu

Skip to content

Commit

Permalink
Item14401: Merge branch 'Release02x01'
Browse files Browse the repository at this point in the history
  • Loading branch information
gac410 committed May 23, 2017
2 parents 4804978 + de3aafc commit 01fd5e8
Show file tree
Hide file tree
Showing 12 changed files with 95 additions and 19 deletions.
9 changes: 6 additions & 3 deletions FastCGIEngineContrib/data/System/FastCGIEngineContrib.txt
@@ -1,4 +1,4 @@
%META:TOPICINFO{author="ProjectContributor" comment="" date="1490401384" format="1.1" version="1"}%
%META:TOPICINFO{author="ProjectContributor" comment="" date="1495415159" format="1.1" version="1"}%
---+!! <nop>FastCGI Engine Contrib
%$SHORTDESCRIPTION%

Expand Down Expand Up @@ -186,7 +186,9 @@ Next, to integrate the =foswiki.fgi= process into the system's init process use

* Conventional init scripts (Should also work with systemd)
* =tools/foswiki.init-script=: copy this to =/etc/init.d/foswiki=; make the file executable using =chmod +x /etc/init.d/foswiki=, and ensure that it is assigned to user/group root.
* =tools/foswiki.defaults=: copy this to =/etc/default/foswiki= and make appropriate adjustmenst; make sure the process uses the same socket as configured in nginx (see above, defaults to =127.0.0.1:9000=)
* =tools/foswiki.defaults=: copy this to =/etc/default/foswiki= and make appropriate adjustmenst;
* make sure the process uses the same socket as configured in nginx (see above, defaults to =127.0.0.1:9000=)
* verify that the =FOSWIKI_ROOT= setting points to your foswiki installation.

* systemd specific service files (Used _in place of the init scripts_. Don't use both!)
* =tools/systemd/foswiki-fastcgi.service=: copy this to =/etc/systemd/system/foswiki.service=.
Expand Down Expand Up @@ -230,7 +232,8 @@ After the update, each process will still serve one more request before reloadin
---++ Info

| Change History: | |
| 21 Mar 2017 | (1.04) Foswikitask:Item14346 - Fix issues in the systemd service file. Improve documentation. |
| 21 May 2017 | (1.04) Foswikitask:Item14346 - Fix issues in the systemd service file. Improve documentation.<br/>
Foswikitask:Item14402 - Fix default Foswiki root location. along with more doc improvements. |
| 04 Oct 2016 | (1.03) Foswikitask:Item13883 - Documentation updates, Foswikitask:Item14086 - Add a systemd example service file. |
| 14 Jun 2015 | (1.02) Foswikitask:Item10751 - Prepare for Unicode core. |
| 29 Mar 2015 | (1.01) Foswikitask:Item13342 - Add missing dependency, don't re-init back end after every transaction while bootstrapping. |
Expand Down
Expand Up @@ -17,7 +17,7 @@ use strict;
use warnings;

our $VERSION = '1.04';
our $RELEASE = '21 Mar 2017';
our $RELEASE = '21 May 2017';
our $SHORTDESCRIPTION = 'Permits Foswiki to be executed with FastCGI';

1;
3 changes: 2 additions & 1 deletion FastCGIEngineContrib/tools/foswiki.defaults
@@ -1,4 +1,5 @@
FOSWIKI_ROOT=/home/www-data/foswiki/core
# Tailor these settings for your installation
FOSWIKI_ROOT=/var/www/foswiki
FOSWIKI_FCGI=foswiki.fcgi
FOSWIKI_BIND=127.0.0.1:9000
FOSWIKI_CHILDREN=3
Expand Down
12 changes: 11 additions & 1 deletion FastCGIEngineContrib/tools/foswiki.init-script
Expand Up @@ -14,18 +14,28 @@ DESC="Foswiki backend server"
NAME=foswiki

PATH=/sbin:/bin:/usr/sbin:/usr/bin

# Tailor the USER and GROUP settings appropriate for your installation
# Typical settings:
# RedHat, Fedora, CentOS, Gentoo, Mandriva USER=apache GROUP=apache
# debian, Ubuntu, Kubuntu USER=www-data GROUP=www-data
# Suse: USER=wwwrun GROUP=www
# FreeBSD: USER=www GROUP=wwwadmin

USER=www-data
GROUP=www-data

FOSWIKI_ROOT=/var/www/foswiki
# The following defaults are overridden in etc/default/foswiki

FOSWIKI_ROOT=/var/www/foswiki
FOSWIKI_FCGI=foswiki.fcgi
FOSWIKI_BIND=127.0.0.1:9000
FOSWIKI_CHILDREN=3
FOSWIKI_MAX_REQUESTS=-1
FOSWIKI_MAX_SIZE=250000
FOSWIKI_CHECK_SIZE=10
FOSWIKI_QUIET=true

FOSWIKI_PIDFILE=/var/run/$NAME.pid

# Include defaults if available
Expand Down
5 changes: 5 additions & 0 deletions FastCGIEngineContrib/tools/systemd/foswiki.service
Expand Up @@ -22,6 +22,11 @@ Environment=FOSWIKI_CHECK_SIZE=10
EnvironmentFile=-/etc/default/foswiki

# The User, Group, PIDFile and WorkingDirectory cannot be specified by Environment variables. Update as needed.
# Typical settings:
# RedHat, Fedora, CentOS, Gentoo, Mandriva USER=apache GROUP=apache
# debian, Ubuntu, Kubuntu USER=www-data GROUP=www-data
# Suse: USER=wwwrun GROUP=www
# FreeBSD: USER=www GROUP=wwwadmin
User=www-data
Group=www-data

Expand Down
Expand Up @@ -64,7 +64,7 @@ sub handle {

# clear redirect enforced by a checkpoint action
$response->deleteHeader( "Location", "Status" );
$response->pushHeader( "Status", $status );
$response->status($status);

# add validation key to HTTP header, if required
unless ( $response->getHeader('X-Foswiki-Validation') ) {
Expand Down
9 changes: 7 additions & 2 deletions core/lib/Foswiki.pm
Expand Up @@ -1961,8 +1961,13 @@ sub new {
if ( $Foswiki::cfg{Cache}{Enabled} && $Foswiki::cfg{Cache}{Implementation} )
{
eval "require $Foswiki::cfg{Cache}{Implementation}";
ASSERT( !$@, $@ ) if DEBUG;
$this->{cache} = $Foswiki::cfg{Cache}{Implementation}->new();
if ($@) { # The require failed - Be graceful in failure
ASSERT( !$@, $@ ) if DEBUG;
$Foswiki::cfg{Cache}{Enabled} = 0;
}
else {
$this->{cache} = $Foswiki::cfg{Cache}{Implementation}->new();
}
}

my $prefs = new Foswiki::Prefs($this);
Expand Down
2 changes: 1 addition & 1 deletion core/lib/Foswiki.spec
Expand Up @@ -1631,7 +1631,7 @@ $Foswiki::cfg{FormTypes} = [
# This setting will switch on/off caching.
$Foswiki::cfg{Cache}{Enabled} = $FALSE;

# **SELECTCLASS Foswiki::PageCache::DBI::* DISPLAY_IF="{Cache}{Enabled}" CHECK="iff:'{Cache}{Enabled}'" LABEL="Cache Implementation"**
# **SELECTCLASS Foswiki::PageCache::DBI::* DISPLAY_IF="{Cache}{Enabled}" CHECK="iff:'{Cache}{Enabled}' also:'{Cache}{Enabled}'" LABEL="Cache Implementation"**
# Select the cache implementation. The default page cache implementation
# is based on DBI (http://dbi.perl.org) which requires a working DBI driver to
# connect to a database. This database will hold all cached data as well as the
Expand Down
41 changes: 41 additions & 0 deletions core/lib/Foswiki/Configure/Checkers/Cache/Enabled.pm
@@ -0,0 +1,41 @@
# See bottom of file for license and copyright information
package Foswiki::Configure::Checkers::Cache::Enabled;

use strict;
use warnings;

use Foswiki::Configure::Checker ();
our @ISA = ('Foswiki::Configure::Checker');

sub check {
my ( $this, $value ) = @_;

if ( $Foswiki::cfg{Cache}{Enabled} && $Foswiki::cfg{Cache}{Implementation} )
{
eval "require $Foswiki::cfg{Cache}{Implementation}";
if ($@) { # The require failed - Be graceful in failure
$this->ERROR("Cache cannot be enabled - Failed to load!");
$this->NOTE($@);
}
}
}

1;
__END__
Foswiki - The Free and Open Source Wiki, http://foswiki.org/
Copyright (C) 2017 Foswiki Contributors. Foswiki Contributors
are listed in the AUTHORS file in the root of this distribution.
NOTE: Please extend that file, not this notice.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version. For
more details read LICENSE in the root of this distribution.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
As per the GPL, removal of this notice is prohibited.
15 changes: 9 additions & 6 deletions core/lib/Foswiki/Configure/Query.pm
Expand Up @@ -39,7 +39,8 @@ and cause the method to fail.

# Get =set= parameters and set the values in %Foswiki::cfg
sub _getSetParams {
my ( $params, $root, $reporter ) = @_;
my ( $params, $root, $reporter, $Foswikicfg ) = @_;

if ( $params->{set} ) {
while ( my ( $k, $value ) = each %{ $params->{set} } ) {
my $spec = $root->getValueObject($k);
Expand All @@ -66,7 +67,7 @@ sub _getSetParams {
. ", spec "
. $spec->stringify() . "\n"
if TRACE_GETSET;
eval("\$Foswiki::cfg$k=\$value");
eval("\$Foswikicfg->$k=\$value");
}
else {
print STDERR "GETSET $k=$value, spec "
Expand All @@ -75,12 +76,12 @@ sub _getSetParams {

# This is needed to prevent expansion of embedded
# $Foswiki::cfg variables during the eval.
eval("\$Foswiki::cfg$k=join('',\$value)");
eval("\$Foswikicfg->$k=join('',\$value)");
}
}
else {
print STDERR "GETSET undef $k\n" if TRACE_GETSET;
eval("undef \$Foswiki::cfg$k");
eval("undef \$Foswikicfg->$k");
}
if ($@) {
$reporter->ERROR( '<verbatim>'
Expand Down Expand Up @@ -322,7 +323,7 @@ sub check_current_value {
my $reporter = Foswiki::Configure::Reporter->new();

# Apply "set" values to $Foswiki::cfg
eval { _getSetParams( $params, $root, $frep ); };
eval { _getSetParams( $params, $root, $frep, \%Foswiki::cfg ); };
if ( $frep->has_level('errors') ) {
return [ { reports => $frep->messages() } ];
}
Expand Down Expand Up @@ -503,6 +504,8 @@ return result is a hash containing the following keys:
sub wizard {
my ( $params, $reporter ) = @_;

local %Foswiki::cfg = %Foswiki::cfg;

my $root = Foswiki::Configure::Root->new();
Foswiki::Configure::LoadSpec::readSpec( $root, $reporter );
if ( $reporter->has_level('errors') ) {
Expand Down Expand Up @@ -536,7 +539,7 @@ sub wizard {
}
$method = $1; # untaint

_getSetParams( $params, $root, $reporter );
_getSetParams( $params, $root, $reporter, \%Foswiki::cfg );
return { messages => $reporter->messages() }
if $reporter->has_level('errors');

Expand Down
1 change: 1 addition & 0 deletions core/lib/Foswiki/Contrib/core/MANIFEST
Expand Up @@ -369,6 +369,7 @@ lib/Foswiki/Configure/Checkers/AccessibleCFG.pm 0444
lib/Foswiki/Configure/Checkers/AccessControlACL/EnableDeprecatedEmptyDeny.pm 0444
lib/Foswiki/Configure/Checkers/AuthRealm.pm 0444
lib/Foswiki/Configure/Checkers/AuthScripts.pm 0444
lib/Foswiki/Configure/Checkers/Cache/Enabled.pm 0444
lib/Foswiki/Configure/Checkers/Cache/DependencyFilter.pm 0444
lib/Foswiki/Configure/Checkers/Cache/Implementation.pm 0444
lib/Foswiki/Configure/Checkers/Certificate/ClientChecker.pm 0444
Expand Down
13 changes: 10 additions & 3 deletions core/lib/Foswiki/Request.pm
Expand Up @@ -306,9 +306,16 @@ sub url {
}
$name =~ s(//+)(/)g;
if ($full) {
my $vh = $this->header('X-Forwarded-Host') || $this->header('Host');
$url =
$vh ? $this->protocol . '://' . $vh : $Foswiki::cfg{DefaultUrlHost};
if ( $Foswiki::cfg{ForceDefaultUrlHost} ) {
$url = $Foswiki::cfg{DefaultUrlHost};
}
else {
my $vh = $this->header('X-Forwarded-Host') || $this->header('Host');
$url =
$vh
? $this->protocol . '://' . $vh
: $Foswiki::cfg{DefaultUrlHost};
}
return $url if $base;
$url .= $name;
}
Expand Down

0 comments on commit 01fd5e8

Please sign in to comment.