[debian-edu-commits] debian-edu/pkg-team/ 01/03: debian/fix-constructors.sh: Additionally replace occurrences of <class>::<class>(...) with <class>::_construct(). Assure script can be run several times on the same GOsa code tree.

Mike Gabriel sunweaver at debian.org
Thu Jun 2 18:35:17 UTC 2016


This is an automated email from the git hooks/post-receive script.

sunweaver pushed a commit to branch master
in repository gosa.

commit 6dfa71f1974b9c7e54469f24d27137bbf31310bb
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Thu Jun 2 20:32:23 2016 +0200

    debian/fix-constructors.sh: Additionally replace occurrences of <class>::<class>(...) with <class>::_construct(). Assure script can be run several times on the same GOsa code tree.
---
 debian/fix-constructors.sh | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/debian/fix-constructors.sh b/debian/fix-constructors.sh
index f641722..942bd13 100755
--- a/debian/fix-constructors.sh
+++ b/debian/fix-constructors.sh
@@ -1,10 +1,21 @@
 #!/bin/bash
 
-classes=$(grep -r ^class * | sed 's/: *class *\([^ {]*\).*$/:\1/')
+classes=$(grep -r -E "^class [_a-zA-Z0-9]" * | sed -r -e 's/(.*):class\ ([^\ {]+).*$/\2:\1/' | sort | uniq)
 
 for line in $classes; do
   split=(${line//:/ })
-  class=${split[1]}
+  class=${split[0]}
+
+  if [ "${last_class}" = "${class}" ]; then
+    continue
+  fi
+  last_class="${class}"
+  echo $class   ----   ${split[1]}
+
+  sed -i "s/function ${class} *(/function __construct(/" ${split[1]}
+
+  find * -type f | egrep "\.php|\.inc" | while read file; do
+    sed -r -e "s/${class}::${class}/${class}::__construct/" -i "$file"
+  done
 
-  sed -i "s/function ${class} *(/function __construct(/" ${split[0]}
 done

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-edu/pkg-team/gosa.git



More information about the debian-edu-commits mailing list