commit:     2b82d0c0c967f59f5993bea53bb5dd86693beef0
Author:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Fri Jan 22 17:47:43 2016 +0000
Commit:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Fri Jan 22 17:47:43 2016 +0000
URL:        https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=2b82d0c0

Remove cleanup_sapis() and ensmarten the libphp[57].so symlink removal.

The cleanup_sapis() function was only called in one place, so it was a
pointless layer of indirection. Move it into do_cleanup(). Also, make
sure we don't remove libphp[57].so symlinks unless they're actually
symlinks and in fact dead.

 src/php.eselect.in.in | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/src/php.eselect.in.in b/src/php.eselect.in.in
index ff3914f..7e52f53 100644
--- a/src/php.eselect.in.in
+++ b/src/php.eselect.in.in
@@ -173,14 +173,6 @@ parse_target_major_version() {
        esac
 }
 
-cleanup_sapis() {
-       local m
-       local link
-       for m in $MODULES ; do
-               cleanup_sapi $m
-       done
-}
-
 cleanup_sapi() {
        local sapi="${1}"
        local l="${sapi}_link"
@@ -197,11 +189,6 @@ cleanup_sapi() {
                fi
        fi
 
-       if [[ "${sapi}" == "apache2" ]] ; then
-               rm -f "@LIBDIR@"/apache2/modules/libphp[57].so \
-                  || die "failed to remove old libphp.so symlink"
-       fi
-
        return 1
 }
 
@@ -582,5 +569,18 @@ describe_cleanup_options() {
 }
 
 do_cleanup() {
-       cleanup_sapis
+       for sapi in $MODULES ; do
+               cleanup_sapi "${sapi}"
+       done
+
+       # Remove older (and dead) apache2 symlinks. These days the symlink
+       # is called mod_php.so. This cleanup code can be removed after a
+       # while, after we think most people will have switched to the new
+       # symlink and removed the old one.
+       for link in "@LIBDIR@"/apache2/modules/libphp[57].so; do
+               if [[ -L "${link}" && ! -e "${link}" ]] ; then
+                       rm -f "${link}" || die "failed to remove old libphp.so 
symlink"
+                       echo "Removed broken symlink ${link}."
+               fi
+       done
 }

Reply via email to