Fixed and closed #455: meta-content is reset to defaults only on the first application start.
This commit is contained in:
parent
ceb228f937
commit
e04e02ed9c
7 changed files with 58 additions and 44 deletions
|
@ -16,5 +16,5 @@ using System.Reflection;
|
||||||
//
|
//
|
||||||
// You can specify all the values or you can default the Revision and Build Numbers
|
// You can specify all the values or you can default the Revision and Build Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
[assembly: AssemblyVersion("3.0.1.460")]
|
[assembly: AssemblyVersion("3.0.1.461")]
|
||||||
[assembly: AssemblyFileVersion("3.0.1.460")]
|
[assembly: AssemblyFileVersion("3.0.1.461")]
|
||||||
|
|
|
@ -142,6 +142,10 @@ namespace ScrewTurn.Wiki.Tests {
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool IsFirstApplicationStart() {
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,6 +59,8 @@ namespace ScrewTurn.Wiki {
|
||||||
private bool bulkUpdating = false;
|
private bool bulkUpdating = false;
|
||||||
private Dictionary<string, string> configData = null;
|
private Dictionary<string, string> configData = null;
|
||||||
|
|
||||||
|
private bool isFirstStart = false;
|
||||||
|
|
||||||
private string GetFullPath(string name) {
|
private string GetFullPath(string name) {
|
||||||
return Path.Combine(host.GetSettingValue(SettingName.PublicDirectory), name);
|
return Path.Combine(host.GetSettingValue(SettingName.PublicDirectory), name);
|
||||||
}
|
}
|
||||||
|
@ -95,6 +97,7 @@ namespace ScrewTurn.Wiki {
|
||||||
|
|
||||||
if(!File.Exists(GetFullPath(ConfigFile))) {
|
if(!File.Exists(GetFullPath(ConfigFile))) {
|
||||||
File.Create(GetFullPath(ConfigFile)).Close();
|
File.Create(GetFullPath(ConfigFile)).Close();
|
||||||
|
isFirstStart = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!File.Exists(GetFullPath(RecentChangesFile))) {
|
if(!File.Exists(GetFullPath(RecentChangesFile))) {
|
||||||
|
@ -1234,6 +1237,14 @@ namespace ScrewTurn.Wiki {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Determines whether the application was started for the first time.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns><c>true</c> if the application was started for the first time, <c>false</c> otherwise.</returns>
|
||||||
|
public bool IsFirstApplicationStart() {
|
||||||
|
return isFirstStart;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,39 +68,34 @@ namespace ScrewTurn.Wiki {
|
||||||
ISettingsStorageProviderV30 ssp = ProviderLoader.LoadSettingsStorageProvider(WebConfigurationManager.AppSettings["SettingsStorageProvider"]);
|
ISettingsStorageProviderV30 ssp = ProviderLoader.LoadSettingsStorageProvider(WebConfigurationManager.AppSettings["SettingsStorageProvider"]);
|
||||||
ssp.Init(Host.Instance, GetSettingsStorageProviderConfiguration());
|
ssp.Init(Host.Instance, GetSettingsStorageProviderConfiguration());
|
||||||
Collectors.SettingsProvider = ssp;
|
Collectors.SettingsProvider = ssp;
|
||||||
//Settings.Instance = new Settings(ssp);
|
|
||||||
|
|
||||||
if(!(ssp is SettingsStorageProvider)) {
|
if(!(ssp is SettingsStorageProvider)) {
|
||||||
// Update DLLs from public\Plugins
|
// Update DLLs from public\Plugins
|
||||||
UpdateDllsIntoSettingsProvider(ssp, ProviderLoader.SettingsStorageProviderAssemblyName);
|
UpdateDllsIntoSettingsProvider(ssp, ProviderLoader.SettingsStorageProviderAssemblyName);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize authorization managers
|
if(ssp.IsFirstApplicationStart()) {
|
||||||
//AuthReader.Instance = new AuthReader(Settings.Provider);
|
if(ssp.GetMetaDataItem(MetaDataItem.AccountActivationMessage, null) == "")
|
||||||
//AuthWriter.Instance = new AuthWriter(Settings.Provider);
|
ssp.SetMetaDataItem(MetaDataItem.AccountActivationMessage, null, Defaults.AccountActivationMessageContent);
|
||||||
//AuthChecker.Instance = new AuthChecker(Settings.Provider);
|
if(ssp.GetMetaDataItem(MetaDataItem.EditNotice, null) == "")
|
||||||
|
ssp.SetMetaDataItem(MetaDataItem.EditNotice, null, Defaults.EditNoticeContent);
|
||||||
if(ssp.GetMetaDataItem(MetaDataItem.AccountActivationMessage, null) == "")
|
if(ssp.GetMetaDataItem(MetaDataItem.Footer, null) == "")
|
||||||
ssp.SetMetaDataItem(MetaDataItem.AccountActivationMessage, null, Defaults.AccountActivationMessageContent);
|
ssp.SetMetaDataItem(MetaDataItem.Footer, null, Defaults.FooterContent);
|
||||||
if(ssp.GetMetaDataItem(MetaDataItem.EditNotice, null) == "")
|
if(ssp.GetMetaDataItem(MetaDataItem.Header, null) == "")
|
||||||
ssp.SetMetaDataItem(MetaDataItem.EditNotice, null, Defaults.EditNoticeContent);
|
ssp.SetMetaDataItem(MetaDataItem.Header, null, Defaults.HeaderContent);
|
||||||
if(ssp.GetMetaDataItem(MetaDataItem.Footer, null) == "")
|
if(ssp.GetMetaDataItem(MetaDataItem.PasswordResetProcedureMessage, null) == "")
|
||||||
ssp.SetMetaDataItem(MetaDataItem.Footer, null, Defaults.FooterContent);
|
ssp.SetMetaDataItem(MetaDataItem.PasswordResetProcedureMessage, null, Defaults.PasswordResetProcedureMessageContent);
|
||||||
if(ssp.GetMetaDataItem(MetaDataItem.Header, null) == "")
|
if(ssp.GetMetaDataItem(MetaDataItem.Sidebar, null) == "")
|
||||||
ssp.SetMetaDataItem(MetaDataItem.Header, null, Defaults.HeaderContent);
|
ssp.SetMetaDataItem(MetaDataItem.Sidebar, null, Defaults.SidebarContent);
|
||||||
if(ssp.GetMetaDataItem(MetaDataItem.PasswordResetProcedureMessage, null) == "")
|
if(ssp.GetMetaDataItem(MetaDataItem.PageChangeMessage, null) == "")
|
||||||
ssp.SetMetaDataItem(MetaDataItem.PasswordResetProcedureMessage, null, Defaults.PasswordResetProcedureMessageContent);
|
ssp.SetMetaDataItem(MetaDataItem.PageChangeMessage, null, Defaults.PageChangeMessage);
|
||||||
if(ssp.GetMetaDataItem(MetaDataItem.Sidebar, null) == "")
|
if(ssp.GetMetaDataItem(MetaDataItem.DiscussionChangeMessage, null) == "")
|
||||||
ssp.SetMetaDataItem(MetaDataItem.Sidebar, null, Defaults.SidebarContent);
|
ssp.SetMetaDataItem(MetaDataItem.DiscussionChangeMessage, null, Defaults.DiscussionChangeMessage);
|
||||||
if(ssp.GetMetaDataItem(MetaDataItem.PageChangeMessage, null) == "")
|
if(ssp.GetMetaDataItem(MetaDataItem.ApproveDraftMessage, null) == "") {
|
||||||
ssp.SetMetaDataItem(MetaDataItem.PageChangeMessage, null, Defaults.PageChangeMessage);
|
ssp.SetMetaDataItem(MetaDataItem.ApproveDraftMessage, null, Defaults.ApproveDraftMessage);
|
||||||
if(ssp.GetMetaDataItem(MetaDataItem.DiscussionChangeMessage, null) == "")
|
}
|
||||||
ssp.SetMetaDataItem(MetaDataItem.DiscussionChangeMessage, null, Defaults.DiscussionChangeMessage);
|
|
||||||
if(ssp.GetMetaDataItem(MetaDataItem.ApproveDraftMessage, null) == "") {
|
|
||||||
ssp.SetMetaDataItem(MetaDataItem.ApproveDraftMessage, null, Defaults.ApproveDraftMessage);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load MIME Types
|
|
||||||
MimeTypes.Init();
|
MimeTypes.Init();
|
||||||
|
|
||||||
// Load Providers
|
// Load Providers
|
||||||
|
@ -190,22 +185,6 @@ namespace ScrewTurn.Wiki {
|
||||||
Collectors.TryEnable(Settings.DefaultCacheProvider);
|
Collectors.TryEnable(Settings.DefaultCacheProvider);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load Snippets and templates
|
|
||||||
//Snippets.Instance = new Snippets();
|
|
||||||
//Templates.Instance = new Templates();
|
|
||||||
|
|
||||||
// Load Pages
|
|
||||||
//Pages.Instance = new Pages();
|
|
||||||
|
|
||||||
// Load Nav. Paths
|
|
||||||
//NavigationPaths.Instance = new NavigationPaths();
|
|
||||||
|
|
||||||
// Create Collisions class
|
|
||||||
//Collisions.Instance = new Collisions();
|
|
||||||
|
|
||||||
// Create Redirections class
|
|
||||||
//Redirections.Instance = new Redirections();
|
|
||||||
|
|
||||||
// Create the Main Page, if needed
|
// Create the Main Page, if needed
|
||||||
if(Pages.FindPage(Settings.DefaultPage) == null) CreateMainPage();
|
if(Pages.FindPage(Settings.DefaultPage) == null) CreateMainPage();
|
||||||
|
|
||||||
|
|
|
@ -237,6 +237,12 @@ namespace ScrewTurn.Wiki.PluginFramework {
|
||||||
/// <exception cref="ArgumentException">If <paramref name="oldName"/> or <paramref name="newName"/> are empty.</exception>
|
/// <exception cref="ArgumentException">If <paramref name="oldName"/> or <paramref name="newName"/> are empty.</exception>
|
||||||
bool UpdateOutgoingLinksForRename(string oldName, string newName);
|
bool UpdateOutgoingLinksForRename(string oldName, string newName);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Determines whether the application was started for the first time.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns><c>true</c> if the application was started for the first time, <c>false</c> otherwise.</returns>
|
||||||
|
bool IsFirstApplicationStart();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -19,6 +19,11 @@ namespace ScrewTurn.Wiki.Plugins.SqlCommon {
|
||||||
|
|
||||||
private IAclManager aclManager;
|
private IAclManager aclManager;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Holds a value indicating whether the application was started for the first time.
|
||||||
|
/// </summary>
|
||||||
|
protected bool isFirstStart = false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes the Storage Provider.
|
/// Initializes the Storage Provider.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -1300,6 +1305,14 @@ namespace ScrewTurn.Wiki.Plugins.SqlCommon {
|
||||||
return somethingUpdated || rows > 0;
|
return somethingUpdated || rows > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Determines whether the application was started for the first time.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns><c>true</c> if the application was started for the first time, <c>false</c> otherwise.</returns>
|
||||||
|
public bool IsFirstApplicationStart() {
|
||||||
|
return isFirstStart;
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region AclManager backend methods
|
#region AclManager backend methods
|
||||||
|
|
|
@ -13,7 +13,7 @@ namespace ScrewTurn.Wiki.Plugins.SqlServer {
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class SqlServerSettingsStorageProvider : SqlSettingsStorageProviderBase {
|
public class SqlServerSettingsStorageProvider : SqlSettingsStorageProviderBase {
|
||||||
|
|
||||||
private readonly ComponentInformation info = new ComponentInformation("SQL Server Settings Storage Provider", "ScrewTurn Software", "3.0.1.446", "http://www.screwturn.eu", "http://www.screwturn.eu/Version/SQLServerProv/Settings.txt");
|
private readonly ComponentInformation info = new ComponentInformation("SQL Server Settings Storage Provider", "ScrewTurn Software", "3.0.1.461", "http://www.screwturn.eu", "http://www.screwturn.eu/Version/SQLServerProv/Settings.txt");
|
||||||
|
|
||||||
private readonly SqlServerCommandBuilder commandBuilder = new SqlServerCommandBuilder();
|
private readonly SqlServerCommandBuilder commandBuilder = new SqlServerCommandBuilder();
|
||||||
|
|
||||||
|
@ -136,6 +136,7 @@ namespace ScrewTurn.Wiki.Plugins.SqlServer {
|
||||||
protected override void CreateOrUpdateDatabaseIfNecessary() {
|
protected override void CreateOrUpdateDatabaseIfNecessary() {
|
||||||
if(!SchemaExists()) {
|
if(!SchemaExists()) {
|
||||||
CreateStandardSchema();
|
CreateStandardSchema();
|
||||||
|
isFirstStart = true;
|
||||||
}
|
}
|
||||||
if(SchemaNeedsUpdate()) {
|
if(SchemaNeedsUpdate()) {
|
||||||
// Run minor update batches...
|
// Run minor update batches...
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue