[Pkg-php-commits] r927 - php5/branches/rg-extension-manager/debian

Raphael Geissert atomo64-guest at alioth.debian.org
Mon Dec 3 02:56:27 UTC 2007


Author: atomo64-guest
Date: 2007-12-03 02:56:27 +0000 (Mon, 03 Dec 2007)
New Revision: 927

Added:
   php5/branches/rg-extension-manager/debian/extsmngr4packagers.README
Modified:
   php5/branches/rg-extension-manager/debian/libapache2-mod-php5.postinst
   php5/branches/rg-extension-manager/debian/php5-cgi.postinst
   php5/branches/rg-extension-manager/debian/php5-cli.postinst
   php5/branches/rg-extension-manager/debian/php5-common.docs
Log:
Added remaining changes to automagically enable the extensions on SAPI installs
debian/extsmngr4packages.README: something to read for php extensions packagers

Added: php5/branches/rg-extension-manager/debian/extsmngr4packagers.README
===================================================================
--- php5/branches/rg-extension-manager/debian/extsmngr4packagers.README	                        (rev 0)
+++ php5/branches/rg-extension-manager/debian/extsmngr4packagers.README	2007-12-03 02:56:27 UTC (rev 927)
@@ -0,0 +1,93 @@
+
+== Using the extensions manager on postinst/postrm ==
+
+The extensions manager provides an auto-enable and conflictive extensions handler.
+
+Contents:
+1. Implementation
+2. When you should do foo and when bar
+
+1. Implementation
+The first step is to source the functions of the extensions manager:
+
+. /usr/lib/php5/php5exts.sh
+
+The next methods are available:
+remAutoEnableRule()
+addAutoEnableRule()
+remExtsConflict()
+addExtsConflict()
+...and more
+
+Some examples of postinst/rm files (sourcing the functions must be done first):
+
+# Oh no, foo (our extension) conflicts with bar!
+addExtsConflict "foo" "bar"
+
+# a CLI-only extension? better not enable it by default:
+addAutoEnableRule "foo" DISABLE
+
+# purging the package? we remove our conflicts:
+remExtsConflict "foo" "bar"
+
+# purging the package? let's also remove our other stuff:
+remAutoEnableRule "foo" DISABLE
+# or for the lazy ones (removes all ENABLE and DISABLE rules of foo):
+remAutoEnableRule "foo"
+
+
+2. When you should do foo and when bar
+
+This section is written in a Q&A way:
+
+* What if enabling both my extension, e.g. foo, and another one, e.g. bar, causes troubles?
+
+On these situations the right way to do it is find which one both extensions needs to be fixed.
+Let's say foo provides foo() and bar provides foo() and bar(), on this situation bar should be fixed.
+
+* What if bar provides foo so it doesn't depend on the *big* foo ext?
+In that case (or until the situation is resolved) 'bar' should conflict with 'foo'.
+This is because by fixing bar the conflict is resolved, no change on foo will fix it.
+
+Sample code:
+addExtsConflict "bar" "foo"
+Read as: bar conflicts with foo
+
+But don't forget to remove the conflict info when purging:
+rmExtsConflict "bar" "foo"
+
+* Hey! I don't know which one is the origin of the problem
+That isn't a question :-)
+But fine, do it both ways:
+# on bar's postinst:
+addExtsConflict "bar" "foo"
+# on foo's postinst:
+addExtsConflict "foo" "bar"
+
+But don't forget to remove the conflict info when purging:
+# on bar's postrm:
+rmExtsConflict "bar" "foo"
+# on foo's postrm:
+rmExtsConflict "foo" "bar"
+
+* When should addAutoEnableRule be used?
+Sometimes an extension moo is only designed to work with php's CLI SAPI.
+In those situations a line like the next one should be used:
+addAutoEnableRule "moo" "DISABLE"
+
+That prevents the moo extension from being automagically enabled on SAPI's installations/upgrades
+and/or when 'all' is used as the extension name when calling php5enext.
+
+* What does addAutoEnableRule "moo" "ENABLE" do?
+It marks the "moo" extension to be automagically enabled on SAPI's installations/upgrades
+and/or when 'all' is used as the extension name when calling php5enext.
+
+With the default config it has no special functionality, this is because the default policy
+is to enable any extension which wasn't marked by addAutoEnableRule someExt DISABLE
+
+* So when should addAutoEnableRule "moo" "ENABLE" be used?
+This could be used on extensions like PECL's timezonedb.
+Why? because if you install such extension you are very likely to want it enabled
+so your scripts use the right timezones information.
+
+For other extensions the default should be used.

Modified: php5/branches/rg-extension-manager/debian/libapache2-mod-php5.postinst
===================================================================
--- php5/branches/rg-extension-manager/debian/libapache2-mod-php5.postinst	2007-12-03 02:16:54 UTC (rev 926)
+++ php5/branches/rg-extension-manager/debian/libapache2-mod-php5.postinst	2007-12-03 02:56:27 UTC (rev 927)
@@ -39,6 +39,10 @@
 	chmod a+xr,u+w "/etc/php5/${SAPI}/conf.d/"
 fi
 
+if [ -x /usr/sbin/php5enext ]; then
+	/usr/sbin/php5enext "$SAPI" all quiet nonfatal
+fi
+
 # END of upgrade code
 
 reload_apache()

Modified: php5/branches/rg-extension-manager/debian/php5-cgi.postinst
===================================================================
--- php5/branches/rg-extension-manager/debian/php5-cgi.postinst	2007-12-03 02:16:54 UTC (rev 926)
+++ php5/branches/rg-extension-manager/debian/php5-cgi.postinst	2007-12-03 02:56:27 UTC (rev 927)
@@ -38,6 +38,10 @@
 	chmod a+xr,u+w "/etc/php5/${SAPI}/conf.d/"
 fi
 
+if [ -x /usr/sbin/php5enext ]; then
+	/usr/sbin/php5enext "$SAPI" all quiet nonfatal
+fi
+
 # END of upgrade code
 
 update-alternatives \

Modified: php5/branches/rg-extension-manager/debian/php5-cli.postinst
===================================================================
--- php5/branches/rg-extension-manager/debian/php5-cli.postinst	2007-12-03 02:16:54 UTC (rev 926)
+++ php5/branches/rg-extension-manager/debian/php5-cli.postinst	2007-12-03 02:56:27 UTC (rev 927)
@@ -38,6 +38,10 @@
 	chmod a+xr,u+w "/etc/php5/${SAPI}/conf.d/"
 fi
 
+if [ -x /usr/sbin/php5enext ]; then
+	/usr/sbin/php5enext "$SAPI" all quiet nonfatal
+fi
+
 # END of upgrade code
 
 update-alternatives \

Modified: php5/branches/rg-extension-manager/debian/php5-common.docs
===================================================================
--- php5/branches/rg-extension-manager/debian/php5-common.docs	2007-12-03 02:16:54 UTC (rev 926)
+++ php5/branches/rg-extension-manager/debian/php5-common.docs	2007-12-03 02:56:27 UTC (rev 927)
@@ -8,3 +8,4 @@
 README.Zeus
 README.PHP4-TO-PHP5-THIN-CHANGES
 debian/README.Debian.security
+debian/extsmngr4packagers.README




More information about the Pkg-php-commits mailing list