Skip to content

Commit b69d37c

Browse files
committed
fix _prep function and add _fetch_missing_files
1 parent d8955e1 commit b69d37c

File tree

1 file changed

+47
-16
lines changed

1 file changed

+47
-16
lines changed

bin/mirror_with_wget.sh

+47-16
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,22 @@ set -o errtrace
33
set -o nounset
44

55

6-
# SCRIPT DISABLED
7-
echo 'ERROR: script disabled' 1>&2
8-
exit 1
9-
10-
116
function _change_to_repo_dir {
127
cd "${0%/*}/.." >/dev/null
138
}
149

1510

11+
function _prep {
12+
printf "\e[1m\e[7m %-80s\e[0m\n" 'Preparing to State of the Commons'
13+
if [[ -d temp_download ]]
14+
then
15+
# Remove modified HTML files to prevent issues with --continue
16+
find temp_download -name '*.html' -delete
17+
mv temp_download stateof.creativecommons.org
18+
fi
19+
}
20+
21+
1622
function _mirror {
1723
# Note: the --mirror option is equivalent to:
1824
# --recursive
@@ -21,6 +27,7 @@ function _mirror {
2127
# --no-remove-listing
2228
wget \
2329
--adjust-extension \
30+
--backup-converted \
2431
--continue \
2532
--convert-links \
2633
--exclude-directories=${1}comments,${1}feed,${1}wp-json \
@@ -34,17 +41,6 @@ function _mirror {
3441
}
3542

3643

37-
prep() {
38-
printf "\e[1m\e[7m %-80s\e[0m\n" 'Preparing to State of the Commons'
39-
if [[ -d temp_download ]]
40-
then
41-
# Remove modified HTML files to prevent issues with --continue
42-
find temp_download -name '*.html' -delete
43-
mv temp_download stateof.creativecommons.org
44-
fi
45-
}
46-
47-
4844
function _2017_root {
4945
printf "\e[1m\e[7m %-80s\e[0m\n" 'Mirroring 2017 State of the Commons'
5046
# Mirror
@@ -69,6 +65,40 @@ function _2015_subdir {
6965
}
7066

7167

68+
function _fetch_missing_files {
69+
printf "\e[1m\e[7m %-80s\e[0m\n" 'Fetching missing files'
70+
local _dom='stateof.creativecommons.org'
71+
72+
local _dir='/wp-content/uploads/2018/04/'
73+
local _file='arrow_down_blk.svg'
74+
mkdir -p "${_dom}/${_dir}"
75+
wget --continue -O ${_dom}${_dir}${_file} "https://${_dom}${_dir}${_file}"
76+
77+
local _dir='/wp-includes/js/'
78+
local _file='wp-emoji-release.min.js'
79+
mkdir -p "${_dom}/${_dir}"
80+
wget --continue -O ${_dom}${_dir}${_file} "https://${_dom}${_dir}${_file}"
81+
82+
local _dir='/2016/wp-includes/js/'
83+
local _file='wp-emoji-release.min.js'
84+
mkdir -p "${_dom}/${_dir}"
85+
wget --continue -O ${_dom}${_dir}${_file} "https://${_dom}${_dir}${_file}"
86+
87+
local _d='/2016/wp-content/plugins/revslider/public/assets/js/extensions/'
88+
local _dir="${_d}"
89+
mkdir -p "${_dom}/${_dir}"
90+
for _file in \
91+
'revolution.extension.slideanims.min.js' \
92+
'revolution.extension.actions.min.js' \
93+
'revolution.extension.layeranimation.min.js' \
94+
'revolution.extension.parallax.min.js'
95+
do
96+
wget --continue -O ${_dom}${_dir}${_file} \
97+
"https://${_dom}${_dir}${_file}"
98+
done
99+
}
100+
101+
72102
function _cleanup {
73103
printf "\e[1m\e[7m %-80s\e[0m\n" 'Performing clean-up on mirror'
74104
if [[ -d stateof.creativecommons.org ]]
@@ -90,4 +120,5 @@ _prep
90120
_2017_root
91121
_2016_subdir
92122
_2015_subdir
123+
_fetch_missing_files
93124
_cleanup

0 commit comments

Comments
 (0)