internal static PhpConfigurationContext GetConfig(ApplicationContext/*!*/ appContext, string/*!*/ sectionName)
{
Debug.Assert(appContext != null);
PhpConfigurationContext context;
lock (loadMutex)
{
applicationContext = appContext;
int old_stamp = stamp;
// loads configuration from all relevant .config files using our Configuration Section Handler;
// although this way of loading configuration is considered deprecated, the new one is not feasible:
#pragma warning disable 618
context = (PhpConfigurationContext)ConfigurationManager.GetSection(sectionName); //ConfigurationSettings.GetConfig(sectionName);
#pragma warning restore 618
int new_stamp = stamp;
if (new_stamp != old_stamp)
{
// a new context has been loaded from .config file //
// fills in missing configuration and checks whether the configuration has been loaded properly:
if (context != null)
{
context.LoadLibrariesNoLock();
context.ValidateNoLock();
}
// validates application configuration if it has not been validated yet;
// the application configuration is shared among all requests (threads);
// therefore only the first one should validate it:
Configuration.application.ValidateNoLock();
}
}
return context;
}