|
@@ -81,7 +81,7 @@ n_delete=${n_delete:=10}
|
81
|
81
|
|
82
|
82
|
for i in $(seq $#)
|
83
|
83
|
do
|
84
|
|
- echo $1 |grep -E "^-?-h" &>/dev/null && usage
|
|
84
|
+ echo $1 |grep -E "^-?-h" &>/dev/null
|
85
|
85
|
shift
|
86
|
86
|
done
|
87
|
87
|
|
|
@@ -175,7 +175,69 @@ mass_link_edit() {
|
175
|
175
|
done
|
176
|
176
|
rm -v $text_ids $person_ids $section_ids $subsection_ids
|
177
|
177
|
;;
|
178
|
|
-
|
|
178
|
+
|
|
179
|
+ Collection)
|
|
180
|
+ collections_ids=$(fetch_all_ids $1 Collection)
|
|
181
|
+ publication_ids=$(fetch_all_ids $1 Publication)
|
|
182
|
+ for i in $(seq $iteration_count)
|
|
183
|
+ do
|
|
184
|
+ cur_id=$(shuf -n1 $collections_ids)
|
|
185
|
+ publications_count=$(shuf -i1-5 -n1)
|
|
186
|
+ publication_param=$(head -n $(expr $publications_count \* $i) $publication_ids| tail -n$publications_count|tr -s "\n" ",")
|
|
187
|
+ $curcurl -d "$(curl_opt_create_$cls $publication_param)&uid=$cur_id" "$base_uri/admin/update?classname=$cls&lodel_id=$cur_id" | tee -a $logfile
|
|
188
|
+ done
|
|
189
|
+ rm -v $collections_ids $publication_ids
|
|
190
|
+ ;;
|
|
191
|
+
|
|
192
|
+ Publication)
|
|
193
|
+ publication_ids=$(fetch_all_ids $1 Publication)
|
|
194
|
+ collection_ids=$(fetch_all_ids $1 Collection)
|
|
195
|
+ for i in $(seq $iteration_count)
|
|
196
|
+ do
|
|
197
|
+ cur_id=$(shuf -n1 $publication_ids)
|
|
198
|
+ collections_count=$(shuf -i1-5 -n1)
|
|
199
|
+ collection_param=$(head -n $(expr $collections_count \* $i) $collection_ids| tail -n$collections_count|tr -s "\n" ",")
|
|
200
|
+ $curcurl -d "$(curl_opt_create_$cls $collection_param)&uid=$cur_id" "$base_uri/admin/update?classname=$cls&lodel_id=$cur_id" | tee -a $logfile
|
|
201
|
+ done
|
|
202
|
+ rm -v $publication_ids $collection_ids
|
|
203
|
+ ;;
|
|
204
|
+
|
|
205
|
+ Section)
|
|
206
|
+ section_ids=$(fetch_all_ids $1 Section)
|
|
207
|
+ child_ids=$(fetch_all_ids $1 Subsection)
|
|
208
|
+ person_ids=$(fetch_all_ids $1 Person)
|
|
209
|
+ for i in $(seq $iteration_count)
|
|
210
|
+ do
|
|
211
|
+ cur_id=$(shuf -n1 $section_ids)
|
|
212
|
+ child_count=$(shuf -i1-5 -n1)
|
|
213
|
+ person_count=$(shuf -i1-5 -n1)
|
|
214
|
+ child_param=$(head -n $(expr $child_count \* $i) $child_ids| tail -n$child_count|tr -s "\n" ",")
|
|
215
|
+ person_param=$(head -n $(expr $person_count \* $i) $person_ids| tail -n$person_count|tr -s "\n" ",")
|
|
216
|
+ $curcurl -d "$(curl_opt_create_$cls $child_param $person_param)&uid=$cur_id" "$base_uri/admin/update?classname=$cls&lodel_id=$cur_id" | tee -a $logfile
|
|
217
|
+ done
|
|
218
|
+ rm -v $section_ids $child_ids $person_ids
|
|
219
|
+ ;;
|
|
220
|
+
|
|
221
|
+ Subsection)
|
|
222
|
+ subsection_ids=$(fetch_all_ids $1 Subsection)
|
|
223
|
+ section_ids=$(fetch_all_ids $1 Section)
|
|
224
|
+ persons_ids=$(fetch_all_ids $1 Person)
|
|
225
|
+ parent_ids=$($cmktemp)
|
|
226
|
+ cat $section_ids $subsection_ids | shuf > $parent_ids
|
|
227
|
+ child_ids=$subsection_ids
|
|
228
|
+ for i in $(seq $iteration_count)
|
|
229
|
+ do
|
|
230
|
+ cur_id=$(shuf -n1 $subsection_ids)
|
|
231
|
+ child_count=$(shuf -i1-5 -n1)
|
|
232
|
+ parent_count=$(shuf -i1-5 -n1)
|
|
233
|
+ person_count=$(shuf -i1-5 -n1)
|
|
234
|
+ child_param=$(head -n $(expr $child_count \* $i) $child_ids| tail -n$child_count|tr -s "\n" ",")
|
|
235
|
+ parent_param=$(head -n $(expr $parent_count \* $i) $parent_ids| tail -n$parent_count|tr -s "\n" ",")
|
|
236
|
+ person_param=$(head -n $(expr $person_count \* $i) $persons_ids| tail -n$person_count|tr -s "\n" ",")
|
|
237
|
+ $curcurl -d "$(curl_opt_create_$cls $child_param $person_param $parent_param)&uid=$cur_id" "$base_uri/admin/update?classname=$cls&lodel_id=$cur_id" | tee -a $logfile
|
|
238
|
+ done
|
|
239
|
+ rm -v $subsection_ids $parent_ids $section_ids $persons_ids
|
|
240
|
+ ;;
|
179
|
241
|
*)
|
180
|
242
|
;;
|
181
|
243
|
|