Skip to content

Commit f3d7915

Browse files
committed
names the lastsynced file to include the both the machine name and appdomainappid. allows {appdomainappid} to exist as a token in the examine index path. adds some error checking to the examine mgmt controller if it cannot read the details. adds a couple of public readonly properties to the base examine indexer so these details show up in the examine mgmt dashboard. updates all config files to work with shared storage on a single machine, of course we should not ship with these settings but i wanted to commit the changes for a reference.
1 parent 18839b4 commit f3d7915

File tree

15 files changed

+85
-326
lines changed

15 files changed

+85
-326
lines changed

src/Umbraco.Core/StringExtensions.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,17 @@ internal static string ReplaceNonAlphanumericChars(this string input, char repla
112112
return mName;
113113
}
114114

115+
internal static string ReplaceNonAlphanumericChars(this string input, string replacement)
116+
{
117+
//any character that is not alphanumeric, convert to a hyphen
118+
var mName = input;
119+
foreach (var c in mName.ToCharArray().Where(c => !char.IsLetterOrDigit(c)))
120+
{
121+
mName = mName.Replace(c.ToString(CultureInfo.InvariantCulture), replacement);
122+
}
123+
return mName;
124+
}
125+
115126
/// <summary>
116127
/// Cleans string to aid in preventing xss attacks.
117128
/// </summary>

src/Umbraco.Core/Sync/DatabaseServerMessenger.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using System.IO;
55
using System.Linq;
66
using System.Threading;
7+
using System.Web;
78
using System.Web.Script.Serialization;
89
using log4net;
910
using Newtonsoft.Json;
@@ -229,8 +230,8 @@ internal void UpdateRefreshers(JArray jsonArray)
229230

