Added way to override public directory.
This commit is contained in:
parent
ffa6f12f6b
commit
6b9dd4150b
4 changed files with 24 additions and 24 deletions
|
@ -16,5 +16,5 @@ using System.Reflection;
|
|||
//
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("3.0.4.572")]
|
||||
[assembly: AssemblyFileVersion("3.0.4.572")]
|
||||
[assembly: AssemblyVersion("3.0.4.573")]
|
||||
[assembly: AssemblyFileVersion("3.0.4.573")]
|
|
@ -12,33 +12,13 @@ namespace ScrewTurn.Wiki {
|
|||
/// </summary>
|
||||
public abstract class ProviderBase {
|
||||
|
||||
private object _syncLock = new object();
|
||||
|
||||
private bool _dataDirectoryAlreadyRead = false;
|
||||
private string _dataDirectory = null;
|
||||
|
||||
/// <summary>
|
||||
/// Sets the data directory.
|
||||
/// </summary>
|
||||
/// <param name="dataDirectory">The data directory.</param>
|
||||
public void SetDataDirectory(string dataDirectory) {
|
||||
lock(_syncLock) {
|
||||
if(_dataDirectoryAlreadyRead) throw new InvalidOperationException("Cannot set data directory when it's already been read");
|
||||
_dataDirectory = dataDirectory;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the data directory.
|
||||
/// </summary>
|
||||
/// <param name="host">The host object.</param>
|
||||
/// <returns>The data directory.</returns>
|
||||
protected string GetDataDirectory(IHostV30 host) {
|
||||
lock(_syncLock) {
|
||||
_dataDirectoryAlreadyRead = true;
|
||||
if(string.IsNullOrEmpty(_dataDirectory)) return host.GetSettingValue(SettingName.PublicDirectory);
|
||||
else return _dataDirectory;
|
||||
}
|
||||
return host.GetSettingValue(SettingName.PublicDirectory);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -22,6 +22,12 @@ namespace ScrewTurn.Wiki {
|
|||
|
||||
private static string version = null;
|
||||
|
||||
/// <summary>
|
||||
/// A value indicating whether the public directory can still be overridden.
|
||||
/// </summary>
|
||||
internal static bool CanOverridePublicDirectory = true;
|
||||
private static string _overriddenPublicDirectory = null;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the settings storage provider.
|
||||
/// </summary>
|
||||
|
@ -152,11 +158,23 @@ namespace ScrewTurn.Wiki {
|
|||
get { return System.Web.HttpRuntime.AppDomainAppPath; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the public directory, unless it's too late to do that.
|
||||
/// </summary>
|
||||
/// <param name="fullPath">The full path.</param>
|
||||
internal static void OverridePublicDirectory(string fullPath) {
|
||||
if(!CanOverridePublicDirectory) throw new InvalidOperationException("Cannot override public directory - that can only be done during Settings Storage Provider initialization");
|
||||
|
||||
_overriddenPublicDirectory = fullPath;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Public Directory of the Wiki.
|
||||
/// </summary>
|
||||
public static string PublicDirectory {
|
||||
get {
|
||||
if(!string.IsNullOrEmpty(_overriddenPublicDirectory)) return _overriddenPublicDirectory;
|
||||
|
||||
string pubDirName = PublicDirectoryName;
|
||||
if(Path.IsPathRooted(pubDirName)) return pubDirName;
|
||||
else {
|
||||
|
@ -170,7 +188,7 @@ namespace ScrewTurn.Wiki {
|
|||
/// <summary>
|
||||
/// Gets the Public Directory Name (without the full Path) of the Wiki.
|
||||
/// </summary>
|
||||
public static string PublicDirectoryName {
|
||||
private static string PublicDirectoryName {
|
||||
get {
|
||||
string dir = WebConfigurationManager.AppSettings["PublicDirectory"];
|
||||
if(string.IsNullOrEmpty(dir)) throw new InvalidConfigurationException("PublicDirectory cannot be empty or null");
|
||||
|
|
|
@ -69,6 +69,8 @@ namespace ScrewTurn.Wiki {
|
|||
ssp.Init(Host.Instance, GetSettingsStorageProviderConfiguration());
|
||||
Collectors.SettingsProvider = ssp;
|
||||
|
||||
Settings.CanOverridePublicDirectory = false;
|
||||
|
||||
if(!(ssp is SettingsStorageProvider)) {
|
||||
// Update DLLs from public\Plugins
|
||||
UpdateDllsIntoSettingsProvider(ssp, ProviderLoader.SettingsStorageProviderAssemblyName);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue