[Webapps-common-discuss] [commit] r118 - in webapps-common/trunk: doc examples/webapp-apache-example examples/webapp-apache-example/debian

seanius at alioth.debian.org seanius at alioth.debian.org
Sun Jul 8 22:56:20 UTC 2007


Author: seanius
Date: 2007-07-08 22:56:20 +0000 (Sun, 08 Jul 2007)
New Revision: 118

Added:
   webapps-common/trunk/examples/webapp-apache-example/index.php
   webapps-common/trunk/examples/webapp-apache-example/settings.php
Removed:
   webapps-common/trunk/examples/webapp-apache-example/index.html
Modified:
   webapps-common/trunk/doc/webapps-common.sgml
   webapps-common/trunk/examples/webapp-apache-example/debian/dirs
   webapps-common/trunk/examples/webapp-apache-example/debian/postinst
   webapps-common/trunk/examples/webapp-apache-example/debian/postrm
   webapps-common/trunk/examples/webapp-apache-example/debian/rules
Log:
doc update, and making webapp-apache-example a little more practical

Modified: webapps-common/trunk/doc/webapps-common.sgml
===================================================================
--- webapps-common/trunk/doc/webapps-common.sgml	2007-07-08 22:09:25 UTC (rev 117)
+++ webapps-common/trunk/doc/webapps-common.sgml	2007-07-08 22:56:20 UTC (rev 118)
@@ -161,10 +161,23 @@
 	<tag>src
 	<item>your provided config template.  this file will look generally
 	      how you expect your application's configure to look, only it
-		  can contain various substXXX
+		  can contain various substitution expressions.
 	<tag>dest
-	<item>
+	<item>The location where the includable configuration file should
+	      be placed.  Your application should then only need to include
+		  this file ("<var>require_once</var> in php, for example).
+		  <em>Note</em>: this file will not actually contain the configuration
+		  template, but instead include a second (and also automatically
+		  generated) file unique to the "instance" of the application.
+		  for example a value of <var>dest</var> set to "settings.php"
+		  will also generate a settings-<var>siteid</var>.php that contains
+		  the configuration for the site associated with <var>siteid</var>.
 	</taglist>
+	<p>
+	for a quick example of this, please see the 
+	<package>webapp-apache-example</package> package in the
+	<var>examples</var> subdirectory in the webapps-common documentation,
+	and also the list of substitutable values in <ref id="substvars">.
 
 	<sect id="dbapp">Database Applications
 	<p>
@@ -257,13 +270,12 @@
 		<item>set to any non-empty string to specify that this application
 		      supports running on multiple instances.  note that this is
 			  still kind of experimental.
-		<tag>wc_dbapp (used in: <var>config</var>, <var>postinst</var>, <var>prerm</var>, <var>postrm</var>, <strong>but note this may change</strong>).
-		<item>set to any non-empty string to specify that this application
-		      requires an underlying database.  <strong>NOTE</strong> this
-			  option currently conflicts with <var>wc_multiple_instances</var>.
-		<tag>wc_dbtype (used in: <var>config</var>, <var>postinst</var>, <var>prerm</var>, <var>postrm</var>, <strong>but note this may change</strong>).
-		<item>if your application requires a database, the database type.
+		<tag>wc_dbtype/wc_dbtypes (used in: <var>config</var>, <var>postinst</var>, <var>prerm</var>, <var>postrm</var>)
+		<item>if your application requires a database, the database type(s).
+		      if using the latter, the list of supported database types should
+			  be comma-separated.
 	</taglist>
+
 	<sect id="substvars">Configuration template substitution variables.
 	<p>
 	The following list documents the substituion variables which will

Modified: webapps-common/trunk/examples/webapp-apache-example/debian/dirs
===================================================================
--- webapps-common/trunk/examples/webapp-apache-example/debian/dirs	2007-07-08 22:09:25 UTC (rev 117)
+++ webapps-common/trunk/examples/webapp-apache-example/debian/dirs	2007-07-08 22:56:20 UTC (rev 118)
@@ -1,3 +1,4 @@
 usr/share/webapps-common/install/webapp-apache-example/httpd
 usr/share/webapp-apache-example/www
+usr/share/webapp-apache-example/templates
 etc/webapp-apache-example

Modified: webapps-common/trunk/examples/webapp-apache-example/debian/postinst
===================================================================
--- webapps-common/trunk/examples/webapp-apache-example/debian/postinst	2007-07-08 22:09:25 UTC (rev 117)
+++ webapps-common/trunk/examples/webapp-apache-example/debian/postinst	2007-07-08 22:56:20 UTC (rev 118)
@@ -4,6 +4,7 @@
 
 . /usr/share/debconf/confmodule
 . /usr/share/webapps-common/dpkg/postinst
+wc_generate_include="php:/usr/share/webapp-apache-example/templates/settings.php:/etc/webapp-apache-example/settings.php"
 wc_go webapp-apache-example $@
 
 #DEBHELPER#

Modified: webapps-common/trunk/examples/webapp-apache-example/debian/postrm
===================================================================
--- webapps-common/trunk/examples/webapp-apache-example/debian/postrm	2007-07-08 22:09:25 UTC (rev 117)
+++ webapps-common/trunk/examples/webapp-apache-example/debian/postrm	2007-07-08 22:56:20 UTC (rev 118)
@@ -3,7 +3,11 @@
 set -e
 
 . /usr/share/debconf/confmodule
-. /usr/share/webapps-common/dpkg/postrm
-wc_go webapp-apache-example $@
 
+if [ -f /usr/share/webapps-common/dpkg/postrm ]; then
+	. /usr/share/webapps-common/dpkg/postrm
+	wc_generate_include="php:/usr/share/webapp-apache-example/templates/settings.php:/etc/webapp-apache-example/settings.php"
+	wc_go webapp-apache-example $@
+fi
+
 #DEBHELPER#

Modified: webapps-common/trunk/examples/webapp-apache-example/debian/rules
===================================================================
--- webapps-common/trunk/examples/webapp-apache-example/debian/rules	2007-07-08 22:09:25 UTC (rev 117)
+++ webapps-common/trunk/examples/webapp-apache-example/debian/rules	2007-07-08 22:56:20 UTC (rev 118)
@@ -13,7 +13,8 @@
 p:=webapp-apache-example
 ptmp:=debian/$p
 INSTDIR:=${ptmp}/usr/share/webapps-common/install/$p/httpd
-WEBDOCDIR:=${ptmp}/usr/share/$p/www
+SHAREDIR:=${ptmp}/usr/share/$p
+WEBDOCDIR:=${SHAREDIR}/www
 
 configure: configure-stamp
 configure-stamp:
@@ -41,7 +42,8 @@
 	dh_installdirs
 #	debian/credit-xlators > ${DOC}/TRANSLATORS
 	cp apache_template.conf ${INSTDIR}/apache_template
-	cp index.html ${WEBDOCDIR}
+	cp index.php ${WEBDOCDIR}
+	cp settings.php ${SHAREDIR}/templates
 
 # Build architecture-independent files here.
 binary-indep: build install

Deleted: webapps-common/trunk/examples/webapp-apache-example/index.html
===================================================================
--- webapps-common/trunk/examples/webapp-apache-example/index.html	2007-07-08 22:09:25 UTC (rev 117)
+++ webapps-common/trunk/examples/webapp-apache-example/index.html	2007-07-08 22:56:20 UTC (rev 118)
@@ -1,3 +0,0 @@
-<p>
-welcome to the front page for webapp-apache-example!
-</p>

Added: webapps-common/trunk/examples/webapp-apache-example/index.php
===================================================================
--- webapps-common/trunk/examples/webapp-apache-example/index.php	                        (rev 0)
+++ webapps-common/trunk/examples/webapp-apache-example/index.php	2007-07-08 22:56:20 UTC (rev 118)
@@ -0,0 +1,20 @@
+<html>
+<body>
+<h1>
+welcome to the front page for webapp-apache-example!
+</h1>
+
+<?php
+// config file generated by dbc_generate_include setting in postinst
+require_once("/etc/webapp-apache-example/settings.php");
+
+global $config;
+
+print "<h2>Settings imported from configuration file</h2>";
+print "<pre>";
+print_r($config);
+print "</pre>";
+?>
+
+</body>
+</html>

Added: webapps-common/trunk/examples/webapp-apache-example/settings.php
===================================================================
--- webapps-common/trunk/examples/webapp-apache-example/settings.php	                        (rev 0)
+++ webapps-common/trunk/examples/webapp-apache-example/settings.php	2007-07-08 22:56:20 UTC (rev 118)
@@ -0,0 +1,8 @@
+<?php
+
+// here's a standard config setting you might have
+$config['someoption']="somevalue";
+// and here's a config setting that might be different per-instance.
+$config['basedir']="_WC_WEBSITE_SUBDIRECTORY_";
+
+?>




More information about the Webapps-common-discuss mailing list