Currently php-ext-source-r3 saves the enabling ini file as
"${PHP_EXT_NAME}.ini".  This is problematic when foo module needs to be
loaded before bar module as things are read in directory order.

This patch introduces PHP_INI_NAME which defaults to PHP_EXT_NAME for
backwards-compatibility.
---
 eclass/php-ext-source-r3.eclass | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/eclass/php-ext-source-r3.eclass b/eclass/php-ext-source-r3.eclass
index bc6751562a5..315ce32887f 100644
--- a/eclass/php-ext-source-r3.eclass
+++ b/eclass/php-ext-source-r3.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2016 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: php-ext-source-r3.eclass
@@ -73,6 +73,17 @@ esac
 # the tree.
 [[ -z "${PHP_EXT_SAPIS}" ]] && PHP_EXT_SAPIS="apache2 cli cgi fpm embed phpdbg"
 
+# @ECLASS-VARIABLE: PHP_INI_NAME
+# @DESCRIPTION
+# An optional file name of the saved ini file minis the ini extension
+# This allows ordering of extensions such that one is loaded before
+# or after another.  Defaults to the PHP_EXT_NAME.
+# Example (produces 40-foo.ini file):
+# @CODE@
+# PHP_INI_NAME="40-foo"
+# @CODE@
+: ${PHP_INI_NAME:=${PHP_EXT_NAME}}
+
 
 # Make sure at least one target is installed. First, start a USE
 # conditional like "php?", but only when PHP_EXT_OPTIONAL_USE is
@@ -295,7 +306,7 @@ php_slot_ini_files() {
        local x
        for x in ${PHP_EXT_SAPIS} ; do
                if [[ -f "${EPREFIX}/etc/php/${x}-${1}/php.ini" ]] ; then
-                       slot_ini_files+=" 
etc/php/${x}-${1}/ext/${PHP_EXT_NAME}.ini"
+                       slot_ini_files+=" 
etc/php/${x}-${1}/ext/${PHP_INI_NAME}.ini"
                fi
        done
 
@@ -324,7 +335,7 @@ php-ext-source-r3_createinifiles() {
                                einfo "Added contents of 
${FILESDIR}/${PHP_EXT_INIFILE}" \
                                          "to ${file}"
                        fi
-                       inidir="${file/${PHP_EXT_NAME}.ini/}"
+                       inidir="${file/${PHP_INI_NAME}.ini/}"
                        inidir="${inidir/ext/ext-active}"
                        dodir "/${inidir}"
                        dosym "/${file}" "/${file/ext/ext-active}"
-- 
2.16.1


Reply via email to