230231
internal void ReadLastSynced()
231232
{
232-
var tempFolder = IOHelper.MapPath("~/App_Data/TEMP/DistCache");
233-
var file = Path.Combine(tempFolder, NetworkHelper.FileSafeMachineName + "-lastsynced.txt");
233+
var tempFolder = IOHelper.MapPath("~/App_Data/TEMP/DistCache/" + NetworkHelper.FileSafeMachineName);
234+
var file = Path.Combine(tempFolder, HttpRuntime.AppDomainAppId.ReplaceNonAlphanumericChars(string.Empty) + "-lastsynced.txt");
234235
if (File.Exists(file))
235236
{
236237
var content = File.ReadAllText(file);
@@ -252,13 +253,13 @@ internal void ReadLastSynced()
252253
private void SaveLastSynced(int id)
253254
{
254255
_lastId = id;
255-
var tempFolder = IOHelper.MapPath("~/App_Data/TEMP/DistCache");
256+
var tempFolder = IOHelper.MapPath("~/App_Data/TEMP/DistCache/" + NetworkHelper.FileSafeMachineName);
256257
if (Directory.Exists(tempFolder) == false)
257258
{
258259
Directory.CreateDirectory(tempFolder);
259260
}
260261
//save the file
261-
File.WriteAllText(Path.Combine(tempFolder, NetworkHelper.FileSafeMachineName + "-lastsynced.txt"), id.ToString(CultureInfo.InvariantCulture));
262+
File.WriteAllText(Path.Combine(tempFolder, HttpRuntime.AppDomainAppId.ReplaceNonAlphanumericChars(string.Empty) + "-lastsynced.txt"), id.ToString(CultureInfo.InvariantCulture));
262263
}
263264

264265

src/Umbraco.Tests/Configurations/DashboardSettings/Dashboard.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
</control>
2929
</tab>
3030
<tab caption="Examine Management">
31-
<control>/umbraco/dashboard/ExamineManagement.ascx</control>
31+
<control>views/dashboard/developer/examinemanagement.html</control>
3232
</tab>
3333
</section>
3434

src/Umbraco.Web.UI.Client/src/views/dashboard/developer/examinemanagement.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ <h3>Examine Management</h3>
99
<h4>Indexers</h4>
1010

1111
<ul ng-hide="loading">
12+
13+
<div ng-if="indexError" class="alert alert-error">
14+
<p>{{indexError.errorMsg}}</p>
15+
<p>{{indexError.data.Message}}</p>
16+
</div>
17+
1218
<li class="provider" ng-repeat="indexer in indexerDetails">
1319

1420
<a href="" ng-click="toggle(indexer, 'showProperties')">

src/Umbraco.Web.UI.Client/src/views/dashboard/developer/examinemgmt.controller.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,11 @@ function examineMgmtController($scope, umbRequestHelper, $log, $http, $q, $timeo
118118
//get the indexer details
119119
umbRequestHelper.resourcePromise(
120120
$http.get(umbRequestHelper.getApiUrl("examineMgmtBaseUrl", "GetIndexerDetails")),
121-
'Failed to retrieve indexer details')
121+
'Failed to retrieve indexer details, check log for details')
122122
.then(function(data) {
123123
$scope.indexerDetails = data;
124+
}, function (reason) {
125+
$scope.indexError = reason;
124126
}),
125127

126128
//get the searcher details

src/Umbraco.Web.UI/config/ExamineIndex.config

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ More information and documentation can be found on CodePlex: http://umbracoexami
99
<ExamineLuceneIndexSets>
1010

1111
<!-- The internal index set used by Umbraco back-office - DO NOT REMOVE -->
12-
<IndexSet SetName="InternalIndexSet" IndexPath="~/App_Data/TEMP/ExamineIndexes/Internal/" />
12+
<IndexSet SetName="InternalIndexSet" IndexPath="~/App_Data/TEMP/ExamineIndexes/{machinename}/{appdomainappid}/Internal/" />
1313

1414
<!-- The internal index set used by Umbraco back-office for indexing members - DO NOT REMOVE -->
15-
<IndexSet SetName="InternalMemberIndexSet" IndexPath="~/App_Data/TEMP/ExamineIndexes/InternalMember/">
15+
<IndexSet SetName="InternalMemberIndexSet" IndexPath="~/App_Data/TEMP/ExamineIndexes/{machinename}/{appdomainappid}/InternalMember/">
1616
<IndexAttributeFields>
1717
<add Name="id" />
1818
<add Name="nodeName"/>
@@ -25,6 +25,6 @@ More information and documentation can be found on CodePlex: http://umbracoexami
2525
</IndexSet>
2626

2727
<!-- Default Indexset for external searches, this indexes all fields on all types of nodes-->
28-
<IndexSet SetName="ExternalIndexSet" IndexPath="~/App_Data/TEMP/ExamineIndexes/External/" />
28+
<IndexSet SetName="ExternalIndexSet" IndexPath="~/App_Data/TEMP/ExamineIndexes/{machinename}/{appdomainappid}/External/" />
2929

3030
</ExamineLuceneIndexSets>

src/Umbraco.Web.UI/config/ExamineSettings.config

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,19 @@ More information and documentation can be found on CodePlex: http://umbracoexami
1111
<providers>
1212
<add name="InternalIndexer" type="UmbracoExamine.UmbracoContentIndexer, UmbracoExamine"
1313
supportUnpublished="true"
14-
supportProtected="true"
15-
14+
supportProtected="true"
15+
useTempStorage="Sync"
1616
analyzer="Lucene.Net.Analysis.WhitespaceAnalyzer, Lucene.Net"/>
1717

1818
<add name="InternalMemberIndexer" type="UmbracoExamine.UmbracoMemberIndexer, UmbracoExamine"
1919
supportUnpublished="true"
2020
supportProtected="true"
21-
21+
useTempStorage="Sync"
2222
analyzer="Lucene.Net.Analysis.Standard.StandardAnalyzer, Lucene.Net"/>
2323

2424
<!-- default external indexer, which excludes protected and unpublished pages-->
2525
<add name="ExternalIndexer" type="UmbracoExamine.UmbracoContentIndexer, UmbracoExamine"
26-
/>
26+
useTempStorage="Sync"/>
2727

2828
</providers>
2929
</ExamineIndexProviders>
@@ -32,14 +32,14 @@ More information and documentation can be found on CodePlex: http://umbracoexami
3232
<providers>
3333
<add name="InternalSearcher" type="UmbracoExamine.UmbracoExamineSearcher, UmbracoExamine"
3434
analyzer="Lucene.Net.Analysis.WhitespaceAnalyzer, Lucene.Net"
35-
/>
35+
useTempStorage="Sync"/>
3636

3737
<add name="ExternalSearcher" type="UmbracoExamine.UmbracoExamineSearcher, UmbracoExamine"
38-
/>
38+
useTempStorage="Sync"/>
3939

4040
<add name="InternalMemberSearcher" type="UmbracoExamine.UmbracoExamineSearcher, UmbracoExamine"
4141
analyzer="Lucene.Net.Analysis.Standard.StandardAnalyzer, Lucene.Net" enableLeadingWildcard="true"
42-
/>
42+
useTempStorage="Sync"/>
4343

4444
</providers>
4545
</ExamineSearchProviders>

src/Umbraco.Web.UI/config/log4net.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99

1010
<appender name="AsynchronousLog4NetAppender" type="Umbraco.Core.Logging.AsynchronousRollingFileAppender, Umbraco.Core">
11-
<file value="App_Data\Logs\UmbracoTraceLog.txt" />
11+
<file type="log4net.Util.PatternString" value="App_Data\Logs\UmbracoTraceLog.%property{log4net:HostName}%appdomain.txt" />
1212
<lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
1313
<appendToFile value="true" />
1414
<rollingStyle value="Date" />

0 commit comments

Comments
 (0)