Merge branch '1.8.x' into 1.x

This commit is contained in:
Sebastien Ros
2014-06-17 15:05:24 -07:00
10 changed files with 295 additions and 96 deletions

View File

@@ -1,10 +1,101 @@
<?xml version="1.0" encoding="utf-8" ?>
<HostComponents>
<Components>
<Component Type="Orchard.Environment.Extensions.Loaders.DynamicExtensionLoader">
<Properties>
<Property Name="Disabled" Value="true"/>
</Properties>
</Component>
</Components>
<Components>
<Component Type="Orchard.Environment.Extensions.ExtensionMonitoringCoordinator">
<Properties>
<!-- Set Value="true" to disable new extensions monitoring -->
<Property Name="Disabled" Value="false"/>
</Properties>
</Component>
<Component Type="Orchard.DisplayManagement.Descriptors.ShapePlacementStrategy.PlacementFileParser">
<Properties>
<!-- Set Value="true" to disable Placement files monitoring (Placement.info) -->
<Property Name="DisableMonitoring" Value="false"/>
</Properties>
</Component>
<Component Type="Orchard.DisplayManagement.Descriptors.ShapeTemplateStrategy.ShapeTemplateBindingStrategy">
<Properties>
<!-- Set Value="true" to disable template views monitoring (Views\*.cshtml) -->
<Property Name="DisableMonitoring" Value="false"/>
</Properties>
</Component>
<Component Type="Orchard.Environment.Extensions.Folders.ExtensionHarvester">
<Properties>
<!-- Set Value="true" to disable extension folders monitoring (new files in modules and themes) -->
<Property Name="DisableMonitoring" Value="false"/>
</Properties>
</Component>
<Component Type="Orchard.Environment.Extensions.Compilers.DefaultProjectFileParser">
<Properties>
<!-- Set Value="true" to disable project files monitoring (/Modules/**/*.csproj) -->
<Property Name="DisableMonitoring" Value="false"/>
</Properties>
</Component>
<Component Type="Orchard.Environment.Extensions.Loaders.DynamicExtensionLoader">
<Properties>
<!-- Set Value="true" to disable source files monitoring -->
<Property Name="DisableMonitoring" Value="false"/>
<!-- Set Value="true" to completely disable the Dynamic Extension Loader -->
<Property Name="Disabled" Value="true"/>
</Properties>
</Component>
<Component Type="Orchard.Environment.Extensions.Loaders.PrecompiledExtensionLoader">
<Properties>
<!-- Set Value="true" to disable pre-compiled files monitoring (~/Modules/**/bin/*.dll) -->
<Property Name="DisableMonitoring" Value="false"/>
</Properties>
</Component>
<Component Type="Orchard.FileSystems.Dependencies.DefaultDependenciesFolder">
<Properties>
<!-- Set Value="true" to disable the dependencies folder monitoring -->
<Property Name="DisableMonitoring" Value="false"/>
</Properties>
</Component>
<Component Type="Orchard.FileSystems.Dependencies.DefaultExtensionDependenciesManager">
<Properties>
<!-- Set Value="true" to disable compiled dependencides files monitoring -->
<Property Name="DisableMonitoring" Value="false"/>
</Properties>
</Component>
<Component Type="Orchard.Localization.Services.DefaultLocalizedStringManager">
<Properties>
<!-- Set Value="true" to disable localization files monitoring (*.po) -->
<Property Name="DisableMonitoring" Value="false"/>
</Properties>
</Component>
<Component Type="Orchard.Caching.DefaultParallelCacheContext">
<Properties>
<!-- Set Value="true" to disable parallel cache resolution -->
<Property Name="Disabled" Value="false"/>
</Properties>
</Component>
<Component Type="Orchard.Data.SessionConfigurationCache">
<Properties>
<!-- Set Value="true" to disable session configuration cache (mappings.bin). Recommended when using multiple instances. -->
<Property Name="Disabled" Value="false"/>
</Properties>
</Component>
<Component Type="Orchard.Environment.Descriptor.ShellDescriptorCache">
<Properties>
<!-- Set Value="true" to disable shell descriptors cache (cache.dat). Recommended when using multiple instances. -->
<Property Name="Disabled" Value="false"/>
</Properties>
</Component>
</Components>
</HostComponents>

View File

@@ -1,20 +1,107 @@
<?xml version="1.0" encoding="utf-8" ?>
<HostComponents>
<Components>
<Component Type="Orchard.Environment.Extensions.Loaders.DynamicExtensionLoader">
<Properties>
<Property Name="Disabled" Value="false"/>
</Properties>
</Component>
<Component Type="Orchard.Environment.Extensions.Loaders.PrecompiledExtensionLoader">
<Properties>
<Property Name="Disabled" Value="true"/>
</Properties>
</Component>
<Component Type="Orchard.Environment.Extensions.Loaders.ReferencedExtensionLoader">
<Properties>
<Property Name="Disabled" Value="true"/>
</Properties>
</Component>
</Components>
<Components>
<Component Type="Orchard.Environment.Extensions.ExtensionMonitoringCoordinator">
<Properties>
<!-- Set Value="true" to disable new extensions monitoring -->
<Property Name="Disabled" Value="false"/>
</Properties>
</Component>
<Component Type="Orchard.DisplayManagement.Descriptors.ShapePlacementStrategy.PlacementFileParser">
<Properties>
<!-- Set Value="true" to disable Placement files monitoring (Placement.info) -->
<Property Name="DisableMonitoring" Value="false"/>
</Properties>
</Component>
<Component Type="Orchard.DisplayManagement.Descriptors.ShapeTemplateStrategy.ShapeTemplateBindingStrategy">
<Properties>
<!-- Set Value="true" to disable template views monitoring (Views\*.cshtml) -->
<Property Name="DisableMonitoring" Value="false"/>
</Properties>
</Component>
<Component Type="Orchard.Environment.Extensions.Folders.ExtensionHarvester">
<Properties>
<!-- Set Value="true" to disable extension folders monitoring (new files in modules and themes) -->
<Property Name="DisableMonitoring" Value="false"/>
</Properties>
</Component>
<Component Type="Orchard.Environment.Extensions.Compilers.DefaultProjectFileParser">
<Properties>
<!-- Set Value="true" to disable project files monitoring (/Modules/**/*.csproj) -->
<Property Name="DisableMonitoring" Value="false"/>
</Properties>
</Component>
<Component Type="Orchard.Environment.Extensions.Loaders.DynamicExtensionLoader">
<Properties>
<!-- Set Value="true" to disable source files monitoring -->
<Property Name="DisableMonitoring" Value="false"/>
<!-- Set Value="true" to completely disable the Dynamic Extension Loader -->
<Property Name="Disabled" Value="false"/>
</Properties>
</Component>
<Component Type="Orchard.Environment.Extensions.Loaders.PrecompiledExtensionLoader">
<Properties>
<!-- Set Value="true" to disable pre-compiled files monitoring (~/Modules/**/bin/*.dll) -->
<Property Name="DisableMonitoring" Value="false"/>
<Property Name="Disabled" Value="true"/>
</Properties>
</Component>
<Component Type="Orchard.Environment.Extensions.Loaders.ReferencedExtensionLoader">
<Properties>
<Property Name="Disabled" Value="true"/>
</Properties>
</Component>
<Component Type="Orchard.FileSystems.Dependencies.DefaultDependenciesFolder">
<Properties>
<!-- Set Value="true" to disable the dependencies folder monitoring -->
<Property Name="DisableMonitoring" Value="false"/>
</Properties>
</Component>
<Component Type="Orchard.FileSystems.Dependencies.DefaultExtensionDependenciesManager">
<Properties>
<!-- Set Value="true" to disable compiled dependencides files monitoring -->
<Property Name="DisableMonitoring" Value="false"/>
</Properties>
</Component>
<Component Type="Orchard.Localization.Services.DefaultLocalizedStringManager">
<Properties>
<!-- Set Value="true" to disable localization files monitoring (*.po) -->
<Property Name="DisableMonitoring" Value="false"/>
</Properties>
</Component>
<Component Type="Orchard.Caching.DefaultParallelCacheContext">
<Properties>
<!-- Set Value="true" to disable parallel cache resolution -->
<Property Name="Disabled" Value="false"/>
</Properties>
</Component>
<Component Type="Orchard.Data.SessionConfigurationCache">
<Properties>
<!-- Set Value="true" to disable session configuration cache (mappings.bin). Recommended when using multiple instances. -->
<Property Name="Disabled" Value="false"/>
</Properties>
</Component>
<Component Type="Orchard.Environment.Descriptor.ShellDescriptorCache">
<Properties>
<!-- Set Value="true" to disable shell descriptors cache (cache.dat). Recommended when using multiple instances. -->
<Property Name="Disabled" Value="false"/>
</Properties>
</Component>
</Components>
</HostComponents>

View File

@@ -9,12 +9,14 @@ Scenario: Dynamic compilation can be disabled
When I go to "admin"
Then I should see "<div id="orchard-version">Orchard v(?:\.\d+){2,4}</div>"
@ignore
Scenario: Dynamic compilation will kick in if modules are deployed as source files only
Given I have chosen to deploy modules as source files only
And I have installed Orchard
When I go to "admin"
Then I should see "<div id="orchard-version">Orchard v(?:\.\d+){2,4}</div>"
@ignore
Scenario: Dynamic compilation can be forced by disabling the precompiled module loader
Given I have chosen to load modules using dymamic compilation only
And I have installed Orchard

View File

@@ -3,7 +3,7 @@
// This code was generated by SpecFlow (http://www.specflow.org/).
// SpecFlow Version:1.9.0.77
// SpecFlow Generator Version:1.9.0.0
// Runtime Version:4.0.30319.33440
// Runtime Version:4.0.30319.34014
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -86,18 +86,20 @@ this.ScenarioSetup(scenarioInfo);
[NUnit.Framework.TestAttribute()]
[NUnit.Framework.DescriptionAttribute("Dynamic compilation will kick in if modules are deployed as source files only")]
[NUnit.Framework.IgnoreAttribute()]
public virtual void DynamicCompilationWillKickInIfModulesAreDeployedAsSourceFilesOnly()
{
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Dynamic compilation will kick in if modules are deployed as source files only", ((string[])(null)));
#line 12
this.ScenarioSetup(scenarioInfo);
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Dynamic compilation will kick in if modules are deployed as source files only", new string[] {
"ignore"});
#line 13
testRunner.Given("I have chosen to deploy modules as source files only", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given ");
this.ScenarioSetup(scenarioInfo);
#line 14
testRunner.And("I have installed Orchard", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
testRunner.Given("I have chosen to deploy modules as source files only", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given ");
#line 15
testRunner.When("I go to \"admin\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
testRunner.And("I have installed Orchard", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 16
testRunner.When("I go to \"admin\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line 17
testRunner.Then("I should see \"<div id=\"orchard-version\">Orchard v(?:\\.\\d+){2,4}</div>\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line hidden
this.ScenarioCleanup();
@@ -105,18 +107,20 @@ this.ScenarioSetup(scenarioInfo);
[NUnit.Framework.TestAttribute()]
[NUnit.Framework.DescriptionAttribute("Dynamic compilation can be forced by disabling the precompiled module loader")]
[NUnit.Framework.IgnoreAttribute()]
public virtual void DynamicCompilationCanBeForcedByDisablingThePrecompiledModuleLoader()
{
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Dynamic compilation can be forced by disabling the precompiled module loader", ((string[])(null)));
#line 18
this.ScenarioSetup(scenarioInfo);
#line 19
testRunner.Given("I have chosen to load modules using dymamic compilation only", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given ");
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Dynamic compilation can be forced by disabling the precompiled module loader", new string[] {
"ignore"});
#line 20
testRunner.And("I have installed Orchard", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
this.ScenarioSetup(scenarioInfo);
#line 21
testRunner.When("I go to \"admin\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
testRunner.Given("I have chosen to load modules using dymamic compilation only", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given ");
#line 22
testRunner.And("I have installed Orchard", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 23
testRunner.When("I go to \"admin\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line 24
testRunner.Then("I should see \"<div id=\"orchard-version\">Orchard v(?:\\.\\d+){2,4}</div>\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line hidden
this.ScenarioCleanup();

View File

@@ -57,7 +57,7 @@ namespace Orchard.Core.Settings.Descriptor {
private ShellDescriptorRecord GetDescriptorRecord() {
if (_shellDescriptorRecord == null) {
return _shellDescriptorRepository.Table.ToList().SingleOrDefault();
return _shellDescriptorRecord = _shellDescriptorRepository.Table.ToList().SingleOrDefault();
}
return _shellDescriptorRecord;
@@ -72,11 +72,12 @@ namespace Orchard.Core.Settings.Descriptor {
if (shellDescriptorRecord == null) {
shellDescriptorRecord = new ShellDescriptorRecord { SerialNumber = 1 };
_shellDescriptorRepository.Create(shellDescriptorRecord);
_shellDescriptorRecord = shellDescriptorRecord;
}
else {
shellDescriptorRecord.SerialNumber++;
}
_shellDescriptorRecord = shellDescriptorRecord;
shellDescriptorRecord.Features.Clear();
foreach (var feature in enabledFeatures) {

View File

@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Linq;
using Orchard.ContentManagement;
using Orchard.Data;
@@ -8,45 +9,46 @@ using Orchard.Settings;
namespace Orchard.JobsQueue.Services {
public class JobsQueueManager : IJobsQueueManager {
private readonly IRepository<QueuedJobRecord> _jobRepository;
private readonly JobsQueueSettingsPart _jobsQueueSettingsPart;
private readonly Lazy<JobsQueueSettingsPart> _jobsQueueSettingsPart;
public JobsQueueManager(
IRepository<QueuedJobRecord> jobRepository,
ISiteService siteService) {
_jobRepository = jobRepository;
_jobsQueueSettingsPart = siteService.GetSiteSettings().As<JobsQueueSettingsPart>();
_jobsQueueSettingsPart = new Lazy<JobsQueueSettingsPart>(() => { return siteService.GetSiteSettings().As<JobsQueueSettingsPart>(); });
}
public void Resume() {
_jobsQueueSettingsPart.Status = JobsQueueStatus.Idle;
_jobsQueueSettingsPart.Value.Status = JobsQueueStatus.Idle;
}
public void Pause() {
_jobsQueueSettingsPart.Status = JobsQueueStatus.Paused;
_jobsQueueSettingsPart.Value.Status = JobsQueueStatus.Paused;
}
public int GetJobsCount() {
return GetMessagesQuery().Count();
return _jobRepository
.Table
.Count();
}
public IEnumerable<QueuedJobRecord> GetJobs(int startIndex, int pageSize) {
return GetMessagesQuery()
.Skip(startIndex)
.Take(pageSize)
.ToList();
}
public QueuedJobRecord GetJob(int id) {
return _jobRepository.Get(id);
}
private IQueryable<QueuedJobRecord> GetMessagesQuery() {
var query = _jobRepository
IQueryable<QueuedJobRecord> query = _jobRepository
.Table
.OrderByDescending(x => x.Priority)
.ThenByDescending(x => x.CreatedUtc);
return query;
if(startIndex > 0) {
query = query.Skip(startIndex);
}
query = query.Take(pageSize);
return query.ToList();
}
public QueuedJobRecord GetJob(int id) {
return _jobRepository.Get(id);
}
public void Delete(QueuedJobRecord job) {

View File

@@ -39,7 +39,7 @@ namespace Orchard.JobsQueue.Services {
IEnumerable<QueuedJobRecord> messages;
while ((messages = _jobsQueueManager.Value.GetJobs(0, 10).ToArray()).Any()) {
foreach (var message in messages.AsParallel()) {
foreach (var message in messages) {
ProcessMessage(message);
}
}

View File

@@ -21,11 +21,12 @@ namespace Orchard.JobsQueue.Services {
Parameters = JsonConvert.SerializeObject(parameters),
Message = message,
CreatedUtc = _clock.UtcNow,
Priority = priority
};
_messageRepository.Create(queuedJob);
return queuedJob;
}
}
}
}

View File

@@ -109,52 +109,62 @@ namespace Orchard.MediaProcessing.Services {
profilePart.Filters.Add(customFilter);
}
using (var image = GetImage(path)) {
// prevent two requests from processing the same file at the same time
// this is only thread safe at the machine level, so there is a try/catch later
// to handle cross machines concurrency
lock (String.Intern(path)) {
using (var image = GetImage(path)) {
var filterContext = new FilterContext { Media = image, FilePath = _storageProvider.Combine("_Profiles", FormatProfilePath(profileName, System.Web.HttpUtility.UrlDecode(path))) };
var filterContext = new FilterContext { Media = image, FilePath = _storageProvider.Combine("_Profiles", FormatProfilePath(profileName, System.Web.HttpUtility.UrlDecode(path))) };
if (image == null) {
return filterContext.FilePath;
}
if (image == null) {
return filterContext.FilePath;
}
var tokens = new Dictionary<string, object>();
// if a content item is provided, use it while tokenizing
if (contentItem != null) {
tokens.Add("Content", contentItem);
}
var tokens = new Dictionary<string, object>();
// if a content item is provided, use it while tokenizing
if (contentItem != null) {
tokens.Add("Content", contentItem);
}
foreach (var filter in profilePart.Filters.OrderBy(f => f.Position)) {
var descriptor = _processingManager.DescribeFilters().SelectMany(x => x.Descriptors).FirstOrDefault(x => x.Category == filter.Category && x.Type == filter.Type);
if (descriptor == null)
continue;
foreach (var filter in profilePart.Filters.OrderBy(f => f.Position)) {
var descriptor = _processingManager.DescribeFilters().SelectMany(x => x.Descriptors).FirstOrDefault(x => x.Category == filter.Category && x.Type == filter.Type);
if (descriptor == null)
continue;
var tokenized = _tokenizer.Replace(filter.State, tokens);
filterContext.State = FormParametersHelper.ToDynamic(tokenized);
descriptor.Filter(filterContext);
}
var tokenized = _tokenizer.Replace(filter.State, tokens);
filterContext.State = FormParametersHelper.ToDynamic(tokenized);
descriptor.Filter(filterContext);
}
_fileNameProvider.UpdateFileName(profileName, path, filterContext.FilePath);
_fileNameProvider.UpdateFileName(profileName, path, filterContext.FilePath);
if (!filterContext.Saved) {
var newFile = _storageProvider.OpenOrCreate(filterContext.FilePath);
using (var imageStream = newFile.OpenWrite()) {
using (var sw = new BinaryWriter(imageStream)) {
if (filterContext.Media.CanSeek) {
filterContext.Media.Seek(0, SeekOrigin.Begin);
}
using (var sr = new BinaryReader(filterContext.Media)) {
int count;
var buffer = new byte[8192];
while ((count = sr.Read(buffer, 0, buffer.Length)) != 0) {
sw.Write(buffer, 0, count);
if (!filterContext.Saved) {
try {
var newFile = _storageProvider.OpenOrCreate(filterContext.FilePath);
using (var imageStream = newFile.OpenWrite()) {
using (var sw = new BinaryWriter(imageStream)) {
if (filterContext.Media.CanSeek) {
filterContext.Media.Seek(0, SeekOrigin.Begin);
}
using (var sr = new BinaryReader(filterContext.Media)) {
int count;
var buffer = new byte[8192];
while ((count = sr.Read(buffer, 0, buffer.Length)) != 0) {
sw.Write(buffer, 0, count);
}
}
}
}
}
catch(Exception e) {
Logger.Error(e, "A profile could not be processed: " + path);
}
}
}
filterContext.Media.Dispose();
filePath = filterContext.FilePath;
filterContext.Media.Dispose();
filePath = filterContext.FilePath;
}
}
}

View File

@@ -11,7 +11,8 @@ namespace Orchard.MultiTenancy.Extensions {
if (host.Contains(":"))
port = host.Substring(host.IndexOf(":"));
var result = string.Format("http://{0}",
var result = string.Format("{0}://{1}",
urlHelper.RequestContext.HttpContext.Request.Url.Scheme,
!string.IsNullOrEmpty(tenantShellSettings.RequestUrlHost)
? tenantShellSettings.RequestUrlHost + port : host);