Reattaching a region was failing if the estate name had not changed (issue 5035).

Using the RemoteAdmin API to close then recreate a region would fail if the estate name had not changed. If the estate name /was/ changed then the existing estate would be renamed rather than a new one being created. The problem really arose from a lack of distinction in the data storage layer between creating new estates and loading existing ones.
This commit is contained in:
Kevin Houlihan
2011-09-12 23:08:16 +01:00
committed by Justin Clark-Casey (justincc)
parent 9046651583
commit 1458fab82c
8 changed files with 287 additions and 166 deletions

View File

@@ -741,21 +741,30 @@ namespace OpenSim.ApplicationPlugins.RemoteController
}
// Create a new estate with the name provided
region.EstateSettings = m_application.EstateDataService.LoadEstateSettings(region.RegionID, true);
region.EstateSettings = m_application.EstateDataService.CreateNewEstate();
region.EstateSettings.EstateName = (string) requestData["estate_name"];
region.EstateSettings.EstateOwner = userID;
// Persistence does not seem to effect the need to save a new estate
region.EstateSettings.Save();
if (!m_application.EstateDataService.LinkRegion(region.RegionID, (int) region.EstateSettings.EstateID))
throw new Exception("Failed to join estate.");
}
else
{
int estateID = estateIDs[0];
region.EstateSettings = m_application.EstateDataService.LoadEstateSettings(estateID);
region.EstateSettings = m_application.EstateDataService.LoadEstateSettings(region.RegionID, false);
if (!m_application.EstateDataService.LinkRegion(region.RegionID, estateID))
throw new Exception("Failed to join estate.");
if (region.EstateSettings.EstateID != estateID)
{
// The region is already part of an estate, but not the one we want.
region.EstateSettings = m_application.EstateDataService.LoadEstateSettings(estateID);
if (!m_application.EstateDataService.LinkRegion(region.RegionID, estateID))
throw new Exception("Failed to join estate.");
}
}
// Create the region and perform any initial initialization