|
@@ -391,21 +391,31 @@ function backup_local_postactiv {
|
391
|
391
|
POSTACTIV_DOMAIN_NAME=$(get_completion_param "postactiv domain")
|
392
|
392
|
fi
|
393
|
393
|
|
394
|
|
- source_directory=/var/www/${POSTACTIV_DOMAIN_NAME}/htdocs
|
395
|
|
- if [ -d $source_directory ]; then
|
396
|
|
- dest_directory=postactiv
|
397
|
|
- function_check suspend_site
|
398
|
|
- suspend_site ${POSTACTIV_DOMAIN_NAME}
|
|
394
|
+ source_directory=/var/www/${POSTACTIV_DOMAIN_NAME}/htdocs/backup
|
|
395
|
+ if [ ! -d $source_directory ]; then
|
|
396
|
+ mkdir $source_directory
|
|
397
|
+ fi
|
|
398
|
+ cp -p /var/www/${POSTACTIV_DOMAIN_NAME}/htdocs/config.php $source_directory
|
|
399
|
+ if [ -d /var/www/${POSTACTIV_DOMAIN_NAME}/htdocs/static ]; then
|
|
400
|
+ cp -rp /var/www/${POSTACTIV_DOMAIN_NAME}/htdocs/static $source_directory
|
|
401
|
+ fi
|
399
|
402
|
|
400
|
|
- function_check backup_directory_to_usb
|
401
|
|
- backup_directory_to_usb $source_directory $dest_directory
|
|
403
|
+ function_check suspend_site
|
|
404
|
+ suspend_site ${POSTACTIV_DOMAIN_NAME}
|
402
|
405
|
|
403
|
|
- function_check backup_database_to_usb
|
404
|
|
- backup_database_to_usb postactiv
|
|
406
|
+ function_check backup_directory_to_usb
|
|
407
|
+ dest_directory=postactivconfig
|
|
408
|
+ backup_directory_to_usb $source_directory $dest_directory
|
405
|
409
|
|
406
|
|
- function_check restart_site
|
407
|
|
- restart_site
|
408
|
|
- fi
|
|
410
|
+ source_directory=/var/www/${POSTACTIV_DOMAIN_NAME}/htdocs/file
|
|
411
|
+ dest_directory=postactivfile
|
|
412
|
+ backup_directory_to_usb $source_directory $dest_directory
|
|
413
|
+
|
|
414
|
+ function_check backup_database_to_usb
|
|
415
|
+ backup_database_to_usb postactiv
|
|
416
|
+
|
|
417
|
+ function_check restart_site
|
|
418
|
+ restart_site
|
409
|
419
|
}
|
410
|
420
|
|
411
|
421
|
function restore_local_postactiv {
|
|
@@ -414,6 +424,7 @@ function restore_local_postactiv {
|
414
|
424
|
fi
|
415
|
425
|
POSTACTIV_DOMAIN_NAME=$(get_completion_param "postactiv domain")
|
416
|
426
|
if [ $POSTACTIV_DOMAIN_NAME ]; then
|
|
427
|
+ echo $"Restoring postactiv"
|
417
|
428
|
temp_restore_dir=/root/temppostactiv
|
418
|
429
|
postactiv_dir=/var/www/${POSTACTIV_DOMAIN_NAME}/htdocs
|
419
|
430
|
# stop the daemons
|
|
@@ -423,55 +434,109 @@ function restore_local_postactiv {
|
423
|
434
|
function_check postactiv_create_database
|
424
|
435
|
postactiv_create_database
|
425
|
436
|
|
426
|
|
- restore_database postactiv ${POSTACTIV_DOMAIN_NAME}
|
|
437
|
+ restore_database postactiv
|
|
438
|
+ if [ -d $temp_restore_dir ]; then
|
|
439
|
+ rm -rf $temp_restore_dir
|
|
440
|
+ fi
|
|
441
|
+
|
|
442
|
+ function_check restore_directory_from_usb
|
|
443
|
+ restore_directory_from_usb $temp_restore_dir postactivconfig
|
427
|
444
|
if [ -d $temp_restore_dir ]; then
|
|
445
|
+ cp $temp_restore_dir$postactiv_dir/backup/config.php $postactiv_dir/
|
|
446
|
+ chown www-data:www-data $postactiv_dir/config.php
|
|
447
|
+ cp -rp $temp_restore_dir$postactiv_dir/static $postactiv_dir/
|
|
448
|
+ chown -R www-data:www-data $postactiv_dir/static
|
|
449
|
+ rm -rf $temp_restore_dir
|
|
450
|
+ fi
|
|
451
|
+
|
|
452
|
+ restore_directory_from_usb $temp_restore_dir postactivfile
|
|
453
|
+ if [ -d $temp_restore_dir ]; then
|
|
454
|
+ cp -rp $temp_restore_dir$postactiv_dir/file $postactiv_dir/
|
|
455
|
+ chown -R www-data:www-data $postactiv_dir/file
|
428
|
456
|
rm -rf $temp_restore_dir
|
429
|
457
|
fi
|
430
|
458
|
|
431
|
459
|
gnusocial_update_after_restore postactiv ${POSTACTIV_DOMAIN_NAME}
|
|
460
|
+
|
|
461
|
+ echo $"Restore of postactiv complete"
|
432
|
462
|
fi
|
433
|
463
|
}
|
434
|
464
|
|
435
|
465
|
function backup_remote_postactiv {
|
|
466
|
+ POSTACTIV_DOMAIN_NAME='postactiv'
|
436
|
467
|
if grep -q "postactiv domain" $COMPLETION_FILE; then
|
437
|
468
|
POSTACTIV_DOMAIN_NAME=$(get_completion_param "postactiv domain")
|
438
|
|
- temp_backup_dir=/var/www/${POSTACTIV_DOMAIN_NAME}/htdocs
|
439
|
|
- if [ -d $temp_backup_dir ]; then
|
440
|
|
- function_check suspend_site
|
441
|
|
- suspend_site ${POSTACTIV_DOMAIN_NAME}
|
|
469
|
+ fi
|
442
|
470
|
|
443
|
|
- function_check backup_database_to_friend
|
444
|
|
- backup_database_to_friend postactiv
|
|
471
|
+ source_directory=/var/www/${POSTACTIV_DOMAIN_NAME}/htdocs/backup
|
|
472
|
+ if [ ! -d $source_directory ]; then
|
|
473
|
+ mkdir $source_directory
|
|
474
|
+ fi
|
|
475
|
+ cp -p /var/www/${POSTACTIV_DOMAIN_NAME}/htdocs/config.php $source_directory
|
|
476
|
+ if [ -d /var/www/${POSTACTIV_DOMAIN_NAME}/htdocs/static ]; then
|
|
477
|
+ cp -rp /var/www/${POSTACTIV_DOMAIN_NAME}/htdocs/static $source_directory
|
|
478
|
+ fi
|
445
|
479
|
|
446
|
|
- function_check backup_directory_to_friend
|
447
|
|
- backup_directory_to_friend $temp_backup_dir postactiv
|
|
480
|
+ function_check suspend_site
|
|
481
|
+ suspend_site ${POSTACTIV_DOMAIN_NAME}
|
448
|
482
|
|
449
|
|
- function_check restart_site
|
450
|
|
- restart_site
|
451
|
|
- else
|
452
|
|
- echo $"postactiv domain specified but not found in ${temp_backup_dir}"
|
453
|
|
- fi
|
454
|
|
- fi
|
|
483
|
+ function_check backup_directory_to_friend
|
|
484
|
+ dest_directory=postactivconfig
|
|
485
|
+ backup_directory_to_friend $source_directory $dest_directory
|
|
486
|
+
|
|
487
|
+ source_directory=/var/www/${POSTACTIV_DOMAIN_NAME}/htdocs/file
|
|
488
|
+ dest_directory=postactivfile
|
|
489
|
+ backup_directory_to_friend $source_directory $dest_directory
|
|
490
|
+
|
|
491
|
+ function_check backup_database_to_friend
|
|
492
|
+ backup_database_to_friend postactiv
|
|
493
|
+
|
|
494
|
+ function_check restart_site
|
|
495
|
+ restart_site
|
455
|
496
|
}
|
456
|
497
|
|
457
|
498
|
function restore_remote_postactiv {
|
458
|
|
- if grep -q "postactiv domain" $COMPLETION_FILE; then
|
459
|
|
- POSTACTIV_DOMAIN_NAME=$(get_completion_param "postactiv domain")
|
460
|
|
-
|
|
499
|
+ if ! grep -q "postactiv domain" $COMPLETION_FILE; then
|
|
500
|
+ return
|
|
501
|
+ fi
|
|
502
|
+ POSTACTIV_DOMAIN_NAME=$(get_completion_param "postactiv domain")
|
|
503
|
+ if [ $POSTACTIV_DOMAIN_NAME ]; then
|
|
504
|
+ echo $"Restoring postactiv"
|
|
505
|
+ temp_restore_dir=/root/temppostactiv
|
|
506
|
+ postactiv_dir=/var/www/${POSTACTIV_DOMAIN_NAME}/htdocs
|
461
|
507
|
# stop the daemons
|
462
|
|
- cd /var/www/${POSTACTIV_DOMAIN_NAME}/htdocs
|
|
508
|
+ cd $postactiv_dir
|
463
|
509
|
scripts/stopdaemons.sh
|
464
|
510
|
|
465
|
511
|
function_check postactiv_create_database
|
466
|
512
|
postactiv_create_database
|
467
|
513
|
|
468
|
514
|
function_check restore_database_from_friend
|
469
|
|
- restore_database_from_friend postactiv ${POSTACTIV_DOMAIN_NAME}
|
470
|
|
- if [ -d /root/temppostactiv ]; then
|
471
|
|
- rm -rf /root/temppostactiv
|
|
515
|
+ restore_database_from_friend postactiv
|
|
516
|
+ if [ -d $temp_restore_dir ]; then
|
|
517
|
+ rm -rf $temp_restore_dir
|
|
518
|
+ fi
|
|
519
|
+
|
|
520
|
+ function_check restore_directory_from_friend
|
|
521
|
+ restore_directory_from_friend $temp_restore_dir postactivconfig
|
|
522
|
+ if [ -d $temp_restore_dir ]; then
|
|
523
|
+ cp $temp_restore_dir$postactiv_dir/backup/config.php $postactiv_dir/
|
|
524
|
+ chown www-data:www-data $postactiv_dir/config.php
|
|
525
|
+ cp -rp $temp_restore_dir$postactiv_dir/static $postactiv_dir/
|
|
526
|
+ chown -R www-data:www-data $postactiv_dir/static
|
|
527
|
+ rm -rf $temp_restore_dir
|
|
528
|
+ fi
|
|
529
|
+
|
|
530
|
+ restore_directory_from_friend $temp_restore_dir postactivfile
|
|
531
|
+ if [ -d $temp_restore_dir ]; then
|
|
532
|
+ cp -rp $temp_restore_dir$postactiv_dir/file $postactiv_dir/
|
|
533
|
+ chown -R www-data:www-data $postactiv_dir/file
|
|
534
|
+ rm -rf $temp_restore_dir
|
472
|
535
|
fi
|
473
|
536
|
|
474
|
537
|
gnusocial_update_after_restore postactiv ${POSTACTIV_DOMAIN_NAME}
|
|
538
|
+
|
|
539
|
+ echo $"Restore of postactiv complete"
|
475
|
540
|
fi
|
476
|
541
|
}
|
477
|
542
|
|