AB4227 - Moved Services and Migration

This commit is contained in:
Bjarke Berg
2019-12-18 10:32:22 +01:00
parent a22824e33a
commit da1cf259c6
241 changed files with 193 additions and 394 deletions

View File

@@ -124,15 +124,7 @@ namespace Umbraco.Core.Services
/// <param name="raiseEvents">Optional parameter to raise events.
/// Default is <c>True</c> otherwise set to <c>False</c> to not raise events</param>
void Save(IEnumerable<T> entities, bool raiseEvents = true);
/// <summary>
/// Gets the default MemberType alias
/// </summary>
/// <remarks>By default we'll return the 'writer', but we need to check it exists. If it doesn't we'll
/// return the first type that is not an admin, otherwise if there's only one we will return that one.</remarks>
/// <returns>Alias of the default MemberType</returns>
string GetDefaultMemberType();
/// <summary>
/// Finds a list of <see cref="IMembershipUser"/> objects by a partial email string
/// </summary>

View File

@@ -203,6 +203,8 @@ namespace Umbraco.Core.Services
/// <returns><see cref="IEnumerable{IUser}"/></returns>
IEnumerable<IUser> GetAllNotInGroup(int groupId);
IEnumerable<IUser> GetNextUsers(int id, int count);
#region User groups
/// <summary>

View File

@@ -21,38 +21,6 @@ namespace Umbraco.Core
private static IMediaFileSystem _mediaFileSystem;
private static IMediaFileSystem MediaFileSystem => _mediaFileSystem ?? (_mediaFileSystem = Current.MediaFileSystem);
#region IContent
/// <summary>
/// Gets the current status of the Content
/// </summary>
public static ContentStatus GetStatus(this IContent content, string culture = null)
{
if (content.Trashed)
return ContentStatus.Trashed;
if (!content.ContentType.VariesByCulture())
culture = string.Empty;
else if (culture.IsNullOrWhiteSpace())
throw new ArgumentNullException($"{nameof(culture)} cannot be null or empty");
var expires = content.ContentSchedule.GetSchedule(culture, ContentScheduleAction.Expire);
if (expires != null && expires.Any(x => x.Date > DateTime.MinValue && DateTime.Now > x.Date))
return ContentStatus.Expired;
var release = content.ContentSchedule.GetSchedule(culture, ContentScheduleAction.Release);
if (release != null && release.Any(x => x.Date > DateTime.MinValue && x.Date > DateTime.Now))
return ContentStatus.AwaitingRelease;
if (content.Published)
return ContentStatus.Published;
return ContentStatus.Unpublished;
}
#endregion
@@ -207,13 +175,6 @@ namespace Umbraco.Core
return Current.Services.UserService.GetProfileById(content.CreatorId);
}
/// <summary>
/// Gets the <see cref="IProfile"/> for the Creator of this content item.
/// </summary>
public static IProfile GetCreatorProfile(this IContentBase content, IUserService userService)
{
return userService.GetProfileById(content.CreatorId);
}
[Obsolete("Use the overload that declares the IUserService to use")]
[EditorBrowsable(EditorBrowsableState.Never)]
@@ -222,21 +183,7 @@ namespace Umbraco.Core
return Current.Services.UserService.GetProfileById(content.WriterId);
}
/// <summary>
/// Gets the <see cref="IProfile"/> for the Writer of this content.
/// </summary>
public static IProfile GetWriterProfile(this IContent content, IUserService userService)
{
return userService.GetProfileById(content.WriterId);
}
/// <summary>
/// Gets the <see cref="IProfile"/> for the Writer of this content.
/// </summary>
public static IProfile GetWriterProfile(this IMedia content, IUserService userService)
{
return userService.GetProfileById(content.WriterId);
}
#endregion

View File

@@ -257,7 +257,7 @@ namespace Umbraco.Core
protected virtual bool EnsureUmbracoUpgradeState(IUmbracoDatabaseFactory databaseFactory, ILogger logger)
{
var upgrader = new Upgrader(new UmbracoPlan(_umbracoVersion));
var upgrader = new Upgrader(new UmbracoPlan(_umbracoVersion, _globalSettings));
var stateValueKey = upgrader.StateValueKey;
// no scope, no service - just directly accessing the database

View File

@@ -153,37 +153,6 @@
<Compile Include="Logging\Viewer\LogTimePeriod.cs" />
<Compile Include="Manifest\ManifestParser.cs" />
<Compile Include="Manifest\ValueValidatorConverter.cs" />
<Compile Include="Migrations\IMigrationBuilder.cs" />
<Compile Include="Migrations\Upgrade\Common\DeleteKeysAndIndexes.cs" />
<Compile Include="Migrations\Upgrade\V_8_0_0\DataTypes\ContentPickerPreValueMigrator.cs" />
<Compile Include="Migrations\Upgrade\V_8_0_0\DataTypes\DecimalPreValueMigrator.cs" />
<Compile Include="Migrations\Upgrade\V_8_0_0\DataTypes\IPreValueMigrator.cs" />
<Compile Include="Migrations\Upgrade\V_8_0_0\DataTypes\ListViewPreValueMigrator.cs" />
<Compile Include="Migrations\Upgrade\V_8_0_0\DataTypes\MediaPickerPreValueMigrator.cs" />
<Compile Include="Migrations\Upgrade\V_8_0_0\DataTypes\MarkdownEditorPreValueMigrator.cs" />
<Compile Include="Migrations\Upgrade\V_8_0_0\DataTypes\NestedContentPreValueMigrator.cs" />
<Compile Include="Migrations\Upgrade\V_8_0_0\DataTypes\PreValueMigratorCollection.cs" />
<Compile Include="Migrations\Upgrade\V_8_0_0\DataTypes\PreValueMigratorCollectionBuilder.cs" />
<Compile Include="Migrations\Upgrade\V_8_0_0\DataTypes\PreValueMigratorComposer.cs" />
<Compile Include="Migrations\Upgrade\V_8_0_0\DataTypes\DefaultPreValueMigrator.cs" />
<Compile Include="Migrations\Upgrade\V_8_0_0\DataTypes\RenamingPreValueMigrator.cs" />
<Compile Include="Migrations\Upgrade\V_8_0_0\DataTypes\RichTextPreValueMigrator.cs" />
<Compile Include="Migrations\Upgrade\V_8_0_0\DataTypes\DropDownFlexiblePreValueMigrator.cs" />
<Compile Include="Migrations\Upgrade\V_8_0_0\MergeDateAndDateTimePropertyEditor.cs" />
<Compile Include="Migrations\Upgrade\V_8_6_0\AddNewRelationTypes.cs" />
<Compile Include="Migrations\Upgrade\V_8_6_0\UpdateRelationTypeTable.cs" />
<Compile Include="Migrations\Upgrade\V_8_0_0\DataTypes\PreValueMigratorBase.cs" />
<Compile Include="Migrations\Upgrade\V_8_0_0\DataTypes\PreValueDto.cs" />
<Compile Include="Migrations\Upgrade\V_8_0_0\PropertyEditorsMigrationBase.cs" />
<Compile Include="Migrations\Upgrade\V_8_0_0\RenameMediaVersionTable.cs" />
<Compile Include="Migrations\Upgrade\V_8_0_0\DataTypes\ValueListPreValueMigrator.cs" />
<Compile Include="Migrations\Upgrade\V_8_0_0\DataTypes\UmbracoSliderPreValueMigrator.cs" />
<Compile Include="Migrations\Upgrade\V_8_6_0\AddPropertyTypeValidationMessageColumns.cs" />
<Compile Include="Migrations\Upgrade\V_8_1_0\FixContentNuCascade.cs" />
<Compile Include="Migrations\Upgrade\V_8_1_0\RenameUserLoginDtoDateIndex.cs" />
<Compile Include="Migrations\Upgrade\V_8_0_1\ChangeNuCacheJsonFormat.cs" />
<Compile Include="Migrations\Upgrade\V_8_1_0\ConvertTinyMceAndGridMediaUrlsToLocalLink.cs" />
<Compile Include="Migrations\Upgrade\V_8_0_0\FixLanguageIsoCodeLength.cs" />
<Compile Include="Models\Identity\BackOfficeIdentityUser.cs" />
<Compile Include="Models\Identity\IdentityMapDefinition.cs" />
<Compile Include="Models\Identity\IdentityUser.cs" />
@@ -193,10 +162,8 @@
<Compile Include="Packaging\PackageInstallation.cs" />
<Compile Include="Persistence\SqlCeBulkSqlInsertProvider.cs" />
<Compile Include="Persistence\SqlSyntax\SqlCeSyntaxProvider.cs" />
<Compile Include="Migrations\Upgrade\V_8_0_0\RenameLabelAndRichTextPropertyEditorAliases.cs" />
<Compile Include="PublishedContentExtensions.cs" />
<Compile Include="Security\PasswordSecurity.cs" />
<Compile Include="Services\Implement\PropertyValidationService.cs" />
<Compile Include="StringExtensions.cs" />
<Compile Include="Sync\RefreshInstructionEnvelope.cs" />
<Compile Include="TypeLoaderExtensions.cs" />
@@ -221,49 +188,9 @@
<Compile Include="Logging\Viewer\MessageTemplateFilter.cs" />
<Compile Include="Logging\Viewer\SavedLogSearch.cs" />
<Compile Include="Manifest\DashboardAccessRuleConverter.cs" />
<Compile Include="Migrations\MergeBuilder.cs" />
<Compile Include="Migrations\MigrationBase_Extra.cs" />
<Compile Include="Migrations\PostMigrations\IPublishedSnapshotRebuilder.cs" />
<Compile Include="Migrations\PostMigrations\PublishedSnapshotRebuilder.cs" />
<Compile Include="Migrations\PostMigrations\RebuildPublishedSnapshot.cs" />
<Compile Include="Migrations\Upgrade\V_8_0_0\ConvertRelatedLinksToMultiUrlPicker.cs" />
<Compile Include="Migrations\Upgrade\V_8_0_0\AddContentTypeIsElementColumn.cs" />
<Compile Include="Migrations\Upgrade\V_8_0_0\AddLogTableColumns.cs" />
<Compile Include="Migrations\Upgrade\V_8_0_0\AddTypedLabels.cs" />
<Compile Include="Migrations\Upgrade\V_8_0_0\AddVariationTables1A.cs" />
<Compile Include="Migrations\Upgrade\V_8_0_0\AddVariationTables2.cs" />
<Compile Include="Migrations\Upgrade\V_8_0_0\DataTypeMigration.cs" />
<Compile Include="Migrations\Upgrade\V_8_0_0\DropDownPropertyEditorsMigration.cs" />
<Compile Include="Migrations\Upgrade\V_8_0_0\DropPreValueTable.cs" />
<Compile Include="Migrations\Upgrade\V_8_0_0\DropTaskTables.cs" />
<Compile Include="Migrations\Upgrade\V_8_0_0\DropTemplateDesignColumn.cs" />
<Compile Include="Migrations\Upgrade\V_8_0_0\DropXmlTables.cs" />
<Compile Include="Migrations\Upgrade\V_8_0_0\LanguageColumns.cs" />
<Compile Include="Migrations\Upgrade\V_8_0_0\MakeRedirectUrlVariant.cs" />
<Compile Include="Migrations\Upgrade\V_8_0_0\MakeTagsVariant.cs" />
<Compile Include="Migrations\Upgrade\V_8_0_0\PropertyEditorsMigration.cs" />
<Compile Include="Migrations\Upgrade\V_8_0_0\RefactorMacroColumns.cs" />
<Compile Include="Migrations\Upgrade\V_8_0_0\RefactorVariantsModel.cs" />
<Compile Include="Migrations\Upgrade\V_8_0_0\RadioAndCheckboxPropertyEditorsMigration.cs" />
<Compile Include="Migrations\Upgrade\V_8_0_0\RenameUmbracoDomainsTable.cs" />
<Compile Include="Migrations\Upgrade\V_8_0_0\SuperZero.cs" />
<Compile Include="Migrations\Upgrade\V_8_0_0\TablesForScheduledPublishing.cs" />
<Compile Include="Migrations\Upgrade\V_8_0_0\TagsMigration.cs" />
<Compile Include="Migrations\Upgrade\V_8_0_0\FallbackLanguage.cs" />
<Compile Include="Migrations\Upgrade\V_8_0_0\TagsMigrationFix.cs" />
<Compile Include="Migrations\Upgrade\V_8_0_0\UpdateDefaultMandatoryLanguage.cs" />
<Compile Include="Migrations\Upgrade\V_8_0_0\UpdatePickerIntegerValuesToUdi.cs" />
<Compile Include="Migrations\Upgrade\V_8_0_0\UserForeignKeys.cs" />
<Compile Include="Migrations\Upgrade\Common\CreateKeysAndIndexes.cs" />
<Compile Include="RuntimeOptions.cs" />
<Compile Include="Runtime\CoreRuntime.cs" />
<Compile Include="Runtime\CoreInitialComponent.cs" />
<Compile Include="Migrations\Expressions\Common\ExecutableBuilder.cs" />
<Compile Include="Migrations\Expressions\Common\IExecutableBuilder.cs" />
<Compile Include="Migrations\Expressions\Create\KeysAndIndexes\CreateKeysAndIndexesBuilder.cs" />
<Compile Include="Migrations\Expressions\Create\Table\CreateTableOfDtoBuilder.cs" />
<Compile Include="Migrations\Expressions\Delete\KeysAndIndexes\DeleteKeysAndIndexesBuilder.cs" />
<Compile Include="Migrations\Install\DatabaseBuilder.cs" />
<Compile Include="Diagnostics\MiniDump.cs" />
<Compile Include="Composing\LightInject\LightInjectException.cs" />
<Compile Include="FileResources\Files.Designer.cs" />
@@ -272,121 +199,7 @@
<Compile Include="Logging\OwinLoggerFactory.cs" />
<Compile Include="MainDom.cs" />
<Compile Include="Manifest\DataEditorConverter.cs" />
<Compile Include="Migrations\MigrationBuilder.cs" />
<Compile Include="Migrations\MigrationPlan.cs" />
<Compile Include="Migrations\Upgrade\UmbracoPlan.cs" />
<Compile Include="Migrations\Upgrade\Upgrader.cs" />
<Compile Include="Migrations\Upgrade\V_8_0_0\DropMigrationsTable.cs" />
<Compile Include="ContentExtensions.cs" />
<Compile Include="Migrations\IMigrationContext.cs" />
<Compile Include="Migrations\IMigrationExpression.cs" />
<Compile Include="Migrations\Install\DatabaseDataCreator.cs" />
<Compile Include="Migrations\Install\DatabaseSchemaCreator.cs" />
<Compile Include="Migrations\Install\DatabaseSchemaResult.cs" />
<Compile Include="Migrations\MigrationBase.cs" />
<Compile Include="Migrations\MigrationContext.cs" />
<Compile Include="Migrations\MigrationExpressionBase.cs" />
<Compile Include="Migrations\Expressions\Alter\AlterBuilder.cs" />
<Compile Include="Migrations\Expressions\Alter\Expressions\AlterColumnExpression.cs" />
<Compile Include="Migrations\Expressions\Alter\Expressions\AlterDefaultConstraintExpression.cs" />
<Compile Include="Migrations\Expressions\Alter\Expressions\AlterTableExpression.cs" />
<Compile Include="Migrations\Expressions\Alter\IAlterBuilder.cs" />
<Compile Include="Migrations\Expressions\Alter\Table\AlterTableBuilder.cs" />
<Compile Include="Migrations\Expressions\Alter\Table\IAlterTableColumnOptionForeignKeyCascadeBuilder.cs" />
<Compile Include="Migrations\Expressions\Alter\Table\IAlterTableColumnOptionBuilder.cs" />
<Compile Include="Migrations\Expressions\Alter\Table\IAlterTableColumnTypeBuilder.cs" />
<Compile Include="Migrations\Expressions\Alter\Table\IAlterTableBuilder.cs" />
<Compile Include="Migrations\Expressions\Create\Column\CreateColumnBuilder.cs" />
<Compile Include="Migrations\Expressions\Create\Column\ICreateColumnOnTableBuilder.cs" />
<Compile Include="Migrations\Expressions\Create\Column\ICreateColumnOptionForeignKeyCascadeBuilder.cs" />
<Compile Include="Migrations\Expressions\Create\Column\ICreateColumnOptionBuilder.cs" />
<Compile Include="Migrations\Expressions\Create\Column\ICreateColumnTypeBuilder.cs" />
<Compile Include="Migrations\Expressions\Create\Constraint\CreateConstraintBuilder.cs" />
<Compile Include="Migrations\Expressions\Create\Constraint\ICreateConstraintColumnsBuilder.cs" />
<Compile Include="Migrations\Expressions\Create\Constraint\ICreateConstraintOnTableBuilder.cs" />
<Compile Include="Migrations\Expressions\Create\CreateBuilder.cs" />
<Compile Include="Migrations\Expressions\Create\Expressions\CreateConstraintExpression.cs" />
<Compile Include="Migrations\Expressions\Create\Expressions\CreateTableExpression.cs" />
<Compile Include="Migrations\Expressions\Create\ForeignKey\CreateForeignKeyBuilder.cs" />
<Compile Include="Migrations\Expressions\Create\ForeignKey\ICreateForeignKeyCascadeBuilder.cs" />
<Compile Include="Migrations\Expressions\Create\ForeignKey\ICreateForeignKeyForeignColumnBuilder.cs" />
<Compile Include="Migrations\Expressions\Create\ForeignKey\ICreateForeignKeyFromTableBuilder.cs" />
<Compile Include="Migrations\Expressions\Create\ForeignKey\ICreateForeignKeyPrimaryColumnBuilder.cs" />
<Compile Include="Migrations\Expressions\Create\ForeignKey\ICreateForeignKeyToTableBuilder.cs" />
<Compile Include="Migrations\Expressions\Create\ICreateBuilder.cs" />
<Compile Include="Migrations\Expressions\Create\Index\CreateIndexBuilder.cs" />
<Compile Include="Migrations\Expressions\Create\Index\ICreateIndexColumnOptionsBuilder.cs" />
<Compile Include="Migrations\Expressions\Create\Index\ICreateIndexForTableBuilder.cs" />
<Compile Include="Migrations\Expressions\Create\Index\ICreateIndexOnColumnBuilder.cs" />
<Compile Include="Migrations\Expressions\Create\Index\ICreateIndexOptionsBuilder.cs" />
<Compile Include="Migrations\Expressions\Create\Table\CreateTableBuilder.cs" />
<Compile Include="Migrations\Expressions\Create\Table\ICreateTableColumnAsTypeBuilder.cs" />
<Compile Include="Migrations\Expressions\Create\Table\ICreateTableColumnOptionForeignKeyCascadeBuilder.cs" />
<Compile Include="Migrations\Expressions\Create\Table\ICreateTableColumnOptionBuilder.cs" />
<Compile Include="Migrations\Expressions\Create\Table\ICreateTableWithColumnBuilder.cs" />
<Compile Include="Migrations\Expressions\Delete\Column\DeleteColumnBuilder.cs" />
<Compile Include="Migrations\Expressions\Delete\Column\IDeleteColumnBuilder.cs" />
<Compile Include="Migrations\Expressions\Delete\Constraint\DeleteConstraintBuilder.cs" />
<Compile Include="Migrations\Expressions\Delete\Constraint\IDeleteConstraintBuilder.cs" />
<Compile Include="Migrations\Expressions\Delete\DefaultConstraint\DeleteDefaultConstraintBuilder.cs" />
<Compile Include="Migrations\Expressions\Delete\DefaultConstraint\IDeleteDefaultConstraintOnColumnBuilder.cs" />
<Compile Include="Migrations\Expressions\Delete\DefaultConstraint\IDeleteDefaultConstraintOnTableBuilder.cs" />
<Compile Include="Migrations\Expressions\Delete\DeleteBuilder.cs" />
<Compile Include="Migrations\Expressions\Delete\Data\DeleteDataBuilder.cs" />
<Compile Include="Migrations\Expressions\Delete\Expressions\DeleteColumnExpression.cs" />
<Compile Include="Migrations\Expressions\Delete\Expressions\DeleteConstraintExpression.cs" />
<Compile Include="Migrations\Expressions\Delete\Expressions\DeleteDataExpression.cs" />
<Compile Include="Migrations\Expressions\Delete\Expressions\DeleteDefaultConstraintExpression.cs" />
<Compile Include="Migrations\Expressions\Delete\Expressions\DeleteForeignKeyExpression.cs" />
<Compile Include="Migrations\Expressions\Delete\Expressions\DeleteIndexExpression.cs" />
<Compile Include="Migrations\Expressions\Delete\Expressions\DeleteTableExpression.cs" />
<Compile Include="Migrations\Expressions\Delete\ForeignKey\DeleteForeignKeyBuilder.cs" />
<Compile Include="Migrations\Expressions\Delete\ForeignKey\IDeleteForeignKeyForeignColumnBuilder.cs" />
<Compile Include="Migrations\Expressions\Delete\ForeignKey\IDeleteForeignKeyFromTableBuilder.cs" />
<Compile Include="Migrations\Expressions\Delete\ForeignKey\IDeleteForeignKeyOnTableBuilder.cs" />
<Compile Include="Migrations\Expressions\Delete\ForeignKey\IDeleteForeignKeyPrimaryColumnBuilder.cs" />
<Compile Include="Migrations\Expressions\Delete\ForeignKey\IDeleteForeignKeyToTableBuilder.cs" />
<Compile Include="Migrations\Expressions\Delete\IDeleteBuilder.cs" />
<Compile Include="Migrations\Expressions\Delete\Data\IDeleteDataBuilder.cs" />
<Compile Include="Migrations\Expressions\Delete\Index\DeleteIndexBuilder.cs" />
<Compile Include="Migrations\Expressions\Delete\Index\IDeleteIndexForTableBuilder.cs" />
<Compile Include="Migrations\Expressions\Delete\Index\IDeleteIndexOnColumnBuilder.cs" />
<Compile Include="Migrations\Expressions\Execute\ExecuteBuilder.cs" />
<Compile Include="Migrations\Expressions\Execute\Expressions\ExecuteSqlStatementExpression.cs" />
<Compile Include="Migrations\Expressions\Execute\IExecuteBuilder.cs" />
<Compile Include="Migrations\Expressions\ExpressionBuilderBaseOfNext.cs" />
<Compile Include="Migrations\Expressions\ExpressionBuilderBase.cs" />
<Compile Include="Migrations\Expressions\Common\Expressions\CreateColumnExpression.cs" />
<Compile Include="Migrations\Expressions\Common\Expressions\CreateForeignKeyExpression.cs" />
<Compile Include="Migrations\Expressions\Common\Expressions\CreateIndexExpression.cs" />
<Compile Include="Migrations\Expressions\Common\IColumnOptionBuilder.cs" />
<Compile Include="Migrations\Expressions\Common\IColumnTypeBuilder.cs" />
<Compile Include="Migrations\Expressions\IFluentBuilder.cs" />
<Compile Include="Migrations\Expressions\Common\IForeignKeyCascadeBuilder.cs" />
<Compile Include="Migrations\Expressions\Insert\Expressions\InsertDataExpression.cs" />
<Compile Include="Migrations\Expressions\Insert\IInsertBuilder.cs" />
<Compile Include="Migrations\Expressions\Insert\IInsertIntoBuilder.cs" />
<Compile Include="Migrations\Expressions\Insert\InsertBuilder.cs" />
<Compile Include="Migrations\Expressions\Insert\InsertIntoBuilder.cs" />
<Compile Include="Migrations\Expressions\Rename\Column\IRenameColumnBuilder.cs" />
<Compile Include="Migrations\Expressions\Rename\Column\IRenameColumnToBuilder.cs" />
<Compile Include="Migrations\Expressions\Rename\Column\RenameColumnBuilder.cs" />
<Compile Include="Migrations\Expressions\Rename\Expressions\RenameColumnExpression.cs" />
<Compile Include="Migrations\Expressions\Rename\Expressions\RenameTableExpression.cs" />
<Compile Include="Migrations\Expressions\Rename\IRenameBuilder.cs" />
<Compile Include="Migrations\Expressions\Rename\RenameBuilder.cs" />
<Compile Include="Migrations\Expressions\Rename\Table\IRenameTableBuilder.cs" />
<Compile Include="Migrations\Expressions\Rename\Table\RenameTableBuilder.cs" />
<Compile Include="Migrations\Expressions\Update\Expressions\UpdateDataExpression.cs" />
<Compile Include="Migrations\Expressions\Update\IUpdateBuilder.cs" />
<Compile Include="Migrations\Expressions\Update\IUpdateTableBuilder.cs" />
<Compile Include="Migrations\Expressions\Update\IUpdateWhereBuilder.cs" />
<Compile Include="Migrations\Expressions\Update\UpdateBuilder.cs" />
<Compile Include="Migrations\Expressions\Update\UpdateDataBuilder.cs" />
<Compile Include="Migrations\Upgrade\V_8_0_0\AddContentNuTable.cs" />
<Compile Include="Migrations\Upgrade\V_8_0_0\AddLockObjects.cs" />
<Compile Include="Migrations\Upgrade\V_8_0_0\VariantsMigration.cs" />
<Compile Include="Migrations\Upgrade\V_8_0_0\ContentVariationMigration.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="RuntimeState.cs" />
<Compile Include="Runtime\CoreInitialComposer.cs" />
@@ -403,42 +216,6 @@
<Compile Include="Security\UmbracoEmailMessage.cs" />
<Compile Include="Security\UserAwarePasswordHasher.cs" />
<Compile Include="ServiceContextExtensions.cs" />
<Compile Include="Services\Implement\AuditService.cs" />
<Compile Include="Services\Implement\ConsentService.cs" />
<Compile Include="Services\Implement\ContentService.cs" />
<Compile Include="Services\Implement\ContentTypeService.cs" />
<Compile Include="Services\Implement\ContentTypeServiceBase.cs" />
<Compile Include="Services\Implement\ContentTypeServiceBaseOfTItemTService.cs" />
<Compile Include="Services\Implement\ContentTypeServiceBaseOfTRepositoryTItemTService.cs" />
<Compile Include="Services\Implement\ContentTypeBaseServiceProvider.cs" />
<Compile Include="Services\Implement\DataTypeService.cs" />
<Compile Include="Services\Implement\DomainService.cs" />
<Compile Include="Services\Implement\EntityService.cs" />
<Compile Include="Services\Implement\EntityXmlSerializer.cs" />
<Compile Include="Services\Implement\ExternalLoginService.cs" />
<Compile Include="Services\Implement\FileService.cs" />
<Compile Include="Services\IdkMap.cs" />
<Compile Include="Services\Implement\KeyValueService.cs" />
<Compile Include="Services\Implement\LocalizationService.cs" />
<Compile Include="Services\Implement\LocalizedTextService.cs" />
<Compile Include="Services\Implement\LocalizedTextServiceFileSources.cs" />
<Compile Include="Services\Implement\LocalizedTextServiceSupplementaryFileSource.cs" />
<Compile Include="Services\Implement\MacroService.cs" />
<Compile Include="Services\Implement\MediaService.cs" />
<Compile Include="Services\Implement\MediaTypeService.cs" />
<Compile Include="Services\Implement\MemberGroupService.cs" />
<Compile Include="Services\Implement\MemberService.cs" />
<Compile Include="Services\Implement\MemberTypeService.cs" />
<Compile Include="Services\Implement\NotificationService.cs" />
<Compile Include="Services\Implement\PackagingService.cs" />
<Compile Include="Services\Implement\PublicAccessService.cs" />
<Compile Include="Services\Implement\RedirectUrlService.cs" />
<Compile Include="Services\Implement\RelationService.cs" />
<Compile Include="Services\Implement\RepositoryService.cs" />
<Compile Include="Services\Implement\ScopeRepositoryService.cs" />
<Compile Include="Services\Implement\ServerRegistrationService.cs" />
<Compile Include="Services\Implement\TagService.cs" />
<Compile Include="Services\Implement\UserService.cs" />
<Compile Include="Sync\DatabaseServerMessenger.cs" />
<Compile Include="Sync\RefreshInstruction.cs" />
<Compile Include="Sync\ServerMessengerBase.cs" />
@@ -465,9 +242,7 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="Models\Editors" />
<Folder Include="Persistence\Repositories\Implement" />
<Folder Include="PropertyEditors" />
<Folder Include="Services\Implement" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@@ -1,4 +1,8 @@
using System;
using System.Linq;
using Umbraco.Core.Models;
using Umbraco.Core.Models.Membership;
using Umbraco.Core.Services;
namespace Umbraco.Core
{
@@ -27,5 +31,62 @@ namespace Umbraco.Core
}
}
}
#region IContent
/// <summary>
/// Gets the current status of the Content
/// </summary>
public static ContentStatus GetStatus(this IContent content, string culture = null)
{
if (content.Trashed)
return ContentStatus.Trashed;
if (!content.ContentType.VariesByCulture())
culture = string.Empty;
else if (culture.IsNullOrWhiteSpace())
throw new ArgumentNullException($"{nameof(culture)} cannot be null or empty");
var expires = content.ContentSchedule.GetSchedule(culture, ContentScheduleAction.Expire);
if (expires != null && expires.Any(x => x.Date > DateTime.MinValue && DateTime.Now > x.Date))
return ContentStatus.Expired;
var release = content.ContentSchedule.GetSchedule(culture, ContentScheduleAction.Release);
if (release != null && release.Any(x => x.Date > DateTime.MinValue && x.Date > DateTime.Now))
return ContentStatus.AwaitingRelease;
if (content.Published)
return ContentStatus.Published;
return ContentStatus.Unpublished;
}
#endregion
/// <summary>
/// Gets the <see cref="IProfile"/> for the Creator of this content item.
/// </summary>
public static IProfile GetCreatorProfile(this IContentBase content, IUserService userService)
{
return userService.GetProfileById(content.CreatorId);
}
/// <summary>
/// Gets the <see cref="IProfile"/> for the Writer of this content.
/// </summary>
public static IProfile GetWriterProfile(this IContent content, IUserService userService)
{
return userService.GetProfileById(content.WriterId);
}
/// <summary>
/// Gets the <see cref="IProfile"/> for the Writer of this content.
/// </summary>
public static IProfile GetWriterProfile(this IMedia content, IUserService userService)
{
return userService.GetProfileById(content.WriterId);
}
}
}

Some files were not shown because too many files have changed in this diff Show More