1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-03-14 04:30:29 +01:00

[ticket/12582] Change strip_icc_profiles.sh to only take a single file.

PHPBB3-12582
This commit is contained in:
Andreas Fischer 2014-05-27 16:56:45 +02:00
parent 4f9aa5e384
commit c02fba3f1c
2 changed files with 14 additions and 21 deletions

View File

@ -22,12 +22,12 @@ before_script:
- sh -c "if [ '$TRAVIS_PHP_VERSION' != '5.2' ]; then php ../composer.phar install --dev --no-interaction --prefer-source; fi"
- cd ..
- sh -c "if [ `php -r "echo (int) version_compare(PHP_VERSION, '5.3.19', '>=');"` = "1" ]; then travis/setup-webserver.sh; fi"
- sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.5' -a '$DB' = 'mysql' ]; then sudo apt-get update; sudo apt-get install -y libimage-exiftool-perl; fi"
- sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.5' -a '$DB' = 'mysql' ]; then sudo apt-get update; sudo apt-get install -y parallel libimage-exiftool-perl; fi"
script:
- sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.2' ]; then phpunit --configuration travis/phpunit-$DB-5-2-travis.xml; else phpBB/vendor/bin/phpunit --configuration travis/phpunit-$DB-travis.xml; fi"
- sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.5' -a '$DB' = 'mysql' -a '$TRAVIS_PULL_REQUEST' != 'false' ]; then git-tools/commit-msg-hook-range.sh origin/$TRAVIS_BRANCH..FETCH_HEAD; fi"
- sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.5' -a '$DB' = 'mysql' ]; then phpBB/develop/strip_icc_profiles.sh ./; fi"
- sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.5' -a '$DB' = 'mysql' ]; then find . -type f -not -path './phpBB/vendor/*' -iregex '.*\.\(gif\|jpg\|jpeg\|png\)$' | parallel --gnu --keep-order 'phpBB/develop/strip_icc_profiles.sh {}' || exit 1; fi"
matrix:
include:

View File

@ -4,30 +4,23 @@
# @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
#
set -e
set -x
SCRIPT=$(basename "$0")
if [ "$#" -ne 1 ]; then
echo "Description: Finds and strips ICC Profiles from image files." >&2
echo "Usage: $SCRIPT /root/directory" >&2
SCRIPT=$(basename "$0")
echo "Description: Finds and strips ICC Profiles from given image file." >&2
echo "Usage: $SCRIPT /path/to/image/file" >&2
echo "Exit Status: 0 if no ICC profiles have been stripped, otherwise 1." >&2
echo "Requires: exiftool" >&2
exit 1
fi
ROOT=$1
STATUS=0
for FILE in $(find "$ROOT" -type f -iregex '.*\.\(gif\|jpg\|jpeg\|png\)$')
do
HASH_OLD=$(md5sum "$FILE")
exiftool -icc_profile"-<=" -overwrite_original_in_place "$FILE" > /dev/null 2>&1
HASH_NEW=$(md5sum "$FILE")
FILE=$1
HASH_OLD=$(md5sum "$FILE")
exiftool -icc_profile"-<=" -overwrite_original_in_place "$FILE" > /dev/null 2>&1
HASH_NEW=$(md5sum "$FILE")
if [ "$HASH_OLD" != "$HASH_NEW" ]
then
echo "Stripped ICC Profile from $FILE."
STATUS=1
fi
done
exit $STATUS
if [ "$HASH_OLD" != "$HASH_NEW" ]
then
echo "Stripped ICC Profile from $FILE."
exit 1
fi