UBB.Dev
Posted By: blaaskaak [7.3.x] Scheduled board close for backup - 06/26/2008 11:01 AM
I have a cronjob running that backup's my ubb database and directory. Since it's better to have the board closed while making a backup, I have added a scheduled close for ubb.

open /languages/english/generic.php

Find:
PHP Code
$ubbt_lang['COPY2CLIP'] = 'Copy'; 

Add below:
PHP Code
$ubbt_lang['BACKUPCLOSED'] = 'Because of a scheduled backup the board is closed from %s until %s'; 

Repeat editing the generic.php for every other language you have.

open /ubbthreads.php
Find:
PHP Code

$user
['USER_STYLE'] = $force ? 0 : $user['USER_STYLE'];
$html->set_style($force);


Add below:
PHP Code

// closed for backup?
$backupstarttime = "04:30";
$backupstoptime = "04:45";

$backuptime = date("H:i");
if (
$backuptime >= $backupstarttime && $backuptime < $backupstoptime) {
$insert = $ubbt_lang['BACKUPCLOSED'];
$closed = true;
$fatal_error = true;
$fatal_error_message = sprintf($insert,$backupstarttime,$backupstoptime);
}

// end closed for backup


Save, upload, and voila! Board is closed between 04:30 and 04:45.

Adjusting $backupstarttime and $backupstoptime will adjust the times the board will automaticly close.

It will also close the board for admins. The purpose of the close is to make the best database snapshop possible, so you don't want yourself messing around the forum also.

How to backup your forum? Lost of information about the subject on ubbcentral.
Posted By: sirdude Re: [7.3.x] Scheduled board close for backup - 06/26/2008 4:10 PM
'repeat this for every other language file you have' ??

i assume you mean for each distinct language, modify generic.php.. no?

:shrug:
Originally Posted by sirdude
i assume you mean for each distinct language, modify generic.php.. no?


Yeppers smile
Thanks Yarp!
Posted By: Mark_S Re: [7.3.x] Scheduled board close for backup - 01/15/2018 5:35 PM
This continues to work in version 7.6.1 + patch so version 7.6.1.1
© UBB.Developers