Bugzilla – Attachment 8684 Details for
Bug 7844
plack scripts for developers
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 7844 - plack intranet tooling for developers
Bug-7844---plack-intranet-tooling-for-developers.patch (text/plain), 3.41 KB, created by
Dobrica Pavlinusic
on 2012-03-29 11:59:12 UTC
(
hide
)
Description:
Bug 7844 - plack intranet tooling for developers
Filename:
MIME Type:
Creator:
Dobrica Pavlinusic
Created:
2012-03-29 11:59:12 UTC
Size:
3.41 KB
patch
obsolete
>From 2b487c4565fd90231c2b1684495063c8469db27b Mon Sep 17 00:00:00 2001 >From: Dobrica Pavlinusic <dpavlin@rot13.org> >Date: Thu, 29 Mar 2012 12:27:05 +0200 >Subject: [PATCH] Bug 7844 - plack intranet tooling for developers > >intranet.psgi example and script to run any Koha intranet under plack > >This assumes that intranetdir in koha-conf.xml points to source code checkout. > >It also defines new enviroment variables: > >PLACK_DEBUG - turn debugging panels on >PLACK_MINIFY - minify JavaScript and CSS which saves us ~10k on each page load > >Test scenario: >1. install plack, using ./cpanm-install.pl >2. start ./intranet-plack.sh sitename > from misc/plack directory so it can find intranet.psgi here >3. open intranet page http://localhost:5001/cgi-bin/koha/mainpage.pl >--- > misc/plack/cpanm-install.sh | 8 +++++++ > misc/plack/intranet-plack.sh | 18 +++++++++++++++++ > misc/plack/intranet.psgi | 44 ++++++++++++++++++++++++++++++++++++++++++ > 3 files changed, 70 insertions(+), 0 deletions(-) > create mode 100755 misc/plack/cpanm-install.sh > create mode 100755 misc/plack/intranet-plack.sh > create mode 100644 misc/plack/intranet.psgi > >diff --git a/misc/plack/cpanm-install.sh b/misc/plack/cpanm-install.sh >new file mode 100755 >index 0000000..589cb73 >--- /dev/null >+++ b/misc/plack/cpanm-install.sh >@@ -0,0 +1,8 @@ >+#!/bin/sh -xe >+ >+sudo cpan App::cpanminus >+cpanm --sudo Task::Plack \ >+ Plack::Middleware::Static::Minifier \ >+ Plack::Middleware::Debug::Profiler::NYTProf \ >+ Plack::Middleware::Debug::DBIProfile >+ >diff --git a/misc/plack/intranet-plack.sh b/misc/plack/intranet-plack.sh >new file mode 100755 >index 0000000..716b902 >--- /dev/null >+++ b/misc/plack/intranet-plack.sh >@@ -0,0 +1,18 @@ >+#!/bin/sh -xe >+ >+site=ffzg >+test ! -z "$1" && site=$1 >+dir=`dirname $0` >+opt="" >+ >+export KOHA_CONF=/etc/koha/sites/$site/koha-conf.xml >+export INTRANETDIR="$( xmlstarlet sel -t -v 'yazgfs/config/intranetdir' $KOHA_CONF )" >+ >+if [ ! -e "$INTRANETDIR/C4" ] ; then >+ echo "intranetdir in $KOHA_CONF doesn't point to Koha git checkout" >+ exit 1 >+fi >+ >+# we are not wathcing all CGI scripts since that tends to use a lot of CPU time for plackup >+opt="--reload -R $INTRANETDIR/C4" >+sudo -E -u $site-koha plackup -I $INTRANETDIR $opt --port 5001 $dir/intranet.psgi >diff --git a/misc/plack/intranet.psgi b/misc/plack/intranet.psgi >new file mode 100644 >index 0000000..e7ec40e >--- /dev/null >+++ b/misc/plack/intranet.psgi >@@ -0,0 +1,44 @@ >+#!/usr/bin/perl >+use Plack::Builder; >+use Plack::App::CGIBin; >+use Plack::Middleware::Debug; >+use Plack::App::Directory; >+ >+# cpanm Plack::Middleware::Debug::DBIProfile >+ >+use C4::Context; >+use C4::Languages; >+use C4::Members; >+use C4::Dates; >+use C4::Boolean; >+use C4::Letters; >+use C4::Koha; >+use C4::XSLT; >+use C4::Branch; >+use C4::Category; >+ >+my $app=Plack::App::CGIBin->new(root => $ENV{INTRANETDIR}); >+ >+builder { >+ >+ enable_if { $ENV{PLACK_DEBUG} } 'Debug', panels => [ >+ qw(Environment Response Timer Memory), >+# [ 'Profiler::NYTProf', exclude => [qw(.*\.css .*\.png .*\.ico .*\.js .*\.gif)] ], >+# [ 'DBITrace', level => 1 ], # a LOT of fine-graded SQL trace >+ [ 'DBIProfile', profile => 2 ], >+ ]; >+ >+ enable_if { $ENV{PLACK_DEBUG} } 'StackTrace'; >+ >+ enable "Plack::Middleware::Static", >+ path => qr{^/intranet-tmpl/}, root => '/srv/koha/koha-tmpl/'; >+ >+ enable_if { $ENV{PLACK_MINIFIER} } "Plack::Middleware::Static::Minifier", >+ path => qr{^/intranet-tmpl/}, >+ root => './koha-tmpl/'; >+ >+ >+ mount "/cgi-bin/koha" => $app; >+ >+}; >+ >-- >1.7.2.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 7844
:
8684
|
8693
|
8731
|
8892
|
8893
|
8894
|
9113
|
9879
|
10082
|
10220
|
26148
|
26201
|
26206
|
26227
|
26275