1
0
mirror of https://github.com/anope/anope.git synced 2026-07-10 05:03:13 +02:00

BUILD : 1.7.15 (1162) BUGS : 604 NOTES : Added functions to let modules backup their own databases and added this functionality to the bundled modules

git-svn-id: svn://svn.anope.org/anope/trunk@1162 31f1291d-b8d6-0310-a050-a5561fc1590b


git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@884 5417fbe8-f217-4b02-8779-1006273d7864
This commit is contained in:
geniusdex geniusdex@31f1291d-b8d6-0310-a050-a5561fc1590b
2006-09-29 17:54:07 +00:00
parent c565a28c43
commit f11e06eca8
6 changed files with 99 additions and 1 deletions
+16
View File
@@ -76,6 +76,7 @@ int ns_do_drop(User * u);
void hsreq_save_db(void);
void hsreq_load_db(void);
int hsreqevt_db_saving(int argc, char **argv);
int hsreqevt_db_backup(int argc, char **argv);
void my_load_config(void);
void my_add_languages(void);
@@ -117,6 +118,9 @@ int AnopeInit(int argc, char **argv)
hook = createEventHook(EVENT_DB_SAVING, hsreqevt_db_saving);
moduleAddEventHook(hook);
hook = createEventHook(EVENT_DB_BACKUP, hsreqevt_db_backup);
moduleAddEventHook(hook);
moduleSetHostHelp(hs_help);
moduleAddAuthor(AUTHOR);
moduleAddVersion(VERSION);
@@ -680,6 +684,18 @@ int hsreqevt_db_saving(int argc, char **argv)
return MOD_CONT;
}
int hsreqevt_db_backup(int argc, char **argv)
{
if ((argc >= 1) && (stricmp(argv[0], EVENT_START) == 0)) {
if (HSRequestDBName)
ModuleDatabaseBackup(HSRequestDBName);
else
ModuleDatabaseBackup(HSREQ_DEFAULT_DBNAME);
}
return MOD_CONT;
}
void my_load_config(void)
{
int i;
+15
View File
@@ -55,6 +55,7 @@ void m_AddLanguages(void);
int mLoadData(void);
int mSaveData(int argc, char **argv);
int mBackupData(int argc, char **argv);
int mLoadConfig();
int mEventReload(int argc, char **argv);
@@ -99,6 +100,9 @@ int AnopeInit(int argc, char **argv)
hook = createEventHook(EVENT_DB_SAVING, mSaveData);
status = moduleAddEventHook(hook);
hook = createEventHook(EVENT_DB_BACKUP, mBackupData);
status = moduleAddEventHook(hook);
hook = createEventHook(EVENT_RELOAD, mEventReload);
status = moduleAddEventHook(hook);
@@ -449,6 +453,17 @@ int mSaveData(int argc, char **argv)
return ret;
}
/**
* Backup our databases using the commands provided by Anope
* @return MOD_CONT
**/
int mBackupData(int argc, char **argv)
{
ModuleDatabaseBackup(OSInfoDBName);
return MOD_CONT;
}
/**
* Load the configuration directives from Services configuration file.
* @return 0 for success