Files
Umbraco-CMS/src/Umbraco.Core/Hosting/IHostingEnvironment.cs
Shannon Deminick eba6373a12 Examine 2.0 integration (#10241)
* Init commit for examine 2.0 work, most old umb examine tests working, probably a lot that doesn't

* Gets Umbraco Examine tests passing and makes some sense out of them, fixes some underlying issues.

* Large refactor, remove TaskHelper, rename Notifications to be consistent, Gets all examine/lucene indexes building and startup ordered in the correct way, removes old files, creates new IUmbracoIndexingHandler for abstracting out all index operations for umbraco data, abstracts out IIndexRebuilder, Fixes Stack overflow with LiveModelsProvider and loading assemblies, ports some changes from v8 for startup handling with cold boots, refactors out LastSyncedFileManager

* fix up issues with rebuilding and management dashboard.

* removes old files, removes NetworkHelper, fixes LastSyncedFileManager implementation to ensure the machine name is used, fix up logging with cold boot state.

* Makes MainDom safer to use and makes PublishedSnapshotService lazily register with MainDom

* lazily acquire application id (fix unit tests)

* Fixes resource casing and missing test file

* Ensures caches when requiring internal services for PublishedSnapshotService, UseNuCache is a separate call, shouldn't be buried in AddWebComponents, was also causing issues in integration tests since nucache was being used for the Id2Key service.

* For UmbracoTestServerTestBase enable nucache services

* Fixing tests

* Fix another test

* Fixes tests, use TestHostingEnvironment, make Tests.Common use net5, remove old Lucene.Net.Contrib ref.

* Fixes up some review notes

* Fixes issue with doubly registering PublishedSnapshotService meanig there could be 2x instances of it

* Checks for parseexception when executing the query

* Use application root instead of duplicating functionality.

* Added Examine project to netcore only solution file

* Fixed casing issue with LazyLoad, that is not lowercase.

* uses cancellationToken instead of bool flag, fixes always reading lastId from the LastSyncedFileManager, fixes RecurringHostedServiceBase so that there isn't an overlapping thread for the same task type

* Fix tests

* remove legacy test project from solution file

* Fix test

Co-authored-by: Bjarke Berg <mail@bergmania.dk>
2021-05-18 10:31:38 +02:00

91 lines
3.9 KiB
C#

using System;
namespace Umbraco.Cms.Core.Hosting
{
public interface IHostingEnvironment
{
string SiteName { get; }
/// <summary>
/// The unique application ID for this Umbraco website.
/// </summary>
/// <remarks>
/// <para>
/// The returned value will be the same consistent value for an Umbraco website on a specific server and will the same
/// between restarts of that Umbraco website/application on that specific server.
/// </para>
/// <para>
/// The value of this does not necesarily distinguish between unique workers/servers for this Umbraco application.
/// Usage of this must take into account that the same <see cref="ApplicationId"/> may be returned for the same
/// Umbraco website hosted on different servers. Similarly the usage of this must take into account that a different
/// <see cref="ApplicationId"/> may be returned for the same Umbraco website hosted on different servers.
/// </para>
/// </remarks>
string ApplicationId { get; }
/// <summary>
/// Will return the physical path to the root of the application
/// </summary>
string ApplicationPhysicalPath { get; }
string LocalTempPath { get; }
/// <summary>
/// The web application's hosted path
/// </summary>
/// <remarks>
/// In most cases this will return "/" but if the site is hosted in a virtual directory then this will return the virtual directory's path such as "/mysite".
/// This value must begin with a "/" and cannot end with "/".
/// </remarks>
string ApplicationVirtualPath { get; }
bool IsDebugMode { get; }
/// <summary>
/// Gets a value indicating whether Umbraco is hosted.
/// </summary>
bool IsHosted { get; }
/// <summary>
/// Gets the main application url.
/// </summary>
Uri ApplicationMainUrl { get; }
/// <summary>
/// Maps a virtual path to a physical path to the application's web root
/// </summary>
/// <remarks>
/// Depending on the runtime 'web root', this result can vary. For example in Net Framework the web root and the content root are the same, however
/// in netcore the web root is /www therefore this will Map to a physical path within www.
/// </remarks>
string MapPathWebRoot(string path);
/// <summary>
/// Maps a virtual path to a physical path to the application's root (not always equal to the web root)
/// </summary>
/// <remarks>
/// Depending on the runtime 'web root', this result can vary. For example in Net Framework the web root and the content root are the same, however
/// in netcore the web root is /www therefore this will Map to a physical path within www.
/// </remarks>
string MapPathContentRoot(string path);
/// <summary>
/// Converts a virtual path to an absolute URL path based on the application's web root
/// </summary>
/// <param name="virtualPath">The virtual path. Must start with either ~/ or / else an exception is thrown.</param>
/// <remarks>
/// This maps the virtual path syntax to the web root. For example when hosting in a virtual directory called "site" and the value "~/pages/test" is passed in, it will
/// map to "/site/pages/test" where "/site" is the value of <see cref="ApplicationVirtualPath"/>.
/// </remarks>
/// <exception cref="InvalidOperationException">
/// If virtualPath does not start with ~/ or /
/// </exception>
string ToAbsolute(string virtualPath);
/// <summary>
/// Ensures that the application know its main Url.
/// </summary>
void EnsureApplicationMainUrl(Uri currentApplicationUrl);
}
}