Jump to content
Sign in to follow this  
El' Rabito

extDB3 - Garbage Cleaner Fix

Recommended Posts

What it does: This fixes the problem of base parts/containers not getting deleted by the garbagecleaner.

# 1. Replace/add the stuff below in the exile.ini for extDB3

[deleteUnpaidTerritories_construction]
SQL1_1 = DELETE FROM construction WHERE deleted_at < DATE_SUB(NOW(), INTERVAL ? DAY) AND deleted_at IS NOT NULL

SQL1_INPUTS = 1

[deleteUnpaidTerritories_container]
SQL1_1 = DELETE FROM container WHERE deleted_at < DATE_SUB(NOW(), INTERVAL ? DAY) AND deleted_at IS NOT NULL

SQL1_INPUTS = 1

[addAbandonedSafes]
SQL1_1 = UPDATE container SET abandoned = NOW(), pin_code = '0000' WHERE last_updated_at < DATE_SUB(NOW(), INTERVAL ? DAY) AND class = "Exile_Container_Safe" AND territory_id IS NULL

SQL1_INPUTS = 1

[deleteBaseFlagStolen]
SQL1_1 = UPDATE territory SET deleted_at = NOW() WHERE flag_stolen_at < DATE_SUB(NOW(), INTERVAL ? DAY) AND deleted_at IS NULL
SQL2_1 = UPDATE construction SET deleted_at = (SELECT deleted_at FROM territory WHERE territory.id = construction.territory_id AND territory.deleted_at IS NOT NULL) WHERE construction.territory_id IS NOT NULL
SQL3_1 = UPDATE container SET deleted_at = (SELECT deleted_at FROM territory WHERE territory.id = container.territory_id AND territory.deleted_at IS NOT NULL) WHERE container.territory_id IS NOT NULL

SQL1_INPUTS = 1



# 2. Replace ExileServer_system_garbageCollector_cleanDatabase.sqf with the code below.

/**
 * ExileServer_system_garbageCollector_cleanDatabase
 *
 * Exile Mod
 * www.exilemod.com
 * © 2015 Exile Mod Team
 *
 * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. 
 * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
 */
 
private["_permanentlyDeleteTime", "_territoryLifeTime", "_containerLifeTime", "_constructionLifeTime", "_vehicleLifeTime", "_abandonedSafeTime", "_stolenFlagLifeTime", "_unlockLifeTime"];
_permanentlyDeleteTime	= getNumber (configFile >> "CfgSettings" >> "GarbageCollector" >> "Database" >> "permanentlyDeleteTime");
_territoryLifeTime    	= getNumber (configFile >> "CfgSettings" >> "GarbageCollector" >> "Database" >> "territoryLifeTime");
_containerLifeTime    	= getNumber (configFile >> "CfgSettings" >> "GarbageCollector" >> "Database" >> "containerLifeTime");
_constructionLifeTime 	= getNumber (configFile >> "CfgSettings" >> "GarbageCollector" >> "Database" >> "constructionLifeTime");
_vehicleLifeTime      	= getNumber (configFile >> "CfgSettings" >> "GarbageCollector" >> "Database" >> "vehicleLifeTime");
_abandonedSafeTime    	= getNumber (configFile >> "CfgSettings" >> "GarbageCollector" >> "Database" >> "abandonedTime");
_stolenFlagLifeTime		= getNumber (configFile >> "CfgSettings" >> "GarbageCollector" >> "Database" >> "stolenFlagLifeTime");
_unlockLifeTime			= getNumber (configFile >> "CfgSettings" >> "GarbageCollector" >> "Database" >> "unlockLifeTime");
format ["setAbandonedUnlocked:%1", _unlockLifeTime] call ExileServer_system_database_query_insertSingle;
format ["markDeleteOldConstructions:%1", _constructionLifeTime] call ExileServer_system_database_query_insertSingle;
format ["markDeleteUnpaidTerritories:%1", _territoryLifeTime] call ExileServer_system_database_query_insertSingle;
format ["markDeleteOldContainers:%1", _containerLifeTime] call ExileServer_system_database_query_insertSingle;
format ["markDeleteOldVehicles:%1", _vehicleLifeTime] call ExileServer_system_database_query_insertSingle;
format ["deleteUnpaidTerritories:%1", _permanentlyDeleteTime] call ExileServer_system_database_query_insertSingle;
format ["deleteUnpaidTerritories_construction:%1", _permanentlyDeleteTime] call ExileServer_system_database_query_insertSingle;
format ["deleteUnpaidTerritories_container:%1", _permanentlyDeleteTime] call ExileServer_system_database_query_insertSingle;
format ["deleteOldContainers:%1", _permanentlyDeleteTime] call ExileServer_system_database_query_insertSingle;
format ["deleteOldConstructions:%1", _permanentlyDeleteTime] call ExileServer_system_database_query_insertSingle;
format ["deleteOldVehicles:%1", _permanentlyDeleteTime] call ExileServer_system_database_query_insertSingle;
format ["deleteBaseFlagStolen:%1", _stolenFlagLifeTime] call ExileServer_system_database_query_insertSingle;
format ["addAbandonedSafes:%1", _abandonedSafeTime] call ExileServer_system_database_query_insertSingle;

# 3. ExileServer_object_container_database_insert.sqf & ExileServer_object_construction_database_insert.sqf (BrettNordin/Extdb3) (Line 19 in both files)
This fixes the issues with elements/containers not despawning outside of territories.

_territoryID = if (isNull _territoryFlag) then { 'NULL' } else  { _territoryFlag getVariable ["ExileDatabaseID", '']};

Change to

_territoryID = if (isNull _territoryFlag) then { '' } else  { _territoryFlag getVariable ["ExileDatabaseID", '']};


Support Me: www.buymeacoffee.com/ElRabito

  • Like 3
  • Thanks 1

Share this post


Link to post
Share on other sites

Hi, i have this problem with extDB2, Any idea if there is a fix for this? Say i delete a flag, all the objects and storage will end up coming back, so everytime someones bases auto deletes due to not paying for flag i have to go into the DB and manually delete each object.

Share this post


Link to post
Share on other sites

I have an error and the server does not start
Error in expression <llExtension _query);
Error position: <select 0
Error Generic error in expression
File Exile_Server_Overrides\ExileServer_system_database_query_insertSingle.sqf..., line 17

Share this post


Link to post
Share on other sites
9 minutes ago, DEH4NK said:

I have an error and the server does not start
Error in expression <llExtension _query);
Error position: <select 0
Error Generic error in expression
File Exile_Server_Overrides\ExileServer_system_database_query_insertSingle.sqf..., line 17


Works for me and others, you must have a error/problem somewhere.

Share this post


Link to post
Share on other sites

In my exile.ini I changed [addAbandonedSafes] and [DeleteBaseFlagStolen] but it did not have [DeleteUnpaidTerritories_construction] and [DeleteUnpaidTerritories_container] and I added them https://pastebin.com/Kitdfb2a In extDB3 logs,

extDB3 error: SQL_CUSTOM: Error No Custom Call Not Found: Input String deleteUnpaidTerritories_construction: 7
extDB3: SQL_CUSTOM: Error No Custom Call Not Found: Callname deleteUnpaidTerritories_construction

Share this post


Link to post
Share on other sites
18 minutes ago, DEH4NK said:

extDB3 error: SQL_CUSTOM: Error No Custom Call Not Found: Input String deleteUnpaidTerritories_construction: 7
extDB3: SQL_CUSTOM: Error No Custom Call Not Found: Callname deleteUnpaidTerritories_construction

The error says you didn't add them.

Share this post


Link to post
Share on other sites

Then try again and be sure that you put it in the exile.ini for extdb3 and not in the the one for extdb2.

Share this post


Link to post
Share on other sites

Perhaps somewhere there was a syntax error when copying from here from the site and pasting into my exile.i ni I did the same thing all over again and it all started, thanks.

Share this post


Link to post
Share on other sites
Sign in to follow this  

×