Make client autoupdate configurable

This commit is contained in:
Martin Raiber 2011-02-17 19:31:21 +01:00
parent 981f3c1d72
commit 64d35e9c5f
6 changed files with 31 additions and 5 deletions

View File

@ -57,11 +57,14 @@ void ServerCleanupThread::operator()(void)
destroyQueries();
}
if( settings->getValue("autoupdate_clients", "true")=="true" )
{
IScopedLock lock(a_mutex);
ServerUpdate upd;
upd();
}
Server->destroy(settings);
}
while(true)
@ -102,14 +105,21 @@ void ServerCleanupThread::operator()(void)
{
IScopedLock lock(a_mutex);
ISettingsReader *settings=Server->createDBSettingsReader(db, "settings");
ScopedActiveThread sat;
ServerUpdate upd;
upd();
if( settings->getValue("autoupdate_clients", "true")=="true" )
{
ServerUpdate upd;
upd();
}
createQueries();
do_cleanup();
destroyQueries();
Server->destroy(settings);
}
}
}

View File

@ -116,8 +116,9 @@ void BackupServerGet::operator ()(void)
if(!b)
{
pipe->Write("ok");
Server->Log("server_get Thread for client "+clientname+" finished, because the identity was not recognized");
Server->Log("server_get Thread for client "+clientname+" finished, because the identity was not recognized", LL_INFO);
ServerStatus::setWrongIdent(clientname, true);
ServerLogger::reset(clientid);
delete this;
return;
@ -191,7 +192,10 @@ void BackupServerGet::operator ()(void)
ServerLogger::Log(clientid, "Sending backup incr intervall...", LL_DEBUG);
sendClientBackupIncrIntervall();
checkClientVersion();
if(server_settings->getSettings()->autoupdate_clients)
{
checkClientVersion();
}
sendClientLogdata();

View File

@ -148,6 +148,7 @@ void ServerSettings::readSettingsDefault(void)
settings.client_overwrite=true;
settings.autoshutdown=false;
settings.startup_backup_delay=settings_default->getValue("startup_backup_delay", 0);
settings.autoupdate_clients=(settings_default->getValue("autoupdate_clients", "true")=="true");
}
void ServerSettings::readSettingsClient(void)

View File

@ -24,6 +24,7 @@ struct SSettings
bool client_overwrite;
bool autoshutdown;
int startup_backup_delay;
bool autoupdate_clients;
};
class ServerSettings

View File

@ -44,10 +44,11 @@ JSON::Object getJSONClientSettings(ServerSettings &settings)
struct SGeneralSettings
{
SGeneralSettings(void): no_images(false), autoshutdown(false) {}
SGeneralSettings(void): no_images(false), autoshutdown(false), autoupdate_clients(true) {}
std::wstring backupfolder;
bool no_images;
bool autoshutdown;
bool autoupdate_clients;
};
struct SClientSettings
@ -72,6 +73,8 @@ SGeneralSettings getGeneralSettings(IDatabase *db)
ret.no_images=true;
else if(key==L"autoshutdown" && value==L"true")
ret.autoshutdown=true;
else if(key==L"autoupdate_clients" && value==L"false")
ret.autoupdate_clients=false;
}
return ret;
}
@ -123,6 +126,7 @@ void saveGeneralSettings(SGeneralSettings settings, IDatabase *db)
updateSetting(L"backupfolder", settings.backupfolder, q_get, q_update, q_insert);
updateSetting(L"no_images", settings.no_images?L"true":L"false", q_get, q_update, q_insert);
updateSetting(L"autoshutdown", settings.autoshutdown?L"true":L"false", q_get, q_update, q_insert);
updateSetting(L"autoupdate_clients", settings.autoupdate_clients?L"true":L"false", q_get, q_update, q_insert);
}
void saveClientSettings(SClientSettings settings, IDatabase *db, int clientid)
@ -455,6 +459,7 @@ ACTION_IMPL(settings)
settings.backupfolder=GET[L"backupfolder"];
settings.no_images=(GET[L"no_images"]==L"true");
settings.autoshutdown=(GET[L"autoshutdown"]==L"true");
settings.autoupdate_clients=(GET[L"autoupdate_clients"]==L"true");
updateClientSettings(0, GET, db);
saveGeneralSettings(settings, db);
@ -474,6 +479,7 @@ ACTION_IMPL(settings)
obj.set("backupfolder", settings.backupfolder);
obj.set("no_images", settings.no_images);
obj.set("autoshutdown", settings.autoshutdown);
obj.set("autoupdate_clients", settings.autoupdate_clients);
ret.set("settings", obj);
}

View File

@ -12,6 +12,10 @@
<td>#{tAutomatically shut down server}:</td>
<td><input type="checkbox" id="autoshutdown" value="true" #{autoshutdown}/></td>
</tr>
<tr>
<td>#{tAutoupdate clients}:</td>
<td><input type="checkbox" id="autoupdate_clients" value="true" #{autoupdate_clients}/></td>
</tr>
#{settings_inv}
</table>
<br />