Cleaned up and fixed a couple of errors in Orchard.Web.csproj.

Publishing now works for both Release and Debug configurations (previously worked only for Debug).
Added missing module project Orchard.AzureBlobStogare to Orchard.Azure.sln and added a reference to it from Orchard.Azure.Web.csproj.
Created separate solution folders Modules and Modules.Deprecated in Orchard.Azure.sln to be consistent with Orchard.sln.
Cleaned up web.config transformation files.
Upgraded Orchard.Azure, Orchard.Web and Orchard.Azure.Web to new storage client (version 2.0).
Removed duplication between Orchard.Azure and Orchard.AzureBlobStorage (the latter is now just a thin wrapper over the former).
Added proper transformations for log4net.config and HostComponents.config in both Orchard.Azure.Web and Orchard.Web (recreating what was previously done by custom MSBuild logic in the project files).
This commit is contained in:
Daniel Stolt
2013-08-21 00:09:11 +02:00
committed by Sebastien Ros
parent f3169400bc
commit d4154fa1fe
30 changed files with 1719 additions and 2218 deletions

View File

@@ -1,422 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Xml.Linq;
using System.Xml.XPath;
using Microsoft.Win32;
using Microsoft.WindowsAzure;
using Microsoft.WindowsAzure.ServiceRuntime;
using Microsoft.WindowsAzure.StorageClient;
using Orchard.FileSystems.Media;
namespace Orchard.Azure {
public class AzureFileSystem {
public const string FolderEntry = "$$$ORCHARD$$$.$$$";
public string ContainerName { get; protected set; }
private readonly CloudStorageAccount _storageAccount;
protected readonly string _root;
protected readonly string _absoluteRoot;
public CloudBlobClient BlobClient { get; private set; }
public CloudBlobContainer Container { get; private set; }
public AzureFileSystem(string containerName, string root, bool isPrivate)
: this(containerName, root, isPrivate, CloudStorageAccount.Parse(RoleEnvironment.GetConfigurationSettingValue("DataConnectionString"))) {
}
public AzureFileSystem(string containerName, string root, bool isPrivate, CloudStorageAccount storageAccount) {
// Setup the connection to custom storage accountm, e.g. Development Storage
_storageAccount = storageAccount;
ContainerName = containerName;
_root = String.IsNullOrEmpty(root) ? "" : root + "/";
_absoluteRoot = Combine(Combine(_storageAccount.BlobEndpoint.AbsoluteUri, containerName), root);
BlobClient = _storageAccount.CreateCloudBlobClient();
// Get and create the container if it does not exist
// The container is named with DNS naming restrictions (i.e. all lower case)
Container = BlobClient.GetContainerReference(ContainerName);
Container.CreateIfNotExist();
Container.SetPermissions(isPrivate
? new BlobContainerPermissions { PublicAccess = BlobContainerPublicAccessType.Off }
: new BlobContainerPermissions { PublicAccess = BlobContainerPublicAccessType.Container });
}
private static string ConvertToRelativeUriPath(string path) {
var newPath = path.Replace(@"\", "/");
if (newPath.StartsWith("/") || newPath.StartsWith("http://") || newPath.StartsWith("https://"))
throw new ArgumentException("Path must be relative");
return newPath;
}
public string Combine(string path1, string path2) {
if (path1 == null) {
throw new ArgumentNullException("path1");
}
if (path2 == null) {
throw new ArgumentNullException("path2");
}
if (String.IsNullOrEmpty(path2)) {
return path1;
}
if (String.IsNullOrEmpty(path1)) {
return path2;
}
if (path2.StartsWith("http://") || path2.StartsWith("https://")) {
return path2;
}
var ch = path1[path1.Length - 1];
if (ch != '/') {
return (path1.TrimEnd('/') + '/' + path2.TrimStart('/'));
}
return (path1 + path2);
}
public IStorageFile GetFile(string path) {
path = ConvertToRelativeUriPath(path);
Container.EnsureBlobExists(String.Concat(_root, path));
return new AzureBlobFileStorage(Container.GetBlockBlobReference(String.Concat(_root, path)), _absoluteRoot);
}
public bool FileExists(string path) {
return Container.BlobExists(String.Concat(_root, path));
}
public bool FolderExists(string path) {
return Container.DirectoryExists(String.Concat(_root, path));
}
public IEnumerable<IStorageFile> ListFiles(string path) {
path = path ?? String.Empty;
path = ConvertToRelativeUriPath(path);
string prefix = Combine(Combine(Container.Name, _root), path);
if (!prefix.EndsWith("/"))
prefix += "/";
return BlobClient
.ListBlobsWithPrefix(prefix)
.OfType<CloudBlockBlob>()
.Where(blobItem => !blobItem.Uri.AbsoluteUri.EndsWith(FolderEntry))
.Select(blobItem => new AzureBlobFileStorage(blobItem, _absoluteRoot))
.ToArray();
}
public IEnumerable<IStorageFolder> ListFolders(string path) {
path = path ?? String.Empty;
path = ConvertToRelativeUriPath(path);
// return root folders
if (String.Concat(_root, path) == String.Empty) {
return Container.ListBlobs()
.OfType<CloudBlobDirectory>()
.Select<CloudBlobDirectory, IStorageFolder>(d => new AzureBlobFolderStorage(d, _absoluteRoot))
.ToList();
}
if (!Container.DirectoryExists(String.Concat(_root, path))) {
try {
CreateFolder(path);
}
catch (Exception ex) {
throw new ArgumentException(string.Format("The folder could not be created at path: {0}. {1}",
path, ex));
}
}
return Container.GetDirectoryReference(String.Concat(_root, path))
.ListBlobs()
.OfType<CloudBlobDirectory>()
.Select<CloudBlobDirectory, IStorageFolder>(d => new AzureBlobFolderStorage(d, _absoluteRoot))
.ToList();
}
public bool TryCreateFolder(string path) {
try {
if (!Container.DirectoryExists(String.Concat(_root, path))) {
CreateFolder(path);
return true;
}
// return false to be consistent with FileSystemProvider's implementation
return false;
}
catch {
return false;
}
}
public void CreateFolder(string path) {
path = ConvertToRelativeUriPath(path);
Container.EnsureDirectoryDoesNotExist(String.Concat(_root, path));
// Creating a virtually hidden file to make the directory an existing concept
CreateFile(Combine(path, FolderEntry));
int lastIndex;
while ((lastIndex = path.LastIndexOf('/')) > 0) {
path = path.Substring(0, lastIndex);
if (!Container.DirectoryExists(String.Concat(_root, path))) {
CreateFile(Combine(path, FolderEntry));
}
}
}
public void DeleteFolder(string path) {
path = ConvertToRelativeUriPath(path);
Container.EnsureDirectoryExists(String.Concat(_root, path));
foreach (var blob in Container.GetDirectoryReference(String.Concat(_root, path)).ListBlobs()) {
if (blob is CloudBlob)
((CloudBlob)blob).Delete();
if (blob is CloudBlobDirectory)
DeleteFolder(blob.Uri.ToString().Substring(Container.Uri.ToString().Length + 1 + _root.Length));
}
}
public void RenameFolder(string path, string newPath) {
path = ConvertToRelativeUriPath(path);
newPath = ConvertToRelativeUriPath(newPath);
if (!path.EndsWith("/"))
path += "/";
if (!newPath.EndsWith("/"))
newPath += "/";
foreach (var blob in Container.GetDirectoryReference(_root + path).ListBlobs()) {
if (blob is CloudBlob) {
string filename = Path.GetFileName(blob.Uri.ToString());
string source = String.Concat(path, filename);
string destination = String.Concat(newPath, filename);
RenameFile(source, destination);
}
if (blob is CloudBlobDirectory) {
string foldername = blob.Uri.Segments.Last();
string source = String.Concat(path, foldername);
string destination = String.Concat(newPath, foldername);
RenameFolder(source, destination);
}
}
}
public void DeleteFile(string path) {
path = ConvertToRelativeUriPath(path);
Container.EnsureBlobExists(Combine(_root, path));
var blob = Container.GetBlockBlobReference(Combine(_root, path));
blob.Delete();
}
public void RenameFile(string path, string newPath) {
path = ConvertToRelativeUriPath(path);
newPath = ConvertToRelativeUriPath(newPath);
Container.EnsureBlobExists(String.Concat(_root, path));
Container.EnsureBlobDoesNotExist(String.Concat(_root, newPath));
var blob = Container.GetBlockBlobReference(String.Concat(_root, path));
var newBlob = Container.GetBlockBlobReference(String.Concat(_root, newPath));
newBlob.CopyFromBlob(blob);
blob.Delete();
}
public IStorageFile CreateFile(string path) {
path = ConvertToRelativeUriPath(path);
if (Container.BlobExists(String.Concat(_root, path))) {
throw new ArgumentException("File " + path + " already exists");
}
// create all folder entries in the hierarchy
int lastIndex;
var localPath = path;
while ((lastIndex = localPath.LastIndexOf('/')) > 0) {
localPath = localPath.Substring(0, lastIndex);
var folder = Container.GetBlockBlobReference(String.Concat(_root, Combine(localPath, FolderEntry)));
folder.OpenWrite().Dispose();
}
var blob = Container.GetBlockBlobReference(String.Concat(_root, path));
var contentType = GetContentType(path);
if (!String.IsNullOrWhiteSpace(contentType)) {
blob.Properties.ContentType = contentType;
}
blob.UploadByteArray(new byte[0]);
return new AzureBlobFileStorage(blob, _absoluteRoot);
}
public string GetPublicUrl(string path) {
path = ConvertToRelativeUriPath(path);
Container.EnsureBlobExists(String.Concat(_root, path));
return Container.GetBlockBlobReference(String.Concat(_root, path)).Uri.ToString();
}
/// <summary>
/// Returns the mime-type of the specified file path, looking into IIS configuration and the Registry
/// </summary>
private string GetContentType(string path) {
string extension = Path.GetExtension(path);
if (String.IsNullOrWhiteSpace(extension)) {
return "application/unknown";
}
try {
try {
string applicationHost = System.Environment.ExpandEnvironmentVariables(@"%windir%\system32\inetsrv\config\applicationHost.config");
string webConfig = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration(null).FilePath;
// search for custom mime types in web.config and applicationhost.config
foreach (var configFile in new[] { webConfig, applicationHost }) {
if (File.Exists(configFile)) {
var xdoc = XDocument.Load(configFile);
var mimeMap = xdoc.XPathSelectElements("//staticContent/mimeMap[@fileExtension='" + extension + "']").FirstOrDefault();
if (mimeMap != null) {
var mimeType = mimeMap.Attribute("mimeType");
if (mimeType != null) {
return mimeType.Value;
}
}
}
}
}
catch {
// ignore issues with web.config to fall back to registry
}
// search into the registry
RegistryKey regKey = Registry.ClassesRoot.OpenSubKey(extension.ToLower());
if (regKey != null) {
var contentType = regKey.GetValue("Content Type");
if (contentType != null) {
return contentType.ToString();
}
}
}
catch {
// if an exception occured return application/unknown
return "application/unknown";
}
return "application/unknown";
}
private class AzureBlobFileStorage : IStorageFile {
private CloudBlockBlob _blob;
private readonly string _rootPath;
public AzureBlobFileStorage(CloudBlockBlob blob, string rootPath) {
_blob = blob;
_rootPath = rootPath;
}
public string GetPath() {
return _blob.Uri.ToString().Substring(_rootPath.Length).Trim('/');
}
public string GetName() {
return Path.GetFileName(GetPath());
}
public long GetSize() {
return _blob.Properties.Length;
}
public DateTime GetLastUpdated() {
return _blob.Properties.LastModifiedUtc;
}
public string GetFileType() {
return Path.GetExtension(GetPath());
}
public Stream OpenRead() {
return _blob.OpenRead();
}
public Stream OpenWrite() {
return _blob.OpenWrite();
}
public Stream CreateFile() {
// as opposed to the File System implementation, if nothing is done on the stream
// the file will be emptied, because Azure doesn't implement FileMode.Truncate
_blob.DeleteIfExists();
_blob = _blob.Container.GetBlockBlobReference(_blob.Uri.ToString());
_blob.OpenWrite().Dispose(); // force file creation
return OpenWrite();
}
}
private class AzureBlobFolderStorage : IStorageFolder {
private readonly CloudBlobDirectory _blob;
private readonly string _rootPath;
public AzureBlobFolderStorage(CloudBlobDirectory blob, string rootPath) {
_blob = blob;
_rootPath = rootPath;
}
public string GetName() {
var path = GetPath();
return path.Substring(path.LastIndexOf('/') + 1);
}
public string GetPath() {
return _blob.Uri.ToString().Substring(_rootPath.Length).Trim('/');
}
public long GetSize() {
return GetDirectorySize(_blob);
}
public DateTime GetLastUpdated() {
return DateTime.MinValue;
}
public IStorageFolder GetParent() {
if (_blob.Parent != null) {
return new AzureBlobFolderStorage(_blob.Parent, _rootPath);
}
throw new ArgumentException("Directory " + _blob.Uri + " does not have a parent directory");
}
private static long GetDirectorySize(CloudBlobDirectory directoryBlob) {
long size = 0;
foreach (var blobItem in directoryBlob.ListBlobs()) {
if (blobItem is CloudBlob)
size += ((CloudBlob)blobItem).Properties.Length;
if (blobItem is CloudBlobDirectory)
size += GetDirectorySize((CloudBlobDirectory)blobItem);
}
return size;
}
}
}
}

View File

@@ -1,58 +0,0 @@
using System;
using System.ComponentModel;
using System.Linq;
using Microsoft.WindowsAzure.StorageClient;
namespace Orchard.Azure {
public static class CloudBlobContainerExtensions {
public static bool BlobExists(this CloudBlobContainer container, string path) {
if ( String.IsNullOrEmpty(path) || path.Trim() == String.Empty )
throw new ArgumentException("Path can't be empty");
try {
var blob = container.GetBlockBlobReference(path);
blob.FetchAttributes();
return true;
}
catch ( StorageClientException e ) {
if ( e.ErrorCode == StorageErrorCode.ResourceNotFound ) {
return false;
}
throw;
}
}
public static void EnsureBlobExists(this CloudBlobContainer container, string path) {
if ( !BlobExists(container, path) ) {
throw new ArgumentException("File " + path + " does not exist");
}
}
public static void EnsureBlobDoesNotExist(this CloudBlobContainer container, string path) {
if ( BlobExists(container, path) ) {
throw new ArgumentException("File " + path + " already exists");
}
}
public static bool DirectoryExists(this CloudBlobContainer container, string path) {
if ( String.IsNullOrEmpty(path) || path.Trim() == String.Empty )
throw new ArgumentException("Path can't be empty");
return container.GetDirectoryReference(path).ListBlobs().Count() > 0;
}
public static void EnsureDirectoryExists(this CloudBlobContainer container, string path) {
if ( !DirectoryExists(container, path) ) {
throw new ArgumentException("Directory " + path + " does not exist");
}
}
public static void EnsureDirectoryDoesNotExist(this CloudBlobContainer container, string path) {
if ( DirectoryExists(container, path) ) {
throw new ArgumentException("Directory " + path + " already exists");
}
}
}
}

View File

@@ -5,6 +5,9 @@ using System.Linq;
using Microsoft.WindowsAzure;
using Microsoft.WindowsAzure.ServiceRuntime;
using Orchard.Environment.Configuration;
using Orchard.Azure.FileSystems;
using Microsoft.WindowsAzure.Storage;
using Orchard.FileSystems.Media;
namespace Orchard.Azure.Environment.Configuration {
@@ -17,12 +20,13 @@ namespace Orchard.Azure.Environment.Configuration {
private readonly IShellSettingsManagerEventHandler _events;
private readonly AzureFileSystem _fileSystem;
public AzureShellSettingsManager(IShellSettingsManagerEventHandler events)
: this(CloudStorageAccount.Parse(RoleEnvironment.GetConfigurationSettingValue("DataConnectionString")), events) {}
public AzureShellSettingsManager(IShellSettingsManagerEventHandler events, IMimeTypeProvider mimeTypeProvider)
: this(CloudStorageAccount.Parse(RoleEnvironment.GetConfigurationSettingValue("DataConnectionString")), events, mimeTypeProvider) {}
public AzureShellSettingsManager(CloudStorageAccount storageAccount, IShellSettingsManagerEventHandler events) {
public AzureShellSettingsManager(CloudStorageAccount storageAccount, IShellSettingsManagerEventHandler events, IMimeTypeProvider mimeTypeProvider)
{
_events = events;
_fileSystem = new AzureFileSystem(ContainerName, String.Empty, true, storageAccount);
_fileSystem = new AzureFileSystem(ContainerName, String.Empty, true, mimeTypeProvider);
}
IEnumerable<ShellSettings> IShellSettingsManager.LoadSettings() {

View File

@@ -7,7 +7,7 @@ using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Blob;
using Orchard.FileSystems.Media;
namespace Orchard.AzureBlobStorage.Services {
namespace Orchard.Azure.FileSystems {
public class AzureFileSystem {
public const string FolderEntry = "$$$ORCHARD$$$.$$$";

View File

@@ -3,7 +3,7 @@ using System.Linq;
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Blob;
namespace Orchard.AzureBlobStorage.Services {
namespace Orchard.Azure.FileSystems {
public static class CloudBlobContainerExtensions {
public static bool BlobExists(this CloudBlobContainer container, string path) {

View File

@@ -1,16 +1,13 @@
using System.IO;
using Microsoft.WindowsAzure;
using Orchard.Environment.Configuration;
using Orchard.Environment.Extensions;
using Orchard.FileSystems.Media;
namespace Orchard.Azure.FileSystems.Media {
public class AzureBlobStorageProvider : AzureFileSystem, IStorageProvider {
public AzureBlobStorageProvider(ShellSettings shellSettings)
: this(shellSettings, CloudStorageAccount.FromConfigurationSetting("DataConnectionString")) {
}
public AzureBlobStorageProvider(ShellSettings shellSettings, CloudStorageAccount storageAccount) : base("media", shellSettings.Name, false, storageAccount) { }
public AzureBlobStorageProvider(ShellSettings shellSettings, IMimeTypeProvider mimeTypeProvider) : base("media", shellSettings.Name, false, mimeTypeProvider) { }
public bool TrySaveStream(string path, Stream inputStream) {
try {

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- For more information on using web.config transformation visit http://go.microsoft.com/fwlink/?LinkId=125889 -->
<log4net xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
</log4net>

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- For more information on using web.config transformation visit http://go.microsoft.com/fwlink/?LinkId=125889 -->
<log4net xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
</log4net>

View File

@@ -1,27 +1,20 @@
<?xml version="1.0" encoding="utf-8" ?>
<log4net>
<root>
<!-- Value of priority may be ALL, DEBUG, INFO, WARN, ERROR, FATAL, OFF -->
<!-- Value of priority may be ALL, DEBUG, INFO, WARN, ERROR, FATAL, OFF. -->
<priority value="WARN" />
<appender-ref ref="AzureAppender" />
</root>
<!--
<logger name="Orchard.Localization">
<priority value="WARN" />
<appender-ref ref="RollingLogFileAppender" />
</logger>
-->
<appender name="AzureAppender" type="Orchard.Azure.Logging.AzureAppender, Orchard.Azure">
<filter type="log4net.Filter.LevelRangeFilter">
<!-- only error and fatal messages end up in this target, even if child loggers accept lower priority -->
<!-- Only error and fatal messages end up in this target, even if child loggers accept lower priority. -->
<levelMin value="ERROR" />
</filter>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %logger - %message%newline" />
</layout>
</appender>
</log4net>

View File

@@ -3,8 +3,8 @@ using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
using Autofac;
using Microsoft.WindowsAzure;
using Microsoft.WindowsAzure.ServiceRuntime;
using Microsoft.WindowsAzure.Storage;
using Orchard.Environment;
namespace Orchard.Azure.Web {
@@ -19,10 +19,6 @@ namespace Orchard.Azure.Web {
}
protected void Application_Start() {
CloudStorageAccount.SetConfigurationSettingPublisher(
(configName, configSetter) =>
configSetter(RoleEnvironment.GetConfigurationSettingValue(configName))
);
// For information on handling configuration changes
// see the MSDN topic at http://go.microsoft.com/fwlink/?LinkId=166357.

View File

@@ -14,12 +14,6 @@
<AssemblyName>Orchard.Azure.Web</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<MvcBuildViews>false</MvcBuildViews>
<FileUpgradeFlags>
</FileUpgradeFlags>
<OldToolsVersion>4.0</OldToolsVersion>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<TargetFrameworkProfile />
<UseIISExpress>false</UseIISExpress>
<IISExpressSSLPort />
<IISExpressAnonymousAuthentication />
@@ -72,9 +66,7 @@
<Reference Include="Microsoft.WindowsAzure.ServiceRuntime, Version=2.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.WindowsAzure.StorageClient, Version=1.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Storage, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
<Reference Include="Newtonsoft.Json">
<HintPath>..\..\..\lib\newtonsoft.json\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
@@ -222,6 +214,10 @@
<Project>{66FCCD76-2761-47E3-8D11-B45D0001DDAA}</Project>
<Name>Orchard.Autoroute</Name>
</ProjectReference>
<ProjectReference Include="..\..\Orchard.Web\Modules\Orchard.AzureBlobStorage\Orchard.AzureBlobStorage.csproj">
<Project>{cbc7993c-57d8-4a6c-992c-19e849dfe71d}</Project>
<Name>Orchard.AzureBlobStorage</Name>
</ProjectReference>
<ProjectReference Include="..\..\Orchard.Web\Modules\Orchard.Blogs\Orchard.Blogs.csproj">
<Project>{63FBD4D9-E1DA-4A7B-AA6A-D6074FE50867}</Project>
<Name>Orchard.Blogs</Name>
@@ -384,9 +380,9 @@
<Name>Orchard.Scripting.Dlr</Name>
<Private>True</Private>
</ProjectReference>
<ProjectReference Include="..\..\Orchard.Web\Modules\Orchard.Scripting\Orchard.Scripting.csproj">
<ProjectReference Include="..\..\Orchard.Web\Modules\Orchard.Scripting.Dlr\Orchard.Scripting.Dlr.csproj">
<Project>{2AD6973D-C7BB-416E-89FE-EEE34664E05F}</Project>
<Name>Orchard.Scripting</Name>
<Name>Orchard.Scripting.Dlr</Name>
<Private>True</Private>
</ProjectReference>
<ProjectReference Include="..\..\Orchard.Web\Modules\Orchard.Search\Orchard.Search.csproj">
@@ -475,9 +471,6 @@
<SubType>Designer</SubType>
</Content>
</ItemGroup>
<ItemGroup>
<Content Include="Config\log4net.config" />
</ItemGroup>
<ItemGroup>
<Content Include="Config\HostComponents.config" />
</ItemGroup>
@@ -493,15 +486,28 @@
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target> -->
<Target Name="AfterBuildCompiler" Condition="'$(MvcBuildViews)'=='true'">
<AspNetCompiler VirtualPath="temp" PhysicalPath="$(ProjectDir)" />
<ItemGroup>
<WebConfigsToTransform Include="Config\log4net.config">
<DestinationRelativePath>Config\log4net.config</DestinationRelativePath>
<Exclude>False</Exclude>
<TransformFileFolder>$(TransformWebConfigIntermediateLocation)\original</TransformFileFolder>
<TransformFile>Config\log4net.$(Configuration).config</TransformFile>
<TransformOriginalFolder>$(TransformWebConfigIntermediateLocation)\original</TransformOriginalFolder>
<TransformOriginalFile>$(TransformWebConfigIntermediateLocation)\original\%(DestinationRelativePath)</TransformOriginalFile>
<TransformOutputFile>$(TransformWebConfigIntermediateLocation)\transformed\%(DestinationRelativePath)</TransformOutputFile>
<TransformScope>$(_PackageTempDir)\%(DestinationRelativePath)</TransformScope>
<SubType>Designer</SubType>
</WebConfigsToTransform>
<None Include="Config\log4net.Debug.config">
<DependentUpon>log4net.config</DependentUpon>
</None>
<None Include="Config\log4net.Release.config">
<DependentUpon>log4net.config</DependentUpon>
</None>
</ItemGroup>
<Target Name="MvcBuildViews" AfterTargets="AfterBuild" Condition="'$(MvcBuildViews)'=='true'">
<AspNetCompiler VirtualPath="temp" PhysicalPath="$(WebProjectOutputDir)" />
</Target>
<!--Target Name="AfterBuild" DependsOnTargets="AfterBuildCompiler">
</Target-->
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
@@ -521,4 +527,10 @@
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild" DependsOnTargets="AfterBuildCompiler">
</Target-->
</Project>

View File

@@ -1,30 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- For more information on using web.config transformation visit http://go.microsoft.com/fwlink/?LinkId=125889 -->
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<!--
In the example below, the "SetAttributes" transform will change the value of
"connectionString" to use "ReleaseSQLServer" only when the "Match" locator
finds an attribute "name" that has a value of "MyDB".
<connectionStrings>
<add name="MyDB"
connectionString="Data Source=ReleaseSQLServer;Initial Catalog=MyReleaseDB;Integrated Security=True"
xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
</connectionStrings>
-->
<system.web>
<!--
In the example below, the "Replace" transform will replace the entire
<customErrors> section of your web.config file.
Note that because there is only one customErrors section under the
<system.web> node, there is no need to use the "xdt:Locator" attribute.
<customErrors defaultRedirect="GenericError.htm"
mode="RemoteOnly" xdt:Transform="Replace">
<error statusCode="500" redirect="InternalError.htm"/>
</customErrors>
-->
</system.web>
</configuration>

View File

@@ -1,31 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- For more information on using web.config transformation visit http://go.microsoft.com/fwlink/?LinkId=125889 -->
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<!--
In the example below, the "SetAttributes" transform will change the value of
"connectionString" to use "ReleaseSQLServer" only when the "Match" locator
finds an attribute "name" that has a value of "MyDB".
<connectionStrings>
<add name="MyDB"
connectionString="Data Source=ReleaseSQLServer;Initial Catalog=MyReleaseDB;Integrated Security=True"
xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
</connectionStrings>
-->
<system.web>
<compilation xdt:Transform="RemoveAttributes(debug)" />
<!--
In the example below, the "Replace" transform will replace the entire
<customErrors> section of your web.config file.
Note that because there is only one customErrors section under the
<system.web> node, there is no need to use the "xdt:Locator" attribute.
<customErrors defaultRedirect="GenericError.htm"
mode="RemoteOnly" xdt:Transform="Replace">
<error statusCode="500" redirect="InternalError.htm"/>
</customErrors>
-->
</system.web>
</configuration>

View File

@@ -56,6 +56,7 @@
<Reference Include="log4net">
<HintPath>..\..\lib\log4net\log4net.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
<Reference Include="Microsoft.WindowsAzure.Diagnostics, Version=1.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>C:\Program Files\Microsoft SDKs\Windows Azure\.NET SDK\2012-10\ref\Microsoft.WindowsAzure.Diagnostics.dll</HintPath>
@@ -64,9 +65,7 @@
<SpecificVersion>False</SpecificVersion>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.WindowsAzure.StorageClient, Version=1.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Storage, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
<Reference Include="System" />
<Reference Include="System.configuration" />
<Reference Include="System.Core">
@@ -83,12 +82,15 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="CloudBlobContainerExtensions.cs" />
<Compile Include="FileSystems\CloudBlobContainerExtensions.cs" />
<Compile Include="Environment\Configuration\AzureShellSettingsManager.cs" />
<Compile Include="FileSystems\Media\AzureBlobStorageProvider.cs" />
<Compile Include="FileSystems\Media\AzureBlobStorageProvider.cs">
<SubType>
</SubType>
</Compile>
<Compile Include="Logging\AzureAppender.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="AzureFileSystem.cs" />
<Compile Include="FileSystems\AzureFileSystem.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Orchard\Orchard.Framework.csproj">
@@ -114,9 +116,6 @@
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<WCFMetadata Include="Service References\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.

View File

@@ -133,6 +133,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.Scripting.CSharp",
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.Taxonomies", "..\Orchard.Web\Modules\Orchard.Taxonomies\Orchard.Taxonomies.csproj", "{E649EA64-D213-461B-87F7-D67035801443}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.AzureBlobStorage", "..\Orchard.Web\Modules\Orchard.AzureBlobStorage\Orchard.AzureBlobStorage.csproj", "{CBC7993C-57D8-4A6C-992C-19E849DFE71D}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Modules.Deprecated", "Modules.Deprecated", "{B6092A92-1071-4C30-AD55-8E8D46BC2F14}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -391,6 +395,10 @@ Global
{E649EA64-D213-461B-87F7-D67035801443}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E649EA64-D213-461B-87F7-D67035801443}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E649EA64-D213-461B-87F7-D67035801443}.Release|Any CPU.Build.0 = Release|Any CPU
{CBC7993C-57D8-4A6C-992C-19E849DFE71D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CBC7993C-57D8-4A6C-992C-19E849DFE71D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CBC7993C-57D8-4A6C-992C-19E849DFE71D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CBC7993C-57D8-4A6C-992C-19E849DFE71D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -400,7 +408,6 @@ Global
{14C049FD-B35B-415A-A824-87F26B26E7FD} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
{0E7646E8-FE8F-43C1-8799-D97860925EC4} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
{EA2B9121-EF54-40A6-A53E-6593C86EE696} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
{D9A7B330-CD22-4DA1-A95A-8DE1982AD8EB} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
{17F86780-9A1F-4AA1-86F1-875EEC2730C7} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
{72457126-E118-4171-A08F-9A709EE4B7FC} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
{D10AD48F-407D-4DB5-A328-173EC7CB010F} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
@@ -419,19 +426,16 @@ Global
{EA4F1DA7-F2AB-4384-9AA4-9B756E2026B1} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
{194D3CCC-1153-474D-8176-FDE8D7D0D0BD} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
{FBC8B571-ED50-49D8-8D9D-64AB7454A0D6} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
{137906EA-15FE-4AD8-A6A0-27528F0477D6} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
{085948FF-0E9B-4A9A-B564-F8B8B4BDDDBC} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
{3420C92A-747F-4990-BA08-F2C9531E44AD} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
{C889167C-E52C-4A65-A419-224B3D1B957D} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
{99002B65-86F7-415E-BF4A-381AA8AB9CCC} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
{2AD6973D-C7BB-416E-89FE-EEE34664E05F} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
{4A4595EF-6C37-4F99-96ED-4AE0B9E438D3} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
{43D0EC0B-1955-4566-8D31-7B9102DA1703} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
{FC1D74E8-7A4D-48F4-83DE-95C6173780C4} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
{3158C928-888C-4A84-8BC1-4A8257489538} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
{642A49D7-8752-4177-80D6-BFBBCFAD3DE0} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
{6F759635-13D7-4E94-BCC9-80445D63F117} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
{966EC390-3C7F-4D98-92A6-F0F30D02E9B1} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
{3F72A4E9-7B72-4260-B010-C16EC54F9BAF} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
{475B6C45-B27C-438B-8966-908B9D6D1077} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
{66FCCD76-2761-47E3-8D11-B45D0001DDAA} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
@@ -452,7 +456,12 @@ Global
{8A9FDB57-342D-49C2-BAFC-D885AAE5CC7C} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
{5D13EF34-8B39-4EC5-847F-E12892ACF841} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
{E649EA64-D213-461B-87F7-D67035801443} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
{CBC7993C-57D8-4A6C-992C-19E849DFE71D} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
{33B1BC8D-E292-4972-A363-22056B207156} = {75E7476C-C05B-4C41-8E38-081D3EB55659}
{CB70A642-8CEC-4DDE-8C9F-AD08900EC98D} = {84650275-884D-4CBB-9CC0-67553996E211}
{137906EA-15FE-4AD8-A6A0-27528F0477D6} = {B6092A92-1071-4C30-AD55-8E8D46BC2F14}
{D9A7B330-CD22-4DA1-A95A-8DE1982AD8EB} = {B6092A92-1071-4C30-AD55-8E8D46BC2F14}
{43D0EC0B-1955-4566-8D31-7B9102DA1703} = {B6092A92-1071-4C30-AD55-8E8D46BC2F14}
{966EC390-3C7F-4D98-92A6-F0F30D02E9B1} = {B6092A92-1071-4C30-AD55-8E8D46BC2F14}
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- For more information on using web.config transformation visit http://go.microsoft.com/fwlink/?LinkId=125889 -->
<HostComponents xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
</HostComponents>

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- For more information on using web.config transformation visit http://go.microsoft.com/fwlink/?LinkId=125889 -->
<HostComponents xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<Components>
<Component>
<Properties>
<Property Name="DisableMonitoring" Value="true" xdt:Locator="Match(Name)" xdt:Transform="SetAttributes(Value)" />
</Properties>
</Component>
</Components>
</HostComponents>

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- For more information on using web.config transformation visit http://go.microsoft.com/fwlink/?LinkId=125889 -->
<log4net xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
</log4net>

View File

@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- For more information on using web.config transformation visit http://go.microsoft.com/fwlink/?LinkId=125889 -->
<log4net xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<root>
<priority value="ERROR" xdt:Transform="SetAttributes(value)" />
<appender-ref ref="debug-file" xdt:Locator="Match(ref)" xdt:Transform="Remove" />
</root>
<logger name="Orchard" xdt:Locator="Match(name)" xdt:Transform="Remove" />
<logger name="Orchard.Localization" xdt:Locator="Match(name)" xdt:Transform="Remove" />
<logger>
<priority value="ERROR" xdt:Transform="SetAttributes(value)" />
</logger>
<appender>
<immediateFlush value="false" xdt:Transform="SetAttributes(value)" />
</appender>
<appender name="debugger" xdt:Locator="Match(name)" xdt:Transform="Remove" />
<appender name="debug-file" xdt:Locator="Match(name)" xdt:Transform="Remove" />
<appender name="error-file" xdt:Locator="Match(name)">
<filter xdt:Transform="Remove" />
</appender>
</log4net>

View File

@@ -1,19 +1,16 @@
<?xml version="1.0" encoding="utf-8" ?>
<log4net>
<!--
If you are looking here and want more output,
first thing to do is change root/priority/@value to "INFO" or "ALL"
-->
<!-- If you are looking here and want more output, first thing to do is change root/priority/@value to "INFO" or "ALL". -->
<root>
<!-- Value of priority may be ALL, DEBUG, INFO, WARN, ERROR, FATAL, OFF -->
<!-- Value of priority may be ALL, DEBUG, INFO, WARN, ERROR, FATAL, OFF. -->
<priority value="WARN" />
<appender-ref ref="error-file" />
<appender-ref ref="debug-file" />
</root>
<!-- example of turning on the output from a component or namespace-->
<!-- Example of turning on the output from a component or namespace. -->
<!--
<logger name="Orchard.Data.SessionLocator">
<priority value="INFO" />
@@ -21,90 +18,76 @@
-->
<logger name="Orchard">
<!-- messages coming from orchard are provided to the attached debugger -->
<!-- Messages coming from Orchard are sent to the attached debugger. -->
<appender-ref ref="debugger"/>
<!--
note: if you put a ref=debugger into root above and widen the priority to ALL or DEBUG,
then you will see nhibernate trace in the attached debugger as well
-->
<!-- Note: if you put a ref=debugger into <root> element above and widen the priority to ALL or DEBUG, then you will see nhibernate trace in the attached debugger as well. -->
</logger>
<logger name="Orchard.Localization">
<!-- this source is very verbose - setting priority here to avoid flooding trace if root priority is lowered -->
<!-- This source is very verbose - setting priority here to avoid flooding trace if root priority is lowered. -->
<priority value="WARN" />
</logger>
<logger name="NHibernate.Cache">
<!-- this source is very verbose - setting priority here to avoid flooding trace if root priority is lowered -->
<!-- This source is very verbose - setting priority here to avoid flooding trace if root priority is lowered. -->
<priority value="ERROR" />
</logger>
<logger name="NHibernate.AdoNet.AbstractBatcher">
<!-- Displays failed table statements that are otherwise intercepted and rendered when unexpected -->
<!-- Displays failed table statements that are otherwise intercepted and rendered when unexpected. -->
<priority value="OFF" />
</logger>
<logger name="NHibernate.AdoNet.AbstractBatcher">
<!-- Displays failed table statements that are otherwise intercepted and rendered when unexpected -->
<!-- Displays failed table statements that are otherwise intercepted and rendered when unexpected. -->
<priority value="OFF" />
</logger>
<logger name="NHibernate.Util.ADOExceptionReporter">
<!-- Displays failed table statements that are otherwise intercepted and rendered when unexpected -->
<!-- Displays failed table statements that are otherwise intercepted and rendered when unexpected. -->
<priority value="OFF" />
</logger>
<appender name="debugger" type="log4net.Appender.DebugAppender">
<!-- debugger: visual studio, if attached -->
<!-- Sends log messages to Visual Studio if attached. -->
<immediateFlush value="true" />
<layout type="log4net.Layout.SimpleLayout" />
</appender>
<appender name="debug-file" type="Orchard.Logging.OrchardFileAppender">
<!-- debug log: all messages, based on logger priority settings of namespaces above -->
<!-- Sends log messages to a file in App_Data. -->
<file value="App_Data/Logs/orchard-debug" />
<appendToFile value="true" />
<!-- immediate flush on error log, to avoid data loss with sudden termination -->
<!-- Immediate flush on error log, to avoid data loss with sudden termination. -->
<immediateFlush value="true" />
<staticLogFileName value="false" />
<rollingStyle value="Date" />
<datepattern value="-yyyy.MM.dd'.log'" />
<!-- prevent orchard.exe from displaying locking debug messages -->
<!-- Prevents Orchard.exe from displaying locking debug messages. -->
<lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %logger - %message%newline" />
</layout>
</appender>
<appender name="error-file" type="Orchard.Logging.OrchardFileAppender">
<!-- error log: only ERROR and FATAL subset of debug log -->
<!-- Sends ERROR and FATAL log messages to a file in App_Data. -->
<file value="App_Data/Logs/orchard-error" />
<appendToFile value="true" />
<!-- immediate flush on error log, to avoid data loss with sudden termination -->
<!-- Immediate flush on error log, to avoid data loss with sudden termination. -->
<immediateFlush value="true" />
<staticLogFileName value="false" />
<rollingStyle value="Date" />
<datepattern value="-yyyy.MM.dd'.log'" />
<!-- prevent orchard.exe from displaying locking error messages -->
<!-- Prevents Orchard.exe from displaying locking debug messages. -->
<lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
<filter type="log4net.Filter.LevelRangeFilter">
<!-- only error and fatal messages end up in this target, even if child loggers accept lower priority -->
<!-- Only ERROR and FATAL log messages end up in this target, even if child loggers accept lower priority. -->
<levelMin value="ERROR" />
</filter>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %logger - %message%newline" />
</layout>
</appender>
</log4net>

View File

@@ -7,6 +7,6 @@ OrchardVersion: 1.7
Description: Description for the module
Features:
Orchard.AzureBlobStorage:
Description: Stores the files on Azure Blob Storage
Description: Configures Windows Azure Blob Storage to be used as the underlying storage for Orchard
Name: Azure Blob Storage
Category: Hosting

View File

@@ -77,6 +77,10 @@
<Content Include="Module.txt" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Orchard.Azure\Orchard.Azure.csproj">
<Project>{2505aa84-65a6-43d0-9c27-4f44fd576284}</Project>
<Name>Orchard.Azure</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\Orchard\Orchard.Framework.csproj">
<Project>{2D1D92BB-4555-4CBE-8D0E-63563D6CE4C6}</Project>
<Name>Orchard.Framework</Name>
@@ -87,9 +91,7 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Compile Include="Services\AzureFileSystem.cs" />
<Compile Include="Services\CloudBlobContainerExtensions.cs" />
<Compile Include="Services\AzureBlobStorageProvider.cs" />
<Compile Include="Services\AzureBlobStorageProviderDependency.cs" />
</ItemGroup>
<ItemGroup />
<PropertyGroup>

View File

@@ -1,57 +0,0 @@
using System.IO;
using Orchard.Environment.Configuration;
using Orchard.Environment.Extensions;
using Orchard.FileSystems.Media;
namespace Orchard.AzureBlobStorage.Services {
[OrchardSuppressDependency("Orchard.FileSystems.Media.FileSystemStorageProvider")]
public class AzureBlobStorageProvider : AzureFileSystem, IStorageProvider {
public AzureBlobStorageProvider(ShellSettings shellSettings, IMimeTypeProvider mimeTypeProvider) : base("media", shellSettings.Name, false, mimeTypeProvider) { }
public bool TrySaveStream(string path, Stream inputStream) {
try {
SaveStream(path, inputStream);
}
catch {
return false;
}
return true;
}
public void SaveStream(string path, Stream inputStream) {
// Create the file.
// The CreateFile method will map the still relative path
var file = CreateFile(path);
using(var outputStream = file.OpenWrite()) {
var buffer = new byte[8192];
for (;;) {
var length = inputStream.Read(buffer, 0, buffer.Length);
if (length <= 0)
break;
outputStream.Write(buffer, 0, length);
}
}
}
/// <summary>
/// Retrieves the local path for a given url within the storage provider.
/// </summary>
/// <param name="url">The public url of the media.</param>
/// <returns>The local path.</returns>
public string GetStoragePath(string url) {
if (url.StartsWith(_absoluteRoot)) {
return url.Substring(Combine(_absoluteRoot, "/").Length);
}
return null;
}
public string GetRelativePath(string path) {
return GetPublicUrl(path);
}
}
}

View File

@@ -0,0 +1,12 @@
using System.IO;
using Orchard.Environment.Configuration;
using Orchard.Environment.Extensions;
using Orchard.FileSystems.Media;
using Orchard.Azure.FileSystems.Media;
namespace Orchard.AzureBlobStorage.Services {
[OrchardSuppressDependency("Orchard.FileSystems.Media.FileSystemStorageProvider")]
public class AzureBlobStorageProviderDependency : AzureBlobStorageProvider {
public AzureBlobStorageProviderDependency(ShellSettings shellSettings, IMimeTypeProvider mimeTypeProvider) : base(shellSettings, mimeTypeProvider) { }
}
}

View File

@@ -14,12 +14,6 @@
<AssemblyName>Orchard.Web</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<MvcBuildViews>false</MvcBuildViews>
<FileUpgradeFlags>
</FileUpgradeFlags>
<OldToolsVersion>4.0</OldToolsVersion>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<TargetFrameworkProfile />
<UseIISExpress>true</UseIISExpress>
<IISExpressSSLPort />
<IISExpressAnonymousAuthentication />
@@ -46,6 +40,8 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<FilesToIncludeForPublish>AllFilesInProjectFolder</FilesToIncludeForPublish>
<PackageAsSingleFile>false</PackageAsSingleFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="Autofac, Version=2.6.3.862, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
@@ -128,12 +124,6 @@
<Compile Include="Global.asax.cs">
<DependentUpon>Global.asax</DependentUpon>
</Compile>
<Content Include="Config\log4net.config">
<SubType>Designer</SubType>
</Content>
<Content Include="Config\HostComponents.config">
<SubType>Designer</SubType>
</Content>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
@@ -165,7 +155,13 @@
<Content Include="Config\Host.config" />
</ItemGroup>
<ItemGroup>
<Folder Include="App_Data\" />
<None Include="Properties\PublishProfiles\TestProfile.pubxml" />
<None Include="Web.Debug.config">
<DependentUpon>Web.config</DependentUpon>
</None>
<None Include="Web.Release.config">
<DependentUpon>Web.config</DependentUpon>
</None>
</ItemGroup>
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
@@ -174,15 +170,71 @@
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" />
<ItemGroup>
<WebConfigsToTransform Include="Config\log4net.config">
<DestinationRelativePath>Config\log4net.config</DestinationRelativePath>
<Exclude>False</Exclude>
<TransformFileFolder>$(TransformWebConfigIntermediateLocation)\original</TransformFileFolder>
<TransformFile>Config\log4net.$(Configuration).config</TransformFile>
<TransformOriginalFolder>$(TransformWebConfigIntermediateLocation)\original</TransformOriginalFolder>
<TransformOriginalFile>$(TransformWebConfigIntermediateLocation)\original\%(DestinationRelativePath)</TransformOriginalFile>
<TransformOutputFile>$(TransformWebConfigIntermediateLocation)\transformed\%(DestinationRelativePath)</TransformOutputFile>
<TransformScope>$(_PackageTempDir)\%(DestinationRelativePath)</TransformScope>
<SubType>Designer</SubType>
</WebConfigsToTransform>
<None Include="Config\log4net.Debug.config">
<DependentUpon>log4net.config</DependentUpon>
</None>
<None Include="Config\log4net.Release.config">
<DependentUpon>log4net.config</DependentUpon>
</None>
</ItemGroup>
<ItemGroup>
<WebConfigsToTransform Include="Config\HostComponents.config">
<DestinationRelativePath>Config\HostComponents.config</DestinationRelativePath>
<Exclude>False</Exclude>
<TransformFileFolder>$(TransformWebConfigIntermediateLocation)\original</TransformFileFolder>
<TransformFile>Config\HostComponents.$(Configuration).config</TransformFile>
<TransformOriginalFolder>$(TransformWebConfigIntermediateLocation)\original</TransformOriginalFolder>
<TransformOriginalFile>$(TransformWebConfigIntermediateLocation)\original\%(DestinationRelativePath)</TransformOriginalFile>
<TransformOutputFile>$(TransformWebConfigIntermediateLocation)\transformed\%(DestinationRelativePath)</TransformOutputFile>
<TransformScope>$(_PackageTempDir)\%(DestinationRelativePath)</TransformScope>
<SubType>Designer</SubType>
</WebConfigsToTransform>
<None Include="Config\HostComponents.Debug.config">
<DependentUpon>HostComponents.config</DependentUpon>
</None>
<None Include="Config\HostComponents.Release.config">
<DependentUpon>HostComponents.config</DependentUpon>
</None>
</ItemGroup>
<Target Name="MvcBuildViews" AfterTargets="AfterBuild" Condition="'$(MvcBuildViews)'=='true'">
<AspNetCompiler VirtualPath="temp" PhysicalPath="$(WebProjectOutputDir)" />
</Target>
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
<WebProjectProperties>
<UseIIS>True</UseIIS>
<AutoAssignPort>False</AutoAssignPort>
<DevelopmentServerPort>30321</DevelopmentServerPort>
<DevelopmentServerVPath>/OrchardLocal</DevelopmentServerVPath>
<IISUrl>http://localhost:30321/OrchardLocal</IISUrl>
<NTLMAuthentication>False</NTLMAuthentication>
<UseCustomServer>False</UseCustomServer>
<CustomServerUrl>
</CustomServerUrl>
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
</WebProjectProperties>
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target> -->
<PropertyGroup>
<CopyAllFilesToSingleFolderForMsdeployDependsOn>
CustomCollectFiles;
$(CopyAllFilesToSingleFolderForMsdeployDependsOn);
</CopyAllFilesToSingleFolderForMsdeployDependsOn>
<CopyAllFilesToSingleFolderForMsdeployDependsOn>CustomCollectFiles;$(CopyAllFilesToSingleFolderForMsdeployDependsOn);</CopyAllFilesToSingleFolderForMsdeployDependsOn>
</PropertyGroup>
<Target Name="CustomCollectFiles">
<ItemGroup>
@@ -209,32 +261,9 @@
<SqlCeBinariesx64 Include="$(ProjectDir)..\..\lib\sqlce\amd64\**\*" />
</ItemGroup>
<Copy SourceFiles="@(SqlCeBinariesx86)" DestinationFolder="$(OutputPath)\x86\%(RecursiveDir)" SkipUnchangedFiles="true" />
<Copy SourceFiles="@(SqlCeBinariesx86)" DestinationFolder="$(OutputPath)\x86\%(RecursiveDir)" SkipUnchangedFiles="true" />
<Copy SourceFiles="@(SqlCeBinariesx64)" DestinationFolder="$(OutputPath)\amd64\%(RecursiveDir)" SkipUnchangedFiles="true" />
</Target>
<Import Project="$(ProjectDir)..\..\lib\msbuild\MSBuild.Community.Tasks.Targets" />
<UsingTask AssemblyFile="$(ProjectDir)\..\Tools\MSBuild.Orchard.Tasks\bin\Release\MSBuild.Orchard.Tasks.dll" TaskName="MSBuild.Orchard.Tasks.XmlDelete" />
<Target Name="ProcessConfigurationFiles" AfterTargets="CopyAllFilesToSingleFolderForMsdeploy">
<PropertyGroup>
<PackageTmp>$(ProjectDir)obj\Release\Package\PackageTmp</PackageTmp>
</PropertyGroup>
<!-- extra processing of the staged config files -->
<XmlUpdate XmlFileName="$(PackageTmp)\web.config" XPath="/configuration/system.web/compilation/@debug" Value="false" />
<XmlDelete XmlFileName="$(PackageTmp)\web.config" XPath="/configuration/system.web/trust" />
<XmlUpdate XmlFileName="$(PackageTmp)\web.config" XPath="/configuration/system.web/machineKey/@validationKey" Value="AutoGenerate" />
<XmlUpdate XmlFileName="$(PackageTmp)\web.config" XPath="/configuration/system.web/machineKey/@decryptionKey" Value="AutoGenerate" />
<XmlUpdate XmlFileName="$(PackageTmp)\Config\log4net.config" XPath="/log4net/appender/immediateFlush/@value" Value="false" />
<XmlUpdate XmlFileName="$(PackageTmp)\Config\log4net.config" XPath="/log4net/logger/priority/@value" Value="ERROR" />
<XmlUpdate XmlFileName="$(PackageTmp)\Config\log4net.config" XPath="/log4net/root/priority/@value" Value="ERROR" />
<XmlDelete XmlFileName="$(PackageTmp)\Config\log4net.config" XPath="/log4net/appender[@name='debug-file']" />
<XmlDelete XmlFileName="$(PackageTmp)\Config\log4net.config" XPath="/log4net/appender[@name='debugger']" />
<XmlDelete XmlFileName="$(PackageTmp)\Config\log4net.config" XPath="/log4net/appender[@name='error-file']/filter" />
<XmlDelete XmlFileName="$(PackageTmp)\Config\log4net.config" XPath="/log4net/logger[@name='Orchard.Localization']" />
<XmlDelete XmlFileName="$(PackageTmp)\Config\log4net.config" XPath="/log4net/logger[@name='Orchard']" />
<XmlDelete XmlFileName="$(PackageTmp)\Config\log4net.config" XPath="/log4net/root/appender-ref[@ref='debug-file']" />
<!-- disable all file monitoring but ExtensionMonitoringCorrdinator to detect new modules/themes -->
<XmlUpdate XmlFileName="$(PackageTmp)\Config\HostComponents.config" XPath="/HostComponents/Components/Component/Properties/Property[@Name='DisableMonitoring']/@Value" Value="true" />
</Target>
<Target Name="AfterBuild" DependsOnTargets="AfterBuildCompiler">
<Target Name="AfterBuild" DependsOnTargets="MvcBuildViews">
<PropertyGroup>
<AreasManifestDir>$(ProjectDir)\..\Manifests</AreasManifestDir>
</PropertyGroup>
@@ -247,25 +276,4 @@
<CopyAreaManifests ManifestPath="$(AreasManifestDir)" CrossCopy="false" RenameViews="true" />
-->
</Target>
<Target Name="AfterBuildCompiler" Condition="'$(MvcBuildViews)'=='true'">
<AspNetCompiler VirtualPath="temp" PhysicalPath="$(ProjectDir)\..\$(ProjectName)" />
</Target>
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
<WebProjectProperties>
<UseIIS>True</UseIIS>
<AutoAssignPort>False</AutoAssignPort>
<DevelopmentServerPort>30321</DevelopmentServerPort>
<DevelopmentServerVPath>/OrchardLocal</DevelopmentServerVPath>
<IISUrl>http://localhost:30321/OrchardLocal</IISUrl>
<NTLMAuthentication>False</NTLMAuthentication>
<UseCustomServer>False</UseCustomServer>
<CustomServerUrl>
</CustomServerUrl>
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
</WebProjectProperties>
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
</Project>

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- For more information on using web.config transformation visit http://go.microsoft.com/fwlink/?LinkId=125889 -->
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
</configuration>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- For more information on using web.config transformation visit http://go.microsoft.com/fwlink/?LinkId=125889 -->
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<system.web>
<compilation xdt:Transform="RemoveAttributes(debug)" />
<machineKey validationKey="AutoGenerate" decryptionKey="AutoGenerate" xdt:Transform="SetAttributes(validationKey,decryptionKey)" />
</system.web>
</configuration>

View File

@@ -44,7 +44,6 @@
<defaultSettings timeout="00:30:00"/>
</system.transactions>
<system.web>
<!--<trust level="Medium" originUrl="" />-->
<!-- Accept file uploads up to 64 Mb -->
<httpRuntime requestValidationMode="2.0" maxRequestLength="65536" />
<!--
@@ -62,6 +61,8 @@
<add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"/>
<add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"/>
<add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<add assembly="System.Data.Entity.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<remove assembly="System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
<remove assembly="System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
<remove assembly="System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>

View File

@@ -162,6 +162,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Modules.Deprecated", "Modul
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.AzureBlobStorage", "Orchard.Web\Modules\Orchard.AzureBlobStorage\Orchard.AzureBlobStorage.csproj", "{CBC7993C-57D8-4A6C-992C-19E849DFE71D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.Azure", "Orchard.Azure\Orchard.Azure.csproj", "{2505AA84-65A6-43D0-9C27-4F44FD576284}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
CodeCoverage|Any CPU = CodeCoverage|Any CPU
@@ -900,6 +902,16 @@ Global
{CBC7993C-57D8-4A6C-992C-19E849DFE71D}.FxCop|Any CPU.Build.0 = Release|Any CPU
{CBC7993C-57D8-4A6C-992C-19E849DFE71D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CBC7993C-57D8-4A6C-992C-19E849DFE71D}.Release|Any CPU.Build.0 = Release|Any CPU
{2505AA84-65A6-43D0-9C27-4F44FD576284}.CodeCoverage|Any CPU.ActiveCfg = Release|Any CPU
{2505AA84-65A6-43D0-9C27-4F44FD576284}.CodeCoverage|Any CPU.Build.0 = Release|Any CPU
{2505AA84-65A6-43D0-9C27-4F44FD576284}.Coverage|Any CPU.ActiveCfg = Release|Any CPU
{2505AA84-65A6-43D0-9C27-4F44FD576284}.Coverage|Any CPU.Build.0 = Release|Any CPU
{2505AA84-65A6-43D0-9C27-4F44FD576284}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2505AA84-65A6-43D0-9C27-4F44FD576284}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2505AA84-65A6-43D0-9C27-4F44FD576284}.FxCop|Any CPU.ActiveCfg = Release|Any CPU
{2505AA84-65A6-43D0-9C27-4F44FD576284}.FxCop|Any CPU.Build.0 = Release|Any CPU
{2505AA84-65A6-43D0-9C27-4F44FD576284}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2505AA84-65A6-43D0-9C27-4F44FD576284}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE