Subversion Repositories oidplus

Rev

Rev 1421 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
597 daniel-mar 1
#!/bin/bash
2
 
600 daniel-mar 3
# OIDplus 2.0
1376 daniel-mar 4
# Copyright 2019 - 2023 Daniel Marschall, ViaThinkSoft
600 daniel-mar 5
#
6
# Licensed under the Apache License, Version 2.0 (the "License");
7
# you may not use this file except in compliance with the License.
8
# You may obtain a copy of the License at
9
#
10
#     http://www.apache.org/licenses/LICENSE-2.0
11
#
12
# Unless required by applicable law or agreed to in writing, software
13
# distributed under the License is distributed on an "AS IS" BASIS,
14
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
# See the License for the specific language governing permissions and
16
# limitations under the License.
17
 
597 daniel-mar 18
DIR=$( dirname "$0" )
19
 
20
cd "$DIR/.."
21
 
600 daniel-mar 22
# We temporarily move the .svn directory, otherwise
23
# we cannot checkout fileformats and vnag in the vendor
24
# directory
25
if [ -d ".svn" ]; then
26
        mv .svn _svn
27
fi
28
 
1419 daniel-mar 29
# For some reason, sometimes composer downgrades packages for now reason.
30
# Clearing the cache helps!
31
composer clear-cache
32
 
600 daniel-mar 33
# Remove vendor and composer.lock, so we can download everything again
34
# (We need to receive everything again, because we had to delete the .git
35
# .svn files and therefore we cannot do a simple "svn update" delta update anymore)
597 daniel-mar 36
rm -rf vendor
37
rm composer.lock
38
 
600 daniel-mar 39
# Download everything again
1034 daniel-mar 40
composer update --no-dev
597 daniel-mar 41
 
600 daniel-mar 42
# Remove stuff we don't want to publish or PHP files which could be
43
# executed (which would be a security risk, because the vendor/ directory
44
# can be accessed via the web-browser)
868 daniel-mar 45
remove_vendor_rubbish() {
46
        shopt -s globstar
47
        rm -rf $1vendor/**/.svn
48
        rm -rf $1vendor/**/.git
49
        rm -rf $1vendor/**/.gitignore
50
        rm -rf $1vendor/**/.gitattributes
51
        rm -rf $1vendor/**/.github
52
        rm -rf $1vendor/**/demo
53
        rm -rf $1vendor/**/demos
54
        rm -rf $1vendor/twbs/bootstrap/package*
55
        rm -rf $1vendor/twbs/bootstrap/*.js
56
        rm -rf $1vendor/twbs/bootstrap/*.yml
57
        rm -rf $1vendor/twbs/bootstrap/.* 2>/dev/null
58
        rm -rf $1vendor/twbs/bootstrap/nuget/
59
        rm -rf $1vendor/twbs/bootstrap/scss/
60
        rm -rf $1vendor/twbs/bootstrap/js/
61
        rm -rf $1vendor/twbs/bootstrap/build/
62
        rm -rf $1vendor/twbs/bootstrap/site/
63
        rm -rf $1vendor/google/recaptcha/examples/
64
        rm -rf $1vendor/**/tests
65
        rm -rf $1vendor/**/test
66
        rm $1vendor/**/*.phpt
67
        rm $1vendor/**/example.php
68
        rm -rf $1vendor/danielmarschall/vnag/logos
69
        rm -rf $1vendor/danielmarschall/vnag/doc
1421 daniel-mar 70
        rm -rf $1vendor/danielmarschall/vnag/bin
1422 daniel-mar 71
        rm -rf $1vendor/danielmarschall/vnag/web
1421 daniel-mar 72
        rm -rf $1vendor/danielmarschall/vnag/create_conf_symlinks.phps
73
        rm -rf $1vendor/danielmarschall/vnag/set_chmod.sh
74
        rm -rf $1vendor/danielmarschall/vnag/Makefile
75
        rm -rf $1vendor/danielmarschall/vnag/src/build.phps
76
        rm -rf $1vendor/danielmarschall/vnag/src/plugins
868 daniel-mar 77
        rm -rf $1vendor/danielmarschall/uuid_mac_utils/*.php
78
        rm -rf $1vendor/danielmarschall/uuid_mac_utils/*.sh
79
        rm -rf $1vendor/danielmarschall/uuid_mac_utils/*.css
930 daniel-mar 80
        rm -rf $1vendor/danielmarschall/uuid_mac_utils/includes/OidDerConverter.class.php
868 daniel-mar 81
        rm -rf $1vendor/paragonie/random_compat/other
82
}
83
remove_vendor_rubbish ./
597 daniel-mar 84
 
600 daniel-mar 85
# It is important that symlinks are not existing, otherwise the .tar.gz dir
86
# cannot be correctly extracted in Windows
87
rm -rf vendor/bin
88
rm -rf vendor/matthiasmullie/minify/bin
89
 
701 daniel-mar 90
# Remove docker stuff since it might confuse services like synk
91
rm vendor/matthiasmullie/minify/Dockerfile
92
rm vendor/matthiasmullie/minify/docker-compose.yml
93
 
600 daniel-mar 94
# Enable SVN again
95
if [ -d "_svn" ]; then
96
        mv _svn .svn
97
fi
98
 
602 daniel-mar 99
composer license > vendor/licenses
868 daniel-mar 100
 
101
# -------
102
# Update composer dependencies of plugins
103
# -------
104
 
1319 daniel-mar 105
rm -rf plugins/viathinksoft/publicPages/100_whois/whois/xml/vendor/
1034 daniel-mar 106
composer update --no-dev -d plugins/viathinksoft/publicPages/100_whois/whois/xml/
868 daniel-mar 107
composer license -d plugins/viathinksoft/publicPages/100_whois/whois/xml/ > plugins/viathinksoft/publicPages/100_whois/whois/xml/vendor/licenses
108
remove_vendor_rubbish plugins/viathinksoft/publicPages/100_whois/whois/xml/
109
 
1319 daniel-mar 110
rm -rf plugins/viathinksoft/publicPages/100_whois/whois/json/vendor/
1034 daniel-mar 111
composer update --no-dev -d plugins/viathinksoft/publicPages/100_whois/whois/json/
868 daniel-mar 112
composer license -d plugins/viathinksoft/publicPages/100_whois/whois/json/ > plugins/viathinksoft/publicPages/100_whois/whois/json/vendor/licenses
113
remove_vendor_rubbish plugins/viathinksoft/publicPages/100_whois/whois/json/
874 daniel-mar 114
 
1319 daniel-mar 115
# !!! Great tool for escaping these hotfixes: https://dwaves.de/tools/escape/ !!!
116
 
874 daniel-mar 117
# Change the PHP 7.2 requirement to PHP 7.0
118
# Since this is no official packagist package, composer does not know the required php version,
119
# so we do not need to patch platform_check.php
120
sed -i 's@private function serialize($item): void@private function serialize($item)/*: void*/  // ViaThinkSoft: Removed ": void" for PHP 7.0 compatibility@g' plugins/viathinksoft/publicPages/100_whois/whois/json/vendor/aywan/php-json-canonicalization/src/Canonicalizator.php
1068 daniel-mar 121
 
1319 daniel-mar 122
# Apply hotfix: https://github.com/aywan/php-json-canonicalization/issues/1
123
sed -i 's@\$formatted = rtrim(\$formatted, \x27\.0\x27);@\$formatted = rtrim(\$formatted, \x270\x27);\$formatted = rtrim(\$formatted, \x27\.\x27); \/\/Hotfix: https:\/\/github\.com\/aywan\/php-json-canonicalization\/issues\/1@g' plugins/viathinksoft/publicPages/100_whois/whois/json/vendor/aywan/php-json-canonicalization/src/Utils.php
124
sed -i 's@\$parts\[0\] = rtrim(\$parts\[0\], \x27\.0\x27);@\$parts\[0\] = rtrim(\$parts\[0\], \x270\x27);\$parts\[0\] = rtrim(\$parts\[0\], \x27\.\x27); \/\/Hotfix: https:\/\/github\.com\/aywan\/php-json-canonicalization\/issues\/1@g' plugins/viathinksoft/publicPages/100_whois/whois/json/vendor/aywan/php-json-canonicalization/src/Utils.php
125
 
1068 daniel-mar 126
# Fix symfony/polyfill-mbstring to make it compatible with PHP 8.2
127
# The author does know about the problem (I have opened a GitHub issue), but they did not sync it from the symfony main repo (as polyfill-mbstring is just a fraction of it, for composer)
128
# see https://github.com/symfony/polyfill-mbstring/pull/11
129
sed -i 's@if (\\is_array(\$fromEncoding) || false !== strpos(\$fromEncoding, \x27,\x27)) {@if (\\is_array(\$fromEncoding) || (null !== \$fromEncoding \&\& false !== strpos(\$fromEncoding, \x27,\x27))) {@g' vendor/symfony/polyfill-mbstring/Mbstring.php
1376 daniel-mar 130
 
131
# Get latest version of WEID converter
132
curl https://raw.githubusercontent.com/frdl/weid/gh-pages/WeidOidConverter.js > plugins/viathinksoft/objectTypes/oid/WeidOidConverter.js
1379 daniel-mar 133
curl https://raw.githubusercontent.com/frdl/weid/gh-pages/WeidOidConverter.php > plugins/viathinksoft/objectTypes/oid/WeidOidConverter.class.php