Compare commits

...

550 Commits

Author SHA1 Message Date
Sebastiaan Janssen 0695839717 Updates version 2015-06-09 19:39:45 +02:00
Sebastiaan Janssen 12dba80553 Removes zzaaa from version number 2015-06-09 14:38:01 +02:00
Sebastiaan Janssen f1d26d0990 Bring web.config in line with the nuget one 2015-06-09 14:35:30 +02:00
Stephan 83d5eda63c Bugfix xdt upgrade to 7.3 2015-06-09 12:22:08 +02:00
Shannon 2f80d5466d Merge branch '7.3.0' of https://github.com/umbraco/Umbraco-CMS into 7.3.0 2015-06-09 12:17:53 +02:00
Shannon e90766ad06 Ensures that during install that we don't enable the identity user manager or cookie auth since no db tables exist, fixes the IsUpgrading check to check for actual valid tables 2015-06-09 12:17:45 +02:00
Stephan 379c629e9c U4-6683 - TEMP workaround enabling upgrade to 7.3 2015-06-08 22:50:48 +02:00
Shannon 49417cbce4 Fixes assembly references and assembly redirects 2015-06-06 22:35:24 +02:00
Shannon 6153c70ef6 Fixes: U4-6673 Xml data integrity dashboard 2015-06-05 17:27:18 +02:00
Stephan dffe09af58 Merge remote-tracking branch 'origin/dev-v7' into 7.3.0
Conflicts:
	src/Umbraco.Web/UmbracoModule.cs
2015-06-04 18:32:54 +02:00
Stephan 07e9a3a4ea Refactor scheduled tasks & publishing cancellation 2015-06-04 14:00:02 +02:00
Shannon e3973de880 Updates scheduled tasks to be async with cancellation token 2015-06-04 12:13:27 +02:00
Shannon 8e114f1e8f Scheduled publishing is executing request async with cancellation token 2015-06-04 11:49:58 +02:00
Shannon b21289a32f Merge branch 'dev-v7' of https://github.com/umbraco/Umbraco-CMS into dev-v7 2015-06-04 10:51:23 +02:00
Shannon 52cf5b5ec3 Changes header modification to PostReleaseRequestState 2015-06-04 10:51:15 +02:00
Shannon 3fbf90e56d Merge remote-tracking branch 'origin/dev-v7' into 7.3.0
Conflicts:
	build/UmbracoVersion.txt
	src/SolutionInfo.cs
	src/Umbraco.Core/Configuration/UmbracoVersion.cs
	src/Umbraco.Web.UI/Umbraco.Web.UI.csproj
2015-06-03 15:08:47 +02:00
Sebastiaan Janssen f100d82e2c Bump version 2015-06-03 14:03:04 +02:00
Shannon 3890353ff5 fixes merge issue 2015-06-03 12:37:31 +02:00
Shannon 60ce993c09 Fixes change password dashboard to have autocomplete = off and to not show plain text passwords. 2015-06-03 12:20:20 +02:00
Shannon c07021d2a0 Merge branch 'dev-v7' of https://github.com/umbraco/Umbraco-CMS into dev-v7 2015-06-02 22:41:06 +02:00
Shannon 744ee39904 Changes the IIS header removal to BeginRequest instead of PreSendRequestHeaders since that is not a recommended practice 2015-06-02 22:40:57 +02:00
Shannon Deminick d669bf64c0 Merge pull request #698 from Nicholas-Westby/dev-v7
Fixes U4-6665 (Localization Bug)
2015-06-02 21:29:16 +02:00
Shannon ff277cd99c Fixes: U4-6654 NullReferenceException downloading translation xml 2015-06-02 21:13:29 +02:00
Shannon Deminick 30cd303a13 Merge pull request #697 from wp-manaosoftware/dev-7-angularthrowexception
U4-6621 - fix issue AngularJS throws exception that locationEvent was…
2015-06-02 21:04:08 +02:00
Shannon 60ce987507 Merge branch 'dev-v7' of https://github.com/umbraco/Umbraco-CMS into dev-v7 2015-06-02 20:53:55 +02:00
Shannon a231899052 Fixes: U4-6635 with label overlaying the folder icon when the folder icons are small. 2015-06-02 20:53:46 +02:00
Shannon Deminick 7ddcccb0c5 Merge pull request #685 from gavinfaux/U4-6618
Back office insecure content warning loading Google Web Fonts when running over HTTPS
2015-06-02 20:16:12 +02:00
Nicholas-Westby db824d8daf Fixes U4-6665 (Localization Bug)
Fix for localization not working some of the time: http://issues.umbraco.org/issue/U4-6665
2015-05-29 21:02:07 -07:00
Warm a1a30240f6 U4-6621 - fix issue AngularJS throws exception that locationEvent was not defined when leaved a page without saving 2015-05-29 10:40:48 +07:00
Stephan f285af8a4e Merge remote-tracking branch 'origin/dev-v7' into 7.3.0 2015-05-26 13:19:43 +02:00
Shannon Deminick 7c4a189aa3 Merge pull request #696 from tomfulton/fix/u4-6655
Fix U4-6655:  RTE Macro not rendering in backoffice when "macroAlias" is not first attribute
2015-05-26 08:01:40 +10:00
Stephan 3b77c301c3 Warn if SkipIisCustomErrors is false 2015-05-23 23:16:15 +02:00
Tom Fulton 4ec66bc868 Fix U4-6655: RTE Macro not rendering in backoffice when "macroAlias" is not first attribute
Loosens UMBRACO_MACRO regex parsing to fix, add tests
2015-05-22 20:40:30 -06:00
Stephan fa8fe8ec66 BackgroundTaskRunner - few fixes 2015-05-21 21:54:30 +02:00
Stephan 61718f9450 fix merge 2015-05-21 21:03:32 +02:00
Stephan 115ba8dcb8 Merge remote-tracking branch 'origin/dev-v7' into 7.3.0
Conflicts:
	src/Umbraco.Tests/Scheduling/BackgroundTaskRunnerTests.cs
	src/Umbraco.Web/Scheduling/BackgroundTaskRunner.cs
	src/Umbraco.Web/Scheduling/BackgroundTaskRunnerAwaiter.cs
	src/Umbraco.Web/Umbraco.Web.csproj
2015-05-21 20:49:18 +02:00
Stephan a76ba9a0a7 BackgroundTaskRunner - more fixes 2015-05-21 19:37:22 +02:00
Stephan b804ff6107 Explicit exception on cache reentry 2015-05-21 16:09:20 +02:00
Shannon 9b086c7fdd fixes merge issues 2015-05-21 17:14:25 +10:00
Shannon b788a6c642 Merge remote-tracking branch 'origin/dev-v7' into 7.3.0
Conflicts:
	src/Umbraco.Web/PublishedCache/XmlPublishedCache/XmlCacheFilePersister.cs
	src/Umbraco.Web/Scheduling/BackgroundTaskRunner.cs
	src/Umbraco.Web/Scheduling/BackgroundTaskRunnerAwaiter.cs
	src/Umbraco.Web/Scheduling/Scheduler.cs
	src/umbraco.cms/businesslogic/web/StyleSheet.cs
2015-05-21 17:12:30 +10:00
Shannon a94f7e6ec0 Fixes RepositoryBase.Get to not use a GetOrAdd with the IRuntimeCache and instead just use a linear lookup, set cache, return - this causes less confusion and also prevents any inner recursive key lookups within our cache which was causing YSODs. Added tests for the RepositoryBase's DeepCloneRuntimeCacheProvider (see code comment about what this does), updates other repo's to use the RuntimeCache property instead of accessing it via the RepositoryCache.RuntimeCache property. 2015-05-21 17:04:14 +10:00
Shannon 72046a6ab9 removes test - expected behavior 2015-05-21 16:36:09 +10:00
Shannon ea2303c327 commits cache tests with recursive key lookup 2015-05-21 16:13:58 +10:00
Shannon 4c4117a052 Fixes BackgroundTaskRunner - moves the OnStopped call to where it should be. Un-ignores tests - these need to execute and cannot be ignored. They are not long running but if there are issues then they will timeout - DO NOT IGNORE. if the build server has issues with these then it's our logic that is at fault. 2015-05-21 13:05:58 +10:00
Stephan 521b8076d2 U4-6638 - bugfix BackgroundTaskRunner 2015-05-20 20:56:05 +02:00
Stephan 1def88d764 U4-6626 2015-05-20 18:26:08 +02:00
Stephan 910c349f7c Bugfix StyleSheet concatenation causing LOH GC issues 2015-05-20 17:00:32 +02:00
Shannon 260ec800c2 Disables the DeepCloneRuntimeCacheProvider for now until we solve this cache problem 2015-05-20 17:51:53 +10:00
Shannon 9e223eb891 Merge remote-tracking branch 'origin/dev-v7' into 7.3.0
Conflicts:
	src/Umbraco.Core/Cache/ObjectCacheRuntimeCacheProvider.cs
	src/Umbraco.Core/CoreBootManager.cs
	src/Umbraco.Web/Scheduling/BackgroundTaskRunner.cs
	src/Umbraco.Web/umbraco.presentation/content.cs
2015-05-20 16:24:17 +10:00
Shannon 6cfb5bc678 Have made the buttons always left aligned with the editing section, seems better since it's consistent on all screens and less right hand motion to click a button 2015-05-20 16:13:36 +10:00
Shannon a3b5996372 Fixes save/publish button placement on small screens 2015-05-20 16:01:44 +10:00
Shannon 31b4560daa Merge branch 'sebastian-claesson-dev-v7' into dev-v7 2015-05-20 15:08:45 +10:00
Shannon 2f2dd9c9b6 Merge branch 'dev-v7' of https://github.com/sebastian-claesson/Umbraco-CMS into sebastian-claesson-dev-v7 2015-05-20 15:07:48 +10:00
Shannon Deminick 02599e1254 Merge pull request #694 from Alain-es/datepicker-custom-format
Datepicker custom format
2015-05-20 14:48:36 +10:00
Stephan ac7ff31a67 U4-6626 - XmlCache, bugfix locks 2015-05-19 20:08:52 +02:00
Stephan bea7387459 bugfix LegacyPropertyEditorIdToAliasConverterTests 2015-05-19 15:06:22 +02:00
Stephan 009f071f48 XmlCache - comments 2015-05-19 14:04:32 +02:00
Stephan e0ecb3291d XmlCache - bugfix running with file cache disabled 2015-05-19 10:20:36 +02:00
Stephan dbaf7c0190 U4-6597 - fix issue with caches that would cache exceptions 2015-05-19 09:24:38 +02:00
Stephan 16e06b6d4d Revert 444a028, 0e5a469 and 9d8f33e 2015-05-19 09:24:25 +02:00
Shannon 444a028e30 adds tests for caching exceptions and only caching one time and fixes HttpRequestCacheProvider to work with them. 2015-05-19 15:57:11 +10:00
Shannon 0e5a469577 Fixes: U4-6597 Umbraco fails to reconnect to a SQL Server if it started up when SQL server was offline - however this requires some review. 2015-05-19 14:29:25 +10:00
Shannon 9d8f33e98e Fixes: U4-6597 Umbraco fails to reconnect to a SQL Server if it started up when SQL server was offline - however this requires some review. 2015-05-19 14:25:31 +10:00
Alain-es 2abb3177af Datepicker custom format 2015-05-18 15:57:27 +01:00
Alain-es 43f99e11a5 Datepicker custom format 2015-05-18 15:54:50 +01:00
Stephan 99ff86aefb DistributedCache - don't serialize payload on local node 2015-05-18 16:35:42 +02:00
Stephan 918bb761b2 Bugfix property value editors null-checks 2015-05-18 16:24:53 +02:00
Stephan 031f70f529 Merge branch 'dev-v7' into 7.3.0
Conflicts:
	src/Umbraco.Core/ApplicationContext.cs
	src/Umbraco.Core/Logging/LogHelper.cs
	src/Umbraco.Web.UI.Client/src/less/login.less
	src/Umbraco.Web/Scheduling/BackgroundTaskRunner.cs
2015-05-18 16:23:12 +02:00
Sebastian Claesson Hoffback d1d9878ab6 Fix content-edit-view on mobile devices
The content editing view did not work at all on small screens. The label
took to much space, leaving the controller with almost none. Now the
label and the controller get its own row on smaller screens. Much
cleaner look and you can acctually edit a page on a small screen. Note:
Grids still don't work well.
2015-05-18 13:59:42 +02:00
Sebastian Claesson Hoffback e9753c72a7 Merge pull request #1 from umbraco/dev-v7
Merge Shannons changes
2015-05-18 12:13:33 +02:00
Shannon 3b791c75f6 Fixes: U4-5020 Login view on mobile screen is too big 2015-05-18 20:09:03 +10:00
Shannon Deminick 35cb4d5690 Merge pull request #693 from sebastian-claesson/dev-v7
Fixed login-view on mobile devices
2015-05-18 19:37:33 +10:00
Sebastian Claesson Hoffback adde7c2f50 Fixed login-view on mobile devices
On smaller screens the login-view was too far to the right.

Related issue: http://issues.umbraco.org/issue/U4-5020
2015-05-18 11:34:13 +02:00
Shannon 25f9fecc16 Completes: U4-1979 Some legacy business logic APIs do not wrap the new Service APIs - gets permissions wrapped too 2015-05-18 19:34:01 +10:00
Shannon 76a10fc776 Works on: U4-1979 Some legacy business logic APIs do not wrap the new Service APIs. Deprecates the ctor passing in a parent id for the data type (since it's always -1). Wraps legacy DataTypeDefinition to use the new services layer. 2015-05-18 16:06:22 +10:00
Shannon 1d0b5f3251 ensures courier has access to internals 2015-05-18 16:04:23 +10:00
Shannon b01f8799ae oops! long time ago with the original 7.3 refactor of runtime caches, before we fixed deep cloning, the changes made just used normal http runtime cache, but with the deep cloning fixes these were not carried over. This fixes that by forcing the base RepositoryBase to use a DeepCloneRuntimeCacheProvider which is a wrapper for the normal runtime cache but ensures deep cloning in/out and resets dirty properties. 2015-05-18 16:03:25 +10:00
Shannon Deminick 62943d391f Merge pull request #692 from bjarnef/dev-v7-U4-6629
Fix changes in user section labels
2015-05-18 13:47:13 +10:00
Shannon 76fb595a55 Fixes: U4-6363 Expose Dictionary item access on UmbracoHelper 2015-05-18 13:38:14 +10:00
Shannon Deminick 0942eb839d Merge pull request #691 from Vrijdagonline/dev-v7
Updating Dutch Translations
2015-05-18 11:38:29 +10:00
bjarnef 21a4dfe33e Fix changes in user section labels
Fixed translation in da.xml according to change in en.xml  from 7.2.4 to
7.2.5
2015-05-17 22:16:39 +02:00
Stephan 8121fc42e5 U4-6626 - fix log level 2015-05-17 21:47:31 +02:00
Stephan c356ed1df8 Logger - add AppDomain.Id to log 2015-05-17 18:48:26 +02:00
Stephan 92f56ccedd U4-6626 - XmlCache, bugfix locks 2015-05-17 18:48:25 +02:00
Stephan 7cbe2410e4 Do not flood the log when installing a new version 2015-05-17 18:48:21 +02:00
Arjan Woldring 1dda3ce45d Updating Dutch Translations
Missing keys added, deleted keys deleted, reorderded some keys based on
the english one and corrected couple of wrong translations.
2015-05-16 19:06:04 +02:00
Shannon Deminick 1e29a4a8ca Merge pull request #688 from sebastian-claesson/dev-v7
Swedish was using the wrong format for variables
2015-05-15 15:46:17 +10:00
Sebastian Claesson Hoffback 01de0bd6a1 Swedish was using the wrong format for variables
The swedish translation was using {0} instead of %0%. Leading to alot of
texts being weirdly formated.
2015-05-15 07:22:11 +02:00
Shannon fbb46c9ffe Allows Courier core to see internals 2015-05-14 14:42:53 +10:00
Shannon 628f5b283f Merge branch 'michaeljfarr-dev-v7' into 7.3.0 2015-05-14 08:39:19 +10:00
Shannon 73c34fda9c Merge branch 'dev-v7' of https://github.com/michaeljfarr/Umbraco-CMS into michaeljfarr-dev-v7
Conflicts:
	src/Umbraco.Core/Umbraco.Core.csproj
	src/Umbraco.Core/packages.config
	src/Umbraco.Web/Umbraco.Web.csproj
2015-05-14 08:38:51 +10:00
Shannon b442fecca7 Merge remote-tracking branch 'origin/dev-v7' into 7.3.0 2015-05-14 08:33:25 +10:00
Shannon Deminick 4d0d29c004 Merge pull request #686 from Aaen/dev-v7
Change translation for add row for fix issue U4-6564
2015-05-14 07:57:12 +10:00
Shannon Deminick 741c2bb085 Merge pull request #687 from sebastian-claesson/dev-v7
Swedish translation for the grid-editor
2015-05-14 07:54:16 +10:00
Sebastian Claesson Hoffback 2c809857af Swedish translation for the grid-editor
Swedish translation was completly missing for the grid-editor
2015-05-13 14:59:27 +02:00
Dennis Aaen 236d6ee302 Change translation for add row for fix issue U4-6564 2015-05-13 13:27:37 +02:00
Gavin Faux 3094dea5d4 Back office insecure content warning loading Google Web Fonts when running over HTTPS
Amend to use https://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js
2015-05-13 09:45:20 +01:00
Shannon 9e1d3220c2 Ensures all correct security columns exist on user table and ensures they are updated. 2015-05-13 18:19:23 +10:00
Shannon de7294335f Adds nicer extensions for the Localize methods to not pass in a Culture and take the Culture from the current thread. Adds GUID Id display to the content/media/members editor 2015-05-13 17:33:59 +10:00
Shannon 416dcdf90f Updates NotFoundHandlerHelper to use IDomainService and fixes IDomainRepository with the Exists and GetByName methods (with tests) 2015-05-13 16:45:08 +10:00
Shannon 2cd5b252d5 fixes merge issues 2015-05-13 12:24:16 +10:00
Shannon 64cbeb4c9d Merge branch 'dev-v7' into 7.3.0
Conflicts:
	src/Umbraco.Core/Services/EntityService.cs
	src/Umbraco.Core/Services/ServiceContext.cs
	src/Umbraco.Web/Cache/DataTypeCacheRefresher.cs
	src/Umbraco.Web/Cache/TemplateCacheRefresher.cs
	src/umbraco.cms/businesslogic/template/Template.cs
2015-05-13 12:20:43 +10:00
Shannon f829b0b16c Fixes text not overlayed on top of icon for folders in folder browser 2015-05-13 10:56:25 +10:00
Sebastiaan Janssen a42526b890 This file just keeps being marked as "changed" by git, committing it so I don't have to discard changes all the time 2015-05-12 11:15:02 +02:00
Shannon 3a36513307 Fixes: U4-6609 SQL Exception when trying to delete a template that isn't assigned to any doc type 2015-05-12 17:59:06 +10:00
Shannon 0548a32405 adds some simple docs to umb settings 2015-05-12 17:32:26 +10:00
Shannon 433950dd59 Merge branch 'dev-v7' of https://github.com/umbraco/Umbraco-CMS into dev-v7 2015-05-12 12:39:57 +10:00
Shannon ad8926668e Fixes: U4-6588 UmbracoSettings Error404 support Guids and Xpath - To achieve this, had to create an Id -> Key and Key -> Id method on EntityService including a cache for it which means updating all relavent cache refreshers to clear this cache when things are removed. Moved the logic for parsing an Umbraco XPath query (with tokens) to a stand-alone testable class (though haven't written tests), move the logic for looking up a not found page to the NotFoundHandlerHelper (instead of legacy 'library'). Fixes the $root query, since I don't think that ever worked. I've tested $root now for both MNTP and for the not found handler and it works. 2015-05-12 12:39:46 +10:00
Sebastiaan Janssen 4ebc0fe4cf U4-6383 Download all translation tasks as XML Error
#U4-6383 Fixed Due in version 7.2.5
2015-05-11 21:33:52 +02:00
Shannon 1b1455067e Fixes: U4-6606 maxInvalidPasswordAttempts work for the UsersMembershipProvider doesn't work any more 2015-05-11 19:44:59 +10:00
Shannon 795de94a5f Fixes: U4-6102 After renaming Grid row configurations all data is lost for renames. So now we have warnings for both deletes and renames. 2015-05-11 18:46:26 +10:00
Shannon d6699ab3b3 Fixes: U4-6102 After renaming Grid row configurations all data is lost, also ensures that all events are unsubscribed on destroy 2015-05-11 16:18:35 +10:00
Shannon d2deaf0375 Fixes MVC references and updates to 4.0.0.1 2015-05-11 12:43:45 +10:00
Shannon 95ff94c532 Merge branch 'dev-v7' into 7.3.0
Conflicts:
	src/Umbraco.Core/packages.config
	src/Umbraco.Web.UI/packages.config
	src/Umbraco.Web.UI/umbraco/config/lang/en_us.xml
	src/Umbraco.Web/Editors/AuthenticationController.cs
	src/Umbraco.Web/packages.config
2015-05-11 12:26:53 +10:00
Shannon d94b334375 Moves login logging to the provider level 2015-05-11 12:22:56 +10:00
Shannon a4a49b1466 Revert "Fixes MVC 4.0.0.1 problem once and for all." - All MVC ref's are 4.0.0.0, no web config transforms (also there was never a 4.0.0.1 version of System.Net.Http). Everything works on my machine now, even with 4.0.0.1 installed in the GAC. 2015-05-11 11:45:13 +10:00
Shannon 9f82ae1db7 unspec to mvc 4.0.0.1 2015-05-11 10:52:38 +10:00
Shannon Deminick 2c92cd9ca9 Merge pull request #683 from umbraco/U4-6603
U4-6603 Log failed login attempts
2015-05-11 09:07:24 +10:00
Sebastiaan Janssen c34605937c U4-6603 Log failed login attempts
#U4-6603 Fixed
2015-05-10 17:47:32 +02:00
Shannon 11b5123bbb fixes datatokens dictionary check and ensures that webapi is initialized at the very end of the boot cycle. 2015-05-08 19:13:58 +10:00
Shannon Deminick 2a9d3df822 Merge pull request #682 from hfloyd/dev-v7
English Language file updates (Umbraco/config/lang)
2015-05-08 08:48:38 +10:00
Heather Floyd 3b849987bf Small fixes to 'en' language file. Update of 'en-us' language file to match 'en' language file. 2015-05-07 16:41:12 -04:00
Shannon d0dc5406cc fixes package merging 2015-05-07 16:39:00 +10:00
Shannon 3be1cd8b0d Merge branch 'dev-v7' into 7.3.0
Conflicts:
	build/UmbracoVersion.txt
	src/SolutionInfo.cs
	src/Umbraco.Core/packages.config
	src/Umbraco.Web.UI.Client/src/views/common/dialogs/user.controller.js
	src/Umbraco.Web.UI/packages.config
	src/Umbraco.Web/packages.config
2015-05-07 16:24:29 +10:00
Shannon 8443513b2b fixes sorting with multipletextbox 2015-05-07 13:39:28 +10:00
Shannon fec9d066f0 Merge branch 'property-editor-fixes' of https://github.com/pynej/Umbraco-CMS into pynej-property-editor-fixes
Conflicts:
	src/Umbraco.Web.UI.Client/src/views/propertyeditors/contentpicker/contentpicker.controller.js
	src/Umbraco.Web.UI.Client/src/views/propertyeditors/markdowneditor/markdowneditor.controller.js
	src/Umbraco.Web.UI.Client/src/views/propertyeditors/multipletextbox/multipletextbox.html
	src/Umbraco.Web/PropertyEditors/ContentPickerPropertyEditor.cs
2015-05-07 13:24:59 +10:00
Shannon a69c7dd1fc Manually merges PR: 564 2015-05-07 13:09:29 +10:00
Shannon 4e6a3458d0 Fixes: U4-6600 Label on files not just folders in file browser (media) and fixes up the last image rendered in the photo browser, as well as the overlays, whitespace and overflow and vertical alignment. 2015-05-07 12:57:23 +10:00
Shannon a5bb8ba8ee Merge branch 'iamphill-media-label' into dev-v7 2015-05-07 12:01:44 +10:00
Shannon d4f3dbcfc0 Merge branch 'media-label' of https://github.com/iamphill/Umbraco-CMS into iamphill-media-label 2015-05-07 12:01:31 +10:00
Shannon 6a0656fbb0 fixes spacing for radio/check boxes (U4-6036) tested in ie, ff and chrome 2015-05-07 11:59:10 +10:00
Shannon Deminick 9dc0999ebd Merge pull request #595 from redmorello/U4-6036
U4 6036 - Checkbox and Radio button styling incorrect in backend
2015-05-07 11:49:30 +10:00
Shannon 813f1a1f2d Fixes: U4-6035 Properrty.WasDirty() always returns false 2015-05-07 11:43:53 +10:00
Shannon e45b0a53b8 Merge branch 'aaronpowell-master-v7' into dev-v7 2015-05-07 11:07:16 +10:00
Shannon 685635c568 Merge branch 'master-v7' of https://github.com/aaronpowell/Umbraco-CMS into aaronpowell-master-v7 2015-05-07 11:06:55 +10:00
Shannon Deminick a3e37de1ad Merge pull request #633 from bjarnef/dev-v7-U4-4507
U4-4507 - Make expand arrow in sections as a toggle
2015-05-07 11:02:08 +10:00
Shannon Deminick 692a8f807e Merge pull request #638 from bjarnef/dev-v7-U4-6276
Fix for U4-6276 - Keep headline at same position
2015-05-07 10:51:32 +10:00
Shannon f4bdcae411 Fixes: U4-6236 umbraco 7 macro parameters saving "null" 2015-05-07 10:47:36 +10:00
Shannon Deminick 3a726348d2 Merge pull request #673 from kgiszewski/dev-v7
Fix for U4-6530
2015-05-07 10:21:42 +10:00
Shannon Deminick d8b029eba6 Merge pull request #680 from WebCentrum/dev-v7-gridsort
U4-6593 - After sort, reset the TinyMCE editors with previous settings
2015-05-07 10:13:29 +10:00
Shannon 7c01670caf fixes mem leaks by not unsubscribing from events 2015-05-07 09:11:39 +10:00
Shannon 3ce5ff882e Fixes U4-5213 in a better way using a query string so it's clear where it redirects to 2015-05-07 09:11:25 +10:00
Shannon 6e7aa19073 Fixes U4-5213 in a better way using a query string so it's clear where it redirects to 2015-05-07 09:00:43 +10:00
Shannon 1cac4ed075 Fixes MVC 4.0.0.1 problem once and for all. 2015-05-07 08:10:45 +10:00
Stephan e358390211 Bugfix Xml cache - bad, bad Stephan 2015-05-06 11:10:04 +02:00
Sebastiaan Janssen 2e6c643dde Bump version 2015-05-06 11:08:25 +02:00
Sebastiaan Janssen d84b8aa675 Fix duplication of the mysql DbProviderFactory when using NuGet 2015-05-06 11:04:09 +02:00
Shannon Deminick 41a0c1f491 Merge pull request #679 from WebCentrum/dev-v7-loginredir
U4-5213 - Login redirect to originally requested URL
2015-05-06 17:46:07 +10:00
Shannon e8d4777d74 re-formatted some of the PR 2015-05-06 17:36:46 +10:00
Shannon e03ef76fcd Merge branch 'Jeavon-U4-5480' into dev-v7 2015-05-06 17:35:13 +10:00
Shannon 781ca34e34 Merge branch 'U4-5480' of https://github.com/Jeavon/Umbraco-CMS into Jeavon-U4-5480 2015-05-06 17:34:59 +10:00
Shannon d01e963365 Merge branch 'dev-v7' of https://github.com/umbraco/Umbraco-CMS into dev-v7
Conflicts:
	src/Umbraco.Web.UI/packages.config
2015-05-06 17:28:05 +10:00
Shannon 821daa82c4 Fixes: U4-6474 Update to latest examine v0.1.63 2015-05-06 17:14:10 +10:00
Sebastiaan Janssen a51dd93ffe Expressed version range was wrong 2015-05-06 08:58:45 +02:00
Shannon 7134373933 Fixes: U4-6484 Don't cast to specific Examine types - only interfaces like ISearcher/IIndexer 2015-05-06 13:25:24 +10:00
Allyen 8299243129 U4-6593 - After sort, reset the TinyMCE editors with previous settings 2015-05-05 22:07:18 +02:00
Sebastiaan Janssen 4144590189 Upgrade to latest MySql.Data and loosen up NuGet dependency 2015-05-05 12:15:28 +02:00
Shannon e2a821c257 Fixes and simplifies migration tests 2015-05-05 13:37:33 +10:00
Shannon ed54301914 Fixes unit test and updates all migration classes to use the correct ctor that get's it's required services 'injected' 2015-05-05 13:22:36 +10:00
Shannon 6849274b98 reverts umb version 2015-05-05 13:03:05 +10:00
Shannon 8fa838e8fb Fixes merge and re-code's the XmlCacheFilePersister to use ILogger 2015-05-05 12:44:19 +10:00
Shannon 2f9753cc12 Merge branch 'dev-v7' into 7.3.0
Conflicts:
	build/UmbracoVersion.txt
	src/SolutionInfo.cs
	src/Umbraco.Web.UI/Umbraco.Web.UI.csproj
	src/Umbraco.Web.UI/packages.config
	src/Umbraco.Web/Editors/BackOfficeController.cs
	src/Umbraco.Web/PublishedCache/XmlPublishedCache/XmlCacheFilePersister.cs
	src/Umbraco.Web/umbraco.presentation/content.cs
	src/umbraco.macroRenderings/app.config
2015-05-05 12:27:01 +10:00
Shannon 66263a44a5 updates nuget.exe ... we should really use the methodolgy that we've got in the new identity projects where we don't commit this file, instead we go get the latest from the web during build (but that would probably mean moving to powershell) 2015-05-05 11:58:33 +10:00
Allyen 2f4ff6aaae Login redirect to originally requested URL 2015-05-04 11:49:07 +02:00
Shannon 425df19c5c adds long overloads to interfaces 2015-05-04 14:36:46 +10:00
Shannon f9babe1882 Converts paged results to use 'long' params instead of ints and obsoletes the old ones. 2015-05-04 11:58:00 +10:00
Shannon cd2f512284 moves auth server classes to the identity extensions sln 2015-05-04 11:02:23 +10:00
Sebastiaan Janssen ab0e549c70 We got rid of macroRenderings project ages ago, why is this file still here? 2015-05-01 14:27:49 +02:00
Sebastiaan Janssen be065b2fa3 Generate symbols nupkg (apparently you can create it from an existing NuSpec file, very cool)
Making sure that all pdbs ARE actually generated in Release mode (the AllBinaries file was missing loads of files)
Generate all and include all xml doc files too
Corrects WebPI zip, also shouldn't include dotLess.Core.dll
2015-05-01 14:27:26 +02:00
Shannon 624975b4c9 Updates to WebApi2, fixes nuspec to include the correct dependencies (and simplifies them) 2015-05-01 14:03:59 +10:00
Shannon 85cdc79fd2 Need to publicize some things for the REST service to work 2015-04-30 16:39:41 +10:00
Shannon 374bbc0973 Need to publicize some things for the REST service to work 2015-04-30 15:39:03 +10:00
Sebastiaan Janssen f0dfd0dce2 U4-6568 NuGet 7.2.4 missing Microsoft.Threading.Tasks.dll and Microsoft.Threading.Tasks.Extensions.dll
#U4-6568 Fixed Due in version 7.2.5
2015-04-29 16:15:24 +02:00
Shannon da579c91e1 Fixes: U4-6460 7.2.2 -> 7.2.4 update fails with "an item with the same key has already been added" error 2015-04-27 13:40:41 +10:00
Shannon 550d690a31 Fixes: U4-6559 ServerVariables parsing - An Item with the same key has already been added 2015-04-27 12:41:19 +10:00
Shannon Deminick 40b75b7cf5 Merge pull request #672 from alecrt/dev-v7
U4-6295 - Fix for BusinessLogic.Log.CleanLogs task error
2015-04-27 10:56:33 +10:00
Shannon Deminick 0b28a68678 Merge pull request #675 from abjerner/patch-6
listview.html: the arrows for symbolizing ascending and descending are wrong
2015-04-27 10:53:52 +10:00
Anders Bjerner 5f27355247 listview.html: the arrows for symbolizing ascending and descending are wrong 2015-04-26 14:44:25 +02:00
Sebastiaan Janssen 356ea6824f U4-6547 Re: U4-6096 German Translator file broken again in V7.2.4
#U4-6547 Fixed Due in version 7.2.5
2015-04-23 16:59:57 +02:00
Sebastiaan Janssen 7ffb73e467 Updates Examine dependency 2015-04-23 16:45:24 +02:00
Sebastiaan Janssen 57c3665d0f Show different ReadMe for fresh install vs. upgrade installs 2015-04-23 16:01:23 +02:00
Sebastiaan Janssen 8037f929aa Ignore more slow tests 2015-04-23 15:35:42 +02:00
Sebastiaan Janssen fec3e57ed6 Ignore tests that don't run to completion on slower build server 2015-04-23 15:19:18 +02:00
Sebastiaan Janssen 5106ffab97 Mark as Release Candidate 2015-04-23 15:00:12 +02:00
Sebastiaan Janssen 9f569171c3 Suppress error (it's useless information) 2015-04-23 14:59:13 +02:00
Sebastiaan Janssen d607041ca4 U4-6450 Creating Partial View Macro without 'Create Macro' selected still tries to create a macro
#U4-6450 Fixed
2015-04-23 14:55:57 +02:00
Sebastiaan Janssen b3daf7f55d Merge branch 'dev-v7-xmllock' into dev-v7 2015-04-23 14:23:23 +02:00
Sebastiaan Janssen a77d3bc4ac Adds some more defaults tests 2015-04-23 14:22:42 +02:00
kgiszewski dc3e144493 Fix for U4-6530 2015-04-20 10:28:35 -04:00
alecrt f20fed3ce8 Fix for U4-6295 - BusinessLogic.Log.CleanLogs task error 2015-04-18 19:00:03 +02:00
Shannon 5a3b97c669 puts the claim validation back in (needs to be there, took it out for testing) 2015-04-15 20:38:04 +10:00
Shannon 570b71820f publicizes a couple things to make it easier for tests 2015-04-15 17:06:08 +10:00
Shannon 442160bb7a fixes identity conversion when it's just a generic identity and not auth'd, we can never convert to back office identity if it's not auth'd 2015-04-15 17:03:12 +10:00
Stephan c4aa87d73d Backport Xml concurrency fixes 2015-04-13 19:12:03 +02:00
Stephan 57909489cb AsyncLock - import 2015-04-13 19:12:00 +02:00
Shannon f87764f9d5 a bit better support for unit testing controllers with ctor overloads 2015-04-13 20:13:57 +10:00
Shannon 9d4e0f1e3d Changes UmbracoApiControllerBase to lazily create properties which helps with unit testing 2015-04-13 16:08:34 +10:00
Shannon 800b8b5f7e updates nuspec, creates new UmbracoApiControllerBase which is not auto-routed but contains the base services 2015-04-13 15:06:40 +10:00
Shannon c10c1f8fac publicizes a global setting (which still needs to be moved to config) 2015-04-13 13:33:13 +10:00
Shannon dbd9240142 adds a token constant auth type 2015-04-10 17:03:07 +10:00
Shannon c3ca651e4a Renames a few things to shorten names 2015-04-10 16:55:04 +10:00
Shannon f2e319a01f Updates the UmbracoBackOfficeIdentity to have better support for claims and adds unit tests for it. Creates OwinLogger's and methods to apply them. Updates security methods to ensure that a UmbracoBackOfficeIdentity is returned even from a normal ClaimsIdentity which will be the case with bearer tokens. Updates the angular anti-forgery checker to be ignore if the auth type is not cookie based. Adds a simple token server provider that people can use if they want. Now token authentication is working. 2015-04-10 14:22:09 +10:00
Shannon d6589960f2 re-organizes a bit of cache tests into one folder 2015-04-10 10:36:21 +10:00
Shannon 2847a28e74 Merge branch 'dev-v7' into 7.3.0
Conflicts:
	src/Umbraco.Web/Scheduling/BackgroundTaskRunner.cs
	src/Umbraco.Web/Scheduling/BackgroundTaskRunnerAwaiter.cs
2015-04-09 18:01:05 +10:00
Shannon c78b371965 updates the BackgroundTaskRunnerAwaiter so that it exits if the runner is not running when it is ctor'd, adds diags. 2015-04-09 17:59:34 +10:00
Shannon e29668a01b Changes DebugDiagnosticsLogger to not output Fail since that launches a debug entry window, adds some diagnostics to the background task runner stuff since the awaiter is waiting for every in very random cases. 2015-04-09 17:49:17 +10:00
Shannon 757108446d fixes tests 2015-04-09 17:18:47 +10:00
Shannon 19715ef45f Fixes build, updated BackgroundTaskRunner to get an ILogger injected 2015-04-09 17:12:52 +10:00
Shannon a1c7352da1 Merge branch 'dev-v7' into 7.3.0
Conflicts:
	src/Umbraco.Core/Umbraco.Core.csproj
	src/Umbraco.Tests/Integration/GetCultureTests.cs
	src/Umbraco.Tests/Models/ContentTests.cs
	src/Umbraco.Tests/Models/ContentTypeTests.cs
	src/Umbraco.Tests/Persistence/Repositories/ContentTypeRepositoryTest.cs
	src/Umbraco.Tests/Routing/DomainsAndCulturesTests.cs
	src/Umbraco.Tests/Scheduling/BackgroundTaskRunnerTests.cs
	src/Umbraco.Tests/Services/ContentTypeServiceTests.cs
	src/Umbraco.Web/Models/ContentExtensions.cs
	src/Umbraco.Web/Mvc/SurfaceController.cs
2015-04-09 16:50:07 +10:00
Shannon c525be3e44 Completes: U4-6474 Update to latest examine v0.1.62 2015-04-09 15:33:58 +10:00
Shannon cc804bd3bd removes duplicate test 2015-04-08 17:57:00 +10:00
Shannon 24dc8309f1 sets ConfigureAwait(false) for XmlCacheFilePersister await calls and BackgroundTaskRunner await calls since these are always on background threads, no synchronizing with any context. 2015-04-08 17:15:21 +10:00
Shannon ce81f9b1b1 we'll try these tests again 2015-04-08 17:08:06 +10:00
Shannon 3f70761d49 this should fix one of the tests 2015-04-08 17:01:38 +10:00
Shannon dee45146a4 applies a max timout for BackgroundTaskRunnerTests 2015-04-08 16:55:34 +10:00
Shannon b35397b464 uses property type ctor overload to accept an alias which prob should have been there all along since in most cases you need an alias to create one (same prob goes for property groups, etc... but oh well). Adds a couple tests for case insensitive comparisons in PropertyCollection 2015-04-08 16:33:16 +10:00
Shannon 147cc92ac5 Updates BackgroundTaskRunner & tests: removes the need for most Thread.Sleep which is error prone, this is done by updating the GetAwaiter() method to be a custom awaiter so we can await the entire background task running operations. We then add a property called CurrentThraedingTask which then allows awaiting the current Task instance. Adds error handling to all event handlers for the task runner. Changes events to be TypedEventHandlers 2015-04-08 16:28:42 +10:00
Shannon 3230fce76a fixes lock on PropertyCollection, should just be a normal lock 2015-04-08 11:47:16 +10:00
Shannon 1d22c1e81e fixes get hash code on Entity base class 2015-04-08 11:47:00 +10:00
Shannon ece2e2359e Updates PropertyGroup's equality comparisons to: check the base comparison, then check for a case insensitive comparison with name, fixes GetHashCode to be consistent with the Equals method. 2015-04-08 11:31:14 +10:00
Shannon 8cbe53f49d Updates PropertyType to have a ctor overload accepting an alias when one already exists. Updates it's equality comparisons to: check the base comparison, then check for a case insensitive comparison with alias, fixes GetHashCode to be consistent with the Equals method. 2015-04-08 11:30:35 +10:00
Shannon Deminick cac3ddc3c8 Merge pull request #666 from JimBobSquarePants/dev-v7
Remove Content Service Setter case sensitivity
2015-04-08 10:07:34 +10:00
Shannon 0eac50ceba Fixes: U4-6506 Grid config in package.manifest doesn't allow for multiple grid editors and adds tests 2015-04-07 17:24:35 +10:00
Shannon d5e735ac14 Fixes singleton accessors and adds ctor which would allow unit testability. 2015-04-07 12:07:54 +10:00
Shannon Deminick 8d841d3537 Merge pull request #667 from AndyButland/u4-1733
U4-1733 - Added overloads to RedirectToUmbracoPage methods to allow passing of a querystring
2015-04-07 11:05:05 +10:00
michael ae3c17073b Move MVC dependencies from Umbraco.Core to Umbraco.Web
note:MvcHandler.DisableMvcResponseHeader = true was removed from UmbracoApplicationBase.StartApplication.
This was the only breaking change, it can be put back in at a higher level if necessary.
2015-04-06 16:48:55 +12:00
Sebastiaan Janssen 5f175874b2 Fixes tests and adds a few 2015-04-02 17:52:59 +02:00
Sebastiaan Janssen fa053426c3 Don't disableFindContentByIdPath when in preview mode 2015-04-02 17:16:56 +02:00
Shannon 59dd6e0941 updates repo config 2015-04-02 14:59:03 +11:00
Shannon a321d4d1b8 Allows the ability to use external logins to login to authorize upgrades, this means being able to add reserved paths at startup dynamically which is now built in as part of the AuthenticationOptionsExtensions for registering external logins for the back office. 2015-04-02 14:46:53 +11:00
AndyButland 437e7f0ffc Removed unused usings from previous commit 2015-04-01 23:29:43 +02:00
AndyButland afa6c35bb5 Added overloads to RedirectToUmbracoPage methods to allow passing of a querystring 2015-04-01 23:27:20 +02:00
Stephan 22ac571c7d U4-6479 - fix GetCulture for unpublished content + add tests 2015-04-01 15:40:34 +02:00
James South 8d00dbf648 Remove Content Service Setter case sensitivity
Makes property alias key checking case-insensitive bringing behaviour in
line with IPublishedContent getters.
2015-04-01 12:37:28 +01:00
Stephan cd26a1ad21 U4-6479 - fix GetCulture for unpublished content + add tests 2015-04-01 12:59:01 +02:00
Shannon 40d3f2ffb9 Merge branch 'dev-v7' into 7.3.0
Conflicts:
	src/Umbraco.Web.UI.Client/src/views/propertyeditors/contentpicker/contentpicker.controller.js
2015-04-01 17:45:38 +11:00
Shannon 437ab4aaf1 Fixes installer permission steps - this cannot just arbitrarily write to the umbraco xml cache file 2015-04-01 17:44:27 +11:00
Shannon 0c0802e964 updates the migrations to use the correct ctor (not empty), this is more for v8 but have created a crappy activator that passes in the right args. 2015-04-01 17:43:27 +11:00
Shannon 2a6d5846d1 Fixes installer permission steps - this cannot just arbitrarily write to the umbraco xml cache file 2015-04-01 16:57:32 +11:00
Shannon a43847bc8b Adds IsUpgrading method to ApplicationContext and fixes AppBuilderExtensions checks since we need a user manager when upgrading 2015-04-01 16:12:32 +11:00
Shannon df6bb36876 moves notification logic to umbnotifications.directive instead of in main (not sure why it was there). Updates the AuthorizeUpgrade screen to be able to show YSOD or alert messages when there are server errors. Adds htmlhelper extensions to share between Default.cshtml and AuthorizeUpgrade.cshtml. Adds null check for BackOfficeUserManager. 2015-04-01 16:04:19 +11:00
Shannon d185f93c35 Fixes unit tests 2015-04-01 14:29:35 +11:00
Shannon df2ce2c133 fix merge 2015-04-01 14:05:29 +11:00
Shannon 5e90e74969 Merge branch '7.3.0' of https://github.com/umbraco/Umbraco-CMS into 7.3.0
Conflicts:
	src/Umbraco.Core/Persistence/Migrations/Initial/DatabaseSchemaCreation.cs
2015-04-01 14:03:05 +11:00
Shannon 924ee5c413 fixes merge 2015-04-01 14:02:14 +11:00
Shannon bceed10bd8 Merge branch 'dev-v7-distcache' into 7.3.0 2015-04-01 14:00:13 +11:00
Shannon Deminick dec7ef8f3f Merge pull request #663 from Shazwazza/dev-v7-7.30-AspNetIdentity
ASP.Net Identity for back office users
2015-04-01 13:57:37 +11:00
Shannon f019900619 oops, not sure how the LICENSE got deleted, removed AD identity nuspec since that is in a diff repo now. Removes commented out code in umb module for auth - this is done by cookie middleware now. 2015-04-01 13:55:33 +11:00
Shannon ad92006f54 Removes the extensibility files and build for identity stuff - that now exists in a separate github repo. 2015-04-01 13:42:43 +11:00
Shannon 439935430a Simple update adding nuspec for Identity AD 2015-04-01 13:42:40 +11:00
Shannon 1de9dbf18c Updates build process to include building a nuget Identity package to provide extensibility points in Umbraco. 2015-04-01 13:42:36 +11:00
Shannon 394cab5ab4 Updates the owin startup classes - we now have a default one shipped as a DLL which will always execute based on the appSettings, then we can ship with 2 optional ones that people can learn and use from which just requires them to update the appSetting. Now to decide on how to ship these .cs files 2015-04-01 13:42:34 +11:00
Shannon 6efd14eff3 Updates the startup auth code extension methods to better support extensibility so people could override the default user store or manager in order to implement some interfaces that we currently don't. 2015-04-01 13:42:31 +11:00
Shannon e468492064 Updates back office ext methods to include the CallbackPath which is key to make multi-tenanted work and ensures that the back office providers are linked with the umbraco back office external cookie provider. Adds some docs about it too. Updates the web.config templates to ensure the correct assembly redirects. 2015-04-01 13:42:29 +11:00
Shannon 140d3c0268 Update to latest Identity. Moves startup code to App_Start like VS templates have, this will be better for our nuget packages (like i do in UmbracoIdentity which works for both web apps and websites). Updates web.config to explicitly declare the owin startup otherwise we'll end up with conflicts (YSODs) and now people can configure it properly. 2015-04-01 13:42:26 +11:00
Shannon 349cb91e3a updates expires logic 2015-04-01 13:42:24 +11:00
Shannon abf70cd302 filters external login providers in the back office to only show the ones configured for umbraco back office 2015-04-01 13:42:21 +11:00
Shannon 880c9cf679 Updates back office extensions to use AuthenticationDescriptionOptionsExtension to configure the options for umb back office 2015-04-01 13:42:19 +11:00
Shannon bf59510c68 Removes setting the default sign in auth type - this is a user setting, we cannot modify that. 2015-04-01 13:42:16 +11:00
Shannon b67250c3d5 Updates back office auth extension methods to be explicit with specifying that it's for back office because we need to explicitly tell each provider the SignInAsAuthenticationType so that it uses the back office auth provider and not a user's own front-end one. 2015-04-01 13:42:14 +11:00
Shannon 86833aa8bf Updates the back office external cookie name to be consistently cased with the other back office cookie names 2015-04-01 13:42:11 +11:00
Shannon 4dcc4807ed Implements IUserSecurityStore and ensures there is a security stamp token in place, have updated the repository layer to manual update this if ASPNet Identity APIs are not used to update users. 2015-04-01 13:42:09 +11:00
Shannon 90b562a0a1 Update the PostLogin method to write the auth ticket the way that webapi is supposed to, not sure how this was actually working before because writing cookies directly with HttpContext and then also using WebApi normally doesn't work (maybe in very specific circumstances), so now the cookie writing is done consistently and it is working, prior to this i was getting lots of issues with the xsrf tokens. Updated some user model mappings for convenience and update naming conventions for some properties of the BackOfficeIdentityUser for consistency. 2015-04-01 13:42:07 +11:00
Shannon fc2b3d7fc7 fixes merge issues 2015-04-01 13:42:04 +11:00
Shannon 4d50dcea61 adds the auth extensions and removes all 3rd party packages 2015-04-01 13:42:02 +11:00
Shannon 1f9594eef4 updates notes in OwinStartup 2015-04-01 13:41:59 +11:00
Shannon 5a88ff774c adds overload to specify custom backoffice user store for custom implementations (i.e. 2 factor auth, etc...) 2015-04-01 13:41:57 +11:00
Shannon b269760b21 removes the BackOfficeRoleManager since we don't use roles in the back office (sections i suppose) and we can't dynamically just create them, that doesn't make sense. 2015-04-01 13:41:55 +11:00
Shannon 3efd038906 implements IUserRoleStore for sections for users 2015-04-01 13:41:52 +11:00
Shannon 2d72a66879 Updates OwinStartup and split the methods into an extension methods file complete with documentation on how to implement the providers. Tested the microsoft provider. Now to clean things up: remove the 3rd party package installs to be ready for shipping, ensure that the user parts are extensible enough for people to plugin their own interfaces. 2015-04-01 13:41:50 +11:00
Shannon 7dc50fda26 moves NaiveSessionCache to web proj 2015-04-01 13:41:48 +11:00
Shannon ff602da0fa Updates owin packages and updates the web.config tempate for owin redirects 2015-04-01 13:41:45 +11:00
Shannon 4b156ba27e Starts stubbing out role manager code 2015-04-01 13:41:43 +11:00
Shannon d9cf9cee88 Includes nice social buttons, updates styling on login and user panel, updates logic to un-link accounts 2015-04-01 13:41:40 +11:00
Shannon afa4c7b697 open id connect is working with azure ad 2015-04-01 13:41:38 +11:00
Shannon a2a8c8fbd7 updated to latest owin 2015-04-01 13:41:36 +11:00
Shannon 52c4d80cfc more identity awesome 2015-04-01 13:41:33 +11:00
Shannon 5d4d209030 Gets external cookies working with a custom auth type (so we don't interfere with the 'default') 2015-04-01 13:41:31 +11:00
Shannon d9f453d860 Gets the user store up to date with the correct queries. 2015-04-01 13:41:28 +11:00
Shannon 8c51e8bad8 Implements IExternalLoginService and the db table, implements more logic to start enabling this to work in the back office, need to implement the rest of the userstore and then implement a way once logged in to the back office to allow users to link their accounts with external logins. Currently if an external login is detected during startup and it has not been linked we'll throw an exception. Very very close to making this all work nicely. 2015-04-01 13:41:26 +11:00
Shannon d4b21243ca Allows external logins to be listed on login page, updates BackOfficeController with actions for invoking them. 2015-04-01 13:41:24 +11:00
Shannon 927add6f44 Updates UmbracoBackOfficeIdentity to add claims and adds a new ctor so people can create an identity manually - this is really the key, by doing this we'd already be able to have 3rd party authentication happening. Ensures our custom secure data format persists the user data 2015-04-01 13:41:21 +11:00
Shannon 48317d7e61 massively simplifies the cookie handling, we don't use our own and just use the defaults, the trick to not validating everything is to use the cookie path. This does mean that each clientside request will also be validated but there's no way to override this behavior in identity currently, the cookie handler is internal so unless we copy/paste all of it's code can't do much about that. 2015-04-01 13:41:18 +11:00
Shannon 93df2edec2 Initial install which now uses Identity middleware to perform the back office auth (no longer done in our module). Created custom data secure classes that use the legacy Forms auth logic for backwards compat. This means that the cookie can still be written the old way and still auth the new way if required. Now need to clean a lot of this up. 2015-04-01 13:41:16 +11:00
Shannon 028ddfe290 Starts adding asp.net identity 2015-04-01 13:41:13 +11:00
Shannon 051e9366e5 updates js undefined check 2015-04-01 13:39:54 +11:00
Shannon Deminick 46c6503320 Merge pull request #665 from magnuskragelund/dev-v7-U4-6469-mntp-referencing-deleted-nodes
fixes bug when trying to render a deleted node in multinode tree picker
2015-04-01 13:36:18 +11:00
Shannon 39a4f141d7 Merge branch 'dev-v7' into 7.3.0 2015-04-01 12:57:08 +11:00
Shannon 1cf2fc7870 updates sln docs and removes pdf test bits 2015-04-01 11:22:10 +11:00
Shannon c350904219 removes umb examine pdf test files 2015-03-31 17:07:35 +11:00
Shannon 3d09157091 fixes build 2015-03-31 17:06:13 +11:00
Shannon 040486c32b Merge branch 'dev-v7' into 7.3.0 2015-03-31 17:04:52 +11:00
Shannon cf1c38dcaa fixes build 2015-03-31 17:04:32 +11:00
Shannon 3b6d557dd4 Merge branch 'dev-v7' into 7.3.0 2015-03-31 14:28:20 +11:00
Shannon 73d7cd4856 updates sln file to remove the PDF proj and removes the sln folder containing umbraco examine libs 2015-03-31 14:27:18 +11:00
Shannon 74f4b60a21 Merge branch 'dev-v7' into 7.3.0 2015-03-31 14:04:49 +11:00
Shannon 1b87fd074c Merge branch 'dev-v7' of https://github.com/umbraco/Umbraco-CMS into dev-v7 2015-03-31 13:49:39 +11:00
Shannon 33f21e0528 Updates build and solution to exclude UmbracoExamine.PDF, removes files for UmbracoExamine.PDF, updates links to license in nuspec files 2015-03-31 13:49:28 +11:00
Sebastiaan Janssen 0b5a2452c2 U4-6476 Examine Issue: The CancellationTokenSource has been disposed.
#U4-6476 Fixed Due in version 7.2.5
2015-03-30 14:38:59 +02:00
Shannon cc8962f090 Removes the old umbracoexamine.azure libs 2015-03-30 20:07:26 +11:00
Shannon f6b9fdba72 Removes old docs folder 2015-03-30 20:06:51 +11:00
Shannon e0effec3b4 fixes pdf build to only have it's required files in the zip 2015-03-30 19:13:13 +11:00
Shannon 76a2f433d9 simplifies build since we don't have the examine azure stuff 2015-03-30 18:42:47 +11:00
Shannon a2bfca4d3a Merge branch 'dev-v7' of https://github.com/umbraco/Umbraco-CMS into dev-v7 2015-03-30 17:40:46 +11:00
Shannon fb24becd0d completes: U4-6468 Move all 'Strategies' in the Web project that performs Core data operations to the Core project 2015-03-30 17:40:36 +11:00
Shannon 58857c5d83 Moves publishing strategies into CacheRefresherEventHandler where the event handlers are supposed to exist. 2015-03-30 17:36:54 +11:00
Shannon 7a31d6cae3 better exception logging for examine 2015-03-30 17:23:28 +11:00
Shannon Deminick 021bb6d367 Merge pull request #661 from kgiszewski/dev-v7
Fix for U4-6462
2015-03-30 16:27:19 +11:00
Shannon Deminick 0742108ec1 Merge pull request #662 from AndyButland/u4-6412
U4-6412 - Ensures footer breadcrumb in content and media returned in correct order
2015-03-30 10:44:08 +11:00
Magnus Kragelund 1c3a7b95fc fixes bug when trying to render a deleted node in multinode tree picker 2015-03-27 11:02:35 +01:00
Shannon 5464107a9a replaces all LogHelper calls with to use ILogger in XmlCacheFilePersister 2015-03-27 15:21:12 +11:00
Shannon 84345a7e37 Merge branch 'dev-v7' into 7.3.0 2015-03-27 15:19:45 +11:00
Shannon fda72b2acc changes the MaxWaitMilliseconds tp 30000 to be consistent with the 7.3 branch 2015-03-27 15:19:31 +11:00
Shannon cd3191012f Merge branch 'dev-v7' into 7.3.0
Conflicts:
	src/Umbraco.Tests/Scheduling/BackgroundTaskRunnerTests.cs
	src/Umbraco.Web/PublishedCache/XmlPublishedCache/XmlCacheFilePersister.cs
	src/Umbraco.Web/Scheduling/LogScrubber.cs
	src/Umbraco.Web/Umbraco.Web.csproj
	src/Umbraco.Web/umbraco.presentation/content.cs
2015-03-27 15:15:49 +11:00
Shannon ec742d1f66 removes the usages of ILogger and ProfilerLogger since this is not for 7.3.0, will need to re-fix for 7.3 branch. 2015-03-27 14:56:12 +11:00
Shannon 4bdac1475f fixes log scrub interval with ms with updated background tasks 2015-03-27 14:52:38 +11:00
Stephan 58ce04e26b cleanup 2015-03-27 14:49:31 +11:00
Shannon 4c3de920c6 Removes the 'else' so that 'wait' is always checked. 2015-03-27 14:49:31 +11:00
Stephan be37026587 refactor latched background tasks, now use a task for xml
Conflicts:
	src/Umbraco.Web.UI/config/ClientDependency.config
2015-03-27 14:49:25 +11:00
Stephan a73b7a5849 refactor Scheduler to use new BackgroundTaskRunner capabilities
Conflicts:
	src/Umbraco.Web/Scheduling/Scheduler.cs
2015-03-27 14:48:47 +11:00
Stephan b7436dc55f refactor BackgroundTaskRunner 2015-03-27 14:47:42 +11:00
Shannon bc068b201d Updates BackgroundTaskRunner to ensure canceled or skipped tasks are disposed, updated tests to reflect 2015-03-27 14:47:42 +11:00
Shannon 912b01c9aa Updates BackgroundTaskRunner to support more complex options including the ability to only execute the last/final task in the queue. Added tests to support, updated the 'content' object to use this option so that only the last task in the queue will execute so that file persisting doesn't get queued but the correctly queued data will be written. 2015-03-27 14:47:42 +11:00
Shannon a82035061c Updates BackgroundTaskRunner to support async operations. Updates the content xml cache file persisting to use a IBackgroundTask instead of the strange queuing for persistence - which was super strange because in many cases another request thread will actually be the thread that is persisting the xml file than the request thread that requested it created. This implementation is far better, the xml file will be persisted on a non request thread and will handle multiple documents being published at the same time guaranteeing that the latest published version is the one persisted. The file persistence is also web aware (due to how BackgroundTaskRunner works) so during app shutdown the file will still be written if it's currently being processed. 2015-03-27 14:47:41 +11:00
Shannon ef9cc2da3a removes WebServerUtility since that original code was only for azure website dist cache when using web services and server registrars (POC) so we also don't need the extra nuget ref either. 2015-03-27 12:58:04 +11:00
Shannon 12fd5c642d Fixes a copy local and specific version ref for a webapi assembly 2015-03-27 12:47:48 +11:00
Shannon a9b71f8533 adds docs 2015-03-27 12:37:03 +11:00
Shannon c73749ea54 Removes ctor's accepting delegates and instead makes them abstract methods, adds some docs 2015-03-27 10:25:25 +11:00
Shannon e001ed93c1 Updates BatchedDatabaseServerMessenger to have an abstract GetBatch method instead of having a delegate in the ctor 2015-03-27 10:16:49 +11:00
AndyButland 0c107fd869 Ensures footer breadcrumb in content and media returned in correct order 2015-03-25 21:52:39 +01:00
kgiszewski 6419f301f7 Fix for U4-6462 2015-03-25 16:30:47 -04:00
Sebastiaan Janssen e775471013 Set disableFindContentByIdPath=false for local debugging of Umb source (the release config was already correct) 2015-03-25 17:08:53 +01:00
Shannon Deminick cc109d1ed0 Merge pull request #660 from perosb/U4-6444
Fix for U4-6444
2015-03-25 09:16:49 +11:00
Sebastiaan Janssen 9dfccd86fd U4-2499 Remove the possibility for accessing pages with nodeid's or give a redirect option
#U4-2499 Fixed Due in version 7.2.5
2015-03-24 20:09:48 +01:00
Per Osbeck ffaf1f96b9 Fix for U4-6444 2015-03-24 09:28:53 +01:00
Shannon 4e195543ea fixes null ref with component renderer in UmbracoHelper 2015-03-24 15:12:58 +11:00
Shannon 2c918a2015 Merge branch 'dev-v7' into 7.3.0
Conflicts:
	build/UmbracoVersion.txt
	src/Umbraco.Core/Configuration/UmbracoVersion.cs
	src/Umbraco.Web.UI/Umbraco.Web.UI.csproj
2015-03-24 15:10:45 +11:00
Shannon Deminick aa3c1d645b Merge pull request #659 from robertjf/dev-v7
Issue#U4-6448 typo fix in pageIndex Mandate checks
2015-03-24 12:45:35 +11:00
Robert Foster c6b393f2e8 typo fix in pageIndex Mandate checks 2015-03-24 12:30:28 +11:00
Shannon Deminick 344d909e6b Merge pull request #657 from webprofijt/packageinstaller-spelling
Fix some spelling mistakes in package installer
2015-03-23 09:45:56 +11:00
Arnoud de Vries e3925f18ef Fix some spelling mistakes in package installer 2015-03-22 16:29:53 +01:00
Sebastiaan Janssen 53a4d063e0 U4-464 The embedded passwordStrength.js file is GPL-licensed
#U4-464 Fixed Due in version 7.2.5
2015-03-22 13:13:51 +01:00
Sebastiaan Janssen 907e5e7ca4 Bump version 2015-03-20 11:25:59 +01:00
Sebastiaan Janssen 94e281e951 Merge branch '7.2.4' into dev-v7 2015-03-20 11:23:30 +01:00
Sebastiaan Janssen 03b60d4923 "It's simple until you make it complicated"
- So now this logic has been un-complicated: look for the web.config file, if it exists and has a umbracoConfigurationStatus appSetting then don't overwrite the web.config, the user is upgrading umbraco and config transforms can do their thing. Otherwise, copy in a fresh web.config with all the required Umbraco bits.
2015-03-20 10:35:41 +01:00
Shannon 27e96d6d5b Fixes: U4-6436 Localization in the back office doesn't work immediately after app restart 2015-03-20 10:35:34 +01:00
Shannon d2b4345773 Fixes: U4-6433 Usercontrol loaded after package installation not executing 2015-03-20 10:35:23 +01:00
Sebastiaan Janssen c5bbf97921 Bump version 2015-03-20 10:35:14 +01:00
Sebastiaan Janssen 8c4eba7837 "It's simple until you make it complicated"
- So now this logic has been un-complicated: look for the web.config file, if it exists and has a umbracoConfigurationStatus appSetting then don't overwrite the web.config, the user is upgrading umbraco and config transforms can do their thing. Otherwise, copy in a fresh web.config with all the required Umbraco bits.
2015-03-20 10:16:53 +01:00
Shannon 08a2ec6883 Fixes: U4-6436 Localization in the back office doesn't work immediately after app restart 2015-03-20 18:15:31 +11:00
Shannon b02e0c0232 Fixes: U4-6433 Usercontrol loaded after package installation not executing 2015-03-20 17:47:33 +11:00
Shannon 182d671e31 Merge branch 'dev-v7' into 7.3.0 2015-03-20 16:42:34 +11:00
Shannon fff0151b62 Updates build process to: Ensure the AssemblyFileVersion is set to the real umbraco version, AssemblyInformationalVersion is set to the real umbraco version including the pre-release name if there is one, AssemblyCopyright has the correct year. 2015-03-20 09:31:14 +11:00
Shannon f15301a7a0 Merge remote-tracking branch 'origin/dev-v7' into 7.3.0
Conflicts:
	build/UmbracoVersion.txt
	src/Umbraco.Core/Configuration/UmbracoVersion.cs
	src/Umbraco.Web.UI/Umbraco.Web.UI.csproj
2015-03-20 08:26:16 +11:00
Sebastiaan Janssen 90fdbb007e Bump version 2015-03-19 14:45:00 +01:00
Stephan 3b2ae6bc4a Merge branch 'dev-v7' into 7.3.0
Conflicts:
	src/Umbraco.Web/Models/ContentExtensions.cs
2015-03-19 09:39:31 +01:00
Stephan b714cbbd72 U4-6320 - fix log scrubbing intervals (from dev-v7) 2015-03-19 09:30:16 +01:00
Shannon 09afb93ec3 fixes test 2015-03-19 18:04:26 +11:00
Shannon ab4cb08c7d removed notes after checking 2015-03-19 17:48:40 +11:00
Shannon 2e877aa446 fixes build errors 2015-03-19 17:42:57 +11:00
Shannon d3eff734aa Merge branch 'dev-v7' into 7.3.0
Conflicts:
	build/UmbracoVersion.txt
	src/Umbraco.Core/Configuration/UmbracoVersion.cs
	src/Umbraco.Core/CoreBootManager.cs
	src/Umbraco.Core/Models/Template.cs
	src/Umbraco.Core/Persistence/Repositories/ContentTypeBaseRepository.cs
	src/Umbraco.Core/PropertyEditors/ParameterEditorResolver.cs
	src/Umbraco.Core/PropertyEditors/PropertyEditorResolver.cs
	src/Umbraco.Core/Services/LocalizedTextService.cs
	src/Umbraco.Core/Umbraco.Core.csproj
	src/Umbraco.Tests/Plugins/TypeFinderTests.cs
	src/Umbraco.Web.UI/Umbraco.Web.UI.csproj
	src/Umbraco.Web/Editors/BackOfficeController.cs
	src/Umbraco.Web/Models/ContentExtensions.cs
	src/Umbraco.Web/PublishedContentExtensions.cs
	src/Umbraco.Web/Routing/PublishedContentRequestEngine.cs
	src/Umbraco.Web/Scheduling/Scheduler.cs
	src/Umbraco.Web/Umbraco.Web.csproj
2015-03-19 17:37:00 +11:00
Stephan b52f234c02 U4-3753 - refactor 2015-03-12 15:01:25 +01:00
Stephan 5baaed19d0 Fix tests 2015-03-06 14:24:08 +01:00
Stephan 183e7e5910 Merge branch '7.3.0' into dev-v7-distcache 2015-03-06 14:06:52 +01:00
Stephan 173392f26e Fix environment issues with tests 2015-03-06 14:06:32 +01:00
Stephan be26527b27 Merge branch '7.3.0' into dev-v7-distcache 2015-03-05 19:57:56 +01:00
Stephan 414374498f Edit tests so they pass (ah well...) 2015-03-05 19:49:36 +01:00
Stephan 1443618857 Merge branch '7.3.0' into dev-v7-distcache 2015-03-05 12:29:38 +01:00
Stephan a7075422dc Fix build 2015-03-05 12:29:04 +01:00
Stephan 9213304161 Bugfix distributed cache 2015-03-05 10:49:22 +01:00
Stephan 46fdd605ae Refactor distributed cache & merge Shazwazza's DataBaseServerMessenger 2015-03-05 10:49:21 +01:00
Stephan 99598ec060 U4-3753 - add a way to get the rendering culture of a content 2015-03-05 10:47:02 +01:00
Shannon 0ae1453fb1 Merge branch 'dev-v7' into 7.3.0
Conflicts:
	src/umbraco.cms/businesslogic/Dictionary.cs
2015-02-23 13:18:01 +01:00
Shannon f63e8d7aed Adds unit test to show how to configure a test to mock the CurrentPage of a SurfaceController with public APIs 2015-02-18 18:05:37 +01:00
Shannon 5342d819d9 Merge branch 'dev-v7' into 7.3.0
Conflicts:
	src/Umbraco.Core/Umbraco.Core.csproj
2015-02-18 17:40:29 +01:00
Shannon ca20fb799d publicizes RouteDefinition 2015-02-18 17:28:21 +01:00
Shannon c760a7c50d Merge branch 'dev-v7-7.3.0-UmbHelperInterfaces' of https://github.com/Shazwazza/Umbraco-CMS into Shazwazza-dev-v7-7.3.0-UmbHelperInterfaces
Conflicts:
	src/Umbraco.Web/Umbraco.Web.csproj
2015-02-18 17:14:55 +01:00
Shannon 2a3019f1b4 Fixes query that broke the list view 2015-02-18 17:12:46 +01:00
Stephan 896d7aa788 Bugfix IContent.HasPublishedVersion 2015-02-18 10:18:01 +01:00
Stephan b7eb81dc76 Bugfix IContentService.GetPublishedVersion 2015-02-18 10:17:46 +01:00
Stephan a72fae333a change XmlCacheFilePersister timeouts 2015-02-17 15:19:20 +01:00
Shannon 4eef90fe25 Merge remote-tracking branch 'origin/dev-v7-7.1.3-BetterXmlCacheFilePersisting' into 7.3.0 2015-02-17 15:15:29 +01:00
Shannon 428df7ae4a Merge branch 'dev-v7' into 7.3.0
Conflicts:
	src/Umbraco.Core/Umbraco.Core.csproj
	src/Umbraco.Web.UI/packages.config
	src/Umbraco.Web/Umbraco.Web.csproj
2015-02-17 15:11:10 +01:00
Stephan 1fd4995edc cleanup 2015-02-17 15:10:51 +01:00
Shannon 667a731164 Removes the 'else' so that 'wait' is always checked. 2015-02-17 15:05:42 +01:00
bjarnef df5c5e78ff Headline was cuttet off in Firefox
In Firefox 35.0.1 the headline was cuttet off. The 1.4 line-height in
commit 824212f6c9 ensure the headline
isn't cuttet off. However line-height: normal act as fallback as 1em it
too little and cause the text might be cuttet off.
2015-02-16 20:58:40 +01:00
bjarnef 5579823b2d Remove padding-left from h1 in modal-left
Removed left-padding from h1 in umb-modal-left to align it with the
other text in the modal.
2015-02-16 00:11:41 +01:00
bjarnef 824212f6c9 Keep headline at same position
I made a small change to make sure the headline is in same position
regardless it is editable or readonly.
2015-02-15 22:20:34 +01:00
Stephan 0c5acb7f32 Implement IContent.HasPublishedVersion
Conflicts:
	src/Umbraco.Core/Persistence/Repositories/ContentRepository.cs
2015-02-10 15:39:12 +01:00
Stephan 470ccd1ffc Merge branch 'dev-v7' into 7.3.0 2015-02-09 08:59:23 +01:00
Stephan e12984af4c refactor latched background tasks, now use a task for xml 2015-02-08 16:25:30 +01:00
Stephan 7a6a6409c4 refactor Scheduler to use new BackgroundTaskRunner capabilities 2015-02-06 18:10:19 +01:00
Stephan 7c0f8db31b refactor BackgroundTaskRunner 2015-02-06 16:10:34 +01:00
bjarnef 7091cb6012 Change code for help videos
Change code for in help.controller.js as it was.
2015-02-05 10:52:55 +01:00
bjarnef a721f6836f Pointer cursor for sections in IE10
IE10 displayed a text cursor for tray and help section. Added cursor:
pointer; to make sure a pointer cursor is displayed.
2015-02-05 03:31:41 +01:00
bjarnef 83840ba6dd U4-4507 - Make expand arrow in sections as a toggle
I have made some suggestions, so the right arrow act as a toggle button,
so you easily can collapse the extra overflow-sections. Furthermore I
have made some changes, so when you click userDialog or helpDialog other
open dialogs close and also sections. When you click a section or expand
it also close dialogs, so you don't have to close those dialogs first.
2015-02-04 21:55:19 +01:00
Stephan f87ba4f0d5 Cleanup TypeHelper, add tests - IsAssignableFromGeneric may have issues? 2015-02-04 17:04:40 +01:00
Shannon fed5a14e1b Updates BackgroundTaskRunner to ensure canceled or skipped tasks are disposed, updated tests to reflect 2015-02-04 15:12:37 +11:00
Shannon b681ca5e17 Updates BackgroundTaskRunner to support more complex options including the ability to only execute the last/final task in the queue. Added tests to support, updated the 'content' object to use this option so that only the last task in the queue will execute so that file persisting doesn't get queued but the correctly queued data will be written. 2015-02-04 14:59:33 +11:00
Shannon cb853168c6 Merge branch 'dev-v7' into 7.3.0 2015-02-04 13:38:14 +11:00
Shannon c3640f2a3d Merge branch 'dev-v7' into 7.3.0 2015-02-04 12:14:45 +11:00
Stephan 70b325a189 fix tests 2015-02-03 20:58:13 +01:00
Stephan 80b23f8fa7 fix PetaPocoExtensions merge 2015-02-03 20:58:05 +01:00
Stephan 6d08d9b7b0 Merge branch 'dev-v7' into 7.3.0 2015-02-03 20:08:46 +01:00
Stephan 6b0292db64 cache clearing by object type (fix) 2015-02-02 09:39:58 +01:00
Stephan 1d80fc66af Merge branch 'dev-v7' into 7.3.0
Conflicts:
	src/Umbraco.Core/Umbraco.Core.csproj
2015-01-30 14:03:01 +01:00
Stephan 010e4edc83 U4-6202 - cache clearing by object type 2015-01-30 10:51:50 +01:00
Shannon b7f2152535 fixes a test, adds a null check 2015-01-30 10:18:19 +11:00
Shannon 5f0dc4a58e Fixes: U4-2038 Violation of PRIMARY KEY constraint 'PK_cmsContentPreviewXml' YSOD occurs when publishing content 2015-01-30 10:01:25 +11:00
Shannon 5667256d2c Merge branch 'dev-v7' into 7.3.0 2015-01-29 17:50:45 +11:00
Shannon c092d871c1 Fixes: U4-5834 Change password description text is confusing 2015-01-29 17:48:41 +11:00
Shannon e1e73f5e5f completes: U4-6174 Remove cmsPropertyType.helpText column 2015-01-29 17:21:44 +11:00
Shannon 23a8777cde oops fixes a stupid thing that i changed 2015-01-29 17:07:07 +11:00
Shannon 0e2e47d4ee Fixes: U4-6202 Cache not clearing by object type properly 2015-01-29 16:40:52 +11:00
Shannon dc8a37b489 updates template repo cache options 2015-01-29 16:08:37 +11:00
Shannon 47ec2572f5 IMplements RepositoryCacheOptions to be able to have a more granular approach to how the base repository caches entities. Allows for a zero count caching as well which by default currently will be false since that's how it's inadvertently been until now, however have enabled a zero count cache for public access since this is queried very heavily on GetAll. Going to look at what other repositories do the same - Templates definitely does. 2015-01-29 15:39:41 +11:00
Shannon bff9dfedcc Updates BackgroundTaskRunner to support async operations. Updates the content xml cache file persisting to use a IBackgroundTask instead of the strange queuing for persistence - which was super strange because in many cases another request thread will actually be the thread that is persisting the xml file than the request thread that requested it created. This implementation is far better, the xml file will be persisted on a non request thread and will handle multiple documents being published at the same time guaranteeing that the latest published version is the one persisted. The file persistence is also web aware (due to how BackgroundTaskRunner works) so during app shutdown the file will still be written if it's currently being processed. 2015-01-29 12:45:44 +11:00
Shannon 1b161c8dbe Removes more usages of legacy Access class to use new IPublicAccessService 2015-01-28 19:46:05 +11:00
Shannon 5a76e380de Adds some extension methods, updates the PCR to not use the legacy access class... this actually also reduces a db lookup, made it not depenent on singletons. 2015-01-28 19:27:08 +11:00
Shannon 6a4966136d more testing, got the protect page dialog all working now and ensuring the data is going to the right places 2015-01-28 18:24:12 +11:00
Shannon 0a0e34d806 Ensures that the cache is updated properly with cache refreshers, ensures that the GetAll method for public access repo doesn't make any db calls and uses a non validating cache since it gets called a ton. 2015-01-28 16:15:34 +11:00
Shannon 214db84f9d fixes up column names and error checks during upgrade 2015-01-28 13:51:07 +11:00
Shannon 61fd3fc505 Implements IPublicAccessService and wraps legacy Access class to use the new service, updates the public access data to use int's since using GUIDs atm is a little too complex, that will need to wait. 2015-01-28 13:16:50 +11:00
Shannon 70789e3676 Ensures that the public access xml migration is not run if there's already data in the db. 2015-01-27 20:34:30 +11:00
Shannon a7de549e4f Got xml public access structure being migrated to db now - need to do a check it hasn't already been migrated now. 2015-01-27 20:32:45 +11:00
Shannon efab275c99 Fixes: U4-6188 umbracoNode.uniqueId needs to be changed to not allow nulls, U4-6187 umbracoNode.uniqueID needs a Unique index - currently it is a non-unique index, Gets the public access repository built and started testing 2015-01-27 19:47:30 +11:00
Shannon f8600725b2 Fixes service context ctor to allow IMacroService 2015-01-27 14:58:59 +11:00
Shannon a5c1b0b2f2 Fixes tests, decouples the UrlSegmentProviderResolver a little bit 2015-01-27 14:52:24 +11:00
Shannon bd5833ec5f adds tests 2015-01-23 16:40:17 +11:00
Shannon 070fc368b2 Adds new public access db tables, removes refs to languagelocale col, fixes the migration script to create a table with a PK 2015-01-23 16:34:57 +11:00
Shannon 50ed207211 error check during stylesheet upgrade 2015-01-23 14:32:09 +11:00
Shannon 4ea0fa0a19 Fixes: U4-6163 Remove LanguageLocale column from cmsContentVersion 2015-01-23 12:34:51 +11:00
Shannon b5dd742257 fixes issue with task query 2015-01-23 12:19:09 +11:00
Shannon 0f4185b6a5 Gets legacy tasks apis wrapping new apis, added more tests and got the new tasks apis up to speed with all required methods. 2015-01-22 19:19:21 +11:00
Shannon ccea64f0fa fixes: U4-3170 Proxy legacy relations API through the new RelationService 2015-01-22 17:43:43 +11:00
Shannon b892f98834 Fixes up remaining routing tests, all tests passing (apart from arbitrary plugin mgr ones) 2015-01-22 15:42:29 +11:00
Shannon 2f86813a21 Migrating usages of old domain object to new IDomainService, this also involves updated quite a lot of unit tests. I've updated quite a few of the routing tests to be pure mocking tests which works much nicer than before so there's no db access, this also means they run a million times faster (need to clean them up further still though). Still more tests failing which need fixing. 2015-01-22 15:16:10 +11:00
Shannon 2cd92353ec Removes listening on legacy events for the CacheRefresherEventHandler 2015-01-22 12:17:36 +11:00
Shannon 42ad3af48b Updates legacy classes to be serialized with the EntityXmlSerializer 2015-01-22 11:48:13 +11:00
Shannon afb0aa8099 Merge remote-tracking branch 'origin/dev-v7' into 7.3.0 2015-01-22 11:21:50 +11:00
Shannon e13e86b25f Gets the legacy domain stuff wrapping the new apis, updates the DomainHelper to use the new apis without any statics and thus updates everything else referencing that, updates the pcr engine to have the propery ctor params with all required services instead of using statics. 2015-01-21 19:49:22 +11:00
Shannon 6b9930df6a removed commented out code 2015-01-21 18:36:57 +11:00
Shannon ae92c8219d Gets legacy domain api wrapping new api, updates DomainService with required methods. 2015-01-21 18:35:08 +11:00
Shannon 512e59871e Fixed issues relating to domain repository and added more tests, starts creating DomainService 2015-01-21 17:43:03 +11:00
Shannon 7545c0c1da Adds the DomainRepository with tests 2015-01-21 17:03:56 +11:00
Shannon 3f8df66385 Merge branch 'dev-v7' into 7.3.0 2015-01-21 13:28:10 +11:00
Shannon 44257e361a Fixes refs to Microsoft.Net.Http 2015-01-21 10:41:01 +11:00
Shannon e94b6fa3a8 fixes tests 2015-01-19 19:10:26 +11:00
Shannon 3621c20f80 Adds Save method and another test 2015-01-19 19:03:28 +11:00
Shannon ef4d28299a few more tests for TaskRepository 2015-01-19 18:50:17 +11:00
Shannon d4b718d615 Creates common base class for services, this streamlines all ctors and exposes correct services. Gets the TaskRepository working with a test, now to get it fully implemented. 2015-01-19 18:37:48 +11:00
Shannon 280826f3e8 Fixes: U4-6110 Cleanup the Audit trail code - this should be a service, remove all internal statics 2015-01-19 15:12:34 +11:00
Shannon 0a0d845173 Merge branch 'dev-v7' into 7.3.0 2015-01-19 13:26:30 +11:00
Shannon a999fca349 finalizes stylesheet editor, all is working nicely now 2015-01-19 12:50:26 +11:00
Shannon c853263894 Ensures that any instances created with the ManyObjectsResolverBase that have an HTTP lifetime are disposed of at the end of the request 2015-01-16 17:24:47 +11:00
Shannon 16f63b7fd9 Creates migration to remove stylesheet tables! and cleans up the singleton usage of sql syntax in the migrations. 2015-01-16 17:18:07 +11:00
Shannon d41035cb2d fixes tests and DebugDiagnosticsLogger 2015-01-16 16:57:32 +11:00
Shannon 1cb0cd296c Decoupling more things, mostly to do with the PluginManager and logging which now requires an IServiceProvider so have created a simple instance of that. 2015-01-16 15:47:44 +11:00
Shannon 8f100a7e9f decouples more of LogHelper and DisposableTimer 2015-01-16 12:29:27 +11:00
Shannon ed95ccc18e Creates ProfilingLogger in order to decouple the DisposableTimer from LogHelper and ProfilerResolver 2015-01-16 12:07:29 +11:00
Shannon e88264d0f7 Decouples more LogHelper 2015-01-16 11:08:00 +11:00
Shannon d9d8bae376 ensures that the html form attribute is set to POST if for some very strange reason someone visited that html page and tries to submit it with a real password 2015-01-16 10:58:22 +11:00
Shannon 6f76377a9e Gets the stylesheet migrations all working, updates other post migrations to use a common base class, adds ILogger to the MigrationContext 2015-01-16 10:57:49 +11:00
Shannon 3fdf13a8b1 Removes database support from legacy stylesheet apis 2015-01-15 15:11:52 +11:00
Shannon 23ea9e71fd Removes db support from the StylesheetRepository 2015-01-15 15:02:29 +11:00
Shannon 19037ee1ba Ensures all stylesheet usages in RTE are working as expected 2015-01-15 12:40:09 +11:00
Shannon 8abf6fc2b5 Cleans up legacy stylesheet code to wrap the new APIs better, creates a new OriginalPath property on IFile to track if the path has changed, updates FileRepository to deal with path's changing and automatically deal with renaming files. Adds new methods to IFileService: GetStylesheetsAtPath. Fixes up the stylesheet and stylesheet property editors to use the file names, gets tree syncing working nicely for them both even with files or properties are renamed. Updates stylesheet editors and controllers to use the new APIs 2015-01-15 11:49:32 +11:00
Shannon 5a6e63e8d4 Fixes up errors with the legacy stylesheet api wrapping the new one, the UI is now all working and even tree syncing is working. 2015-01-14 16:38:54 +11:00
Shannon 23341d8c76 fixes test 2015-01-14 15:22:19 +11:00
Shannon 5cbfa7bd91 Updates how the stylesheet file works, uses v5 style logic for naming a stylesheet rule, adds plenty of tests to support, fixes validation methods on the file service, removes the css parser library stuff as it's overkill for what we want. 2015-01-14 14:10:55 +11:00
Shannon b3a93e369a WIP - bit of a refactor on the IFile stuff, moves all validation to the service level and obsoletes the IFile.IsValid methods. Adds v5 style CSS property parsing, but might integrate that with this zany css parser in the core for 'safer' parsing. 2015-01-14 12:09:30 +11:00
Shannon 5d7902a9a7 Merge remote-tracking branch 'origin/dev-v7' into 7.3.0
Conflicts:
	src/Umbraco.Core/Persistence/Repositories/PartialViewMacroRepository.cs
	src/Umbraco.Core/Umbraco.Core.csproj
2015-01-14 09:10:11 +11:00
Shannon c41c727e06 WIP - working on getting the legacy StyleSheet business logic class wrapping the new services. 2015-01-13 20:18:02 +11:00
Shannon 10aad7e048 More decoupling from the SqlSyntaxContext singleton, repositories now all use an injected SqlSyntaxProvider, the respository factory, service context, etc... is now much more streamlined with classes created with a propery dependency chain. 2015-01-13 19:38:23 +11:00
Shannon cc396c8b96 Removes more unecessary singletons and simplifies/refactors some internal parts like the ctors for the ServiceContext, DatabaseContext. No more RepositoryResolver or SqlSyntaxProvidersResolver these are entirely uncessary and complicate things. 2015-01-13 18:19:52 +11:00
Shannon 1a7fbf5927 Also part of: U4-6106 Threading/Performance issue with MappingResolver and LazyManyObjectsResolverbase/ManyObjectsResolverBase 2015-01-13 18:11:01 +11:00
Shannon b28d719ee6 Fixes: U4-6106 Threading/Performance issue with MappingResolver and LazyManyObjectsResolverbase/ManyObjectsResolverBase 2015-01-13 18:09:52 +11:00
Shannon d5c8430cd2 Removes all IRepositoryCacheProvider's, we are just using a single cache construct to which is much easier to manage. 2015-01-13 13:33:39 +11:00
Shannon e3acdbe85b Fixes up dictionary and language repositories to have underlying simple get repositories since they support getting by id, unique id and string variations but we want to have native repository enabled caching for these items so these get methods now use private repositories based on these keys. Adds more tests, removes N+1 queries for languages and dictionary items. Removes RuntimeCacheProvider, we only want one type of cache, this simplifies things a lot. 2015-01-13 13:25:36 +11:00
Shannon ef2c46b6ab WIP - removes all the commented out code, now we need to ensure that the DictionaryRepository/Service performs well, there's a bunch of N+1 queries in there and caching will be ignored for several of the get methods when loading with a GUID which we need to have in there if we want it to perform just as well as before. 2015-01-12 20:14:12 +11:00
Shannon b9398375f1 Merge branch 'leekelleher-U4-5658' into 7.3.0 2015-01-12 19:40:33 +11:00
Shannon 274819f75f Merge branch 'U4-5658' of https://github.com/leekelleher/Umbraco-CMS into leekelleher-U4-5658 2015-01-12 19:40:16 +11:00
Shannon fb3b99a49a Fixes up a left join with dictionary -> language items, adds another couple of unit tests adds another method to the ILocalizationService 2015-01-12 19:39:30 +11:00
Shannon ffd4e9507b WIP Gets legacy dictionary, language classes to wrap the Core services implementation properly. Obsoletes a bunch of stuff, creates a few more tests, need to test UI now. 2015-01-12 18:52:30 +11:00
Shannon 7212015127 obsoletes all of the service ctor's that don't specify all required dependencies, none of these are used in the core. 2015-01-09 18:53:08 +11:00
Shannon 31a1ee9145 Fixes: U4-6088 Publicize all partial view methods on IFileService & U4-6087 Fix Partial View macro repository usage so that when a macro is created from the FileService, the MacroService events are raised 2015-01-09 18:39:44 +11:00
Shannon 53fbb18f1c removes unneeded commented out code in old template class 2015-01-09 17:32:10 +11:00
Shannon 43cfabe9e7 adds unit tests for File service for templates 2015-01-09 17:10:42 +11:00
Shannon caf972cd0f Ensures virtual path is set on the template, updates the tree controller to render the correct editor if it's webforms, updates the rest service to return the updated contents if the server changes it and updates the UI 2015-01-09 17:01:38 +11:00
Shannon 5bef3593dd More dependency cleanup, less singleton usages, better testing implementations 2015-01-09 15:27:47 +11:00
Shannon 3f233ad4a4 test fixed 2015-01-09 13:38:43 +11:00
Shannon 9252dc222a still unweaving more of this singleton mess, makes unit testing much easier 2015-01-09 13:35:32 +11:00
Shannon fafe056db0 More refactoring with ILogger and reducing the dependencies on all of these singletons. Created new DatabaseSchemaHelper to be used instead of the extension methods that require singletons to be set. 2015-01-09 13:00:26 +11:00
Shannon 9f30a9b0fc Removes more singletons and reliance on singletons/statics 2015-01-09 12:04:33 +11:00
Shannon 86f6c4a39d another test fixed 2015-01-09 11:56:43 +11:00
Shannon 32470e9bd2 fixes more tests 2015-01-09 11:23:40 +11:00
Shannon 97c18980d8 fixes some tests 2015-01-09 11:07:38 +11:00
Shannon defc9d3bc2 Updated all repo's to have their correct ctor's with their correct dependencies. Updated them all to accept ILogger updated all other dependencies with the same without breaking anything since all is internal, or obsoleted other public methods. Updates lots of the tests with mock instances instead, now more tests have less singleton dependencies, easier to test, much clearer and more IoC driven. Updated unit tests to supply the ILogger for required objects, tests should run faster now since most things are just mocked. 2015-01-09 10:51:15 +11:00
Shannon 77e672aec1 Exposes an ILogger property called Logger on all relevant base classes 2015-01-07 17:38:25 +11:00
Shannon 519b06fe30 Moves logging interface to Logging namespace called ILogger, creates a resolver for it, updates the boot process to ensure it exists first and anything during the boot process that is logging ensures that if it is not resolved that it logs elsewhere. Wraps LogHelper to use the ILogger based on the resolver. Updates all services that used LogHelper to have an ILogger injected into them. This is really only the start, there's a ton of places that use LogHelper (508) other places so we'll need to start looking at changing those over. All base classes will need to expose an Ilogger so people can use that. 2015-01-07 17:23:24 +11:00
Shannon 7e1b20e600 Merge branch 'umbUKFest-U4-5231' of https://github.com/AnthonyCogworks/Umbraco-CMS into 7.3.0
Conflicts:
	src/Umbraco.Core/Services/ServiceContext.cs
	src/Umbraco.Core/Umbraco.Core.csproj
	src/Umbraco.Tests/MockTests.cs
2015-01-07 16:13:47 +11:00
Shannon 023c7f3fe7 Merge branch 'dev-v7' into 7.3.0
Conflicts:
	build/UmbracoVersion.txt
	src/Umbraco.Core/Configuration/UmbracoVersion.cs
	src/Umbraco.Core/Persistence/Repositories/TemplateRepository.cs
	src/Umbraco.Web.UI/Umbraco.Web.UI.csproj
2015-01-07 15:54:08 +11:00
Shannon 89b8fe93b7 Updes more code for U4-337 2015-01-06 15:36:14 +11:00
Shannon f6cd597841 Fixes up some things from PR 610 and fixes up quoted values when using the Insert.IntoTable migration. 2015-01-06 13:44:42 +11:00
Shannon fa48af02a1 Merge branch 'leekelleher-U4-337' into 7.3.0
Conflicts:
	src/Umbraco.Core/Umbraco.Core.csproj
2015-01-06 12:24:29 +11:00
Shannon 8509aef99a Merge branch 'U4-337' of https://github.com/leekelleher/Umbraco-CMS into leekelleher-U4-337 2015-01-06 12:23:31 +11:00
Shannon 46e939715a Merge branch 'dev-v7' into 7.3.0 2015-01-06 12:22:54 +11:00
leekelleher 8a32f02781 Added custom event handler to create the relation for trashed nodes.
Removed the additional (AJAX) resource call from the Angular controller, as the relation removal is handled in server-side code during the move.
2015-01-04 20:46:00 +00:00
leekelleher 573192c33f Amends based @sitereactor's feedback. 2015-01-04 17:09:05 +00:00
leekelleher 56f5789976 Added "restore" language key/value for English (+US).
Will aim to do other languages in due course.
2015-01-03 22:24:10 +00:00
leekelleher f21265c7ae Added "DeleteById" method to the Relation Resource/Service. 2015-01-03 22:22:54 +00:00
leekelleher eace046342 Moved the SQL insert (to create the new relation type) to a separate DB migration for v7.3.0.
(This may need to be reviewed by Core team?)
2015-01-03 22:20:19 +00:00
leekelleher 0a6a41e4c2 Swapped the Action letter to be 'V', as it appeared to be available. 2015-01-03 22:19:03 +00:00
leekelleher b449973403 Added the relationship between the trashed node and its former parent node 2015-01-03 20:10:42 +00:00
leekelleher 911e81e4af Added constants for the relation-type aliases. 2015-01-03 20:10:41 +00:00
leekelleher 458e7dde94 Created "relationResource" to expose methods from RelationService to angular controllers.
Added view for the "restore" menu option.
2015-01-03 20:10:39 +00:00
leekelleher 0c7826b250 Added 'Restore' action class
+ menu option for items in the recycle bin.
2015-01-03 19:52:06 +00:00
leekelleher ef0ad41c8e New relation type: "Relate Parent Document On Delete" 2015-01-03 19:52:04 +00:00
Shannon fff1da2a12 Merge branch 'dev-v7' into 7.3.0 2015-01-02 16:25:52 +11:00
Shannon f91f25e5c0 Fixes issue with template model and package installation 2015-01-02 11:04:12 +11:00
Shannon 3f35ca1e77 Fixes merge and file encoding for master pages and templates to have BOM 2014-12-29 14:35:54 +11:00
Shannon 8c619e92d9 Merge branch 'dev-v7' into 7.3.0
Conflicts:
	build/UmbracoVersion.txt
	src/Umbraco.Core/Configuration/UmbracoVersion.cs
	src/Umbraco.Core/Persistence/Repositories/TemplateRepository.cs
	src/Umbraco.Web.UI/Umbraco.Web.UI.csproj
2014-12-29 14:30:01 +11:00
Aaron Powell b8097219fb Implementing a test for U4-6035 2014-12-21 17:56:33 +11:00
redmorello e5ec935128 Update forms.less
Removed negative left margin from checkbox and radio button inputs.
2014-12-18 11:08:44 +00:00
redmorello 3ea16e66d4 Update forms.less
Removed negative left margin from input and radio button inputs.
2014-12-18 11:07:08 +00:00
Phil Hughes 562367e9a2 Label on files not just folders 2014-12-16 15:25:13 +00:00
Shannon d4fd58e038 Completes: U4-5846 Remove cmsTemplate.master column and transfer those values over to umbracoNode.parentId, U4-5847 Ensure the path is set correctly for templates in the db, almost done the other template service tasks too. 2014-12-05 17:29:47 +11:00
Shannon 2961370b83 Adds some more tests, the legacy template object should now be wrapping the new one completely in regards with business logic (db) 2014-12-05 14:34:34 +11:00
Shannon c71e00b3dc Merge branch '7.2.1' into 7.3.0 2014-12-05 13:57:23 +11:00
Shannon 641c7dfa04 WIP - more work on templates repository/service 2014-12-02 11:30:30 +11:00
Shannon 95845c8f2e Almost completed U4-5847 Ensure the path is set correctly for templates in the db but needs a db migration script as well, more unit tests 2014-12-01 17:34:22 +11:00
Shannon c656bb632e WIP more template repo work and more unit tests 2014-12-01 16:22:18 +11:00
Shannon bf82a70744 WIP - still working on getting the template repository and models working correctly and adding some more tests. 2014-12-01 14:14:44 +11:00
Shannon 520955a8db WIP - ported over viewhelper and MasterpageHelper to the Core lib, still wrapping new file service from old template class. 2014-12-01 12:59:36 +11:00
Shannon 2b25815eee Merge branch '7.2.0' into 7.3.0
Conflicts:
	src/Umbraco.Web/Umbraco.Web.csproj
2014-12-01 12:22:19 +11:00
Shannon 7cfcab4011 WIP working on getting the template services up to par and wrapping the new ones from old ones. 2014-11-25 18:48:19 +11:00
Shannon 787e10bbe1 ensures the templates are sorted by name 2014-11-25 18:02:17 +11:00
Shannon 8328f09d6b Works on U4-2866 - converted template tree to new tree structure. 2014-11-25 17:59:59 +11:00
Shannon 04823c23a0 Merge branch '7.2.0' into 7.3.0 2014-11-25 17:46:51 +11:00
Shannon 5af67facad Removes non-completed/tested/used code for templates which was during a WIP of the grid some time ago. 2014-11-25 17:36:02 +11:00
Shannon be9e4c9623 Merge branch '7.2.0' into 7.3.0 2014-11-25 17:07:35 +11:00
Anthony Dang e03988dd81 Removed regions from LoggingService to expose code. 2014-11-21 12:38:56 +00:00
Anthony Dang 79990b6a6c Cleaned up interface as per Shannons comments https://github.com/umbraco/Umbraco-CMS/pull/559/files#r20683448 2014-11-21 12:38:27 +00:00
Anthony Dang 7f78aef05f Issue U4-5231 - Created an interface based on the LogHelper, and created a service, exposed through Application.Services. 2014-11-20 16:11:04 +00:00
Shannon df3d427c0b WIP - Updates templates service and repo with some extra methods, creates new template tree, updates template model with some more properties, still need to finish the template tree, it's missing some menu actions. 2014-11-20 19:51:42 +11:00
Shannon e558918432 Completes migrating the lang tree to the new format, a good starting place to convert the other ones even with having the legacy dialogs in place. 2014-11-20 17:54:30 +11:00
Shannon e6d1eb0ba0 Converts languages tree to new structure 2014-11-20 16:28:50 +11:00
Shannon f32a46c546 Working on U4-1979 - language service 2014-11-20 13:41:34 +11:00
leekelleher a4de37efb9 Fixes U4-5658 - Dictionary tree JS: 'openDictionary' defined in Languages tree 2014-10-20 11:30:46 +01:00
Jeavon Leopold ee386d06da Fix for U4-5480 "Bad value for attribute rel on element img in Richtext editor" by removing the attributes in the RTE value converter so they don't render on the front end site but still exist in the Umbraco UI 2014-10-01 18:48:23 +01:00
1012 changed files with 36734 additions and 23924 deletions
+9 -9
View File
@@ -1,9 +1,9 @@
# The MIT License (MIT) #
Copyright (c) 2013 Umbraco
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# The MIT License (MIT) #
Copyright (c) 2013 Umbraco
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+2 -4
View File
@@ -23,7 +23,7 @@ ReplaceIISExpressPortNumber.exe ..\src\Umbraco.Web.UI\Umbraco.Web.UI.csproj %rel
ECHO Installing the Microsoft.Bcl.Build package before anything else, otherwise you'd have to run build.cmd twice
SET nuGetFolder=%CD%\..\src\packages\
..\src\.nuget\NuGet.exe sources Remove -Name MyGetUmbracoCore
..\src\.nuget\NuGet.exe sources Remove -Name MyGetUmbracoCore >NUL
..\src\.nuget\NuGet.exe sources Add -Name MyGetUmbracoCore -Source https://www.myget.org/F/umbracocore/api/v2/ >NUL
..\src\.nuget\NuGet.exe install ..\src\Umbraco.Web.UI\packages.config -OutputDirectory %nuGetFolder%
..\src\.nuget\NuGet.exe install ..\src\umbraco.businesslogic\packages.config -OutputDirectory %nuGetFolder%
@@ -49,14 +49,12 @@ ECHO Setting node_modules folder to hidden to prevent VS13 from crashing on it w
attrib +h ..\src\Umbraco.Web.UI.Client\node_modules
ECHO Adding Web.config transform files to the NuGet package
REN .\_BuildOutput\WebApp\MacroScripts\Web.config Web.config.transform
REN .\_BuildOutput\WebApp\Views\Web.config Web.config.transform
REN .\_BuildOutput\WebApp\Xslt\Web.config Web.config.transform
ECHO Packing the NuGet release files
..\src\.nuget\NuGet.exe Pack NuSpecs\UmbracoCms.Core.nuspec -Version %version%
..\src\.nuget\NuGet.exe Pack NuSpecs\UmbracoCms.Core.nuspec -Version %version% -Symbols
..\src\.nuget\NuGet.exe Pack NuSpecs\UmbracoCms.nuspec -Version %version%
..\src\.nuget\NuGet.exe Pack NuSpecs\UmbracoExamine.PDF.nuspec
IF ERRORLEVEL 1 GOTO :showerror
+91 -113
View File
@@ -1,4 +1,3 @@
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!--
@@ -14,18 +13,18 @@
<Import Project="..\tools\UmbracoMSBuildTasks\Umbraco.MSBuild.Tasks.Targets" />
<Import Project="..\tools\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets" />
<UsingTask TaskName="GenerateHash" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
<UsingTask TaskName="GenerateHash" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
<ParameterGroup>
<InputFiles ParameterType="Microsoft.Build.Framework.ITaskItem[]" Required="true" />
<OutputFile ParameterType="System.String" Required="true" />
<InputFiles ParameterType="Microsoft.Build.Framework.ITaskItem[]" Required="true" />
<OutputFile ParameterType="System.String" Required="true" />
</ParameterGroup>
<Task>
<Using Namespace="System.IO" />
<Using Namespace="System.Linq" />
<Using Namespace="System.Security.Cryptography" />
<Code Type="Fragment" Language="cs">
<![CDATA[
<Using Namespace="System.IO" />
<Using Namespace="System.Linq" />
<Using Namespace="System.Security.Cryptography" />
<Code Type="Fragment" Language="cs">
<![CDATA[
using (var ms = new MemoryStream())
{
foreach (var item in InputFiles)
@@ -48,11 +47,11 @@
}
}
]]>
</Code>
</Code>
</Task>
</UsingTask>
</UsingTask>
<!--
****************************************************
VARIABLES
@@ -76,23 +75,19 @@
<BuildZipFileName>UmbracoCms$(DECIMAL_BUILD_NUMBER).zip</BuildZipFileName>
<BuildZipFileNameBin>UmbracoCms.AllBinaries$(DECIMAL_BUILD_NUMBER).zip</BuildZipFileNameBin>
<BuildZipFileNameWebPi>UmbracoCms.WebPI$(DECIMAL_BUILD_NUMBER).zip</BuildZipFileNameWebPi>
<BuildZipExaminePDFName>UmbracoExamine.PDF.0.6.0.zip</BuildZipExaminePDFName>
<IncludeSymbols>False</IncludeSymbols>
<BuildFolderRelativeToProjects>..\..\build\$(BuildFolder)</BuildFolderRelativeToProjects>
<BuildFolderAbsolutePath>$(MSBuildProjectDirectory)\$(BuildFolder)</BuildFolderAbsolutePath>
<SolutionBinFolder>$(BuildFolder)bin\</SolutionBinFolder>
<WebAppFolder>$(BuildFolder)WebApp\</WebAppFolder>
<WebPiFolder>$(BuildFolder)WebPi\</WebPiFolder>
<ConfigsFolder>$(BuildFolder)Configs\</ConfigsFolder>
<ConfigsFolder>$(BuildFolder)Configs\</ConfigsFolder>
<SolutionBinFolderRelativeToProjects>$(BuildFolderRelativeToProjects)bin\</SolutionBinFolderRelativeToProjects>
<SolutionBinFolderAbsolutePath>$(BuildFolderAbsolutePath)bin\</SolutionBinFolderAbsolutePath>
<WebAppFolderRelativeToProjects>$(BuildFolderRelativeToProjects)WebApp\</WebAppFolderRelativeToProjects>
<WebAppFolderAbsolutePath>$(BuildFolderAbsolutePath)WebApp\</WebAppFolderAbsolutePath>
<WebPiFolderRelativeToProjects>$(BuildFolderRelativeToProjects)WebPi\</WebPiFolderRelativeToProjects>
<WebPiFolderAbsolutePath>$(BuildFolderAbsolutePath)WebPi\</WebPiFolderAbsolutePath>
<ExaminePDFPath>$(BuildFolderAbsolutePath)UmbracoExamine.PDF\</ExaminePDFPath>
<ExamineAzurePath>$(BuildFolderAbsolutePath)UmbracoExamine.Azure\</ExamineAzurePath>
<ExaminePDFAzurePath>$(BuildFolderAbsolutePath)UmbracoExamine.PDF.Azure\</ExaminePDFAzurePath>
</PropertyGroup>
<ItemGroup>
@@ -114,16 +109,16 @@
*****************************************************
-->
<Target Name="Build" DependsOnTargets="GenerateWebPiHash">
<Target Name="Build" DependsOnTargets="GenerateWebPiHash">
<Message Text="Build finished" />
</Target>
<Target Name="GenerateWebPiHash" DependsOnTargets="ZipWebPiApp">
<ItemGroup>
</Target>
<Target Name="GenerateWebPiHash" DependsOnTargets="ZipWebPiApp">
<ItemGroup>
<WebPiFile Include="$(BuildZipFileNameWebPi)" />
</ItemGroup>
<Message Text="Calculating hash for $(BuildZipFileNameWebPi)" />
<GenerateHash InputFiles="@(WebPiFile)" OutputFile="webpihash.txt" />
</ItemGroup>
<Message Text="Calculating hash for $(BuildZipFileNameWebPi)" />
<GenerateHash InputFiles="@(WebPiFile)" OutputFile="webpihash.txt" />
</Target>
<Target Name="CleanUp" DependsOnTargets="ZipWebPiApp">
@@ -150,10 +145,10 @@
DestinationFiles="@(WebPiFiles->'$(WebPiFolder)%(RecursiveDir)%(Filename)%(Extension)')" />
<!-- Zip the files -->
<Exec Command="..\tools\7zip\7za.exe a -r %22$(BuildZipFileNameWebPi)%22 %22$(WebPiFolderAbsolutePath)*%22" />
<Exec Command="..\tools\7zip\7za.exe a -r %22$(BuildZipFileNameWebPi)%22 %22$(WebPiFolderAbsolutePath)*%22 -x!dotLess.Core.dll" />
</Target>
<Target Name="ZipWebApp" DependsOnTargets="ZipUmbracoExaminePDF" >
<Target Name="ZipWebApp" DependsOnTargets="CreateSystemFolders" >
<Message Text="Starting to zip to $(buildDate)-$(BuildZipFileName)" Importance="high" />
<Exec Command="..\tools\7zip\7za.exe a -r %22$(BuildZipFileNameBin)%22 %22$(SolutionBinFolderAbsolutePath)*%22 -x!dotLess.Core.dll" />
@@ -162,14 +157,6 @@
<Message Text="Finished zipping to build\$(BuildFolder)\$(buildDate)-$(BuildZipFileName)" Importance="high" />
</Target>
<Target Name="ZipUmbracoExaminePDF" DependsOnTargets="CreateSystemFolders" >
<Message Text="Starting to zip to $(buildDate)-$(BuildZipExaminePDFName)" Importance="high" />
<Exec Command="..\tools\7zip\7za.exe a -r %22$(BuildZipExaminePDFName)%22 %22$(ExaminePDFPath)*%22" />
<Message Text="Finished zipping to build\$(BuildFolder)\$(buildDate)-$(BuildZipExaminePDFName)" Importance="high" />
</Target>
<Target Name="CreateSystemFolders" DependsOnTargets="CopyBelleBuild" Inputs="@(SystemFolders)" Outputs="%(Identity).Dummy">
<MakeDir Directories="@(SystemFolders)" />
</Target>
@@ -177,14 +164,14 @@
<Target Name="CopyBelleBuild" DependsOnTargets="CopyLibraries" >
<ItemGroup>
<BelleFiles Include="..\src\Umbraco.Web.UI.Client\build\belle\**\*.*" Exclude="..\src\Umbraco.Web.UI.Client\build\belle\index.html" />
</ItemGroup>
<Copy SourceFiles="@(BelleFiles)"
DestinationFiles="@(BelleFiles->'$(WebAppFolder)umbraco\%(RecursiveDir)%(Filename)%(Extension)')"
OverwriteReadOnlyFiles="true"
SkipUnchangedFiles="false" />
</ItemGroup>
<Copy SourceFiles="@(BelleFiles)"
DestinationFiles="@(BelleFiles->'$(WebAppFolder)umbraco\%(RecursiveDir)%(Filename)%(Extension)')"
OverwriteReadOnlyFiles="true"
SkipUnchangedFiles="false" />
</Target>
<Target Name="CopyLibraries" DependsOnTargets="OffsetTimestamps" >
<!-- Copy SQL CE -->
<ItemGroup>
@@ -217,7 +204,7 @@
</Target>
<!-- Copy the transformed web.config file to the root -->
<Target Name="CopyTransformedWebConfig" DependsOnTargets="CopyTransformedConfig">
<Target Name="CopyTransformedWebConfig" DependsOnTargets="CopyTransformedConfig">
<ItemGroup>
<WebConfigFile Include="..\src\Umbraco.Web.UI\web.$(BuildConfiguration).Config.transformed" />
</ItemGroup>
@@ -226,24 +213,24 @@
DestinationFiles="$(WebAppFolder)Web.config"
OverwriteReadOnlyFiles="true"
SkipUnchangedFiles="false" />
</Target>
<!-- Copy the config files and rename them to *.config.transform -->
<Target Name="CopyTransformedConfig" DependsOnTargets="CopyXmlDocumentation">
</Target>
<!-- Copy the config files and rename them to *.config.transform -->
<Target Name="CopyTransformedConfig" DependsOnTargets="CopyXmlDocumentation">
<ItemGroup>
<ConfigFiles Include="$(WebAppFolder)config\*.config;$(WebAppFolder)config\*.js" />
<WebConfigTransformFile Include="$(WebAppFolder)Web.config" />
</ItemGroup>
<Copy SourceFiles="@(ConfigFiles)"
DestinationFiles="@(ConfigFiles->'$(ConfigsFolder)\%(RecursiveDir)%(Filename)%(Extension)')"
OverwriteReadOnlyFiles="true"
SkipUnchangedFiles="false" />
<Copy SourceFiles="@(WebConfigTransformFile)"
DestinationFiles="$(ConfigsFolder)Web.config.transform"
OverwriteReadOnlyFiles="true"
SkipUnchangedFiles="false" />
<ConfigFiles Include="$(WebAppFolder)config\*.config;$(WebAppFolder)config\*.js" />
<WebConfigTransformFile Include="$(WebAppFolder)Web.config" />
</ItemGroup>
<Copy SourceFiles="@(ConfigFiles)"
DestinationFiles="@(ConfigFiles->'$(ConfigsFolder)\%(RecursiveDir)%(Filename)%(Extension)')"
OverwriteReadOnlyFiles="true"
SkipUnchangedFiles="false" />
<Copy SourceFiles="@(WebConfigTransformFile)"
DestinationFiles="$(ConfigsFolder)Web.config.transform"
OverwriteReadOnlyFiles="true"
SkipUnchangedFiles="false" />
</Target>
<!-- Copy the xml documentation to the bin folder -->
@@ -261,66 +248,32 @@
<!-- Unlike 2010, the VS2012 build targets file doesn't clean up the umbraco.presentation dir, do it manually -->
<Target Name="CleanupPresentation" DependsOnTargets="CompileProjects">
<ItemGroup>
<PresentationFolderToDelete Include="$(WebAppFolder)umbraco.presentation" />
<ItemGroup>
<PresentationFolderToDelete Include="$(WebAppFolder)umbraco.presentation" />
</ItemGroup>
<RemoveDir Directories="@(PresentationFolderToDelete)" />
<RemoveDir Directories="@(PresentationFolderToDelete)" />
</Target>
<Target Name="CompileProjects" DependsOnTargets="CompileExternalExamineProjects">
<Target Name="CompileProjects" DependsOnTargets="SetVersionNumber">
<Message Text="Compiling web project to build\$(BuildFolder)" Importance="high" />
<!-- For UseWPP_CopyWebApplication=True see http://stackoverflow.com/questions/1983575/copywebapplication-with-web-config-transformations -->
<!-- Build the Umbraco.Web.UI project -->
<MSBuild Projects="..\src\Umbraco.Web.UI\Umbraco.Web.UI.csproj" Properties="WarningLevel=0;Configuration=$(BuildConfiguration);UseWPP_CopyWebApplication=True;PipelineDependsOnBuild=False;OutDir=$(SolutionBinFolderAbsolutePath);WebProjectOutputDir=$(WebAppFolderAbsolutePath)" Targets="Clean;Rebuild;" BuildInParallel="False" ToolsVersion="4.0" UnloadProjectsOnCompletion="False">
</MSBuild>
<!-- DONE -->
<Message Text="Finished compiling projects" Importance="high" />
</Target>
<Target Name="CompileExternalExamineProjects" DependsOnTargets="SetVersionNumber">
<Message Text="Building externally shipped examine projects" Importance="high" />
<!-- First remove old files from the examine builds -->
<ItemGroup>
<FilesToDeleteBeforeBuild Include="$(ExaminePDFPath)*;$(ExamineAzurePath)*"/>
</ItemGroup>
<Delete Files="@(FilesToDeleteBeforeBuild)" />
<!--
Build the UmbracoExamine.PDF.Azure library ... this builds the 3 projects that we want to bundle separately so no need to build each one separately .
We'll just build this one and then manually copy the DLLs to where we want them.
-->
<MSBuild Projects="..\src\UmbracoExamine.PDF.Azure\UmbracoExamine.PDF.Azure.csproj" Properties="WarningLevel=0;Configuration=$(BuildConfiguration);PipelineDependsOnBuild=False;OutDir=$(ExaminePDFAzurePath);" Targets="Clean;Build;" BuildInParallel="False" ToolsVersion="4.0" UnloadProjectsOnCompletion="False">
</MSBuild>
<ItemGroup>
<ExaminePDFFiles Include="$(ExaminePDFAzurePath)**\UmbracoExamine.PDF.dll;$(ExaminePDFAzurePath)**\UmbracoExamine.PDF.pdf;$(ExaminePDFAzurePath)**\UmbracoExamine.PDF.xml;$(ExaminePDFAzurePath)**\itextsharp.dll" />
<ExamineAzureFiles Include="$(ExaminePDFAzurePath)**\UmbracoExamine.Azure.dll;$(ExaminePDFAzurePath)**\UmbracoExamine.Azure.pdb;$(ExaminePDFAzurePath)**\UmbracoExamine.Azure.xml" />
<ExaminePDFAzureFiles Include="$(ExaminePDFAzurePath)**\UmbracoExamine.Azure.PDF.dll;$(ExaminePDFAzurePath)**\UmbracoExamine.Azure.PDF.pdb;$(ExaminePDFAzurePath)**\UmbracoExamine.Azure.PDF.xml" />
</ItemGroup>
<!-- Now copy the built files to their correct deployment folders-->
<Copy SourceFiles="@(ExaminePDFFiles)"
DestinationFolder="$(ExaminePDFPath)"
OverwriteReadOnlyFiles="true"
SkipUnchangedFiles="false" />
<Copy SourceFiles="@(ExamineAzureFiles)"
DestinationFolder="$(ExamineAzurePath)"
OverwriteReadOnlyFiles="true"
SkipUnchangedFiles="false" />
<!-- Then just delete the files we don't want to ship in the UmbracoExamine.Azure.PDF folder -->
<ItemGroup>
<FilesToDeleteAfterBuild Include="$(ExaminePDFAzurePath)*" Exclude="$(ExaminePDFAzurePath)UmbracoExamine.PDF.Azure.dll;$(ExaminePDFAzurePath)UmbracoExamine.PDF.Azure.pdb;$(ExaminePDFAzurePath)UmbracoExamine.PDF.Azure.xml"/>
</ItemGroup>
<Delete Files="@(FilesToDeleteAfterBuild)" />
</Target>
<Target Name="SetVersionNumber" Condition="'$(BUILD_RELEASE)'!=''">
<PropertyGroup>
<NewVersion>$(BUILD_RELEASE)</NewVersion>
<NewVersion Condition="'$(BUILD_COMMENT)'!=''">$(BUILD_RELEASE)-$(BUILD_COMMENT)</NewVersion>
</PropertyGroup>
<!-- Match & replace 3 and 4 digit version numbers and -beta (if it's there) -->
<PropertyGroup>
<NewVersion>$(BUILD_RELEASE)</NewVersion>
<NewVersion Condition="'$(BUILD_COMMENT)'!=''">$(BUILD_RELEASE)-$(BUILD_COMMENT)</NewVersion>
</PropertyGroup>
<!-- Match & replace 3 and 4 digit version numbers and -beta (if it's there) -->
<FileUpdate
Files="..\src\Umbraco.Core\Configuration\UmbracoVersion.cs"
Regex="(\d+)\.(\d+)\.(\d+)(.(\d+))?"
@@ -329,10 +282,35 @@
<FileUpdate Files="..\src\Umbraco.Core\Configuration\UmbracoVersion.cs"
Regex="CurrentComment { get { return &quot;(.+)?&quot;"
ReplacementText="CurrentComment { get { return &quot;$(BUILD_COMMENT)&quot;"/>
<XmlPoke XmlInputPath=".\NuSpecs\build\UmbracoCms.props"
Namespaces="&lt;Namespace Prefix='x' Uri='http://schemas.microsoft.com/developer/msbuild/2003' /&gt;"
Query="//x:UmbracoVersion"
Value="$(NewVersion)" />
<!--This updates the AssemblyFileVersion for the solution to the umbraco version-->
<FileUpdate
Files="..\src\SolutionInfo.cs"
Regex="AssemblyFileVersion\(&quot;(.+)?&quot;\)"
ReplacementText="AssemblyFileVersion(&quot;$(BUILD_RELEASE)&quot;)"/>
<!--This updates the AssemblyInformationalVersion for the solution to the umbraco version and comment-->
<FileUpdate
Condition="'$(BUILD_COMMENT)'!=''"
Files="..\src\SolutionInfo.cs"
Regex="AssemblyInformationalVersion\(&quot;(.+)?&quot;\)"
ReplacementText="AssemblyInformationalVersion(&quot;$(BUILD_RELEASE)-$(BUILD_COMMENT)&quot;)"/>
<FileUpdate
Condition="'$(BUILD_COMMENT)'==''"
Files="..\src\SolutionInfo.cs"
Regex="AssemblyInformationalVersion\(&quot;(.+)?&quot;\)"
ReplacementText="AssemblyInformationalVersion(&quot;$(BUILD_RELEASE)&quot;)"/>
<!--This updates the copyright year-->
<FileUpdate
Condition="'$(BUILD_COMMENT)'==''"
Files="..\src\SolutionInfo.cs"
Regex="AssemblyCopyright\(&quot;Copyright © Umbraco (\d{4})&quot;\)"
ReplacementText="AssemblyCopyright(&quot;Copyright © Umbraco $([System.DateTime]::Now.ToString(`yyyy`))&quot;)"/>
<XmlPoke XmlInputPath=".\NuSpecs\build\UmbracoCms.props"
Namespaces="&lt;Namespace Prefix='x' Uri='http://schemas.microsoft.com/developer/msbuild/2003' /&gt;"
Query="//x:UmbracoVersion"
Value="$(NewVersion)" />
</Target>
</Project>
@@ -1,73 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>UmbracoCms.Core.AllBinaries</id>
<version>6.1.2</version>
<title>Umbraco Cms Core All Binaries</title>
<authors>Morten Christensen</authors>
<owners>Umbraco HQ</owners>
<licenseUrl>http://umbraco.codeplex.com/license</licenseUrl>
<projectUrl>http://umbraco.com/</projectUrl>
<iconUrl>http://umbraco.com/media/357769/100px_transparent.png</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Contains the core assemblies and all of the dependant assemblies needed to run Umbraco Cms. This package only contains assemblies and can be used for package development. Use the UmbracoCms-package to setup Umbraco in Visual Studio as an ASP.NET project.</description>
<summary>Contains the core assemblies and all of the dependant assemblies needed to run Umbraco Cms</summary>
<language>en-US</language>
<tags>umbraco</tags>
</metadata>
<files>
<file src="..\_BuildOutput\bin\businesslogic.dll" target="lib\businesslogic.dll" />
<file src="..\_BuildOutput\bin\AutoMapper.dll" target="lib\AutoMapper.dll" />
<file src="..\_BuildOutput\bin\AutoMapper.Net4.dll" target="lib\AutoMapper.Net4.dll" />
<file src="..\_BuildOutput\bin\businesslogic.dll" target="lib\businesslogic.dll" />
<file src="..\_BuildOutput\bin\ClientDependency.Core.dll" target="lib\ClientDependency.Core.dll" />
<file src="..\_BuildOutput\bin\ClientDependency.Core.Mvc.dll" target="lib\ClientDependency.Core.Mvc.dll" />
<file src="..\_BuildOutput\bin\cms.dll" target="lib\cms.dll" />
<file src="..\_BuildOutput\bin\controls.dll" target="lib\controls.dll" />
<file src="..\_BuildOutput\bin\CookComputing.XmlRpcV2.dll" target="lib\CookComputing.XmlRpcV2.dll" />
<file src="..\_BuildOutput\bin\Examine.dll" target="lib\Examine.dll" />
<file src="..\_BuildOutput\bin\HtmlAgilityPack.dll" target="lib\HtmlAgilityPack.dll" />
<file src="..\_BuildOutput\bin\ICSharpCode.SharpZipLib.dll" target="lib\ICSharpCode.SharpZipLib.dll" />
<file src="..\_BuildOutput\bin\ImageProcessor.dll" target="lib\ImageProcessor.dll" />
<file src="..\_BuildOutput\bin\ImageProcessor.Web.dll" target="lib\ImageProcessor.Web.dll" />
<file src="..\_BuildOutput\bin\interfaces.dll" target="lib\interfaces.dll" />
<file src="..\_BuildOutput\bin\log4net.dll" target="lib\log4net.dll" />
<file src="..\_BuildOutput\bin\Lucene.Net.dll" target="lib\Lucene.Net.dll" />
<file src="..\_BuildOutput\bin\Microsoft.ApplicationBlocks.Data.dll" target="lib\Microsoft.ApplicationBlocks.Data.dll" />
<file src="..\_BuildOutput\bin\Microsoft.Threading.Tasks.dll" target="lib\Microsoft.Threading.Tasks.dll" />
<file src="..\_BuildOutput\bin\Microsoft.Threading.Tasks.Extensions.dll" target="lib\Microsoft.Threading.Tasks.Extensions.dll" />
<file src="..\_BuildOutput\bin\Microsoft.Web.Infrastructure.dll" target="lib\Microsoft.Web.Infrastructure.dll" />
<file src="..\_BuildOutput\bin\Microsoft.Web.Mvc.FixedDisplayModes.dll" target="lib\Microsoft.Web.Mvc.FixedDisplayModes.dll" />
<file src="..\_BuildOutput\bin\MiniProfiler.dll" target="lib\MiniProfiler.dll" />
<file src="..\_BuildOutput\bin\MySql.Data.dll" target="lib\MySql.Data.dll" />
<file src="..\_BuildOutput\bin\Newtonsoft.Json.dll" target="lib\Newtonsoft.Json.dll" />
<file src="..\_BuildOutput\bin\NuGet.Core.dll" target="lib\NuGet.Core.dll" />
<file src="..\_BuildOutput\bin\SQLCE4Umbraco.dll" target="lib\SQLCE4Umbraco.dll" />
<file src="..\_BuildOutput\bin\System.Data.SqlServerCe.dll" target="lib\System.Data.SqlServerCe.dll" />
<file src="..\_BuildOutput\bin\System.Data.SqlServerCe.Entity.dll" target="lib\System.Data.SqlServerCe.Entity.dll" />
<file src="..\_BuildOutput\bin\System.Net.Http.dll" target="lib\System.Net.Http.dll" />
<file src="..\_BuildOutput\bin\System.Net.Http.Extensions.dll" target="lib\System.Net.Http.Extensions.dll" />
<file src="..\_BuildOutput\bin\System.Net.Http.Formatting.dll" target="lib\System.Net.Http.Formatting.dll" />
<file src="..\_BuildOutput\bin\System.Net.Http.Primitives.dll" target="lib\System.Net.Http.Primitives.dll" />
<file src="..\_BuildOutput\bin\System.Net.Http.WebRequest.dll" target="lib\System.Net.Http.WebRequest.dll" />
<file src="..\_BuildOutput\bin\System.Web.Helpers.dll" target="lib\System.Web.Helpers.dll" />
<file src="..\_BuildOutput\bin\System.Web.Http.dll" target="lib\System.Web.Http.dll" />
<file src="..\_BuildOutput\bin\System.Web.Http.WebHost.dll" target="lib\System.Web.Http.WebHost.dll" />
<file src="..\_BuildOutput\bin\System.Web.Mvc.dll" target="lib\System.Web.Mvc.dll" />
<file src="..\_BuildOutput\bin\System.Web.Razor.dll" target="lib\System.Web.Razor.dll" />
<file src="..\_BuildOutput\bin\System.Web.WebPages.Administration.dll" target="lib\System.Web.WebPages.Administration.dll" />
<file src="..\_BuildOutput\bin\System.Web.WebPages.Deployment.dll" target="lib\System.Web.WebPages.Deployment.dll" />
<file src="..\_BuildOutput\bin\System.Web.WebPages.dll" target="lib\System.Web.WebPages.dll" />
<file src="..\_BuildOutput\bin\System.Web.WebPages.Razor.dll" target="lib\System.Web.WebPages.Razor.dll" />
<file src="..\_BuildOutput\bin\TidyNet.dll" target="lib\TidyNet.dll" />
<file src="..\_BuildOutput\bin\Umbraco.Core.dll" target="lib\Umbraco.Core.dll" />
<file src="..\_BuildOutput\bin\umbraco.DataLayer.dll" target="lib\umbraco.DataLayer.dll" />
<file src="..\_BuildOutput\bin\umbraco.dll" target="lib\umbraco.dll" />
<file src="..\_BuildOutput\bin\umbraco.editorControls.dll" target="lib\umbraco.editorControls.dll" />
<file src="..\_BuildOutput\bin\umbraco.MacroEngines.dll" target="lib\umbraco.MacroEngines.dll" />
<file src="..\_BuildOutput\bin\umbraco.providers.dll" target="lib\umbraco.providers.dll" />
<file src="..\_BuildOutput\bin\Umbraco.Web.UI.dll" target="lib\Umbraco.Web.UI.dll" />
<file src="..\_BuildOutput\bin\UmbracoExamine.dll" target="lib\UmbracoExamine.dll" />
<file src="..\_BuildOutput\bin\UrlRewritingNet.UrlRewriter.dll" target="lib\UrlRewritingNet.UrlRewriter.dll" />
</files>
</package>
@@ -1,71 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>UmbracoCms.Core</id>
<version>7.0.0</version>
<title>Umbraco Cms Core Binaries</title>
<authors>Umbraco HQ</authors>
<owners>Umbraco HQ</owners>
<licenseUrl>http://umbraco.codeplex.com/license</licenseUrl>
<projectUrl>http://umbraco.com/</projectUrl>
<iconUrl>http://umbraco.com/media/357769/100px_transparent.png</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Contains the core assemblies needed to run Umbraco Cms. This package only contains assemblies and can be used for package development. Use the UmbracoCms-package to setup Umbraco in Visual Studio as an ASP.NET project.</description>
<summary>Contains the core assemblies needed to run Umbraco Cms</summary>
<language>en-US</language>
<tags>umbraco</tags>
</metadata>
<files>
<file src="..\..\src\SQLCE4Umbraco\obj\Debug\SQLCE4Umbraco.dll" target="lib" />
<file src="..\..\src\SQLCE4Umbraco\obj\Debug\SQLCE4Umbraco.pdb" target="lib" />
<file src="..\..\src\SQLCE4Umbraco\**\*.cs" exclude="..\..\src\**\TemporaryGeneratedFile*.cs" target="src\SQLCE4Umbraco" />
<file src="..\..\src\umbraco.businesslogic\obj\Debug\businesslogic.dll" target="lib" />
<file src="..\..\src\umbraco.businesslogic\obj\Debug\businesslogic.pdb" target="lib" />
<file src="..\..\src\umbraco.businesslogic\**\*.cs" exclude="..\..\src\**\TemporaryGeneratedFile*.cs" target="src\umbraco.businesslogic" />
<file src="..\..\src\umbraco.cms\obj\Debug\cms.dll" target="lib" />
<file src="..\..\src\umbraco.cms\obj\Debug\cms.pdb" target="lib" />
<file src="..\..\src\umbraco.cms\**\*.cs" exclude="..\..\src\**\TemporaryGeneratedFile*.cs" target="src\umbraco.cms" />
<file src="..\..\src\umbraco.controls\obj\Debug\controls.dll" target="lib" />
<file src="..\..\src\umbraco.controls\obj\Debug\controls.pdb" target="lib" />
<file src="..\..\src\umbraco.controls\**\*.cs" exclude="..\..\src\**\TemporaryGeneratedFile*.cs" target="src\umbraco.controls" />
<file src="..\..\src\umbraco.interfaces\obj\Debug\interfaces.dll" target="lib" />
<file src="..\..\src\umbraco.interfaces\obj\Debug\interfaces.pdb" target="lib" />
<file src="..\..\src\umbraco.interfaces\**\*.cs" exclude="..\..\src\**\TemporaryGeneratedFile*.cs" target="src\umbraco.interfaces" />
<file src="..\..\src\Umbraco.Core\obj\Debug\Umbraco.Core.dll" target="lib" />
<file src="..\..\src\Umbraco.Core\obj\Debug\Umbraco.Core.pdb" target="lib" />
<file src="..\..\src\Umbraco.Core\**\*.cs" exclude="..\..\src\**\TemporaryGeneratedFile*.cs" target="src\Umbraco.Core" />
<file src="..\..\src\umbraco.datalayer\obj\Debug\umbraco.DataLayer.dll" target="lib" />
<file src="..\..\src\umbraco.datalayer\obj\Debug\umbraco.DataLayer.pdb" target="lib" />
<file src="..\..\src\umbraco.datalayer\**\*.cs" exclude="..\..\src\**\TemporaryGeneratedFile*.cs" target="src\umbraco.datalayer" />
<file src="..\..\src\umbraco.editorControls\obj\Debug\umbraco.editorControls.dll" target="lib" />
<file src="..\..\src\umbraco.editorControls\obj\Debug\umbraco.editorControls.pdb" target="lib" />
<file src="..\..\src\umbraco.editorControls\**\*.cs" exclude="..\..\src\**\TemporaryGeneratedFile*.cs" target="src\umbraco.editorControls" />
<file src="..\..\src\umbraco.MacroEngines\obj\Debug\umbraco.MacroEngines.dll" target="lib" />
<file src="..\..\src\umbraco.MacroEngines\obj\Debug\umbraco.MacroEngines.pdb" target="lib" />
<file src="..\..\src\umbraco.MacroEngines\**\*.cs" exclude="..\..\src\**\TemporaryGeneratedFile*.cs" target="src\umbraco.MacroEngines" />
<file src="..\..\src\umbraco.providers\obj\Debug\umbraco.providers.dll" target="lib" />
<file src="..\..\src\umbraco.providers\obj\Debug\umbraco.providers.pdb" target="lib" />
<file src="..\..\src\umbraco.providers\**\*.cs" exclude="..\..\src\**\TemporaryGeneratedFile*.cs" target="src\umbraco.providers" />
<file src="..\..\src\Umbraco.Web\obj\Debug\umbraco.dll" target="lib" />
<file src="..\..\src\Umbraco.Web\obj\Debug\umbraco.pdb" target="lib" />
<file src="..\..\src\Umbraco.Web\**\*.cs" exclude="..\..\src\**\TemporaryGeneratedFile*.cs" target="src\Umbraco.Web" />
<file src="..\..\src\bin\Debug\Umbraco.Web.UI.dll" target="lib" />
<file src="..\..\src\bin\Debug\Umbraco.Web.UI.pdb" target="lib" />
<file src="..\..\src\Umbraco.Web.UI\**\*.cs" exclude="..\..\src\**\TemporaryGeneratedFile*.cs" target="src\Umbraco.Web.UI" />
<file src="..\..\src\UmbracoExamine\obj\Debug\UmbracoExamine.dll" target="lib" />
<file src="..\..\src\UmbracoExamine\obj\Debug\UmbracoExamine.pdb" target="lib" />
<file src="..\..\src\UmbracoExamine\**\*.cs" exclude="..\..\src\**\TemporaryGeneratedFile*.cs" target="src\UmbracoExamine" />
</files>
</package>
+40 -8
View File
@@ -6,7 +6,7 @@
<title>Umbraco Cms Core Binaries</title>
<authors>Umbraco HQ</authors>
<owners>Umbraco HQ</owners>
<licenseUrl>http://umbraco.codeplex.com/license</licenseUrl>
<licenseUrl>http://opensource.org/licenses/MIT</licenseUrl>
<projectUrl>http://umbraco.com/</projectUrl>
<iconUrl>http://umbraco.com/media/357769/100px_transparent.png</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
@@ -15,24 +15,25 @@
<language>en-US</language>
<tags>umbraco</tags>
<dependencies>
<dependency id="Microsoft.AspNet.Mvc" version="[4.0.30506.0,6.0.0)" />
<dependency id="Microsoft.AspNet.WebApi" version="[4.0.30506,6.0.0)" />
<dependency id="Microsoft.AspNet.WebApi.WebHost" version="[4.0.30506, 6.0.0)" />
<dependency id="Microsoft.AspNet.WebApi.Core" version="[4.0.30506, 6.0.0)" />
<dependency id="Microsoft.AspNet.WebApi.Client" version="[4.0.30506, 6.0.0)" />
<dependency id="Microsoft.AspNet.Mvc" version="[4.0.40804.0,6.0.0)" />
<dependency id="Microsoft.AspNet.WebApi" version="[5.2.3,6.0.0)" />
<dependency id="Microsoft.AspNet.Mvc.FixedDisplayModes" version="1.0.1" />
<dependency id="Microsoft.Net.Http" version="[2.0.20710.0, 3.0.0)" />
<dependency id="Microsoft.AspNet.Identity.Owin" version="[2.2.0, 3.0.0)" />
<dependency id="Microsoft.Owin.Security.Cookies" version="[3.0.1, 4.0.0)" />
<dependency id="Microsoft.Owin.Security.OAuth" version="[3.0.1, 4.0.0)" />
<dependency id="Microsoft.Owin.Host.SystemWeb" version="[3.0.1, 4.0.0)" />
<dependency id="MiniProfiler" version="[2.1.0, 3.0.0)" />
<dependency id="HtmlAgilityPack" version="[1.4.6, 2.0.0)" />
<dependency id="Lucene.Net" version="[2.9.4.1, 3.0.0.0)" />
<dependency id="SharpZipLib" version="[0.86.0, 1.0.0)" />
<dependency id="MySql.Data" version="[6.6.5]" />
<dependency id="MySql.Data" version="[6.9.6, 7.0.0)" />
<dependency id="xmlrpcnet" version="[2.5.0, 3.0.0)" />
<dependency id="ClientDependency" version="[1.8.3.1, 2.0.0)" />
<dependency id="ClientDependency-Mvc" version="[1.8.0, 2.0.0)" />
<dependency id="AutoMapper" version="[3.0.0, 4.0.0)" />
<dependency id="Newtonsoft.Json" version="[6.0.5, 7.0.0)" />
<dependency id="Examine" version="[0.1.60, 1.0.0)" />
<dependency id="Examine" version="[0.1.63, 1.0.0)" />
<dependency id="ImageProcessor" version="[1.9.5, 3.0.0)" />
<dependency id="ImageProcessor.Web" version="[3.3.1, 5.0.0)" />
</dependencies>
@@ -49,6 +50,7 @@
<file src="..\_BuildOutput\WebApp\bin\log4net.dll" target="lib\log4net.dll" />
<file src="..\_BuildOutput\WebApp\bin\Microsoft.ApplicationBlocks.Data.dll" target="lib\Microsoft.ApplicationBlocks.Data.dll" />
<file src="..\_BuildOutput\WebApp\bin\SQLCE4Umbraco.dll" target="lib\SQLCE4Umbraco.dll" />
<file src="..\_BuildOutput\WebApp\bin\SQLCE4Umbraco.xml" target="lib\SQLCE4Umbraco.xml" />
<file src="..\_BuildOutput\WebApp\bin\System.Data.SqlServerCe.dll" target="lib\System.Data.SqlServerCe.dll" />
<file src="..\_BuildOutput\WebApp\bin\System.Data.SqlServerCe.Entity.dll" target="lib\System.Data.SqlServerCe.Entity.dll" />
<file src="..\_BuildOutput\WebApp\bin\TidyNet.dll" target="lib\TidyNet.dll" />
@@ -65,8 +67,38 @@
<file src="..\_BuildOutput\WebApp\bin\umbraco.providers.dll" target="lib\umbraco.providers.dll" />
<file src="..\_BuildOutput\WebApp\bin\umbraco.providers.xml" target="lib\umbraco.providers.xml" />
<file src="..\_BuildOutput\WebApp\bin\Umbraco.Web.UI.dll" target="lib\Umbraco.Web.UI.dll" />
<file src="..\_BuildOutput\WebApp\bin\Umbraco.Web.UI.xml" target="lib\Umbraco.Web.UI.xml" />
<file src="..\_BuildOutput\WebApp\bin\UmbracoExamine.dll" target="lib\UmbracoExamine.dll" />
<file src="..\_BuildOutput\WebApp\bin\UmbracoExamine.xml" target="lib\UmbracoExamine.xml" />
<file src="..\_BuildOutput\WebApp\bin\UrlRewritingNet.UrlRewriter.dll" target="lib\UrlRewritingNet.UrlRewriter.dll" />
<file src="tools\install.core.ps1" target="tools\install.ps1" />
<!-- Added to be able to produce a symbols package -->
<file src="..\_BuildOutput\bin\SQLCE4Umbraco.pdb" target="lib" />
<file src="..\..\src\SQLCE4Umbraco\**\*.cs" exclude="..\..\src\**\TemporaryGeneratedFile*.cs" target="src\SQLCE4Umbraco" />
<file src="..\_BuildOutput\bin\businesslogic.pdb" target="lib" />
<file src="..\..\src\umbraco.businesslogic\**\*.cs" exclude="..\..\src\**\TemporaryGeneratedFile*.cs" target="src\umbraco.businesslogic" />
<file src="..\_BuildOutput\bin\cms.pdb" target="lib" />
<file src="..\..\src\umbraco.cms\**\*.cs" exclude="..\..\src\**\TemporaryGeneratedFile*.cs" target="src\umbraco.cms" />
<file src="..\_BuildOutput\bin\controls.pdb" target="lib" />
<file src="..\..\src\umbraco.controls\**\*.cs" exclude="..\..\src\**\TemporaryGeneratedFile*.cs" target="src\umbraco.controls" />
<file src="..\_BuildOutput\bin\interfaces.pdb" target="lib" />
<file src="..\..\src\umbraco.interfaces\**\*.cs" exclude="..\..\src\**\TemporaryGeneratedFile*.cs" target="src\umbraco.interfaces" />
<file src="..\_BuildOutput\bin\Umbraco.Core.pdb" target="lib" />
<file src="..\..\src\Umbraco.Core\**\*.cs" exclude="..\..\src\**\TemporaryGeneratedFile*.cs" target="src\Umbraco.Core" />
<file src="..\_BuildOutput\bin\umbraco.DataLayer.pdb" target="lib" />
<file src="..\..\src\umbraco.datalayer\**\*.cs" exclude="..\..\src\**\TemporaryGeneratedFile*.cs" target="src\umbraco.datalayer" />
<file src="..\_BuildOutput\bin\umbraco.editorControls.pdb" target="lib" />
<file src="..\..\src\umbraco.editorControls\**\*.cs" exclude="..\..\src\**\TemporaryGeneratedFile*.cs" target="src\umbraco.editorControls" />
<file src="..\_BuildOutput\bin\umbraco.MacroEngines.pdb" target="lib" />
<file src="..\..\src\umbraco.MacroEngines\**\*.cs" exclude="..\..\src\**\TemporaryGeneratedFile*.cs" target="src\umbraco.MacroEngines" />
<file src="..\_BuildOutput\bin\umbraco.providers.pdb" target="lib" />
<file src="..\..\src\umbraco.providers\**\*.cs" exclude="..\..\src\**\TemporaryGeneratedFile*.cs" target="src\umbraco.providers" />
<file src="..\_BuildOutput\bin\umbraco.pdb" target="lib" />
<file src="..\..\src\Umbraco.Web\**\*.cs" exclude="..\..\src\**\TemporaryGeneratedFile*.cs" target="src\Umbraco.Web" />
<file src="..\_BuildOutput\bin\Umbraco.Web.UI.pdb" target="lib" />
<file src="..\..\src\Umbraco.Web.UI\**\*.cs" exclude="..\..\src\**\TemporaryGeneratedFile*.cs" target="src\Umbraco.Web.UI" />
<file src="..\_BuildOutput\bin\UmbracoExamine.pdb" target="lib" />
<file src="..\..\src\UmbracoExamine\**\*.cs" exclude="..\..\src\**\TemporaryGeneratedFile*.cs" target="src\UmbracoExamine" />
</files>
</package>
+2 -1
View File
@@ -6,7 +6,7 @@
<title>Umbraco Cms</title>
<authors>Umbraco HQ</authors>
<owners>Umbraco HQ</owners>
<licenseUrl>http://umbraco.codeplex.com/license</licenseUrl>
<licenseUrl>http://opensource.org/licenses/MIT</licenseUrl>
<projectUrl>http://umbraco.com/</projectUrl>
<iconUrl>http://umbraco.com/media/357769/100px_transparent.png</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
@@ -34,6 +34,7 @@
<file src="..\_BuildOutput\WebApp\umbraco_client\**" target="UmbracoFiles\umbraco_client" />
<file src="tools\install.ps1" target="tools\install.ps1" />
<file src="tools\Readme.txt" target="tools\Readme.txt" />
<file src="tools\ReadmeUpgrade.txt" target="tools\ReadmeUpgrade.txt" />
<file src="tools\Web.config.install.xdt" target="Content\Web.config.install.xdt" />
<file src="tools\applications.config.install.xdt" target="Content\config\applications.config.install.xdt" />
<file src="tools\ClientDependency.config.install.xdt" target="Content\config\ClientDependency.config.install.xdt" />
-23
View File
@@ -1,23 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>UmbracoExamine.PDF</id>
<version>0.7.0</version>
<authors>Umbraco HQ</authors>
<owners>Umbraco HQ</owners>
<licenseUrl>http://umbraco.codeplex.com/license</licenseUrl>
<projectUrl>http://umbraco.com/</projectUrl>
<iconUrl>http://umbraco.com/media/357769/100px_transparent.png</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>UmbracoExmine.PDF</description>
<tags>umbraco</tags>
<dependencies>
<dependency id="UmbracoCms.Core" version="[7.0.0, 8.0.0)" />
<dependency id="iTextSharp" version="[5.5.3, 6.0.0)" />
</dependencies>
</metadata>
<files>
<file src="..\_BuildOutput\UmbracoExamine.PDF\UmbracoExamine.PDF.dll" target="lib\UmbracoExamine.PDF.dll" />
<file src="..\_BuildOutput\UmbracoExamine.PDF\UmbracoExamine.PDF.XML" target="lib\UmbracoExamine.PDF.XML" />
</files>
</package>
-10
View File
@@ -8,21 +8,11 @@
----------------------------------------------------
A note about running Umbraco from Visual Studio.
Don't forget to build!
When upgrading your website using NuGet you should answer "No" to the questions to overwrite the Web.config
file (and config files in the config folder).
We've done our best to transform your configuration files but in case something is not quite right: remember we
backed up your files in App_Data\NuGetBackup so you can find the original files before they were transformed.
We've overwritten all the files in the Umbraco and Umbraco_Client folder, these have been backed up in
App_Data\NuGetBackup. We didn't overwrite the UI.xml file nor did we remove any files or folders that you or
a package might have added. Only the existing files were overwritten. If you customized anything then make
sure to do a compare and merge with the NuGetBackup folder.
This NuGet package includes build targets that extend the creation of a deploy package, which is generated by
Publishing from Visual Studio. The targets will only work once Publishing is configured, so if you don't use
Publish this won't affect you.
+33
View File
@@ -0,0 +1,33 @@
_ _ __ __ ____ _____ _____ ____
| | | | \/ | _ \| __ \ /\ / ____/ __ \
| | | | \ / | |_) | |__) | / \ | | | | | |
| | | | |\/| | _ <| _ / / /\ \| | | | | |
| |__| | | | | |_) | | \ \ / ____ | |___| |__| |
\____/|_| |_|____/|_| \_/_/ \_\_____\____/
----------------------------------------------------
Don't forget to build!
When upgrading your website using NuGet you should answer "No" to the questions to overwrite the Web.config
file (and config files in the config folder).
We've done our best to transform your configuration files but in case something is not quite right: remember we
backed up your files in App_Data\NuGetBackup so you can find the original files before they were transformed.
We've overwritten all the files in the Umbraco and Umbraco_Client folder, these have been backed up in
App_Data\NuGetBackup. We didn't overwrite the UI.xml file nor did we remove any files or folders that you or
a package might have added. Only the existing files were overwritten. If you customized anything then make
sure to do a compare and merge with the NuGetBackup folder.
This NuGet package includes build targets that extend the creation of a deploy package, which is generated by
Publishing from Visual Studio. The targets will only work once Publishing is configured, so if you don't use
Publish this won't affect you.
The following items will now be automatically included when creating a deploy package or publishing to the file
system: umbraco, umbraco_client, config\splashes and global.asax.
Please read the release notes on our.umbraco.org:
http://our.umbraco.org/contribute/releases
- Umbraco
+10 -2
View File
@@ -21,6 +21,7 @@
<appSettings xdt:Transform="InsertIfMissing" />
<appSettings>
<add key="ValidationSettings:UnobtrusiveValidationMode" value="None" xdt:Locator="Match(key)" xdt:Transform="InsertIfMissing" />
<add key="owin:appStartup" value="UmbracoDefaultOwinStartup" xdt:Locator="Match(key)" xdt:Transform="InsertIfMissing" />
</appSettings>
<umbracoConfiguration xdt:Transform="InsertIfMissing">
@@ -37,8 +38,10 @@
<DbProviderFactories xdt:Transform="InsertIfMissing">
<remove invariant="System.Data.SqlServerCe.4.0" xdt:Locator="Match(invariant)" xdt:Transform="InsertIfMissing" />
<add name="Microsoft SQL Server Compact Data Provider 4.0" invariant="System.Data.SqlServerCe.4.0" description=".NET Framework Data Provider for Microsoft SQL Server Compact" type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe" xdt:Locator="Match(invariant)" xdt:Transform="SetAttributes(invariant,description,type)" />
<remove invariant="MySql.Data.MySqlClient" xdt:Locator="Match(invariant)" xdt:Transform="InsertIfMissing" />
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data" xdt:Locator="Match(invariant)" xdt:Transform="SetAttributes(invariant,description,type)" />
<remove invariant="MySql.Data.MySqlClient" xdt:Locator="Match(invariant)" xdt:Transform="InsertIfMissing" />
<add invariant="MySql.Data.MySqlClient" xdt:Locator="Match(invariant)" xdt:Transform="Remove" />
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data" xdt:Locator="Match(invariant)" xdt:Transform="InsertIfMissing" />
<add invariant="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data" xdt:Locator="Match(invariant)" xdt:Transform="SetAttributes(type)" />
</DbProviderFactories>
</system.data>
<clientDependency xdt:Transform="RemoveAttributes(version)" />
@@ -141,6 +144,7 @@
<dependentAssembly xdt:Locator="Condition(./_defaultNamespace:assemblyIdentity/@name='System.Net.Http')" xdt:Transform="Remove" />
<dependentAssembly xdt:Locator="Condition(./_defaultNamespace:assemblyIdentity/@name='Newtonsoft.Json')" xdt:Transform="Remove" />
<dependentAssembly xdt:Locator="Condition(./_defaultNamespace:assemblyIdentity/@name='System.Web.Mvc')" xdt:Transform="Remove" />
<dependentAssembly xdt:Locator="Condition(./_defaultNamespace:assemblyIdentity/@name='System.Web.Htttp')" xdt:Transform="Remove" />
</assemblyBinding>
</runtime>
@@ -158,6 +162,10 @@
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
</dependentAssembly>
<dependentAssembly xdt:Transform="Insert">
<assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
+26 -73
View File
@@ -47,93 +47,46 @@ if ($project) {
robocopy $umbracoClientFolder $umbracoClientBackupPath /e /LOG:$copyLogsPath\UmbracoClientBackup.log
robocopy $umbracoClientFolderSource $umbracoClientFolder /is /it /e /LOG:$copyLogsPath\UmbracoClientCopy.log
}
$copyWebconfig = $false
# SJ - What can I say: big up for James Newton King for teaching us a hack for detecting if this is a new install vs. an upgrade!
# https://github.com/JamesNK/Newtonsoft.Json/pull/387 - would never have seen this without the controversial pull request..
Try
$copyWebconfig = $true
$destinationWebConfig = Join-Path $projectDestinationPath "Web.config"
if(Test-Path $destinationWebConfig)
{
# see if user is installing from VS NuGet console
# get reference to the window, the console host and the input history
# copy web.config if "install-package UmbracoCms" was last input
# this is in a try-catch as they might be using the regular NuGet dialog
# instead of package manager console
$dte2 = Get-Interface $dte ([EnvDTE80.DTE2])
$consoleWindow = $(Get-VSComponentModel).GetService([NuGetConsole.IPowerConsoleWindow])
Try
{
[xml]$config = Get-Content $destinationWebConfig
$props = $consoleWindow.GetType().GetProperties([System.Reflection.BindingFlags]::Instance -bor [System.Reflection.BindingFlags]::NonPublic)
$prop = $props | ? { $_.Name -eq "ActiveHostInfo" } | select -first 1
$hostInfo = $prop.GetValue($consoleWindow)
$history = $hostInfo.WpfConsole.InputHistory.History
$lastCommand = $history | select -last 1
if ($lastCommand)
{
$lastCommand = $lastCommand.Trim().ToLower()
if ($lastCommand.StartsWith("install-package") -and $lastCommand.Contains("umbracocms"))
{
$copyWebconfig = $true
$config.configuration.appSettings.ChildNodes | ForEach-Object {
if($_.key -eq "umbracoConfigurationStatus")
{
# The web.config has an umbraco-specific appSetting in it
# don't overwrite it and let config transforms do their thing
$copyWebconfig = $false
}
}
}
}
Catch { }
}
Catch { }
Try
{
# user is installing from VS NuGet dialog
# get reference to the window, then smart output console provider
# copy web.config if messages in buffered console contains "installing...UmbracoCms" in last operation
$instanceField = [NuGet.Dialog.PackageManagerWindow].GetField("CurrentInstance", [System.Reflection.BindingFlags]::Static -bor [System.Reflection.BindingFlags]::NonPublic)
$consoleField = [NuGet.Dialog.PackageManagerWindow].GetField("_smartOutputConsoleProvider", [System.Reflection.BindingFlags]::Instance -bor [System.Reflection.BindingFlags]::NonPublic)
$instance = $instanceField.GetValue($null)
$consoleProvider = $consoleField.GetValue($instance)
$console = $consoleProvider.CreateOutputConsole($false)
$messagesField = $console.GetType().GetField("_messages", [System.Reflection.BindingFlags]::Instance -bor [System.Reflection.BindingFlags]::NonPublic)
$messages = $messagesField.GetValue($console)
$operations = $messages -split "=============================="
$lastOperation = $operations | select -last 1
if ($lastOperation)
{
$lastOperation = $lastOperation.ToLower()
$lines = $lastOperation -split "`r`n"
$installMatch = $lines | ? { $_.Contains("...umbracocms ") } | select -first 1
if ($installMatch)
{
$copyWebconfig = $true
}
}
}
Catch { }
if($copyWebconfig -eq $true)
{
$packageWebConfigSource = Join-Path $rootPath "UmbracoFiles\Web.config"
$destinationWebConfig = Join-Path $projectDestinationPath "Web.config"
Copy-Item $packageWebConfigSource $destinationWebConfig -Force
}
}
$installFolder = Join-Path $projectDestinationPath "Install"
if(Test-Path $installFolder) {
Remove-Item $installFolder -Force -Recurse -Confirm:$false
}
# Open readme.txt file
$DTE.ItemOperations.OpenFile($toolsPath + '\Readme.txt')
# Open appropriate readme
if($copyWebconfig -eq $true)
{
$DTE.ItemOperations.OpenFile($toolsPath + '\Readme.txt')
}
else
{
$DTE.ItemOperations.OpenFile($toolsPath + '\ReadmeUpgrade.txt')
}
}
+2 -1
View File
@@ -1,2 +1,3 @@
# Usage: on line 2 put the release version, on line 3 put the version comment (example: beta)
7.2.3
7.3.0
beta
-13
View File
@@ -1,13 +0,0 @@
Umbraco CMS version 4.5 is licensed under the OSI approved MIT License:
Copyright (c) 2007-2010 umbraco I/S.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Umbraco versions prior to 4.5 were licensed under a combination of MIT and a propriatary UI license. The license history can be found here:
http://umbraco.codeplex.com/license
-33
View File
@@ -1,33 +0,0 @@
Umbraco - the simple, flexible and friendly ASP.NET CMS
=======================================================
For the first time on the Microsoft platform a free user and developer friendly cms that makes it quick and easy to create websites - or a breeze to build complex web applications. umbraco got award-winning integration capabilities and supports your ASP.NET User and Custom Controls out of the box. It's a developers dream and your users will love it too. Used by more than 57.000 active websites including Heinz.com, Peugeot.com, NAIAS.com and Microsofts documentinteropinitiative.org website you can be sure that the technology is proven, stable and scales.
More info at http://umbraco.com
Exploring the repository
========================
Most contributors will work on their own fork and should pick the branch in which they need their fix. For more information see:
http://our.umbraco.org/contribute/guidelines-for-core-contribution
Exploring the source
====================
The Umbraco source code is never required for you to start building sites. If you are not using the source code for debugging purposes or to contribute to the source then please download the binaries listed at http://umbraco.codeplex.com
With that said, the Umbraco solution can be opened in Visual Studio 2010 with SP1 installed or Visual Studio 2012.
Contributing
============
Umbraco is Open Source which means you can contribute to make it great!
Read all about it at http://our.umbraco.org/contribute
Forums
======
We have a forum running on http://our.umbraco.org for friendly community support.
Documentation
=============
Our documentation section provides help on installing and using Umbraco including API reference documentation: http://our.umbraco.org/documentation
Submitting Issues
=================
Another way you can contribute to Umbraco is by providing issue reports, for information on how to submit an issue report refer to our online guide at http://our.umbraco.org/contribute/report-an-issue-or-request-a-feature
Binary file not shown.
+3 -2
View File
@@ -77,8 +77,9 @@
<Compile Include="SqlCEUtility.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="app.config" />
<None Include="app.config">
<SubType>Designer</SubType>
</None>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
+16
View File
@@ -14,6 +14,22 @@
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Owin.Security.OAuth" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Owin.Security" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Owin.Security.Cookies" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
+6 -3
View File
@@ -1,8 +1,8 @@
using System.Reflection;
using System.Reflection;
using System.Resources;
[assembly: AssemblyCompany("umbraco")]
[assembly: AssemblyCopyright("Copyright © Umbraco 2012")]
[assembly: AssemblyCompany("Umbraco")]
[assembly: AssemblyCopyright("Copyright © Umbraco 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
@@ -10,3 +10,6 @@ using System.Resources;
[assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyFileVersion("7.3.0")]
[assembly: AssemblyInformationalVersion("7.3.0-beta")]
+10 -8
View File
@@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Umbraco.Core.Logging;
using Umbraco.Core.ObjectResolution;
using umbraco.interfaces;
@@ -12,13 +13,14 @@ namespace Umbraco.Core
/// </summary>
internal sealed class ActionsResolver : LazyManyObjectsResolverBase<ActionsResolver, IAction>
{
/// <summary>
/// Constructor
/// </summary>
/// <param name="packageActions"></param>
internal ActionsResolver(Func<IEnumerable<Type>> packageActions)
: base(packageActions)
/// <summary>
/// Constructor
/// </summary>
/// <param name="serviceProvider"></param>
/// <param name="logger"></param>
/// <param name="packageActions"></param>
internal ActionsResolver(IServiceProvider serviceProvider, ILogger logger, Func<IEnumerable<Type>> packageActions)
: base(serviceProvider, logger, packageActions)
{
}
@@ -55,7 +57,7 @@ namespace Umbraco.Core
var instance = type.GetProperty("Instance", BindingFlags.Public | BindingFlags.Static);
//if the singletone initializer is not found, try simply creating an instance of the IAction if it supports public constructors
if (instance == null)
typeInstance = PluginManager.Current.CreateInstance<IAction>(type);
typeInstance = ServiceProvider.GetService(type) as IAction;
else
typeInstance = instance.GetValue(null, null) as IAction;
+4 -4
View File
@@ -1,8 +1,6 @@
using System;
namespace Umbraco.Core
{
/// <summary>
/// <summary>
/// Helper methods for Activation
/// </summary>
internal static class ActivatorHelper
@@ -14,7 +12,9 @@ namespace Umbraco.Core
/// <returns></returns>
public static T CreateInstance<T>() where T : class, new()
{
return Activator.CreateInstance(typeof(T)) as T;
return new ActivatorServiceProvider().GetService(typeof (T)) as T;
}
}
}
@@ -0,0 +1,12 @@
using System;
namespace Umbraco.Core
{
internal class ActivatorServiceProvider : IServiceProvider
{
public object GetService(Type serviceType)
{
return Activator.CreateInstance(serviceType);
}
}
}
+84 -12
View File
@@ -8,6 +8,7 @@ using Umbraco.Core.Configuration;
using Umbraco.Core.Configuration.UmbracoSettings;
using Umbraco.Core.Logging;
using Umbraco.Core.ObjectResolution;
using Umbraco.Core.Profiling;
using Umbraco.Core.Services;
@@ -21,21 +22,35 @@ namespace Umbraco.Core
/// </remarks>
public class ApplicationContext : IDisposable
{
/// <summary>
/// Constructor
/// </summary>
/// <param name="dbContext"></param>
/// <param name="serviceContext"></param>
/// <param name="cache"></param>
public ApplicationContext(DatabaseContext dbContext, ServiceContext serviceContext, CacheHelper cache)
{
/// <param name="logger"></param>
public ApplicationContext(DatabaseContext dbContext, ServiceContext serviceContext, CacheHelper cache, ProfilingLogger logger)
{
if (dbContext == null) throw new ArgumentNullException("dbContext");
if (serviceContext == null) throw new ArgumentNullException("serviceContext");
if (cache == null) throw new ArgumentNullException("cache");
_databaseContext = dbContext;
_services = serviceContext;
ApplicationCache = cache;
ProfilingLogger = logger;
}
/// <summary>
/// Constructor
/// </summary>
/// <param name="dbContext"></param>
/// <param name="serviceContext"></param>
/// <param name="cache"></param>
[Obsolete("Use the other constructor specifying an ILogger instead")]
public ApplicationContext(DatabaseContext dbContext, ServiceContext serviceContext, CacheHelper cache)
: this(dbContext, serviceContext, cache,
new ProfilingLogger(LoggerResolver.Current.Logger, ProfilerResolver.Current.Profiler))
{
}
/// <summary>
@@ -83,6 +98,7 @@ namespace Umbraco.Core
/// <remarks>
/// This is NOT thread safe
/// </remarks>
[Obsolete("Use the other method specifying an ProfilingLogger instead")]
public static ApplicationContext EnsureContext(DatabaseContext dbContext, ServiceContext serviceContext, CacheHelper cache, bool replaceContext)
{
if (ApplicationContext.Current != null)
@@ -95,6 +111,33 @@ namespace Umbraco.Core
return ApplicationContext.Current;
}
/// <summary>
/// A method used to create and ensure that a global ApplicationContext singleton is created.
/// </summary>
/// <param name="cache"></param>
/// <param name="logger"></param>
/// <param name="replaceContext">
/// If set to true will replace the current singleton instance - This should only be used for unit tests or on app
/// startup if for some reason the boot manager is not the umbraco boot manager.
/// </param>
/// <param name="dbContext"></param>
/// <param name="serviceContext"></param>
/// <returns></returns>
/// <remarks>
/// This is NOT thread safe
/// </remarks>
public static ApplicationContext EnsureContext(DatabaseContext dbContext, ServiceContext serviceContext, CacheHelper cache, ProfilingLogger logger, bool replaceContext)
{
if (ApplicationContext.Current != null)
{
if (!replaceContext)
return ApplicationContext.Current;
}
var ctx = new ApplicationContext(dbContext, serviceContext, cache, logger);
ApplicationContext.Current = ctx;
return ApplicationContext.Current;
}
/// <summary>
/// Singleton accessor
/// </summary>
@@ -108,7 +151,13 @@ namespace Umbraco.Core
/// </remarks>
public CacheHelper ApplicationCache { get; private set; }
// IsReady is set to true by the boot manager once it has successfully booted
/// <summary>
/// Exposes the global ProfilingLogger - this should generally not be accessed via the UmbracoContext and should normally just be exposed
/// on most base classes or injected with IoC
/// </summary>
public ProfilingLogger ProfilingLogger { get; private set; }
// IsReady is set to true by the boot manager once it has successfully booted
// note - the original umbraco module checks on content.Instance in umbraco.dll
// now, the boot task that setup the content store ensures that it is ready
bool _isReady = false;
@@ -153,6 +202,25 @@ namespace Umbraco.Core
}
}
/// <summary>
/// If the db is configured, there is a database context and there is an umbraco schema, but we are not 'configured' , then it means we are upgrading
/// </summary>
public bool IsUpgrading
{
get
{
if (IsConfigured == false
&& DatabaseContext != null
&& DatabaseContext.IsDatabaseConfigured)
{
var schemaresult = DatabaseContext.ValidateDatabaseSchema();
if (schemaresult.ValidTables.Count > 0) return true;
}
return false;
}
}
/// <summary>
/// The original/first url that the web application executes
/// </summary>
@@ -165,6 +233,8 @@ namespace Umbraco.Core
/// </remarks>
internal string OriginalRequestUrl { get; set; }
private bool _versionsDifferenceReported;
/// <summary>
/// Checks if the version configured matches the assembly version
/// </summary>
@@ -174,17 +244,19 @@ namespace Umbraco.Core
{
try
{
string configStatus = ConfigurationStatus;
string currentVersion = UmbracoVersion.Current.ToString(3);
var configStatus = ConfigurationStatus;
var currentVersion = UmbracoVersion.Current.ToString(3);
var ok = configStatus == currentVersion;
if (currentVersion != configStatus)
if (ok == false && _versionsDifferenceReported == false)
{
LogHelper.Info<ApplicationContext>("CurrentVersion different from configStatus: '" + currentVersion + "','" + configStatus + "'");
// remember it's been reported so we don't flood the log
// no thread-safety so there may be a few log entries, doesn't matter
_versionsDifferenceReported = true;
ProfilingLogger.Logger.Debug<ApplicationContext>("CurrentVersion different from configStatus: '" + currentVersion + "','" + configStatus + "'");
}
return (configStatus == currentVersion);
return ok;
}
catch
{
@@ -289,7 +361,7 @@ namespace Umbraco.Core
this.ApplicationCache = null;
if (_databaseContext != null) //need to check the internal field here
{
if (DatabaseContext.IsDatabaseConfigured)
if (DatabaseContext.IsDatabaseConfigured && DatabaseContext.Database != null)
{
DatabaseContext.Database.Dispose();
}
+207
View File
@@ -0,0 +1,207 @@
using System;
using System.Runtime.ConstrainedExecution;
using System.Threading;
using System.Threading.Tasks;
namespace Umbraco.Core
{
// http://blogs.msdn.com/b/pfxteam/archive/2012/02/12/10266988.aspx
//
// notes:
// - this is NOT a reader/writer lock
// - this is NOT a recursive lock
//
// using a named Semaphore here and not a Mutex because mutexes have thread
// affinity which does not work with async situations
//
// it is important that managed code properly release the Semaphore before
// going down else it will maintain the lock - however note that when the
// whole process (w3wp.exe) goes down and all handles to the Semaphore have
// been closed, the Semaphore system object is destroyed - so in any case
// an iisreset should clean up everything
//
internal class AsyncLock
{
private readonly SemaphoreSlim _semaphore;
private readonly Semaphore _semaphore2;
private readonly IDisposable _releaser;
private readonly Task<IDisposable> _releaserTask;
public AsyncLock()
: this (null)
{ }
public AsyncLock(string name)
{
// WaitOne() waits until count > 0 then decrements count
// Release() increments count
// initial count: the initial count value
// maximum count: the max value of count, and then Release() throws
if (string.IsNullOrWhiteSpace(name))
{
// anonymous semaphore
// use one unique releaser, that will not release the semaphore when finalized
// because the semaphore is destroyed anyway if the app goes down
_semaphore = new SemaphoreSlim(1, 1); // create a local (to the app domain) semaphore
_releaser = new SemaphoreSlimReleaser(_semaphore);
_releaserTask = Task.FromResult(_releaser);
}
else
{
// named semaphore
// use dedicated releasers, that will release the semaphore when finalized
// because the semaphore is system-wide and we cannot leak counts
_semaphore2 = new Semaphore(1, 1, name); // create a system-wide named semaphore
}
}
private IDisposable CreateReleaser()
{
// for anonymous semaphore, use the unique releaser, else create a new one
return _semaphore != null
? _releaser // (IDisposable)new SemaphoreSlimReleaser(_semaphore)
: (IDisposable)new NamedSemaphoreReleaser(_semaphore2);
}
public Task<IDisposable> LockAsync()
{
var wait = _semaphore != null
? _semaphore.WaitAsync()
: WaitOneAsync(_semaphore2);
return wait.IsCompleted
? _releaserTask ?? Task.FromResult(CreateReleaser()) // anonymous vs named
: wait.ContinueWith((_, state) => (((AsyncLock) state).CreateReleaser()),
this, CancellationToken.None,
TaskContinuationOptions.ExecuteSynchronously, TaskScheduler.Default);
}
public IDisposable Lock()
{
if (_semaphore != null)
_semaphore.Wait();
else
_semaphore2.WaitOne();
return _releaser ?? CreateReleaser(); // anonymous vs named
}
public IDisposable Lock(int millisecondsTimeout)
{
var entered = _semaphore != null
? _semaphore.Wait(millisecondsTimeout)
: _semaphore2.WaitOne(millisecondsTimeout);
if (entered == false)
throw new TimeoutException("Failed to enter the lock within timeout.");
return _releaser ?? CreateReleaser(); // anonymous vs named
}
// note - before making those classes some structs, read
// about "impure methods" and mutating readonly structs...
private class NamedSemaphoreReleaser : CriticalFinalizerObject, IDisposable
{
private readonly Semaphore _semaphore;
internal NamedSemaphoreReleaser(Semaphore semaphore)
{
_semaphore = semaphore;
}
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
private void Dispose(bool disposing)
{
// critical
_semaphore.Release();
}
// we WANT to release the semaphore because it's a system object
// ie a critical non-managed resource - so we inherit from CriticalFinalizerObject
// which means that the finalizer "should" run in all situations
// however... that can fail with System.ObjectDisposedException because the
// underlying handle was closed... because we cannot guarantee that the semaphore
// is not gone already... unless we get a GCHandle = GCHandle.Alloc(_semaphore);
// which should keep it around and then we free the handle?
// so... I'm not sure this is safe really...
~NamedSemaphoreReleaser()
{
Dispose(false);
}
}
private class SemaphoreSlimReleaser : IDisposable
{
private readonly SemaphoreSlim _semaphore;
internal SemaphoreSlimReleaser(SemaphoreSlim semaphore)
{
_semaphore = semaphore;
}
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
private void Dispose(bool disposing)
{
if (disposing)
{
// normal
_semaphore.Release();
}
}
~SemaphoreSlimReleaser()
{
Dispose(false);
}
}
// http://stackoverflow.com/questions/25382583/waiting-on-a-named-semaphore-with-waitone100-vs-waitone0-task-delay100
// http://blog.nerdbank.net/2011/07/c-await-for-waithandle.html
// F# has a AwaitWaitHandle method that accepts a time out... and seems pretty complex...
// version below should be OK
private static Task WaitOneAsync(WaitHandle handle)
{
var tcs = new TaskCompletionSource<object>();
var callbackHandleInitLock = new object();
lock (callbackHandleInitLock)
{
RegisteredWaitHandle callbackHandle = null;
// ReSharper disable once RedundantAssignment
callbackHandle = ThreadPool.RegisterWaitForSingleObject(
handle,
(state, timedOut) =>
{
tcs.SetResult(null);
// we take a lock here to make sure the outer method has completed setting the local variable callbackHandle.
lock (callbackHandleInitLock)
{
// ReSharper disable once PossibleNullReferenceException
// ReSharper disable once AccessToModifiedClosure
callbackHandle.Unregister(null);
}
},
/*state:*/ null,
/*millisecondsTimeOutInterval:*/ Timeout.Infinite,
/*executeOnlyOnce:*/ true);
}
return tcs.Task;
}
}
}
+10 -6
View File
@@ -1,13 +1,17 @@
namespace Umbraco.Core.Auditing
using System;
using System.ComponentModel;
namespace Umbraco.Core.Auditing
{
/// <summary>
/// Public method to create new audit trail
/// </summary>
[Obsolete("Use Umbraco.Core.Services.IAuditService instead")]
[EditorBrowsable(EditorBrowsableState.Never)]
public static class Audit
{
public static void Add(AuditTypes type, string comment, int userId, int objectId)
public static void Add(Umbraco.Core.Auditing.AuditTypes type, string comment, int userId, int objectId)
{
AuditTrail.Current.AddEntry(type, comment, userId, objectId);
ApplicationContext.Current.Services.AuditService.Add(
Enum<Umbraco.Core.Models.AuditType>.Parse(type.ToString()),
comment, userId, objectId);
}
}
}
-30
View File
@@ -1,30 +0,0 @@
using System;
namespace Umbraco.Core.Auditing
{
/// <summary>
/// Represents the Audit implementation
/// </summary>
internal class AuditTrail
{
#region Singleton
private static readonly Lazy<AuditTrail> lazy = new Lazy<AuditTrail>(() => new AuditTrail());
public static AuditTrail Current { get { return lazy.Value; } }
private AuditTrail()
{
WriteProvider = new DataAuditWriteProvider();
}
#endregion
private IAuditWriteProvider WriteProvider { get; set; }
public void AddEntry(AuditTypes type, string comment, int userId, int objectId)
{
WriteProvider.WriteEntry(objectId, userId, DateTime.Now, type.ToString(), comment);
}
}
}
+6 -4
View File
@@ -1,8 +1,10 @@
namespace Umbraco.Core.Auditing
using System;
using System.ComponentModel;
namespace Umbraco.Core.Auditing
{
/// <summary>
/// Enums for vailable types of auditing
/// </summary>
[Obsolete("Use Umbraco.Core.Models.AuditType instead")]
[EditorBrowsable(EditorBrowsableState.Never)]
public enum AuditTypes
{
/// <summary>
@@ -1,29 +0,0 @@
using System;
using Umbraco.Core.Models.Rdbms;
using Umbraco.Core.Persistence;
namespace Umbraco.Core.Auditing
{
internal class DataAuditWriteProvider : IAuditWriteProvider
{
/// <summary>
/// Writes an audit entry to the underlaying datastore.
/// </summary>
/// <param name="objectId">Id of the object (Content, ContentType, Media, etc.)</param>
/// <param name="userId">Id of the user</param>
/// <param name="date">Datestamp</param>
/// <param name="header">Audit header</param>
/// <param name="comment">Audit comment</param>
public void WriteEntry(int objectId, int userId, DateTime date, string header, string comment)
{
ApplicationContext.Current.DatabaseContext.Database.Insert(new LogDto
{
Comment = comment,
Datestamp = date,
Header = header,
NodeId = objectId,
UserId = userId
});
}
}
}
@@ -1,17 +0,0 @@
using System;
namespace Umbraco.Core.Auditing
{
internal interface IAuditWriteProvider
{
/// <summary>
/// Writes an audit entry to the underlaying datastore.
/// </summary>
/// <param name="objectId">Id of the object (Content, ContentType, Media, etc.)</param>
/// <param name="userId">Id of the user</param>
/// <param name="date">Datestamp</param>
/// <param name="header">Audit header</param>
/// <param name="comment">Audit comment</param>
void WriteEntry(int objectId, int userId, DateTime date, string header, string comment);
}
}
+9
View File
@@ -29,6 +29,8 @@ namespace Umbraco.Core.Cache
public const string MemberBusinessLogicCacheKey = "MemberCacheItem_";
public const string TemplateFrontEndCacheKey = "template";
[Obsolete("This is no longer used and will be removed from the codebase in the future")]
public const string TemplateBusinessLogicCacheKey = "UmbracoTemplateCache";
public const string UserContextCacheKey = "UmbracoUserContext";
@@ -45,14 +47,21 @@ namespace Umbraco.Core.Cache
public const string PropertyTypeCacheKey = "UmbracoPropertyTypeCache";
[Obsolete("This is no longer used and will be removed from the codebase in the future")]
public const string LanguageCacheKey = "UmbracoLanguageCache";
[Obsolete("This is no longer used and will be removed from the codebase in the future")]
public const string DomainCacheKey = "UmbracoDomainList";
[Obsolete("This is no longer used and will be removed from the codebase in the future")]
public const string StylesheetCacheKey = "UmbracoStylesheet";
[Obsolete("This is no longer used and will be removed from the codebase in the future")]
public const string StylesheetPropertyCacheKey = "UmbracoStylesheetProperty";
public const string DataTypeCacheKey = "UmbracoDataTypeDefinition";
public const string DataTypePreValuesCacheKey = "UmbracoPreVal";
public const string IdToKeyCacheKey = "UI2K";
public const string KeyToIdCacheKey = "UK2I";
}
}
@@ -12,7 +12,7 @@ namespace Umbraco.Core.Cache
protected const string CacheItemPrefix = "umbrtmche";
// an object that represent a value that has not been created yet
protected readonly object ValueNotCreated = new object();
protected internal static readonly object ValueNotCreated = new object();
// manupulate the underlying cache entries
// these *must* be called from within the appropriate locks
@@ -30,21 +30,58 @@ namespace Umbraco.Core.Cache
return string.Format("{0}-{1}", CacheItemPrefix, key);
}
protected object GetSafeLazyValue(Lazy<object> lazy, bool onlyIfValueIsCreated = false)
protected internal static Lazy<object> GetSafeLazy(Func<object> getCacheItem)
{
// try to generate the value and if it fails,
// wrap in an ExceptionHolder - would be much simpler
// to just use lazy.IsValueFaulted alas that field is
// internal
return new Lazy<object>(() =>
{
try
{
return getCacheItem();
}
catch (Exception e)
{
return new ExceptionHolder(e);
}
});
}
protected internal static object GetSafeLazyValue(Lazy<object> lazy, bool onlyIfValueIsCreated = false)
{
// if onlyIfValueIsCreated, do not trigger value creation
// must return something, though, to differenciate from null values
if (onlyIfValueIsCreated && lazy.IsValueCreated == false) return ValueNotCreated;
// if execution has thrown then lazy.IsValueCreated is false
// and lazy.IsValueFaulted is true (but internal) so we use our
// own exception holder (see Lazy<T> source code) to return null
if (lazy.Value is ExceptionHolder) return null;
// we have a value and execution has not thrown so returning
// here does not throw - unless we're re-entering, take care of it
try
{
// if onlyIfValueIsCreated, do not trigger value creation
// must return something, though, to differenciate from null values
if (onlyIfValueIsCreated && lazy.IsValueCreated == false) return ValueNotCreated;
return lazy.Value;
}
catch
catch (InvalidOperationException e)
{
return null;
throw new InvalidOperationException("The method that computes a value for the cache has tried to read that value from the cache.", e);
}
}
internal class ExceptionHolder
{
public ExceptionHolder(Exception e)
{
Exception = e;
}
public Exception Exception { get; private set; }
}
#region Clear
public virtual void ClearAllCache()
@@ -68,6 +105,9 @@ namespace Umbraco.Core.Cache
public virtual void ClearCacheObjectTypes(string typeName)
{
var type = TypeFinder.GetTypeByName(typeName);
if (type == null) return;
var isInterface = type.IsInterface;
using (WriteLock)
{
foreach (var entry in GetDictionaryEntries()
@@ -77,7 +117,10 @@ namespace Umbraco.Core.Cache
// remove null values as well, does not hurt
// get non-created as NonCreatedValue & exceptions as null
var value = GetSafeLazyValue((Lazy<object>)x.Value, true);
return value == null || value.GetType().ToString().InvariantEquals(typeName);
// if T is an interface remove anything that implements that interface
// otherwise remove exact types (not inherited types)
return value == null || (isInterface ? (type.IsInstanceOfType(value)) : (value.GetType() == type));
})
.ToArray())
RemoveEntry((string) entry.Key);
@@ -87,6 +130,7 @@ namespace Umbraco.Core.Cache
public virtual void ClearCacheObjectTypes<T>()
{
var typeOfT = typeof(T);
var isInterface = typeOfT.IsInterface;
using (WriteLock)
{
foreach (var entry in GetDictionaryEntries()
@@ -97,7 +141,10 @@ namespace Umbraco.Core.Cache
// compare on exact type, don't use "is"
// get non-created as NonCreatedValue & exceptions as null
var value = GetSafeLazyValue((Lazy<object>)x.Value, true);
return value == null || value.GetType() == typeOfT;
// if T is an interface remove anything that implements that interface
// otherwise remove exact types (not inherited types)
return value == null || (isInterface ? (value is T) : (value.GetType() == typeOfT));
})
.ToArray())
RemoveEntry((string) entry.Key);
@@ -107,6 +154,7 @@ namespace Umbraco.Core.Cache
public virtual void ClearCacheObjectTypes<T>(Func<string, T, bool> predicate)
{
var typeOfT = typeof(T);
var isInterface = typeOfT.IsInterface;
var plen = CacheItemPrefix.Length + 1;
using (WriteLock)
{
@@ -119,9 +167,12 @@ namespace Umbraco.Core.Cache
// get non-created as NonCreatedValue & exceptions as null
var value = GetSafeLazyValue((Lazy<object>)x.Value, true);
if (value == null) return true;
return value.GetType() == typeOfT
// run predicate on the 'public key' part only, ie without prefix
&& predicate(((string)x.Key).Substring(plen), (T)value);
// if T is an interface remove anything that implements that interface
// otherwise remove exact types (not inherited types)
return (isInterface ? (value is T) : (value.GetType() == typeOfT))
// run predicate on the 'public key' part only, ie without prefix
&& predicate(((string) x.Key).Substring(plen), (T) value);
}))
RemoveEntry((string) entry.Key);
}
@@ -105,15 +105,22 @@ namespace Umbraco.Core.Cache
if (result == null || GetSafeLazyValue(result, true) == null) // get non-created as NonCreatedValue & exceptions as null
{
result = new Lazy<object>(getCacheItem);
result = GetSafeLazy(getCacheItem);
ContextItems[cacheKey] = result;
}
}
// this may throw if getCacheItem throws, but this is the only place where
// it would throw as everywhere else we use GetLazySaveValue() to hide exceptions
// and pretend exceptions were never inserted into cache to begin with.
return result.Value;
// using GetSafeLazy and GetSafeLazyValue ensures that we don't cache
// exceptions (but try again and again) and silently eat them - however at
// some point we have to report them - so need to re-throw here
// this does not throw anymore
//return result.Value;
var value = result.Value; // will not throw (safe lazy)
var eh = value as ExceptionHolder;
if (eh != null) throw eh.Exception; // throw once!
return value;
}
#endregion
@@ -20,9 +20,15 @@ namespace Umbraco.Core.Cache
private readonly System.Web.Caching.Cache _cache;
/// <summary>
/// Used for debugging
/// </summary>
internal Guid InstanceId { get; private set; }
public HttpRuntimeCacheProvider(System.Web.Caching.Cache cache)
{
_cache = cache;
InstanceId = Guid.NewGuid();
}
protected override IEnumerable<DictionaryEntry> GetDictionaryEntries()
@@ -129,19 +135,27 @@ namespace Umbraco.Core.Cache
if (result == null || GetSafeLazyValue(result, true) == null) // get non-created as NonCreatedValue & exceptions as null
{
result = new Lazy<object>(getCacheItem);
result = GetSafeLazy(getCacheItem);
var absolute = isSliding ? System.Web.Caching.Cache.NoAbsoluteExpiration : (timeout == null ? System.Web.Caching.Cache.NoAbsoluteExpiration : DateTime.Now.Add(timeout.Value));
var sliding = isSliding == false ? System.Web.Caching.Cache.NoSlidingExpiration : (timeout ?? System.Web.Caching.Cache.NoSlidingExpiration);
lck.UpgradeToWriteLock();
//NOTE: 'Insert' on System.Web.Caching.Cache actually does an add or update!
_cache.Insert(cacheKey, result, dependency, absolute, sliding, priority, removedCallback);
}
}
// this may throw if getCacheItem throws, but this is the only place where
// it would throw as everywhere else we use GetLazySaveValue() to hide exceptions
// and pretend exceptions were never inserted into cache to begin with.
return result.Value;
// using GetSafeLazy and GetSafeLazyValue ensures that we don't cache
// exceptions (but try again and again) and silently eat them - however at
// some point we have to report them - so need to re-throw here
// this does not throw anymore
//return result.Value;
value = result.Value; // will not throw (safe lazy)
var eh = value as ExceptionHolder;
if (eh != null) throw eh.Exception; // throw once!
return value;
}
public object GetCacheItem(string cacheKey, Func<object> getCacheItem, TimeSpan? timeout, bool isSliding = false, CacheItemPriority priority = CacheItemPriority.Normal, CacheItemRemovedCallback removedCallback = null, string[] dependentFiles = null)
@@ -173,7 +187,7 @@ namespace Umbraco.Core.Cache
// NOTE - here also we must insert a Lazy<object> but we can evaluate it right now
// and make sure we don't store a null value.
var result = new Lazy<object>(getCacheItem);
var result = GetSafeLazy(getCacheItem);
var value = result.Value; // force evaluation now - this may throw if cacheItem throws, and then nothing goes into cache
if (value == null) return; // do not store null values (backward compat)
@@ -184,6 +198,7 @@ namespace Umbraco.Core.Cache
using (new WriteLock(_locker))
{
//NOTE: 'Insert' on System.Web.Caching.Cache actually does an add or update!
_cache.Insert(cacheKey, result, dependency, absolute, sliding, priority, removedCallback);
}
}
+38
View File
@@ -8,13 +8,51 @@ namespace Umbraco.Core.Cache
/// </summary>
public interface ICacheProvider
{
/// <summary>
/// Removes all items from the cache.
/// </summary>
void ClearAllCache();
/// <summary>
/// Removes an item from the cache, identified by its key.
/// </summary>
/// <param name="key">The key of the item.</param>
void ClearCacheItem(string key);
/// <summary>
/// Removes items from the cache, of a specified type.
/// </summary>
/// <param name="typeName">The name of the type to remove.</param>
/// <remarks>
/// <para>If the type is an interface, then all items of a type implementing that interface are
/// removed. Otherwise, only items of that exact type are removed (items of type inheriting from
/// the specified type are not removed).</para>
/// <para>Performs a case-sensitive search.</para>
/// </remarks>
void ClearCacheObjectTypes(string typeName);
/// <summary>
/// Removes items from the cache, of a specified type.
/// </summary>
/// <typeparam name="T">The type of the items to remove.</typeparam>
/// <remarks>If the type is an interface, then all items of a type implementing that interface are
/// removed. Otherwise, only items of that exact type are removed (items of type inheriting from
/// the specified type are not removed).</remarks>
void ClearCacheObjectTypes<T>();
/// <summary>
/// Removes items from the cache, of a specified type, satisfying a predicate.
/// </summary>
/// <typeparam name="T">The type of the items to remove.</typeparam>
/// <param name="predicate">The predicate to satisfy.</param>
/// <remarks>If the type is an interface, then all items of a type implementing that interface are
/// removed. Otherwise, only items of that exact type are removed (items of type inheriting from
/// the specified type are not removed).</remarks>
void ClearCacheObjectTypes<T>(Func<string, T, bool> predicate);
void ClearCacheByKeySearch(string keyStartsWith);
void ClearCacheByKeyExpression(string regexString);
IEnumerable<object> GetCacheItemsByKeySearch(string keyStartsWith);
IEnumerable<object> GetCacheItemsByKeyExpression(string regexString);
@@ -0,0 +1,16 @@
using umbraco.interfaces;
namespace Umbraco.Core.Cache
{
/// <summary>
/// A cache refresher that supports refreshing cache based on a custom payload
/// </summary>
interface IPayloadCacheRefresher : IJsonCacheRefresher
{
/// <summary>
/// Refreshes, clears, etc... any cache based on the information provided in the payload
/// </summary>
/// <param name="payload"></param>
void Refresh(object payload);
}
}
@@ -4,17 +4,16 @@ using umbraco.interfaces;
namespace Umbraco.Core.Cache
{
/// <summary>
/// A base class for json cache refreshers that ensures the correct events are raised when
/// cache refreshing occurs.
/// Provides a base class for "json" cache refreshers.
/// </summary>
/// <typeparam name="TInstanceType">The real cache refresher type, this is used for raising strongly typed events</typeparam>
public abstract class JsonCacheRefresherBase<TInstanceType> : CacheRefresherBase<TInstanceType>, IJsonCacheRefresher
where TInstanceType : ICacheRefresher
/// <typeparam name="TInstance">The actual cache refresher type.</typeparam>
/// <remarks>Ensures that the correct events are raised when cache refreshing occurs.</remarks>
public abstract class JsonCacheRefresherBase<TInstance> : CacheRefresherBase<TInstance>, IJsonCacheRefresher
where TInstance : ICacheRefresher
{
public virtual void Refresh(string jsonPayload)
public virtual void Refresh(string json)
{
OnCacheUpdated(Instance, new CacheRefresherEventArgs(jsonPayload, MessageType.RefreshByJson));
OnCacheUpdated(Instance, new CacheRefresherEventArgs(json, MessageType.RefreshByJson));
}
}
}
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Reflection;
using System.Runtime.Caching;
using System.Text.RegularExpressions;
using System.Threading;
@@ -16,30 +17,19 @@ namespace Umbraco.Core.Cache
/// </summary>
internal class ObjectCacheRuntimeCacheProvider : IRuntimeCacheProvider
{
private readonly ReaderWriterLockSlim _locker = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion);
internal ObjectCache MemoryCache;
// an object that represent a value that has not been created yet
protected readonly object ValueNotCreated = new object();
/// <summary>
/// Used for debugging
/// </summary>
internal Guid InstanceId { get; private set; }
public ObjectCacheRuntimeCacheProvider()
{
MemoryCache = new MemoryCache("in-memory");
}
protected object GetSafeLazyValue(Lazy<object> lazy, bool onlyIfValueIsCreated = false)
{
try
{
// if onlyIfValueIsCreated, do not trigger value creation
// must return something, though, to differenciate from null values
if (onlyIfValueIsCreated && lazy.IsValueCreated == false) return ValueNotCreated;
return lazy.Value;
}
catch
{
return null;
}
InstanceId = Guid.NewGuid();
}
#region Clear
@@ -64,6 +54,9 @@ namespace Umbraco.Core.Cache
public virtual void ClearCacheObjectTypes(string typeName)
{
var type = TypeFinder.GetTypeByName(typeName);
if (type == null) return;
var isInterface = type.IsInterface;
using (new WriteLock(_locker))
{
foreach (var key in MemoryCache
@@ -72,8 +65,11 @@ namespace Umbraco.Core.Cache
// x.Value is Lazy<object> and not null, its value may be null
// remove null values as well, does not hurt
// get non-created as NonCreatedValue & exceptions as null
var value = GetSafeLazyValue((Lazy<object>)x.Value, true);
return value == null || value.GetType().ToString().InvariantEquals(typeName);
var value = DictionaryCacheProviderBase.GetSafeLazyValue((Lazy<object>)x.Value, true);
// if T is an interface remove anything that implements that interface
// otherwise remove exact types (not inherited types)
return value == null || (isInterface ? (type.IsInstanceOfType(value)) : (value.GetType() == type));
})
.Select(x => x.Key)
.ToArray()) // ToArray required to remove
@@ -86,14 +82,19 @@ namespace Umbraco.Core.Cache
using (new WriteLock(_locker))
{
var typeOfT = typeof (T);
var isInterface = typeOfT.IsInterface;
foreach (var key in MemoryCache
.Where(x =>
{
// x.Value is Lazy<object> and not null, its value may be null
// remove null values as well, does not hurt
// get non-created as NonCreatedValue & exceptions as null
var value = GetSafeLazyValue((Lazy<object>)x.Value, true);
return value == null || value.GetType() == typeOfT;
var value = DictionaryCacheProviderBase.GetSafeLazyValue((Lazy<object>)x.Value, true);
// if T is an interface remove anything that implements that interface
// otherwise remove exact types (not inherited types)
return value == null || (isInterface ? (value is T) : (value.GetType() == typeOfT));
})
.Select(x => x.Key)
.ToArray()) // ToArray required to remove
@@ -106,16 +107,20 @@ namespace Umbraco.Core.Cache
using (new WriteLock(_locker))
{
var typeOfT = typeof(T);
var isInterface = typeOfT.IsInterface;
foreach (var key in MemoryCache
.Where(x =>
{
// x.Value is Lazy<object> and not null, its value may be null
// remove null values as well, does not hurt
// get non-created as NonCreatedValue & exceptions as null
var value = GetSafeLazyValue((Lazy<object>)x.Value, true);
var value = DictionaryCacheProviderBase.GetSafeLazyValue((Lazy<object>)x.Value, true);
if (value == null) return true;
return value.GetType() == typeOfT
&& predicate(x.Key, (T) value);
// if T is an interface remove anything that implements that interface
// otherwise remove exact types (not inherited types)
return (isInterface ? (value is T) : (value.GetType() == typeOfT))
&& predicate(x.Key, (T)value);
})
.Select(x => x.Key)
.ToArray()) // ToArray required to remove
@@ -161,7 +166,7 @@ namespace Umbraco.Core.Cache
.ToArray(); // evaluate while locked
}
return entries
.Select(x => GetSafeLazyValue((Lazy<object>)x.Value)) // return exceptions as null
.Select(x => DictionaryCacheProviderBase.GetSafeLazyValue((Lazy<object>)x.Value)) // return exceptions as null
.Where(x => x != null) // backward compat, don't store null values in the cache
.ToList();
}
@@ -176,7 +181,7 @@ namespace Umbraco.Core.Cache
.ToArray(); // evaluate while locked
}
return entries
.Select(x => GetSafeLazyValue((Lazy<object>)x.Value)) // return exceptions as null
.Select(x => DictionaryCacheProviderBase.GetSafeLazyValue((Lazy<object>)x.Value)) // return exceptions as null
.Where(x => x != null) // backward compat, don't store null values in the cache
.ToList();
}
@@ -188,7 +193,7 @@ namespace Umbraco.Core.Cache
{
result = MemoryCache.Get(cacheKey) as Lazy<object>; // null if key not found
}
return result == null ? null : GetSafeLazyValue(result); // return exceptions as null
return result == null ? null : DictionaryCacheProviderBase.GetSafeLazyValue(result); // return exceptions as null
}
public object GetCacheItem(string cacheKey, Func<object> getCacheItem)
@@ -205,17 +210,23 @@ namespace Umbraco.Core.Cache
using (var lck = new UpgradeableReadLock(_locker))
{
result = MemoryCache.Get(cacheKey) as Lazy<object>;
if (result == null || GetSafeLazyValue(result, true) == null) // get non-created as NonCreatedValue & exceptions as null
if (result == null || DictionaryCacheProviderBase.GetSafeLazyValue(result, true) == null) // get non-created as NonCreatedValue & exceptions as null
{
result = new Lazy<object>(getCacheItem);
result = DictionaryCacheProviderBase.GetSafeLazy(getCacheItem);
var policy = GetPolicy(timeout, isSliding, removedCallback, dependentFiles);
lck.UpgradeToWriteLock();
//NOTE: This does an add or update
MemoryCache.Set(cacheKey, result, policy);
}
}
return result.Value;
//return result.Value;
var value = result.Value; // will not throw (safe lazy)
var eh = value as DictionaryCacheProviderBase.ExceptionHolder;
if (eh != null) throw eh.Exception; // throw once!
return value;
}
#endregion
@@ -227,11 +238,12 @@ namespace Umbraco.Core.Cache
// NOTE - here also we must insert a Lazy<object> but we can evaluate it right now
// and make sure we don't store a null value.
var result = new Lazy<object>(getCacheItem);
var result = DictionaryCacheProviderBase.GetSafeLazy(getCacheItem);
var value = result.Value; // force evaluation now
if (value == null) return; // do not store null values (backward compat)
var policy = GetPolicy(timeout, isSliding, removedCallback, dependentFiles);
//NOTE: This does an add or update
MemoryCache.Set(cacheKey, result, policy);
}
@@ -0,0 +1,27 @@
using Umbraco.Core.Sync;
using umbraco.interfaces;
namespace Umbraco.Core.Cache
{
/// <summary>
/// Provides a base class for "payload" cache refreshers.
/// </summary>
/// <typeparam name="TInstance">The actual cache refresher type.</typeparam>
/// <remarks>Ensures that the correct events are raised when cache refreshing occurs.</remarks>
public abstract class PayloadCacheRefresherBase<TInstance> : JsonCacheRefresherBase<TInstance>, IPayloadCacheRefresher
where TInstance : ICacheRefresher
{
protected abstract object Deserialize(string json);
public override void Refresh(string json)
{
var payload = Deserialize(json);
Refresh(payload);
}
public virtual void Refresh(object payload)
{
OnCacheUpdated(Instance, new CacheRefresherEventArgs(payload, MessageType.RefreshByPayload));
}
}
}
+9 -7
View File
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using Umbraco.Core.Logging;
using Umbraco.Core.ObjectResolution;
using umbraco.interfaces;
@@ -12,13 +13,14 @@ namespace Umbraco.Core
/// </summary>
internal sealed class CacheRefreshersResolver : LegacyTransientObjectsResolver<CacheRefreshersResolver, ICacheRefresher>
{
/// <summary>
/// Constructor
/// </summary>
/// <param name="refreshers"></param>
internal CacheRefreshersResolver(Func<IEnumerable<Type>> refreshers)
: base(refreshers)
/// <summary>
/// Constructor
/// </summary>
/// <param name="serviceProvider"></param>
/// <param name="logger"></param>
/// <param name="refreshers"></param>
internal CacheRefreshersResolver(IServiceProvider serviceProvider, ILogger logger, Func<IEnumerable<Type>> refreshers)
: base(serviceProvider, logger, refreshers)
{
}
@@ -8,10 +8,13 @@ namespace Umbraco.Core.Configuration
{
internal class ClientDependencyConfiguration
{
private readonly ILogger _logger;
private readonly string _fileName;
public ClientDependencyConfiguration()
public ClientDependencyConfiguration(ILogger logger)
{
if (logger == null) throw new ArgumentNullException("logger");
_logger = logger;
_fileName = IOHelper.MapPath(string.Format("{0}/ClientDependency.config", SystemDirectories.Config));
}
@@ -35,13 +38,13 @@ namespace Umbraco.Core.Configuration
versionAttribute.SetValue(newVersion);
clientDependencyConfigXml.Save(_fileName, SaveOptions.DisableFormatting);
LogHelper.Info<ClientDependencyConfiguration>(string.Format("Updated version number from {0} to {1}", oldVersion, newVersion));
_logger.Info<ClientDependencyConfiguration>(string.Format("Updated version number from {0} to {1}", oldVersion, newVersion));
return true;
}
}
catch (Exception ex)
{
LogHelper.Error<ClientDependencyConfiguration>("Couldn't update ClientDependency version number", ex);
_logger.Error<ClientDependencyConfiguration>("Couldn't update ClientDependency version number", ex);
}
return false;
@@ -174,7 +174,7 @@ namespace Umbraco.Core.Configuration
/// We also make sure that the virtual directory (SystemDirectories.Root) is stripped off first, otherwise we'd end up with something
/// like "MyVirtualDirectory-Umbraco" instead of just "Umbraco".
/// </remarks>
internal static string UmbracoMvcArea
public static string UmbracoMvcArea
{
get
{
@@ -34,7 +34,7 @@ namespace Umbraco.Core.Configuration
{
get
{
var converted = ObjectExtensions.TryConvertTo<T>(RawValue);
var converted = RawValue.TryConvertTo<T>();
if (converted.Success == false)
throw new InvalidCastException("Could not convert value " + RawValue + " to type " + typeof(T));
return converted.Result;
@@ -83,14 +83,20 @@ namespace Umbraco.Core.Configuration
return _dashboardSection;
}
//ONLY for unit testing
/// <summary>
/// Only for testing
/// </summary>
/// <param name="value"></param>
internal void SetDashboardSettings(IDashboardSection value)
{
_dashboardSection = value;
}
//ONLY for unit testing
internal void SetUmbracoSettings(IUmbracoSettingsSection value)
/// <summary>
/// Only for testing
/// </summary>
/// <param name="value"></param>
public void SetUmbracoSettings(IUmbracoSettingsSection value)
{
_umbracoSettings = value;
}
@@ -110,7 +116,10 @@ namespace Umbraco.Core.Configuration
return _umbracoSettings;
}
//ONLY for unit testing
/// <summary>
/// Only for testing
/// </summary>
/// <param name="value"></param>
public void SetBaseRestExtensions(IBaseRestSection value)
{
_baseRestExtensions = value;
@@ -1,8 +1,9 @@
using System.Xml.Linq;
using System;
using System.Xml.Linq;
namespace Umbraco.Core.Configuration.UmbracoSettings
{
internal class ContentErrorPageElement : InnerTextConfigurationElement<int>, IContentErrorPage
internal class ContentErrorPageElement : InnerTextConfigurationElement<string>, IContentErrorPage
{
public ContentErrorPageElement(XElement rawXml)
: base(rawXml)
@@ -14,7 +15,43 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
}
public bool HasContentId
{
get { return ContentId != int.MinValue; }
}
public bool HasContentKey
{
get { return ContentKey != Guid.Empty; }
}
public int ContentId
{
get
{
int parsed;
if (int.TryParse(Value, out parsed))
{
return parsed;
}
return int.MinValue;
}
}
public Guid ContentKey
{
get
{
Guid parsed;
if (Guid.TryParse(Value, out parsed))
{
return parsed;
}
return Guid.Empty;
}
}
public string ContentXPath
{
get { return Value; }
}
@@ -1,8 +1,14 @@
namespace Umbraco.Core.Configuration.UmbracoSettings
using System;
namespace Umbraco.Core.Configuration.UmbracoSettings
{
public interface IContentErrorPage
{
int ContentId { get; }
Guid ContentKey { get; }
string ContentXPath { get; }
bool HasContentId { get; }
bool HasContentKey { get; }
string Culture { get; set; }
}
}
@@ -1,4 +1,6 @@
namespace Umbraco.Core.Configuration.UmbracoSettings
using System;
namespace Umbraco.Core.Configuration.UmbracoSettings
{
public interface ITemplatesSection : IUmbracoConfigurationSection
{
@@ -8,6 +10,7 @@
RenderingEngine DefaultRenderingEngine { get; }
[Obsolete("This has no affect and will be removed in future versions")]
bool EnableTemplateFolders { get; }
}
}
@@ -8,6 +8,8 @@
bool DisableAlternativeTemplates { get; }
bool DisableFindContentByIdPath { get; }
string UrlProviderMode { get; }
}
@@ -1,4 +1,5 @@
using System.Configuration;
using System;
using System.Configuration;
namespace Umbraco.Core.Configuration.UmbracoSettings
{
@@ -40,6 +41,7 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
}
}
[Obsolete("This has no affect and will be removed in future versions")]
[ConfigurationProperty("enableTemplateFolders")]
internal InnerTextConfigurationElement<bool> EnableTemplateFolders
{
@@ -67,6 +69,7 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
get { return DefaultRenderingEngine; }
}
[Obsolete("This has no affect and will be removed in future versions")]
bool ITemplatesSection.EnableTemplateFolders
{
get { return EnableTemplateFolders; }
@@ -21,6 +21,11 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
{
get { return (bool) base["disableAlternativeTemplates"]; }
}
[ConfigurationProperty("disableFindContentByIdPath", DefaultValue = "false")]
public bool DisableFindContentByIdPath
{
get { return (bool) base["disableFindContentByIdPath"]; }
}
[ConfigurationProperty("urlProviderMode", DefaultValue = "AutoLegacy")]
public string UrlProviderMode
@@ -5,7 +5,7 @@ namespace Umbraco.Core.Configuration
{
public class UmbracoVersion
{
private static readonly Version Version = new Version("7.2.3");
private static readonly Version Version = new Version("7.3.0");
/// <summary>
/// Gets the current version of Umbraco.
@@ -23,7 +23,7 @@ namespace Umbraco.Core.Configuration
/// Gets the version comment (like beta or RC).
/// </summary>
/// <value>The version comment.</value>
public static string CurrentComment { get { return ""; } }
public static string CurrentComment { get { return "beta"; } }
// Get the version of the umbraco.dll by looking at a class in that dll
// Had to do it like this due to medium trust issues, see: http://haacked.com/archive/2010/11/04/assembly-location-and-medium-trust.aspx
+4 -3
View File
@@ -78,12 +78,12 @@
/// </summary>
public const string Dictionary = "dictionary";
//TODO: Fill in the rest!
public const string Stylesheets = "stylesheets";
/// <summary>
/// alias for the media tree.
/// alias for the template tree.
/// </summary>
public const string Templates = "template";
public const string Templates = "templates";
public const string RelationTypes = "relationTypes";
@@ -91,6 +91,7 @@
public const string Languages = "languages";
//TODO: Fill in the rest!
}
}
+39 -19
View File
@@ -11,6 +11,25 @@ namespace Umbraco.Core
/// </summary>
public static class Conventions
{
public static class PublicAccess
{
public const string MemberUsernameRuleType = "MemberUsername";
public const string MemberRoleRuleType = "MemberRole";
[Obsolete("No longer supported, this is here for backwards compatibility only")]
public const string MemberIdRuleType = "MemberId";
[Obsolete("No longer supported, this is here for backwards compatibility only")]
public const string MemberGroupIdRuleType = "MemberGroupId";
}
public static class Localization
{
/// <summary>
/// The root id for all top level dictionary items
/// </summary>
public const string DictionaryItemRootId = "41c7638d-f529-4bff-853e-59a0c2fb1bde";
}
public static class DataTypes
{
public const string ListViewPrefix = "List View - ";
@@ -192,73 +211,64 @@ namespace Umbraco.Core
{
{
Comments,
new PropertyType(PropertyEditors.TextboxMultipleAlias, DataTypeDatabaseType.Ntext, true)
new PropertyType(PropertyEditors.TextboxMultipleAlias, DataTypeDatabaseType.Ntext, true, Comments)
{
Alias = Comments,
Name = CommentsLabel
}
},
{
FailedPasswordAttempts,
new PropertyType(PropertyEditors.NoEditAlias, DataTypeDatabaseType.Integer, true)
new PropertyType(PropertyEditors.NoEditAlias, DataTypeDatabaseType.Integer, true, FailedPasswordAttempts)
{
Alias = FailedPasswordAttempts,
Name = FailedPasswordAttemptsLabel
}
},
{
IsApproved,
new PropertyType(PropertyEditors.TrueFalseAlias, DataTypeDatabaseType.Integer, true)
new PropertyType(PropertyEditors.TrueFalseAlias, DataTypeDatabaseType.Integer, true, IsApproved)
{
Alias = IsApproved,
Name = IsApprovedLabel
}
},
{
IsLockedOut,
new PropertyType(PropertyEditors.TrueFalseAlias, DataTypeDatabaseType.Integer, true)
new PropertyType(PropertyEditors.TrueFalseAlias, DataTypeDatabaseType.Integer, true, IsLockedOut)
{
Alias = IsLockedOut,
Name = IsLockedOutLabel
}
},
{
LastLockoutDate,
new PropertyType(PropertyEditors.NoEditAlias, DataTypeDatabaseType.Date, true)
new PropertyType(PropertyEditors.NoEditAlias, DataTypeDatabaseType.Date, true, LastLockoutDate)
{
Alias = LastLockoutDate,
Name = LastLockoutDateLabel
}
},
{
LastLoginDate,
new PropertyType(PropertyEditors.NoEditAlias, DataTypeDatabaseType.Date, true)
new PropertyType(PropertyEditors.NoEditAlias, DataTypeDatabaseType.Date, true, LastLoginDate)
{
Alias = LastLoginDate,
Name = LastLoginDateLabel
}
},
{
LastPasswordChangeDate,
new PropertyType(PropertyEditors.NoEditAlias, DataTypeDatabaseType.Date, true)
new PropertyType(PropertyEditors.NoEditAlias, DataTypeDatabaseType.Date, true, LastPasswordChangeDate)
{
Alias = LastPasswordChangeDate,
Name = LastPasswordChangeDateLabel
}
},
{
PasswordAnswer,
new PropertyType(PropertyEditors.NoEditAlias, DataTypeDatabaseType.Nvarchar, true)
new PropertyType(PropertyEditors.NoEditAlias, DataTypeDatabaseType.Nvarchar, true, PasswordAnswer)
{
Alias = PasswordAnswer,
Name = PasswordAnswerLabel
}
},
{
PasswordQuestion,
new PropertyType(PropertyEditors.NoEditAlias, DataTypeDatabaseType.Nvarchar, true)
new PropertyType(PropertyEditors.NoEditAlias, DataTypeDatabaseType.Nvarchar, true, PasswordQuestion)
{
Alias = PasswordQuestion,
Name = PasswordQuestionLabel
}
}
@@ -293,7 +303,7 @@ namespace Umbraco.Core
}
/// <summary>
/// Defines the alias identifiers for Umbraco relation types.
/// Defines the alias identifiers for built-in Umbraco relation types.
/// </summary>
public static class RelationTypes
{
@@ -306,6 +316,16 @@ namespace Umbraco.Core
/// ContentType alias for default relation type "Relate Document On Copy".
/// </summary>
public const string RelateDocumentOnCopyAlias = "relateDocumentOnCopy";
/// <summary>
/// ContentType name for default relation type "Relate Parent Document On Delete".
/// </summary>
public const string RelateParentDocumentOnDeleteName = "Relate Parent Document On Delete";
/// <summary>
/// ContentType alias for default relation type "Relate Parent Document On Delete".
/// </summary>
public const string RelateParentDocumentOnDeleteAlias = "relateParentDocumentOnDelete";
}
}
}
+8 -2
View File
@@ -1,4 +1,6 @@
namespace Umbraco.Core
using System;
namespace Umbraco.Core
{
public static partial class Constants
{
@@ -70,7 +72,11 @@
/// <summary>
/// Guid for a Stylesheet object.
/// </summary>
public const string Stylesheet = "9F68DA4F-A3A8-44C2-8226-DCBD125E4840";
[Obsolete("This no longer exists in the database")]
public const string Stylesheet = "9F68DA4F-A3A8-44C2-8226-DCBD125E4840";
[Obsolete("This no longer exists in the database")]
internal const string StylesheetProperty = "5555da4f-a123-42b2-4488-dcdfb25e4111";
/// <summary>
/// Guid for the System Root.
+24
View File
@@ -18,5 +18,29 @@
public const string AuthCookieName = "UMB_UCONTEXT";
}
public static class Security
{
public const string BackOfficeAuthenticationType = "UmbracoBackOffice";
public const string BackOfficeExternalAuthenticationType = "UmbracoExternalCookie";
public const string BackOfficeExternalCookieName = "UMB_EXTLOGIN";
public const string BackOfficeTokenAuthenticationType = "UmbracoBackOfficeToken";
/// <summary>
/// The prefix used for external identity providers for their authentication type
/// </summary>
/// <remarks>
/// By default we don't want to interfere with front-end external providers and their default setup, for back office the
/// providers need to be setup differently and each auth type for the back office will be prefixed with this value
/// </remarks>
public const string BackOfficeExternalAuthenticationTypePrefix = "Umbraco.";
public const string StartContentNodeIdClaimType = "http://umbraco.org/2015/02/identity/claims/backoffice/startcontentnode";
public const string StartMediaNodeIdClaimType = "http://umbraco.org/2015/02/identity/claims/backoffice/startmedianode";
public const string AllowedApplicationsClaimType = "http://umbraco.org/2015/02/identity/claims/backoffice/allowedapp";
public const string SessionIdClaimType = "http://umbraco.org/2015/02/identity/claims/backoffice/sessionid";
}
}
}
+162 -116
View File
@@ -32,66 +32,90 @@ using MigrationsVersionFourNineZero = Umbraco.Core.Persistence.Migrations.Upgrad
namespace Umbraco.Core
{
/// <summary>
/// A bootstrapper for the Umbraco application which initializes all objects for the Core of the application
/// </summary>
/// <remarks>
/// This does not provide any startup functionality relating to web objects
/// </remarks>
public class CoreBootManager : IBootManager
{
private DisposableTimer _timer;
private bool _isInitialized = false;
private bool _isStarted = false;
private bool _isComplete = false;
/// A bootstrapper for the Umbraco application which initializes all objects for the Core of the application
/// </summary>
/// <remarks>
/// This does not provide any startup functionality relating to web objects
/// </remarks>
public class CoreBootManager : IBootManager
{
private ProfilingLogger _profilingLogger;
private DisposableTimer _timer;
private bool _isInitialized = false;
private bool _isStarted = false;
private bool _isComplete = false;
private readonly IServiceProvider _serviceProvider = new ActivatorServiceProvider();
private readonly UmbracoApplicationBase _umbracoApplication;
protected ApplicationContext ApplicationContext { get; set; }
protected ApplicationContext ApplicationContext { get; set; }
protected CacheHelper ApplicationCache { get; set; }
protected PluginManager PluginManager { get; private set; }
protected UmbracoApplicationBase UmbracoApplication
{
get { return _umbracoApplication; }
}
protected UmbracoApplicationBase UmbracoApplication
{
get { return _umbracoApplication; }
}
public CoreBootManager(UmbracoApplicationBase umbracoApplication)
{
protected IServiceProvider ServiceProvider
{
get { return _serviceProvider; }
}
public CoreBootManager(UmbracoApplicationBase umbracoApplication)
{
if (umbracoApplication == null) throw new ArgumentNullException("umbracoApplication");
_umbracoApplication = umbracoApplication;
}
public virtual IBootManager Initialize()
{
if (_isInitialized)
throw new InvalidOperationException("The boot manager has already been initialized");
public virtual IBootManager Initialize()
{
if (_isInitialized)
throw new InvalidOperationException("The boot manager has already been initialized");
InitializeProfilerResolver();
InitializeLoggerResolver();
InitializeProfilerResolver();
_timer = DisposableTimer.DebugDuration<CoreBootManager>("Umbraco application starting", "Umbraco application startup complete");
CreateApplicationCache();
_profilingLogger = new ProfilingLogger(LoggerResolver.Current.Logger, ProfilerResolver.Current.Profiler);
_timer = _profilingLogger.TraceDuration<CoreBootManager>("Umbraco application starting", "Umbraco application startup complete");
CreateApplicationCache();
//create and set the plugin manager (I'd much prefer to not use this singleton anymore but many things are using it unfortunately and
// the way that it is setup, there must only ever be one per app so without IoC it would be hard to make this not a singleton)
PluginManager = new PluginManager(ServiceProvider, ApplicationCache.RuntimeCache, _profilingLogger);
PluginManager.Current = PluginManager;
//Create the legacy prop-eds mapping
LegacyPropertyEditorIdToAliasConverter.CreateMappingsForCoreEditors();
LegacyParameterEditorAliasConverter.CreateMappingsForCoreEditors();
//create database and service contexts for the app context
var dbFactory = new DefaultDatabaseFactory(GlobalSettings.UmbracoConnectionName);
Database.Mapper = new PetaPocoMapper();
var dbContext = new DatabaseContext(dbFactory);
var serviceContext = new ServiceContext(
new PetaPocoUnitOfWorkProvider(dbFactory),
new FileUnitOfWorkProvider(),
new PublishingStrategy(),
ApplicationCache);
//create database and service contexts for the app context
var dbFactory = new DefaultDatabaseFactory(GlobalSettings.UmbracoConnectionName, LoggerResolver.Current.Logger);
Database.Mapper = new PetaPocoMapper();
var dbContext = new DatabaseContext(
dbFactory,
LoggerResolver.Current.Logger,
SqlSyntaxProviders.CreateDefault(LoggerResolver.Current.Logger));
//initialize the DatabaseContext
dbContext.Initialize();
var serviceContext = new ServiceContext(
new RepositoryFactory(ApplicationCache, LoggerResolver.Current.Logger, dbContext.SqlSyntax, UmbracoConfig.For.UmbracoSettings()),
new PetaPocoUnitOfWorkProvider(dbFactory),
new FileUnitOfWorkProvider(),
new PublishingStrategy(),
ApplicationCache,
LoggerResolver.Current.Logger);
CreateApplicationContext(dbContext, serviceContext);
InitializeApplicationEventsResolver();
InitializeResolvers();
InitializeResolvers();
//initialize the DatabaseContext
dbContext.Initialize();
InitializeModelMappers();
@@ -99,10 +123,10 @@ namespace Umbraco.Core
ApplicationEventsResolver.Current.ApplicationEventHandlers
.ForEach(x => x.OnApplicationInitialized(UmbracoApplication, ApplicationContext));
_isInitialized = true;
_isInitialized = true;
return this;
}
return this;
}
/// <summary>
/// Creates and assigns the application context singleton
@@ -112,7 +136,7 @@ namespace Umbraco.Core
protected virtual void CreateApplicationContext(DatabaseContext dbContext, ServiceContext serviceContext)
{
//create the ApplicationContext
ApplicationContext = ApplicationContext.Current = new ApplicationContext(dbContext, serviceContext, ApplicationCache);
ApplicationContext = ApplicationContext.Current = new ApplicationContext(dbContext, serviceContext, ApplicationCache, _profilingLogger);
}
/// <summary>
@@ -123,7 +147,7 @@ namespace Umbraco.Core
var cacheHelper = new CacheHelper(
new ObjectCacheRuntimeCacheProvider(),
new StaticCacheProvider(),
//we have no request based cache when not running in web-based context
//we have no request based cache when not running in web-based context
new NullCacheProvider());
ApplicationCache = cacheHelper;
@@ -147,18 +171,31 @@ namespace Umbraco.Core
});
}
/// <summary>
/// Special method to initialize the LoggerResolver
/// </summary>
protected virtual void InitializeLoggerResolver()
{
LoggerResolver.Current = new LoggerResolver(Logger.CreateWithDefaultLog4NetConfiguration())
{
//This is another special resolver that needs to be resolvable before resolution is frozen
//since it is used for profiling the application startup
CanResolveBeforeFrozen = true
};
}
/// <summary>
/// Special method to initialize the ProfilerResolver
/// </summary>
protected virtual void InitializeProfilerResolver()
{
//By default we'll initialize the Log profiler (in the web project, we'll override with the web profiler)
ProfilerResolver.Current = new ProfilerResolver(new LogProfiler())
{
//This is another special resolver that needs to be resolvable before resolution is frozen
//since it is used for profiling the application startup
CanResolveBeforeFrozen = true
};
ProfilerResolver.Current = new ProfilerResolver(new LogProfiler(LoggerResolver.Current.Logger))
{
//This is another special resolver that needs to be resolvable before resolution is frozen
//since it is used for profiling the application startup
CanResolveBeforeFrozen = true
};
}
/// <summary>
@@ -173,7 +210,9 @@ namespace Umbraco.Core
//ApplicationStartupHandler.RegisterHandlers();
//... and set the special flag to let us resolve before frozen resolution
ApplicationEventsResolver.Current = new ApplicationEventsResolver(
PluginManager.Current.ResolveApplicationStartupHandlers())
ServiceProvider,
LoggerResolver.Current.Logger,
PluginManager.ResolveApplicationStartupHandlers())
{
CanResolveBeforeFrozen = true
};
@@ -190,16 +229,16 @@ namespace Umbraco.Core
Umbraco.Core.IO.IOHelper.SetRootDirectory(rootPath);
}
/// <summary>
/// Fires after initialization and calls the callback to allow for customizations to occur &
/// <summary>
/// Fires after initialization and calls the callback to allow for customizations to occur &
/// Ensure that the OnApplicationStarting methods of the IApplicationEvents are called
/// </summary>
/// <param name="afterStartup"></param>
/// <returns></returns>
public virtual IBootManager Startup(Action<ApplicationContext> afterStartup)
{
if (_isStarted)
throw new InvalidOperationException("The boot manager has already been initialized");
/// </summary>
/// <param name="afterStartup"></param>
/// <returns></returns>
public virtual IBootManager Startup(Action<ApplicationContext> afterStartup)
{
if (_isStarted)
throw new InvalidOperationException("The boot manager has already been initialized");
//call OnApplicationStarting of each application events handler
ApplicationEventsResolver.Current.ApplicationEventHandlers
@@ -210,23 +249,23 @@ namespace Umbraco.Core
afterStartup(ApplicationContext.Current);
}
_isStarted = true;
_isStarted = true;
return this;
}
return this;
}
/// <summary>
/// Fires after startup and calls the callback once customizations are locked
/// </summary>
/// <param name="afterComplete"></param>
/// <returns></returns>
public virtual IBootManager Complete(Action<ApplicationContext> afterComplete)
{
if (_isComplete)
throw new InvalidOperationException("The boot manager has already been completed");
/// <summary>
/// Fires after startup and calls the callback once customizations are locked
/// </summary>
/// <param name="afterComplete"></param>
/// <returns></returns>
public virtual IBootManager Complete(Action<ApplicationContext> afterComplete)
{
if (_isComplete)
throw new InvalidOperationException("The boot manager has already been completed");
FreezeResolution();
FreezeResolution();
//call OnApplicationStarting of each application events handler
ApplicationEventsResolver.Current.ApplicationEventHandlers
.ForEach(x => x.OnApplicationStarted(UmbracoApplication, ApplicationContext));
@@ -239,15 +278,15 @@ namespace Umbraco.Core
afterComplete(ApplicationContext.Current);
}
_isComplete = true;
_isComplete = true;
// we're ready to serve content!
ApplicationContext.IsReady = true;
//stop the timer and log the output
_timer.Dispose();
return this;
}
return this;
}
/// <summary>
/// Freeze resolution to not allow Resolvers to be modified
@@ -256,21 +295,22 @@ namespace Umbraco.Core
{
Resolution.Freeze();
}
/// <summary>
/// Create the resolvers
/// </summary>
protected virtual void InitializeResolvers()
{
/// <summary>
/// Create the resolvers
/// </summary>
protected virtual void InitializeResolvers()
{
var builder = new ManifestBuilder(
ApplicationCache.RuntimeCache,
new ManifestParser(new DirectoryInfo(IOHelper.MapPath("~/App_Plugins")), ApplicationCache.RuntimeCache));
PropertyEditorResolver.Current = new PropertyEditorResolver(() => PluginManager.Current.ResolvePropertyEditors(), builder);
ParameterEditorResolver.Current = new ParameterEditorResolver(() => PluginManager.Current.ResolveParameterEditors(), builder);
PropertyEditorResolver.Current = new PropertyEditorResolver(ServiceProvider, LoggerResolver.Current.Logger, () => PluginManager.ResolvePropertyEditors(), builder);
ParameterEditorResolver.Current = new ParameterEditorResolver(ServiceProvider, LoggerResolver.Current.Logger, () => PluginManager.ResolveParameterEditors(), builder);
//setup the validators resolver with our predefined validators
ValidatorsResolver.Current = new ValidatorsResolver(new[]
ValidatorsResolver.Current = new ValidatorsResolver(
ServiceProvider, LoggerResolver.Current.Logger, new[]
{
new Lazy<Type>(() => typeof (RequiredManifestValueValidator)),
new Lazy<Type>(() => typeof (RegexValidator)),
@@ -281,63 +321,69 @@ namespace Umbraco.Core
//by default we'll use the standard configuration based sync
ServerRegistrarResolver.Current = new ServerRegistrarResolver(
new ConfigServerRegistrar());
new ConfigServerRegistrar());
//by default (outside of the web) we'll use the default server messenger without
//supplying a username/password, this will automatically disable distributed calls
// .. we'll override this in the WebBootManager
ServerMessengerResolver.Current = new ServerMessengerResolver(
new DefaultServerMessenger());
new WebServiceServerMessenger());
MappingResolver.Current = new MappingResolver(
() => PluginManager.Current.ResolveAssignedMapperTypes());
ServiceProvider, LoggerResolver.Current.Logger,
() => PluginManager.ResolveAssignedMapperTypes());
RepositoryResolver.Current = new RepositoryResolver(
new RepositoryFactory(ApplicationCache));
SqlSyntaxProvidersResolver.Current = new SqlSyntaxProvidersResolver(
new[] { typeof(MySqlSyntaxProvider), typeof(SqlCeSyntaxProvider), typeof(SqlServerSyntaxProvider) })
{
CanResolveBeforeFrozen = true
};
//RepositoryResolver.Current = new RepositoryResolver(
// new RepositoryFactory(ApplicationCache));
CacheRefreshersResolver.Current = new CacheRefreshersResolver(
() => PluginManager.Current.ResolveCacheRefreshers());
CacheRefreshersResolver.Current = new CacheRefreshersResolver(
ServiceProvider, LoggerResolver.Current.Logger,
() => PluginManager.ResolveCacheRefreshers());
DataTypesResolver.Current = new DataTypesResolver(
() => PluginManager.Current.ResolveDataTypes());
DataTypesResolver.Current = new DataTypesResolver(
ServiceProvider, LoggerResolver.Current.Logger,
() => PluginManager.ResolveDataTypes());
MacroFieldEditorsResolver.Current = new MacroFieldEditorsResolver(
() => PluginManager.Current.ResolveMacroRenderings());
MacroFieldEditorsResolver.Current = new MacroFieldEditorsResolver(
ServiceProvider, LoggerResolver.Current.Logger,
() => PluginManager.ResolveMacroRenderings());
PackageActionsResolver.Current = new PackageActionsResolver(
() => PluginManager.Current.ResolvePackageActions());
PackageActionsResolver.Current = new PackageActionsResolver(
ServiceProvider, LoggerResolver.Current.Logger,
() => PluginManager.ResolvePackageActions());
ActionsResolver.Current = new ActionsResolver(
() => PluginManager.Current.ResolveActions());
ActionsResolver.Current = new ActionsResolver(
ServiceProvider, LoggerResolver.Current.Logger,
() => PluginManager.ResolveActions());
//the database migration objects
MigrationResolver.Current = new MigrationResolver(
() => PluginManager.Current.ResolveTypes<IMigration>());
LoggerResolver.Current.Logger,
() => PluginManager.ResolveTypes<IMigration>());
// todo: remove once we drop IPropertyEditorValueConverter support.
PropertyEditorValueConvertersResolver.Current = new PropertyEditorValueConvertersResolver(
PluginManager.Current.ResolvePropertyEditorValueConverters());
ServiceProvider, LoggerResolver.Current.Logger,
PluginManager.ResolvePropertyEditorValueConverters());
// need to filter out the ones we dont want!!
PropertyValueConvertersResolver.Current = new PropertyValueConvertersResolver(
PluginManager.Current.ResolveTypes<IPropertyValueConverter>());
// need to filter out the ones we dont want!!
PropertyValueConvertersResolver.Current = new PropertyValueConvertersResolver(
ServiceProvider, LoggerResolver.Current.Logger,
PluginManager.ResolveTypes<IPropertyValueConverter>());
// use the new DefaultShortStringHelper
ShortStringHelperResolver.Current = new ShortStringHelperResolver(
//new LegacyShortStringHelper());
new DefaultShortStringHelper().WithDefaultConfig());
UrlSegmentProviderResolver.Current = new UrlSegmentProviderResolver(
typeof (DefaultUrlSegmentProvider));
UrlSegmentProviderResolver.Current = new UrlSegmentProviderResolver(
ServiceProvider, LoggerResolver.Current.Logger,
typeof(DefaultUrlSegmentProvider));
// by default, no factory is activated
PublishedContentModelFactoryResolver.Current = new PublishedContentModelFactoryResolver();
}
}
PublishedContentModelFactoryResolver.Current = new PublishedContentModelFactoryResolver();
}
}
}
+9 -6
View File
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using Umbraco.Core.Logging;
using Umbraco.Core.ObjectResolution;
using umbraco.interfaces;
@@ -11,12 +12,14 @@ namespace Umbraco.Core
[Obsolete("IDataType is obsolete and is no longer used, it will be removed from the codebase in future versions")]
internal sealed class DataTypesResolver : LegacyTransientObjectsResolver<DataTypesResolver, IDataType>
{
/// <summary>
/// Constructor
/// </summary>
/// <param name="dataTypes"></param>
internal DataTypesResolver(Func<IEnumerable<Type>> dataTypes)
: base(dataTypes)
/// <summary>
/// Constructor
/// </summary>
/// <param name="serviceProvider"></param>
/// <param name="logger"></param>
/// <param name="dataTypes"></param>
internal DataTypesResolver(IServiceProvider serviceProvider, ILogger logger, Func<IEnumerable<Type>> dataTypes)
: base(serviceProvider, logger, dataTypes)
{
}
+79 -24
View File
@@ -25,6 +25,8 @@ namespace Umbraco.Core
public class DatabaseContext
{
private readonly IDatabaseFactory _factory;
private readonly ILogger _logger;
private readonly SqlSyntaxProviders _syntaxProviders;
private bool _configured;
private bool _canConnect;
private volatile bool _connectCheck = false;
@@ -33,11 +35,53 @@ namespace Umbraco.Core
private string _providerName;
private DatabaseSchemaResult _result;
[Obsolete("Use the constructor specifying all dependencies instead")]
public DatabaseContext(IDatabaseFactory factory)
: this(factory, LoggerResolver.Current.Logger, new SqlSyntaxProviders(new ISqlSyntaxProvider[]
{
new MySqlSyntaxProvider(LoggerResolver.Current.Logger),
new SqlCeSyntaxProvider(),
new SqlServerSyntaxProvider()
}))
{
_factory = factory;
}
/// <summary>
/// Default constructor
/// </summary>
/// <param name="factory"></param>
/// <param name="logger"></param>
/// <param name="syntaxProviders"></param>
public DatabaseContext(IDatabaseFactory factory, ILogger logger, SqlSyntaxProviders syntaxProviders)
{
if (factory == null) throw new ArgumentNullException("factory");
if (logger == null) throw new ArgumentNullException("logger");
if (syntaxProviders == null) throw new ArgumentNullException("syntaxProviders");
_factory = factory;
_logger = logger;
_syntaxProviders = syntaxProviders;
}
/// <summary>
/// Create a configured DatabaseContext
/// </summary>
/// <param name="factory"></param>
/// <param name="logger"></param>
/// <param name="sqlSyntax"></param>
/// <param name="providerName"></param>
public DatabaseContext(IDatabaseFactory factory, ILogger logger, ISqlSyntaxProvider sqlSyntax, string providerName)
{
_providerName = providerName;
SqlSyntax = sqlSyntax;
SqlSyntaxContext.SqlSyntaxProvider = SqlSyntax;
_factory = factory;
_logger = logger;
_configured = true;
}
public ISqlSyntaxProvider SqlSyntax { get; private set; }
/// <summary>
/// Gets the <see cref="Database"/> object for doing CRUD operations
/// against custom tables that resides in the Umbraco database.
@@ -324,7 +368,7 @@ namespace Umbraco.Core
xml.Save(fileName, SaveOptions.DisableFormatting);
LogHelper.Info<DatabaseContext>("Configured a new ConnectionString using the '" + providerName + "' provider.");
_logger.Info<DatabaseContext>("Configured a new ConnectionString using the '" + providerName + "' provider.");
}
/// <summary>
@@ -398,12 +442,23 @@ namespace Umbraco.Core
internal void Initialize(string providerName)
{
//only configure once!
if (_configured == true) return;
_providerName = providerName;
try
{
SqlSyntaxContext.SqlSyntaxProvider =
SqlSyntaxProvidersResolver.Current.GetByProviderNameOrDefault(providerName);
if (_syntaxProviders != null)
{
SqlSyntax = _syntaxProviders.GetByProviderNameOrDefault(providerName);
}
else if (SqlSyntax == null)
{
throw new InvalidOperationException("No " + typeof(ISqlSyntaxProvider) + " specified or no " + typeof(SqlSyntaxProviders) + " instance specified");
}
SqlSyntaxContext.SqlSyntaxProvider = SqlSyntax;
_configured = true;
}
@@ -411,8 +466,8 @@ namespace Umbraco.Core
{
_configured = false;
LogHelper.Info<DatabaseContext>("Initialization of the DatabaseContext failed with following error: " + e.Message);
LogHelper.Info<DatabaseContext>(e.StackTrace);
_logger.Info<DatabaseContext>("Initialization of the DatabaseContext failed with following error: " + e.Message);
_logger.Info<DatabaseContext>(e.StackTrace);
}
}
@@ -427,8 +482,8 @@ namespace Umbraco.Core
/// </summary>
private void DetermineSqlServerVersion()
{
var sqlServerSyntax = SqlSyntaxContext.SqlSyntaxProvider as SqlServerSyntaxProvider;
var sqlServerSyntax = SqlSyntax as SqlServerSyntaxProvider;
if (sqlServerSyntax != null)
{
//this will not execute now, it is lazy so will only execute when we need to actually know
@@ -479,8 +534,8 @@ namespace Umbraco.Core
throw new InvalidOperationException("Cannot use MySql in Medium Trust configuration");
}
var database = new UmbracoDatabase(_connectionString, ProviderName);
var dbSchema = new DatabaseSchemaCreation(database);
var database = new UmbracoDatabase(_connectionString, ProviderName, _logger);
var dbSchema = new DatabaseSchemaCreation(database, _logger, SqlSyntax);
_result = dbSchema.ValidateSchema();
}
return _result;
@@ -496,17 +551,17 @@ namespace Umbraco.Core
return readyForInstall.Result;
}
LogHelper.Info<DatabaseContext>("Database configuration status: Started");
_logger.Info<DatabaseContext>("Database configuration status: Started");
string message;
var database = new UmbracoDatabase(_connectionString, ProviderName);
var database = new UmbracoDatabase(_connectionString, ProviderName, _logger);
// If MySQL, we're going to ensure that database calls are maintaining proper casing as to remove the necessity for checks
// for case insensitive queries. In an ideal situation (which is what we're striving for), all calls would be case sensitive.
/*
var supportsCaseInsensitiveQueries = SqlSyntaxContext.SqlSyntaxProvider.SupportsCaseInsensitiveQueries(database);
var supportsCaseInsensitiveQueries = SqlSyntax.SupportsCaseInsensitiveQueries(database);
if (supportsCaseInsensitiveQueries == false)
{
message = "<p>&nbsp;</p><p>The database you're trying to use does not support case insensitive queries. <br />We currently do not support these types of databases.</p>" +
@@ -532,12 +587,12 @@ namespace Umbraco.Core
message = message + "<p>Installation completed!</p>";
//now that everything is done, we need to determine the version of SQL server that is executing
LogHelper.Info<DatabaseContext>("Database configuration status: " + message);
_logger.Info<DatabaseContext>("Database configuration status: " + message);
return new Result { Message = message, Success = true, Percentage = "100" };
}
//we need to do an upgrade so return a new status message and it will need to be done during the next step
LogHelper.Info<DatabaseContext>("Database requires upgrade");
_logger.Info<DatabaseContext>("Database requires upgrade");
message = "<p>Upgrading database, this may take some time...</p>";
return new Result
{
@@ -568,10 +623,10 @@ namespace Umbraco.Core
return readyForInstall.Result;
}
LogHelper.Info<DatabaseContext>("Database upgrade started");
_logger.Info<DatabaseContext>("Database upgrade started");
var database = new UmbracoDatabase(_connectionString, ProviderName);
//var supportsCaseInsensitiveQueries = SqlSyntaxContext.SqlSyntaxProvider.SupportsCaseInsensitiveQueries(database);
var database = new UmbracoDatabase(_connectionString, ProviderName, _logger);
//var supportsCaseInsensitiveQueries = SqlSyntax.SupportsCaseInsensitiveQueries(database);
var message = GetResultMessageForMySql();
@@ -584,13 +639,13 @@ namespace Umbraco.Core
? installedVersion
: new Version(GlobalSettings.ConfigurationStatus);
var targetVersion = UmbracoVersion.Current;
var runner = new MigrationRunner(currentVersion, targetVersion, GlobalSettings.UmbracoMigrationName);
var runner = new MigrationRunner(_logger, currentVersion, targetVersion, GlobalSettings.UmbracoMigrationName);
var upgraded = runner.Execute(database, true);
message = message + "<p>Upgrade completed!</p>";
//now that everything is done, we need to determine the version of SQL server that is executing
LogHelper.Info<DatabaseContext>("Database configuration status: " + message);
_logger.Info<DatabaseContext>("Database configuration status: " + message);
return new Result { Message = message, Success = true, Percentage = "100" };
}
@@ -602,7 +657,7 @@ namespace Umbraco.Core
private string GetResultMessageForMySql()
{
if (SqlSyntaxContext.SqlSyntaxProvider.GetType() == typeof(MySqlSyntaxProvider))
if (SqlSyntax.GetType() == typeof(MySqlSyntaxProvider))
{
return "<p>&nbsp;</p><p>Congratulations, the database step ran successfully!</p>" +
"<p>Note: You're using MySQL and the database instance you're connecting to seems to support case insensitive queries.</p>" +
@@ -628,7 +683,7 @@ namespace Umbraco.Core
"<p>For more technical information on case sensitivity in MySQL, have a look at " +
"<a href='http://dev.mysql.com/doc/refman/5.0/en/identifier-case-sensitivity.html'>the documentation on the subject</a></p>";
}
if (SqlSyntaxContext.SqlSyntaxProvider.GetType() == typeof(MySqlSyntaxProvider))
if (SqlSyntax.GetType() == typeof(MySqlSyntaxProvider))
{
return "<p>&nbsp;</p><p>Congratulations, the database step ran successfully!</p>" +
"<p>Note: You're using MySQL and the database instance you're connecting to seems to support case insensitive queries.</p>" +
@@ -665,11 +720,11 @@ namespace Umbraco.Core
private Result HandleInstallException(Exception ex)
{
LogHelper.Error<DatabaseContext>("Database configuration failed", ex);
_logger.Error<DatabaseContext>("Database configuration failed", ex);
if (_result != null)
{
LogHelper.Info<DatabaseContext>("The database schema validation produced the following summary: \n" + _result.GetSummary());
_logger.Info<DatabaseContext>("The database schema validation produced the following summary: \n" + _result.GetSummary());
}
return new Result
@@ -1,3 +1,5 @@
using System;
using System.ComponentModel;
using Umbraco.Core.ObjectResolution;
namespace Umbraco.Core.Dictionary
@@ -12,15 +14,22 @@ namespace Umbraco.Core.Dictionary
{
}
/// <summary>
/// Can be used by developers at runtime to set their ICultureDictionaryFactory at app startup
/// </summary>
/// <param name="factory"></param>
[Obsolete("Use SetDictionaryFactory instead")]
[EditorBrowsable(EditorBrowsableState.Never)]
public void SetContentStore(ICultureDictionaryFactory factory)
{
Value = factory;
}
/// <summary>
/// Can be used by developers at runtime to set their ICultureDictionaryFactory at app startup
/// </summary>
/// <param name="factory"></param>
public void SetDictionaryFactory(ICultureDictionaryFactory factory)
{
Value = factory;
}
/// <summary>
/// Returns the ICultureDictionaryFactory
/// </summary>
@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Globalization;
namespace Umbraco.Core.Dictionary
@@ -19,5 +20,12 @@ namespace Umbraco.Core.Dictionary
/// Returns the current culture
/// </summary>
CultureInfo Culture { get; }
/// <summary>
/// Returns the child dictionary entries for a given key
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
IDictionary<string, string> GetChildren(string key);
}
}
-15
View File
@@ -5,7 +5,6 @@ using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.Web.Mvc;
using System.Web;
namespace Umbraco.Core
@@ -135,20 +134,6 @@ namespace Umbraco.Core
return n;
}
/// <summary>
/// Converts a dictionary to a FormCollection
/// </summary>
/// <param name="d"></param>
/// <returns></returns>
public static FormCollection ToFormCollection(this IDictionary<string, object> d)
{
var n = new FormCollection();
foreach (var i in d)
{
n.Add(i.Key, Convert.ToString(i.Value));
}
return n;
}
/// <summary>
/// Merges all key/values from the sources dictionaries into the destination dictionary
+111 -94
View File
@@ -1,4 +1,5 @@
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Web;
using Umbraco.Core.Logging;
@@ -9,32 +10,65 @@ namespace Umbraco.Core
/// <summary>
/// Starts the timer and invokes a callback upon disposal. Provides a simple way of timing an operation by wrapping it in a <code>using</code> (C#) statement.
/// </summary>
/// <example>
/// <code>
///
/// using (DisposableTimer.TraceDuration{MyType}("starting", "finished"))
/// {
/// Thread.Sleep(567);
/// }
///
/// Console.WriteLine("Testing Stopwatchdisposable, should be 567:");
/// using (var timer = new DisposableTimer(result => Console.WriteLine("Took {0}ms", result)))
/// {
/// Thread.Sleep(567);
/// }
/// </code>
/// </example>
public class DisposableTimer : DisposableObject
{
private readonly Stopwatch _stopwatch = Stopwatch.StartNew();
private readonly Stopwatch _stopwatch = Stopwatch.StartNew();
private readonly Action<long> _callback;
protected DisposableTimer(Action<long> callback)
{
_callback = callback;
}
internal enum LogType
{
Debug, Info
}
public Stopwatch Stopwatch
internal DisposableTimer(ILogger logger, LogType logType, IProfiler profiler, Type loggerType, string startMessage, string endMessage)
{
if (logger == null) throw new ArgumentNullException("logger");
if (loggerType == null) throw new ArgumentNullException("loggerType");
_callback = x =>
{
if (profiler != null)
{
profiler.DisposeIfDisposable();
}
switch (logType)
{
case LogType.Debug:
logger.Debug(loggerType, () => endMessage + " (took " + x + "ms)");
break;
case LogType.Info:
logger.Info(loggerType, () => endMessage + " (took " + x + "ms)");
break;
default:
throw new ArgumentOutOfRangeException("logType");
}
};
switch (logType)
{
case LogType.Debug:
logger.Debug(loggerType, startMessage);
break;
case LogType.Info:
logger.Info(loggerType, startMessage);
break;
default:
throw new ArgumentOutOfRangeException("logType");
}
if (profiler != null)
{
profiler.Step(loggerType, startMessage);
}
}
protected internal DisposableTimer(Action<long> callback)
{
if (callback == null) throw new ArgumentNullException("callback");
_callback = callback;
}
public Stopwatch Stopwatch
{
get { return _stopwatch; }
}
@@ -51,25 +85,25 @@ namespace Umbraco.Core
}
#region TraceDuration
[EditorBrowsable(EditorBrowsableState.Never)]
[Obsolete("Use the other methods that specify strings instead of Func")]
public static DisposableTimer TraceDuration<T>(Func<string> startMessage, Func<string> completeMessage)
{
return TraceDuration(typeof(T), startMessage, completeMessage);
}
[EditorBrowsable(EditorBrowsableState.Never)]
[Obsolete("Use the other methods that specify strings instead of Func")]
public static DisposableTimer TraceDuration(Type loggerType, Func<string> startMessage, Func<string> completeMessage)
{
var startMsg = startMessage();
LogHelper.Info(loggerType, startMsg);
if (HttpContext.Current != null)
HttpContext.Current.Trace.Write("Start: " + startMsg);
var profiler = ActivateProfiler(loggerType, startMsg);
return new DisposableTimer(x =>
{
profiler.DisposeIfDisposable();
LogHelper.Info(loggerType, () => completeMessage() + " (took " + x + "ms)");
if (HttpContext.Current != null)
HttpContext.Current.Trace.Write("End: " + startMsg);
});
return new DisposableTimer(
LoggerResolver.Current.Logger,
LogType.Info,
ProfilerResolver.HasCurrent ? ProfilerResolver.Current.Profiler : null,
loggerType,
startMessage(),
completeMessage());
}
/// <summary>
@@ -79,11 +113,19 @@ namespace Umbraco.Core
/// <param name="startMessage"></param>
/// <param name="completeMessage"></param>
/// <returns></returns>
[Obsolete("Use the Umbraco.Core.Logging.ProfilingLogger to create instances of DisposableTimer")]
public static DisposableTimer TraceDuration<T>(string startMessage, string completeMessage)
{
return TraceDuration(typeof(T), startMessage, completeMessage);
}
/// <summary>
/// Adds a start and end log entry as Info and tracks how long it takes until disposed.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="startMessage"></param>
/// <returns></returns>
[Obsolete("Use the Umbraco.Core.Logging.ProfilingLogger to create instances of DisposableTimer")]
public static DisposableTimer TraceDuration<T>(string startMessage)
{
return TraceDuration(typeof(T), startMessage, "Complete");
@@ -96,20 +138,18 @@ namespace Umbraco.Core
/// <param name="startMessage"></param>
/// <param name="completeMessage"></param>
/// <returns></returns>
[Obsolete("Use the Umbraco.Core.Logging.ProfilingLogger to create instances of DisposableTimer")]
public static DisposableTimer TraceDuration(Type loggerType, string startMessage, string completeMessage)
{
LogHelper.Info(loggerType, startMessage);
if (HttpContext.Current != null)
HttpContext.Current.Trace.Write("Start: " + startMessage);
var profiler = ActivateProfiler(loggerType, startMessage);
return new DisposableTimer(x =>
{
profiler.DisposeIfDisposable();
LogHelper.Info(loggerType, () => completeMessage + " (took " + x + "ms)");
if (HttpContext.Current != null)
HttpContext.Current.Trace.Write("End: " + startMessage);
});
}
return new DisposableTimer(
LoggerResolver.Current.Logger,
LogType.Info,
ProfilerResolver.HasCurrent ? ProfilerResolver.Current.Profiler : null,
loggerType,
startMessage,
completeMessage);
}
#endregion
#region DebugDuration
@@ -120,23 +160,26 @@ namespace Umbraco.Core
/// <param name="startMessage"></param>
/// <param name="completeMessage"></param>
/// <returns></returns>
[Obsolete("Use the Umbraco.Core.Logging.ProfilingLogger to create instances of DisposableTimer")]
public static DisposableTimer DebugDuration<T>(string startMessage, string completeMessage)
{
return DebugDuration(typeof(T), startMessage, completeMessage);
}
public static DisposableTimer DebugDuration<T>(string startMessage)
{
return DebugDuration(typeof(T), startMessage, "Complete");
}
/// <summary>
/// Adds a start and end log entry as Debug and tracks how long it takes until disposed.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="startMessage"></param>
/// <param name="completeMessage"></param>
/// <returns></returns>
[Obsolete("Use the Umbraco.Core.Logging.ProfilingLogger to create instances of DisposableTimer")]
public static DisposableTimer DebugDuration<T>(string startMessage)
{
return DebugDuration(typeof(T), startMessage, "Complete");
}
[EditorBrowsable(EditorBrowsableState.Never)]
[Obsolete("Use the other methods that specify strings instead of Func")]
public static DisposableTimer DebugDuration<T>(Func<string> startMessage, Func<string> completeMessage)
{
return DebugDuration(typeof(T), startMessage, completeMessage);
@@ -149,42 +192,29 @@ namespace Umbraco.Core
/// <param name="startMessage"></param>
/// <param name="completeMessage"></param>
/// <returns></returns>
[Obsolete("Use the Umbraco.Core.Logging.ProfilingLogger to create instances of DisposableTimer")]
public static DisposableTimer DebugDuration(Type loggerType, string startMessage, string completeMessage)
{
LogHelper.Debug(loggerType, startMessage);
if (HttpContext.Current != null)
HttpContext.Current.Trace.Write("Start: " + startMessage);
var profiler = ActivateProfiler(loggerType, startMessage);
return new DisposableTimer(x =>
{
profiler.DisposeIfDisposable();
LogHelper.Debug(loggerType, () => completeMessage + " (took " + x + "ms)");
if (HttpContext.Current != null)
HttpContext.Current.Trace.Write("End: " + startMessage);
});
return new DisposableTimer(
LoggerResolver.Current.Logger,
LogType.Debug,
ProfilerResolver.HasCurrent ? ProfilerResolver.Current.Profiler : null,
loggerType,
startMessage,
completeMessage);
}
/// <summary>
/// Adds a start and end log entry as Debug and tracks how long it takes until disposed.
/// </summary>
/// <param name="loggerType"></param>
/// <param name="startMessage"></param>
/// <param name="completeMessage"></param>
/// <returns></returns>
[EditorBrowsable(EditorBrowsableState.Never)]
[Obsolete("Use the other methods that specify strings instead of Func")]
public static DisposableTimer DebugDuration(Type loggerType, Func<string> startMessage, Func<string> completeMessage)
{
var msg = startMessage();
LogHelper.Debug(loggerType, msg);
if (HttpContext.Current != null)
HttpContext.Current.Trace.Write("Start: " + startMessage);
var profiler = ActivateProfiler(loggerType, msg);
return new DisposableTimer(x =>
{
profiler.DisposeIfDisposable();
LogHelper.Debug(loggerType, () => completeMessage() + " (took " + x + "ms)");
if (HttpContext.Current != null)
HttpContext.Current.Trace.Write("End: " + startMessage);
});
return new DisposableTimer(
LoggerResolver.Current.Logger,
LogType.Debug,
ProfilerResolver.HasCurrent ? ProfilerResolver.Current.Profiler : null,
loggerType,
startMessage(),
completeMessage());
}
#endregion
@@ -196,18 +226,5 @@ namespace Umbraco.Core
_callback.Invoke(Stopwatch.ElapsedMilliseconds);
}
private static IDisposable ActivateProfiler(Type loggerType, string profileName)
{
try
{
return ProfilerResolver.Current.Profiler.Step(loggerType, profileName);
}
catch (InvalidOperationException)
{
//swallow this exception, it will occur if the ProfilerResolver is not initialized... generally only in
// unit tests.
}
return null;
}
}
}
+45
View File
@@ -0,0 +1,45 @@
using System.Web;
namespace Umbraco.Core
{
public static class HttpContextExtensions
{
public static string GetCurrentRequestIpAddress(this HttpContextBase httpContext)
{
if (httpContext == null)
{
return "Unknown, httpContext is null";
}
if (httpContext.Request == null)
{
return "Unknown, httpContext.Request is null";
}
if (httpContext.Request.ServerVariables == null)
{
return "Unknown, httpContext.Request.ServerVariables is null";
}
// From: http://stackoverflow.com/a/740431/5018
try
{
var ipAddress = httpContext.Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
if (string.IsNullOrEmpty(ipAddress))
return httpContext.Request.ServerVariables["REMOTE_ADDR"];
var addresses = ipAddress.Split(',');
if (addresses.Length != 0)
return addresses[0];
return httpContext.Request.ServerVariables["REMOTE_ADDR"];
}
catch (System.Exception ex)
{
//This try catch is to just always ensure that no matter what we're not getting any exceptions caused since
// that would cause people to not be able to login
return string.Format("Unknown, exception occurred trying to resolve IP {0}", ex);
}
}
}
}
+2 -2
View File
@@ -56,11 +56,11 @@ namespace Umbraco.Core.IO
{
if (UmbracoConfig.For.UmbracoSettings().Content.ResolveUrlsFromTextString)
{
using (var timer = DisposableTimer.DebugDuration(typeof(IOHelper), "ResolveUrlsFromTextString starting", "ResolveUrlsFromTextString complete"))
using (DisposableTimer.DebugDuration(typeof(IOHelper), "ResolveUrlsFromTextString starting", "ResolveUrlsFromTextString complete"))
{
// find all relative urls (ie. urls that contain ~)
var tags = ResolveUrlPattern.Matches(text);
LogHelper.Debug(typeof(IOHelper), "After regex: " + timer.Stopwatch.ElapsedMilliseconds + " matched: " + tags.Count);
foreach (Match tag in tags)
{
string url = "";
+450
View File
@@ -0,0 +1,450 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using Umbraco.Core.Models;
using Umbraco.Core.Persistence.Repositories;
using Umbraco.Core.Services;
namespace Umbraco.Core.IO
{
internal class MasterPageHelper
{
private readonly IFileSystem _masterPageFileSystem;
internal static readonly string DefaultMasterTemplate = SystemDirectories.Umbraco + "/masterpages/default.master";
//private static readonly char[] NewLineChars = Environment.NewLine.ToCharArray();
public MasterPageHelper(IFileSystem masterPageFileSystem)
{
if (masterPageFileSystem == null) throw new ArgumentNullException("masterPageFileSystem");
_masterPageFileSystem = masterPageFileSystem;
}
public bool MasterPageExists(ITemplate t)
{
return _masterPageFileSystem.FileExists(GetFilePath(t));
}
[Obsolete("This is only used for legacy purposes and will be removed in future versions")]
internal string GetPhysicalFilePath(ITemplate t)
{
return _masterPageFileSystem.GetFullPath(GetFilePath(t.Alias));
}
private string GetFilePath(ITemplate t)
{
return GetFilePath(t.Alias);
}
private string GetFilePath(string alias)
{
return alias + ".master";
}
public string CreateMasterPage(ITemplate t, ITemplateRepository templateRepo, bool overWrite = false)
{
string masterpageContent = "";
var filePath = GetFilePath(t);
if (_masterPageFileSystem.FileExists(filePath) == false || overWrite)
{
masterpageContent = t.Content.IsNullOrWhiteSpace() ? CreateDefaultMasterPageContent(t, templateRepo) : t.Content;
var data = Encoding.UTF8.GetBytes(masterpageContent);
var withBom = Encoding.UTF8.GetPreamble().Concat(data).ToArray();
using (var ms = new MemoryStream(withBom))
{
_masterPageFileSystem.AddFile(filePath, ms, true);
}
}
else
{
using (var s = _masterPageFileSystem.OpenFile(filePath))
using (var tr = new StreamReader(s, Encoding.UTF8))
{
masterpageContent = tr.ReadToEnd();
tr.Close();
}
}
return masterpageContent;
}
//internal string GetFileContents(ITemplate t)
//{
// var masterpageContent = "";
// if (_masterPageFileSystem.FileExists(GetFilePath(t)))
// {
// using (var s = _masterPageFileSystem.OpenFile(GetFilePath(t)))
// using (var tr = new StreamReader(s))
// {
// masterpageContent = tr.ReadToEnd();
// tr.Close();
// }
// }
// return masterpageContent;
//}
public string UpdateMasterPageFile(ITemplate t, string currentAlias, ITemplateRepository templateRepo)
{
var template = UpdateMasterPageContent(t, currentAlias);
UpdateChildTemplates(t, currentAlias, templateRepo);
var filePath = GetFilePath(t);
var data = Encoding.UTF8.GetBytes(template);
var withBom = Encoding.UTF8.GetPreamble().Concat(data).ToArray();
using (var ms = new MemoryStream(withBom))
{
_masterPageFileSystem.AddFile(filePath, ms, true);
}
return template;
}
private string CreateDefaultMasterPageContent(ITemplate template, ITemplateRepository templateRepo)
{
var design = new StringBuilder();
design.Append(GetMasterPageHeader(template) + Environment.NewLine);
if (template.MasterTemplateAlias.IsNullOrWhiteSpace() == false)
{
var master = templateRepo.Get(template.MasterTemplateAlias);
if (master != null)
{
foreach (var cpId in GetContentPlaceholderIds(master))
{
design.Append("<asp:content ContentPlaceHolderId=\"" + cpId + "\" runat=\"server\">" +
Environment.NewLine +
Environment.NewLine +
"</asp:content>" +
Environment.NewLine +
Environment.NewLine);
}
return design.ToString();
}
}
design.Append(GetMasterContentElement(template) + Environment.NewLine);
design.Append(template.Content + Environment.NewLine);
design.Append("</asp:Content>" + Environment.NewLine);
return design.ToString();
}
public static IEnumerable<string> GetContentPlaceholderIds(ITemplate template)
{
var retVal = new List<string>();
var mp = template.Content;
var path = "<asp:ContentPlaceHolder+(\\s+[a-zA-Z]+\\s*=\\s*(\"([^\"]*)\"|'([^']*)'))*\\s*/?>";
var r = new Regex(path, RegexOptions.IgnoreCase);
var m = r.Match(mp);
while (m.Success)
{
var cc = m.Groups[3].Captures;
retVal.AddRange(cc.Cast<Capture>().Where(c => c.Value != "server").Select(c => c.Value));
m = m.NextMatch();
}
return retVal;
}
private static string UpdateMasterPageContent(ITemplate template, string currentAlias)
{
var masterPageContent = template.Content;
if (string.IsNullOrEmpty(currentAlias) == false && currentAlias != template.Alias)
{
var masterHeader =
masterPageContent.Substring(0, masterPageContent.IndexOf("%>", StringComparison.Ordinal) + 2).Trim(
Environment.NewLine.ToCharArray());
// find the masterpagefile attribute
var m = Regex.Matches(masterHeader, "(?<attributeName>\\S*)=\"(?<attributeValue>[^\"]*)\"",
RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace);
foreach (Match attributeSet in m)
{
if (attributeSet.Groups["attributeName"].Value.ToLower() == "masterpagefile")
{
// validate the masterpagefile
var currentMasterPageFile = attributeSet.Groups["attributeValue"].Value;
var currentMasterTemplateFile = ParentTemplatePath(template);
if (currentMasterPageFile != currentMasterTemplateFile)
{
masterPageContent =
masterPageContent.Replace(
attributeSet.Groups["attributeName"].Value + "=\"" + currentMasterPageFile + "\"",
attributeSet.Groups["attributeName"].Value + "=\"" + currentMasterTemplateFile +
"\"");
}
}
}
}
return masterPageContent;
}
private void UpdateChildTemplates(ITemplate template, string currentAlias, ITemplateRepository templateRepo)
{
//if we have a Old Alias if the alias and therefor the masterpage file name has changed...
//so before we save the new masterfile, we'll clear the old one, so we don't up with
//Unused masterpage files
if (string.IsNullOrEmpty(currentAlias) == false && currentAlias != template.Alias)
{
//Ensure that child templates have the right master masterpage file name
if (template.IsMasterTemplate)
{
var children = templateRepo.GetChildren(template.Id);
foreach (var t in children)
UpdateMasterPageFile(t, null, templateRepo);
}
}
}
//private void SaveDesignToFile(ITemplate t, string currentAlias, string design)
//{
// //kill the old file..
// if (string.IsNullOrEmpty(currentAlias) == false && currentAlias != t.Alias)
// {
// var oldFile =
// IOHelper.MapPath(SystemDirectories.Masterpages + "/" + currentAlias.Replace(" ", "") + ".master");
// if (System.IO.File.Exists(oldFile))
// System.IO.File.Delete(oldFile);
// }
// // save the file in UTF-8
// System.IO.File.WriteAllText(GetFilePath(t), design, Encoding.UTF8);
//}
//internal static void RemoveMasterPageFile(string alias)
//{
// if (string.IsNullOrWhiteSpace(alias) == false)
// {
// string file = IOHelper.MapPath(SystemDirectories.Masterpages + "/" + alias.Replace(" ", "") + ".master");
// if (System.IO.File.Exists(file))
// System.IO.File.Delete(file);
// }
//}
//internal string SaveTemplateToFile(ITemplate template, string currentAlias, ITemplateRepository templateRepo)
//{
// var masterPageContent = template.Content;
// if (IsMasterPageSyntax(masterPageContent) == false)
// masterPageContent = ConvertToMasterPageSyntax(template);
// // Add header to master page if it doesn't exist
// if (masterPageContent.TrimStart().StartsWith("<%@") == false)
// {
// masterPageContent = GetMasterPageHeader(template) + Environment.NewLine + masterPageContent;
// }
// else
// {
// // verify that the masterpage attribute is the same as the masterpage
// var masterHeader =
// masterPageContent.Substring(0, masterPageContent.IndexOf("%>", StringComparison.Ordinal) + 2).Trim(NewLineChars);
// // find the masterpagefile attribute
// var m = Regex.Matches(masterHeader, "(?<attributeName>\\S*)=\"(?<attributeValue>[^\"]*)\"",
// RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace);
// foreach (Match attributeSet in m)
// {
// if (attributeSet.Groups["attributeName"].Value.ToLower() == "masterpagefile")
// {
// // validate the masterpagefile
// var currentMasterPageFile = attributeSet.Groups["attributeValue"].Value;
// var currentMasterTemplateFile = ParentTemplatePath(template);
// if (currentMasterPageFile != currentMasterTemplateFile)
// {
// masterPageContent =
// masterPageContent.Replace(
// attributeSet.Groups["attributeName"].Value + "=\"" + currentMasterPageFile + "\"",
// attributeSet.Groups["attributeName"].Value + "=\"" + currentMasterTemplateFile +
// "\"");
// }
// }
// }
// }
// //we have a Old Alias if the alias and therefor the masterpage file name has changed...
// //so before we save the new masterfile, we'll clear the old one, so we don't up with
// //Unused masterpage files
// if (string.IsNullOrEmpty(currentAlias) == false && currentAlias != template.Alias)
// {
// //Ensure that child templates have the right master masterpage file name
// if (template.IsMasterTemplate)
// {
// var children = templateRepo.GetChildren(template.Id);
// foreach (var t in children)
// UpdateMasterPageFile(t, null, templateRepo);
// }
// //then kill the old file..
// var oldFile = GetFilePath(currentAlias);
// if (_masterPageFileSystem.FileExists(oldFile))
// _masterPageFileSystem.DeleteFile(oldFile);
// }
// // save the file in UTF-8
// System.IO.File.WriteAllText(GetFilePath(template), masterPageContent, Encoding.UTF8);
// return masterPageContent;
//}
//internal static string ConvertToMasterPageSyntax(ITemplate template)
//{
// string masterPageContent = GetMasterContentElement(template) + Environment.NewLine;
// masterPageContent += template.Content;
// // Parse the design for getitems
// masterPageContent = EnsureMasterPageSyntax(template.Alias, masterPageContent);
// // append ending asp:content element
// masterPageContent += Environment.NewLine + "</asp:Content>" + Environment.NewLine;
// return masterPageContent;
//}
public static bool IsMasterPageSyntax(string code)
{
return Regex.IsMatch(code, @"<%@\s*Master", RegexOptions.IgnoreCase) ||
code.InvariantContains("<umbraco:Item") || code.InvariantContains("<asp:") || code.InvariantContains("<umbraco:Macro");
}
private static string GetMasterPageHeader(ITemplate template)
{
return String.Format("<%@ Master Language=\"C#\" MasterPageFile=\"{0}\" AutoEventWireup=\"true\" %>", ParentTemplatePath(template)) + Environment.NewLine;
}
private static string ParentTemplatePath(ITemplate template)
{
var masterTemplate = DefaultMasterTemplate;
if (template.MasterTemplateAlias.IsNullOrWhiteSpace() == false)
masterTemplate = SystemDirectories.Masterpages + "/" + template.MasterTemplateAlias + ".master";
return masterTemplate;
}
private static string GetMasterContentElement(ITemplate template)
{
if (template.MasterTemplateAlias.IsNullOrWhiteSpace() == false)
{
string masterAlias = template.MasterTemplateAlias;
return
String.Format("<asp:Content ContentPlaceHolderID=\"{0}ContentPlaceHolder\" runat=\"server\">", masterAlias);
}
else
return
String.Format("<asp:Content ContentPlaceHolderID=\"ContentPlaceHolderDefault\" runat=\"server\">");
}
//internal static string EnsureMasterPageSyntax(string templateAlias, string masterPageContent)
//{
// ReplaceElement(ref masterPageContent, "?UMBRACO_GETITEM", "umbraco:Item", true);
// ReplaceElement(ref masterPageContent, "?UMBRACO_GETITEM", "umbraco:Item", false);
// // Parse the design for macros
// ReplaceElement(ref masterPageContent, "?UMBRACO_MACRO", "umbraco:Macro", true);
// ReplaceElement(ref masterPageContent, "?UMBRACO_MACRO", "umbraco:Macro", false);
// // Parse the design for load childs
// masterPageContent = masterPageContent.Replace("<?UMBRACO_TEMPLATE_LOAD_CHILD/>", CreateDefaultPlaceHolder(templateAlias))
// .Replace("<?UMBRACO_TEMPLATE_LOAD_CHILD />", CreateDefaultPlaceHolder(templateAlias));
// // Parse the design for aspnet forms
// GetAspNetMasterPageForm(ref masterPageContent, templateAlias);
// masterPageContent = masterPageContent.Replace("</?ASPNET_FORM>", "</form>");
// // Parse the design for aspnet heads
// masterPageContent = masterPageContent.Replace("</ASPNET_HEAD>", String.Format("<head id=\"{0}Head\" runat=\"server\">", templateAlias.Replace(" ", "")));
// masterPageContent = masterPageContent.Replace("</?ASPNET_HEAD>", "</head>");
// return masterPageContent;
//}
//private static void GetAspNetMasterPageForm(ref string design, string templateAlias)
//{
// var formElement = Regex.Match(design, GetElementRegExp("?ASPNET_FORM", false), RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace);
// if (string.IsNullOrEmpty(formElement.Value) == false)
// {
// string formReplace = String.Format("<form id=\"{0}Form\" runat=\"server\">", templateAlias.Replace(" ", ""));
// if (formElement.Groups.Count == 0)
// {
// formReplace += "<asp:scriptmanager runat=\"server\"></asp:scriptmanager>";
// }
// design = design.Replace(formElement.Value, formReplace);
// }
//}
//private static string CreateDefaultPlaceHolder(string templateAlias)
//{
// return String.Format("<asp:ContentPlaceHolder ID=\"{0}ContentPlaceHolder\" runat=\"server\"></asp:ContentPlaceHolder>", templateAlias.Replace(" ", ""));
//}
//private static void ReplaceElement(ref string design, string elementName, string newElementName, bool checkForQuotes)
//{
// var m =
// Regex.Matches(design, GetElementRegExp(elementName, checkForQuotes),
// RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace);
// foreach (Match match in m)
// {
// GroupCollection groups = match.Groups;
// // generate new element (compensate for a closing trail on single elements ("/"))
// string elementAttributes = groups[1].Value;
// // test for macro alias
// if (elementName == "?UMBRACO_MACRO")
// {
// var tags = XmlHelper.GetAttributesFromElement(match.Value);
// if (tags["macroAlias"] != null)
// elementAttributes = String.Format(" Alias=\"{0}\"", tags["macroAlias"]) + elementAttributes;
// else if (tags["macroalias"] != null)
// elementAttributes = String.Format(" Alias=\"{0}\"", tags["macroalias"]) + elementAttributes;
// }
// string newElement = "<" + newElementName + " runat=\"server\" " + elementAttributes.Trim() + ">";
// if (elementAttributes.EndsWith("/"))
// {
// elementAttributes = elementAttributes.Substring(0, elementAttributes.Length - 1);
// }
// else if (groups[0].Value.StartsWith("</"))
// // It's a closing element, so generate that instead of a starting element
// newElement = "</" + newElementName + ">";
// if (checkForQuotes)
// {
// // if it's inside quotes, we'll change element attribute quotes to single quotes
// newElement = newElement.Replace("\"", "'");
// newElement = String.Format("\"{0}\"", newElement);
// }
// design = design.Replace(match.Value, newElement);
// }
//}
//private static string GetElementRegExp(string elementName, bool checkForQuotes)
//{
// if (checkForQuotes)
// return String.Format("\"<[^>\\s]*\\b{0}(\\b[^>]*)>\"", elementName);
// else
// return String.Format("<[^>\\s]*\\b{0}(\\b[^>]*)>", elementName);
//}
}
}
+2 -2
View File
@@ -15,7 +15,7 @@ namespace Umbraco.Core.IO
public PhysicalFileSystem(string virtualRoot)
{
if (virtualRoot == null) throw new ArgumentNullException("virtualRoot");
if (!virtualRoot.StartsWith("~/"))
if (virtualRoot.StartsWith("~/") == false)
throw new ArgumentException("The virtualRoot argument must be a virtual path and start with '~/'");
RootPath = IOHelper.MapPath(virtualRoot);
@@ -65,7 +65,7 @@ namespace Umbraco.Core.IO
public void DeleteDirectory(string path, bool recursive)
{
if (!DirectoryExists(path))
if (DirectoryExists(path) == false)
return;
try
+1 -1
View File
@@ -11,7 +11,7 @@ namespace Umbraco.Core.IO
{
public class SystemFiles
{
[Obsolete("This file is no longer used and should not be accessed!")]
public static string AccessXml
{
get
+149
View File
@@ -0,0 +1,149 @@
using System;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using Umbraco.Core.Models;
namespace Umbraco.Core.IO
{
internal class ViewHelper
{
private readonly IFileSystem _viewFileSystem;
public ViewHelper(IFileSystem viewFileSystem)
{
if (viewFileSystem == null) throw new ArgumentNullException("viewFileSystem");
_viewFileSystem = viewFileSystem;
}
internal bool ViewExists(ITemplate t)
{
return _viewFileSystem.FileExists(ViewPath(t.Alias));
}
[Obsolete("This is only used for legacy purposes and will be removed in future versions")]
internal string GetPhysicalFilePath(ITemplate t)
{
return _viewFileSystem.GetFullPath(ViewPath(t.Alias));
}
internal string GetFileContents(ITemplate t)
{
string viewContent = "";
string path = ViewPath(t.Alias);
if (_viewFileSystem.FileExists(path))
{
using (var tr = new StreamReader(_viewFileSystem.OpenFile(path)))
{
viewContent = tr.ReadToEnd();
tr.Close();
}
}
return viewContent;
}
public string CreateView(ITemplate t, bool overWrite = false)
{
string viewContent;
string path = ViewPath(t.Alias);
if (_viewFileSystem.FileExists(path) == false || overWrite)
{
viewContent = SaveTemplateToFile(t);
}
else
{
using (var tr = new StreamReader(_viewFileSystem.OpenFile(path)))
{
viewContent = tr.ReadToEnd();
tr.Close();
}
}
return viewContent;
}
internal static string GetDefaultFileContent(string layoutPageAlias = null)
{
var design = @"@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@{
Layout = null;
}";
if (layoutPageAlias.IsNullOrWhiteSpace() == false)
design = design.Replace("null", string.Format("\"{0}.cshtml\"", layoutPageAlias));
return design;
}
private string SaveTemplateToFile(ITemplate template)
{
var design = template.Content.IsNullOrWhiteSpace() ? EnsureInheritedLayout(template) : template.Content;
var path = ViewPath(template.Alias);
var data = Encoding.UTF8.GetBytes(design);
var withBom = Encoding.UTF8.GetPreamble().Concat(data).ToArray();
using (var ms = new MemoryStream(withBom))
{
_viewFileSystem.AddFile(path, ms, true);
}
return design;
}
public string UpdateViewFile(ITemplate t, string currentAlias = null)
{
var path = ViewPath(t.Alias);
if (string.IsNullOrEmpty(currentAlias) == false && currentAlias != t.Alias)
{
//then kill the old file..
var oldFile = ViewPath(currentAlias);
if (_viewFileSystem.FileExists(oldFile))
_viewFileSystem.DeleteFile(oldFile);
}
var data = Encoding.UTF8.GetBytes(t.Content);
var withBom = Encoding.UTF8.GetPreamble().Concat(data).ToArray();
using (var ms = new MemoryStream(withBom))
{
_viewFileSystem.AddFile(path, ms, true);
}
return t.Content;
}
internal void RemoveViewFile(string alias)
{
if (string.IsNullOrWhiteSpace(alias) == false)
{
var file = ViewPath(alias);
if (_viewFileSystem.FileExists(file))
_viewFileSystem.DeleteFile(file);
}
}
public string ViewPath(string alias)
{
return _viewFileSystem.GetRelativePath(alias.Replace(" ", "") + ".cshtml");
//return SystemDirectories.MvcViews + "/" + alias.Replace(" ", "") + ".cshtml";
}
private string EnsureInheritedLayout(ITemplate template)
{
string design = template.Content;
if (string.IsNullOrEmpty(design))
{
design = GetDefaultFileContent(template.MasterTemplateAlias);
}
return design;
}
}
}
@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web;
namespace Umbraco.Core.Logging
{
/// <summary>
/// Allows for outputting a normalized appdomainappid token in a log format
/// </summary>
public sealed class AppDomainTokenConverter : log4net.Util.PatternConverter
{
protected override void Convert(TextWriter writer, object state)
{
writer.Write(HttpRuntime.AppDomainAppId.ReplaceNonAlphanumericChars(string.Empty));
}
}
}
@@ -0,0 +1,43 @@
using System;
using System.Linq;
namespace Umbraco.Core.Logging
{
internal class DebugDiagnosticsLogger : ILogger
{
public void Error(Type callingType, string message, Exception exception)
{
System.Diagnostics.Debug.WriteLine(message + Environment.NewLine + exception, callingType.ToString());
}
public void Warn(Type callingType, string message, params Func<object>[] formatItems)
{
System.Diagnostics.Debug.WriteLine(string.Format(message, formatItems.Select(x => x()).ToArray()), callingType.ToString());
}
public void WarnWithException(Type callingType, string message, Exception e, params Func<object>[] formatItems)
{
System.Diagnostics.Debug.WriteLine(string.Format(message + Environment.NewLine + e, formatItems.Select(x => x()).ToArray()), callingType.ToString());
}
public void Info(Type callingType, Func<string> generateMessage)
{
System.Diagnostics.Debug.WriteLine(generateMessage(), callingType.ToString());
}
public void Info(Type type, string generateMessageFormat, params Func<object>[] formatItems)
{
System.Diagnostics.Debug.WriteLine(string.Format(generateMessageFormat, formatItems.Select(x => x()).ToArray()), type.ToString());
}
public void Debug(Type callingType, Func<string> generateMessage)
{
System.Diagnostics.Debug.WriteLine(generateMessage(), callingType.ToString());
}
public void Debug(Type type, string generateMessageFormat, params Func<object>[] formatItems)
{
System.Diagnostics.Debug.WriteLine(string.Format(generateMessageFormat, formatItems.Select(x => x()).ToArray()), type.ToString());
}
}
}
+24
View File
@@ -0,0 +1,24 @@
using System;
namespace Umbraco.Core.Logging
{
/// <summary>
/// Interface for logging service.
/// </summary>
public interface ILogger
{
void Error(Type callingType, string message, Exception exception);
void Warn(Type callingType, string message, params Func<object>[] formatItems);
void WarnWithException(Type callingType, string message, Exception e, params Func<object>[] formatItems);
void Info(Type callingType, Func<string> generateMessage);
void Info(Type type, string generateMessageFormat, params Func<object>[] formatItems);
void Debug(Type callingType, Func<string> generateMessage);
void Debug(Type type, string generateMessageFormat, params Func<object>[] formatItems);
}
}
+30 -63
View File
@@ -6,43 +6,14 @@ using log4net;
namespace Umbraco.Core.Logging
{
///<summary>
/// Used for logging
///<summary>
/// Used for logging, ILogger should be used instead but this is available for static access to logging
///</summary>
/// <remarks>
/// this wraps ILogger
/// </remarks>
public static class LogHelper
{
///<summary>
/// Returns a logger for the type specified
///</summary>
///<typeparam name="T"></typeparam>
///<returns></returns>
internal static ILog LoggerFor<T>()
{
return LogManager.GetLogger(typeof(T));
}
/// <summary>
/// Returns a logger for the object's type
/// </summary>
/// <param name="getTypeFromInstance"></param>
/// <returns></returns>
internal static ILog LoggerFor(object getTypeFromInstance)
{
if (getTypeFromInstance == null) throw new ArgumentNullException("getTypeFromInstance");
return LogManager.GetLogger(getTypeFromInstance.GetType());
}
/// <summary>
/// Useful if the logger itself is running on another thread
/// </summary>
/// <param name="generateMessageFormat"></param>
/// <returns></returns>
private static string PrefixThreadId(string generateMessageFormat)
{
return "[Thread " + Thread.CurrentThread.ManagedThreadId + "] " + generateMessageFormat;
}
#region Error
/// <summary>
/// Adds an error log
@@ -52,14 +23,14 @@ namespace Umbraco.Core.Logging
/// <param name="exception"></param>
public static void Error<T>(string message, Exception exception)
{
Error(typeof (T), message, exception);
if (LoggerResolver.HasCurrent == false || LoggerResolver.Current.HasValue == false) return;
LoggerResolver.Current.Logger.Error<T>(message, exception);
}
public static void Error(Type callingType, string message, Exception exception)
{
var logger = LogManager.GetLogger(callingType);
if (logger != null)
logger.Error(PrefixThreadId(message), exception);
if (LoggerResolver.HasCurrent == false || LoggerResolver.Current.HasValue == false) return;
LoggerResolver.Current.Logger.Error(callingType, message, exception);
}
#endregion
@@ -68,11 +39,11 @@ namespace Umbraco.Core.Logging
public static void Warn(Type callingType, string message, params Func<object>[] formatItems)
{
var logger = LogManager.GetLogger(callingType);
if (logger == null || !logger.IsWarnEnabled) return;
logger.WarnFormat(PrefixThreadId(message), formatItems.Select(x => x.Invoke()).ToArray());
if (LoggerResolver.HasCurrent == false || LoggerResolver.Current.HasValue == false) return;
LoggerResolver.Current.Logger.Warn(callingType, message, formatItems);
}
[Obsolete("Warnings with http trace should not be used. This method will be removed in future versions")]
public static void Warn(Type callingType, string message, bool showHttpTrace, params Func<object>[] formatItems)
{
Mandate.ParameterNotNull(callingType, "callingType");
@@ -81,11 +52,10 @@ namespace Umbraco.Core.Logging
if (showHttpTrace && HttpContext.Current != null)
{
HttpContext.Current.Trace.Warn(callingType.Name, string.Format(message, formatItems.Select(x => x.Invoke()).ToArray()));
}
}
var logger = LogManager.GetLogger(callingType);
if (logger == null || !logger.IsWarnEnabled) return;
logger.WarnFormat(PrefixThreadId(message), formatItems.Select(x => x.Invoke()).ToArray());
if (LoggerResolver.HasCurrent == false || LoggerResolver.Current.HasValue == false) return;
LoggerResolver.Current.Logger.Warn(callingType, message, formatItems);
}
@@ -94,6 +64,7 @@ namespace Umbraco.Core.Logging
WarnWithException(callingType, message, false, e, formatItems);
}
[Obsolete("Warnings with http trace should not be used. This method will be removed in future versions")]
public static void WarnWithException(Type callingType, string message, bool showHttpTrace, Exception e, params Func<object>[] formatItems)
{
Mandate.ParameterNotNull(e, "e");
@@ -108,10 +79,8 @@ namespace Umbraco.Core.Logging
e);
}
var logger = LogManager.GetLogger(callingType);
if (logger == null || !logger.IsWarnEnabled) return;
var executedParams = formatItems.Select(x => x.Invoke()).ToArray();
logger.WarnFormat(PrefixThreadId(message) + ". Exception: " + e, executedParams);
if (LoggerResolver.HasCurrent == false || LoggerResolver.Current.HasValue == false) return;
LoggerResolver.Current.Logger.WarnWithException(callingType, message, e, formatItems);
}
/// <summary>
@@ -125,6 +94,7 @@ namespace Umbraco.Core.Logging
Warn(typeof(T), message, formatItems);
}
[Obsolete("Warnings with http trace should not be used. This method will be removed in future versions")]
public static void Warn<T>(string message, bool showHttpTrace, params Func<object>[] formatItems)
{
Warn(typeof(T), message, showHttpTrace, formatItems);
@@ -134,6 +104,8 @@ namespace Umbraco.Core.Logging
{
WarnWithException(typeof(T), message, e, formatItems);
}
[Obsolete("Warnings with http trace should not be used. This method will be removed in future versions")]
public static void WarnWithException<T>(string message, bool showHttpTrace, Exception e, params Func<object>[] formatItems)
{
WarnWithException(typeof(T), message, showHttpTrace, e, formatItems);
@@ -160,9 +132,8 @@ namespace Umbraco.Core.Logging
/// <param name="generateMessage"></param>
public static void Info(Type callingType, Func<string> generateMessage)
{
var logger = LogManager.GetLogger(callingType);
if (logger == null || !logger.IsInfoEnabled) return;
logger.Info(PrefixThreadId(generateMessage.Invoke()));
if (LoggerResolver.HasCurrent == false || LoggerResolver.Current.HasValue == false) return;
LoggerResolver.Current.Logger.Info(callingType, generateMessage);
}
/// <summary>
@@ -173,10 +144,8 @@ namespace Umbraco.Core.Logging
/// <param name="formatItems">The format items.</param>
public static void Info(Type type, string generateMessageFormat, params Func<object>[] formatItems)
{
var logger = LogManager.GetLogger(type);
if (logger == null || !logger.IsInfoEnabled) return;
var executedParams = formatItems.Select(x => x.Invoke()).ToArray();
logger.InfoFormat(PrefixThreadId(generateMessageFormat), executedParams);
if (LoggerResolver.HasCurrent == false || LoggerResolver.Current.HasValue == false) return;
LoggerResolver.Current.Logger.Info(type, generateMessageFormat, formatItems);
}
/// <summary>
@@ -211,9 +180,8 @@ namespace Umbraco.Core.Logging
/// <param name="generateMessage"></param>
public static void Debug(Type callingType, Func<string> generateMessage)
{
var logger = LogManager.GetLogger(callingType);
if (logger == null || !logger.IsDebugEnabled) return;
logger.Debug(PrefixThreadId(generateMessage.Invoke()));
if (LoggerResolver.HasCurrent == false || LoggerResolver.Current.HasValue == false) return;
LoggerResolver.Current.Logger.Debug(callingType, generateMessage);
}
/// <summary>
@@ -224,10 +192,8 @@ namespace Umbraco.Core.Logging
/// <param name="formatItems">The format items.</param>
public static void Debug(Type type, string generateMessageFormat, params Func<object>[] formatItems)
{
var logger = LogManager.GetLogger(type);
if (logger == null || !logger.IsDebugEnabled) return;
var executedParams = formatItems.Select(x => x.Invoke()).ToArray();
logger.DebugFormat(PrefixThreadId(generateMessageFormat), executedParams);
if (LoggerResolver.HasCurrent == false || LoggerResolver.Current.HasValue == false) return;
LoggerResolver.Current.Logger.Debug(type, generateMessageFormat, formatItems);
}
/// <summary>
@@ -250,6 +216,7 @@ namespace Umbraco.Core.Logging
/// <param name="generateMessageFormat"></param>
/// <param name="showHttpTrace"></param>
/// <param name="formatItems"></param>
[Obsolete("Warnings with http trace should not be used. This method will be removed in future versions")]
public static void Debug<T>(string generateMessageFormat, bool showHttpTrace, params Func<object>[] formatItems)
{
if (showHttpTrace && HttpContext.Current != null)
+166
View File
@@ -0,0 +1,166 @@
using System;
using System.IO;
using System.Linq;
using System.Threading;
using System.Web;
using log4net;
using log4net.Config;
namespace Umbraco.Core.Logging
{
///<summary>
/// Used for logging
///</summary>
public class Logger : ILogger
{
public Logger(FileInfo log4NetConfigFile)
{
XmlConfigurator.Configure(log4NetConfigFile);
}
private Logger()
{
}
/// <summary>
/// Creates a logger with the default log4net configuration discovered (i.e. from the web.config)
/// </summary>
/// <returns></returns>
public static Logger CreateWithDefaultLog4NetConfiguration()
{
return new Logger();
}
///<summary>
/// Returns a logger for the type specified
///</summary>
///<typeparam name="T"></typeparam>
///<returns></returns>
internal ILog LoggerFor<T>()
{
return LogManager.GetLogger(typeof(T));
}
/// <summary>
/// Returns a logger for the object's type
/// </summary>
/// <param name="getTypeFromInstance"></param>
/// <returns></returns>
internal ILog LoggerFor(object getTypeFromInstance)
{
if (getTypeFromInstance == null) throw new ArgumentNullException("getTypeFromInstance");
return LogManager.GetLogger(getTypeFromInstance.GetType());
}
/// <summary>
/// Useful if the logger itself is running on another thread
/// </summary>
/// <param name="generateMessageFormat"></param>
/// <returns></returns>
private string PrefixThreadId(string generateMessageFormat)
{
return "[Thread " + Thread.CurrentThread.ManagedThreadId + "] " + generateMessageFormat;
}
public void Error(Type callingType, string message, Exception exception)
{
var logger = LogManager.GetLogger(callingType);
if (logger != null)
logger.Error(PrefixThreadId(message), exception);
}
public void Warn(Type callingType, string message, params Func<object>[] formatItems)
{
var logger = LogManager.GetLogger(callingType);
if (logger == null || logger.IsWarnEnabled == false) return;
logger.WarnFormat(PrefixThreadId(message), formatItems.Select(x => x.Invoke()).ToArray());
}
public void Warn(Type callingType, string message, bool showHttpTrace, params Func<object>[] formatItems)
{
Mandate.ParameterNotNull(callingType, "callingType");
Mandate.ParameterNotNullOrEmpty(message, "message");
if (showHttpTrace && HttpContext.Current != null)
{
HttpContext.Current.Trace.Warn(callingType.Name, string.Format(message, formatItems.Select(x => x.Invoke()).ToArray()));
}
var logger = LogManager.GetLogger(callingType);
if (logger == null || logger.IsWarnEnabled == false) return;
logger.WarnFormat(PrefixThreadId(message), formatItems.Select(x => x.Invoke()).ToArray());
}
public void WarnWithException(Type callingType, string message, Exception e, params Func<object>[] formatItems)
{
Mandate.ParameterNotNull(e, "e");
Mandate.ParameterNotNull(callingType, "callingType");
Mandate.ParameterNotNullOrEmpty(message, "message");
var logger = LogManager.GetLogger(callingType);
if (logger == null || logger.IsWarnEnabled == false) return;
var executedParams = formatItems.Select(x => x.Invoke()).ToArray();
logger.WarnFormat(PrefixThreadId(message) + ". Exception: " + e, executedParams);
}
/// <summary>
/// Traces if tracing is enabled.
/// </summary>
/// <param name="callingType"></param>
/// <param name="generateMessage"></param>
public void Info(Type callingType, Func<string> generateMessage)
{
var logger = LogManager.GetLogger(callingType);
if (logger == null || logger.IsInfoEnabled == false) return;
logger.Info(PrefixThreadId(generateMessage.Invoke()));
}
/// <summary>
/// Traces if tracing is enabled.
/// </summary>
/// <param name="type">The type for the logging namespace.</param>
/// <param name="generateMessageFormat">The message format.</param>
/// <param name="formatItems">The format items.</param>
public void Info(Type type, string generateMessageFormat, params Func<object>[] formatItems)
{
var logger = LogManager.GetLogger(type);
if (logger == null || logger.IsInfoEnabled == false) return;
var executedParams = formatItems.Select(x => x.Invoke()).ToArray();
logger.InfoFormat(PrefixThreadId(generateMessageFormat), executedParams);
}
/// <summary>
/// Debugs if tracing is enabled.
/// </summary>
/// <param name="callingType"></param>
/// <param name="generateMessage"></param>
public void Debug(Type callingType, Func<string> generateMessage)
{
var logger = LogManager.GetLogger(callingType);
if (logger == null || logger.IsDebugEnabled == false) return;
logger.Debug(PrefixThreadId(generateMessage.Invoke()));
}
/// <summary>
/// Debugs if tracing is enabled.
/// </summary>
/// <param name="type">The type for the logging namespace.</param>
/// <param name="generateMessageFormat">The message format.</param>
/// <param name="formatItems">The format items.</param>
public void Debug(Type type, string generateMessageFormat, params Func<object>[] formatItems)
{
var logger = LogManager.GetLogger(type);
if (logger == null || logger.IsDebugEnabled == false) return;
var executedParams = formatItems.Select(x => x.Invoke()).ToArray();
logger.DebugFormat(PrefixThreadId(generateMessageFormat), executedParams);
}
}
}
@@ -0,0 +1,90 @@
using System;
namespace Umbraco.Core.Logging
{
/// <summary>
/// Allows for strongly typed log sources
/// </summary>
public static class LoggerExtensions
{
/// <summary>
/// Adds an error log
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="logger"></param>
/// <param name="message"></param>
/// <param name="exception"></param>
public static void Error<T>(this ILogger logger, string message, Exception exception)
{
logger.Error(typeof(T), message, exception);
}
/// <summary>
/// Adds a warn log
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="logger"></param>
/// <param name="message"></param>
/// <param name="formatItems"></param>
public static void Warn<T>(this ILogger logger, string message, params Func<object>[] formatItems)
{
logger.Warn(typeof(T), message, formatItems);
}
public static void WarnWithException<T>(this ILogger logger, string message, Exception e, params Func<object>[] formatItems)
{
logger.WarnWithException(typeof(T), message, e, formatItems);
}
/// <summary>
/// Traces a message, only generating the message if tracing is actually enabled. Use this method to avoid calling any long-running methods such as "ToDebugString" if logging is disabled.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="logger"></param>
/// <param name="generateMessageFormat">The generate message format.</param>
/// <param name="formatItems">The format items.</param>
/// <remarks></remarks>
public static void Info<T>(this ILogger logger, string generateMessageFormat, params Func<object>[] formatItems)
{
logger.Info(typeof(T), generateMessageFormat, formatItems);
}
/// <summary>
/// Traces a message, only generating the message if tracing is actually enabled. Use this method to avoid calling any long-running methods such as "ToDebugString" if logging is disabled.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="logger"></param>
/// <param name="generateMessage">The delegate to generate a message.</param>
/// <remarks></remarks>
public static void Info<T>(this ILogger logger, Func<string> generateMessage)
{
logger.Info(typeof(T), generateMessage);
}
/// <summary>
/// Debugs a message, only generating the message if tracing is actually enabled. Use this method to avoid calling any long-running methods such as "ToDebugString" if logging is disabled.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="logger"></param>
/// <param name="generateMessage">The delegate to generate a message.</param>
/// <remarks></remarks>
public static void Debug<T>(this ILogger logger, Func<string> generateMessage)
{
logger.Debug(typeof(T), generateMessage);
}
/// <summary>
/// Debugs a message, only generating the message if debug is actually enabled. Use this method to avoid calling any long-running methods such as "ToDebugString" if logging is disabled.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="logger"></param>
/// <param name="generateMessageFormat">The generate message format.</param>
/// <param name="formatItems">The format items.</param>
/// <remarks></remarks>
public static void Debug<T>(this ILogger logger, string generateMessageFormat, params Func<object>[] formatItems)
{
logger.Debug(typeof(T), generateMessageFormat, formatItems);
}
}
}
@@ -0,0 +1,31 @@
using Umbraco.Core.ObjectResolution;
namespace Umbraco.Core.Logging
{
public sealed class LoggerResolver : SingleObjectResolverBase<LoggerResolver, ILogger>
{
public LoggerResolver(ILogger logger)
: base(logger)
{
}
/// <summary>
/// Method allowing to change the logger during startup
/// </summary>
/// <param name="profiler"></param>
internal void SetLogger(ILogger profiler)
{
Value = profiler;
}
/// <summary>
/// Gets the current logger
/// </summary>
public ILogger Logger
{
get { return Value; }
}
}
}
+63
View File
@@ -0,0 +1,63 @@
using System;
using System.Diagnostics;
namespace Umbraco.Core.Logging
{
internal class OwinLogger : Microsoft.Owin.Logging.ILogger
{
private readonly ILogger _logger;
private readonly Lazy<Type> _type;
public OwinLogger(ILogger logger, Lazy<Type> type)
{
_logger = logger;
_type = type;
}
/// <summary>
/// Aggregates most logging patterns to a single method. This must be compatible with the Func representation in the OWIN environment.
/// To check IsEnabled call WriteCore with only TraceEventType and check the return value, no event will be written.
/// </summary>
/// <param name="eventType"/><param name="eventId"/><param name="state"/><param name="exception"/><param name="formatter"/>
/// <returns/>
public bool WriteCore(TraceEventType eventType, int eventId, object state, Exception exception, Func<object, Exception, string> formatter)
{
if (state == null) state = "";
switch (eventType)
{
case TraceEventType.Critical:
_logger.Error(_type.Value, string.Format("Event Id: {0}, state: {1}", eventId, state), exception ?? new Exception("Critical error"));
return true;
case TraceEventType.Error:
_logger.Error(_type.Value, string.Format("Event Id: {0}, state: {1}", eventId, state), exception ?? new Exception("Error"));
return true;
case TraceEventType.Warning:
_logger.Warn(_type.Value, string.Format("Event Id: {0}, state: {1}", eventId, state));
return true;
case TraceEventType.Information:
_logger.Info(_type.Value, string.Format("Event Id: {0}, state: {1}", eventId, state));
return true;
case TraceEventType.Verbose:
_logger.Debug(_type.Value, string.Format("Event Id: {0}, state: {1}", eventId, state));
return true;
case TraceEventType.Start:
_logger.Debug(_type.Value, string.Format("Event Id: {0}, state: {1}", eventId, state));
return true;
case TraceEventType.Stop:
_logger.Debug(_type.Value, string.Format("Event Id: {0}, state: {1}", eventId, state));
return true;
case TraceEventType.Suspend:
_logger.Debug(_type.Value, string.Format("Event Id: {0}, state: {1}", eventId, state));
return true;
case TraceEventType.Resume:
_logger.Debug(_type.Value, string.Format("Event Id: {0}, state: {1}", eventId, state));
return true;
case TraceEventType.Transfer:
_logger.Debug(_type.Value, string.Format("Event Id: {0}, state: {1}", eventId, state));
return true;
default:
throw new ArgumentOutOfRangeException("eventType");
}
}
}
}
@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Owin.Logging;
namespace Umbraco.Core.Logging
{
internal class OwinLoggerFactory : ILoggerFactory
{
/// <summary>
/// Creates a new ILogger instance of the given name.
/// </summary>
/// <param name="name"/>
/// <returns/>
public Microsoft.Owin.Logging.ILogger Create(string name)
{
return new OwinLogger(
LoggerResolver.HasCurrent ? LoggerResolver.Current.Logger : new DebugDiagnosticsLogger(),
new Lazy<Type>(() => Type.GetType(name) ?? typeof (OwinLogger)));
}
}
}
@@ -0,0 +1,52 @@
using System;
using Umbraco.Core.Profiling;
namespace Umbraco.Core.Logging
{
/// <summary>
/// Used to create DisposableTimer instances for debugging or tracing durations
/// </summary>
public sealed class ProfilingLogger
{
public ILogger Logger { get; private set; }
public IProfiler Profiler { get; private set; }
public ProfilingLogger(ILogger logger, IProfiler profiler)
{
Logger = logger;
Profiler = profiler;
if (logger == null) throw new ArgumentNullException("logger");
if (profiler == null) throw new ArgumentNullException("profiler");
}
public DisposableTimer TraceDuration<T>(string startMessage, string completeMessage)
{
return new DisposableTimer(Logger, DisposableTimer.LogType.Info, Profiler, typeof(T), startMessage, completeMessage);
}
public DisposableTimer TraceDuration<T>(string startMessage)
{
return new DisposableTimer(Logger, DisposableTimer.LogType.Info, Profiler, typeof(T), startMessage, "Complete");
}
public DisposableTimer TraceDuration(Type loggerType, string startMessage, string completeMessage)
{
return new DisposableTimer(Logger, DisposableTimer.LogType.Info, Profiler, loggerType, startMessage, completeMessage);
}
public DisposableTimer DebugDuration<T>(string startMessage, string completeMessage)
{
return new DisposableTimer(Logger, DisposableTimer.LogType.Debug, Profiler, typeof(T), startMessage, completeMessage);
}
public DisposableTimer DebugDuration<T>(string startMessage)
{
return new DisposableTimer(Logger, DisposableTimer.LogType.Debug, Profiler, typeof(T), startMessage, "Complete");
}
public DisposableTimer DebugDuration(Type loggerType, string startMessage, string completeMessage)
{
return new DisposableTimer(Logger, DisposableTimer.LogType.Debug, Profiler, loggerType, startMessage, completeMessage);
}
}
}
@@ -4,6 +4,7 @@ using System.Linq;
using System.Web;
using System.Web.UI;
using System.Linq;
using Umbraco.Core.Logging;
using Umbraco.Core.ObjectResolution;
using umbraco.interfaces;
@@ -18,13 +19,14 @@ namespace Umbraco.Core.Macros
/// </remarks>
internal sealed class MacroFieldEditorsResolver : LazyManyObjectsResolverBase<MacroFieldEditorsResolver, IMacroGuiRendering>
{
/// <summary>
/// Constructor
/// </summary>
/// <param name="macroEditors"></param>
internal MacroFieldEditorsResolver(Func<IEnumerable<Type>> macroEditors)
: base(macroEditors, ObjectLifetimeScope.Transient)
/// <summary>
/// Constructor
/// </summary>
/// <param name="serviceProvider"></param>
/// <param name="logger"></param>
/// <param name="macroEditors"></param>
internal MacroFieldEditorsResolver(IServiceProvider serviceProvider, ILogger logger, Func<IEnumerable<Type>> macroEditors)
: base(serviceProvider, logger, macroEditors, ObjectLifetimeScope.Transient)
{ }
/// <summary>
@@ -70,10 +72,10 @@ namespace Umbraco.Core.Macros
internal Control GetMacroRenderControlByType(PersistableMacroProperty prop, string uniqueId)
{
var m = MacroControlTypes.FindLast(macroGuiCcontrol => macroGuiCcontrol.ToString() == string.Format("{0}.{1}", prop.AssemblyName, prop.TypeName));
var instance = PluginManager.Current.CreateInstance<IMacroGuiRendering>(m);
var instance = ServiceProvider.GetService(m) as IMacroGuiRendering;
if (instance != null)
{
if (!string.IsNullOrEmpty(prop.Value))
if (string.IsNullOrEmpty(prop.Value) == false)
{
instance.Value = HttpUtility.HtmlDecode(prop.Value);
}
+1 -1
View File
@@ -12,7 +12,7 @@ namespace Umbraco.Core.Macros
internal class MacroTagParser
{
private static readonly Regex MacroRteContent = new Regex(@"(<!--\s*?)(<\?UMBRACO_MACRO.*?/>)(\s*?-->)", RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.Singleline);
private static readonly Regex MacroPersistedFormat = new Regex(@"(<\?UMBRACO_MACRO macroAlias=[""']([^""\'\n\r]+?)[""'].+?)(?:/>|>.*?</\?UMBRACO_MACRO>)", RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.Singleline);
private static readonly Regex MacroPersistedFormat = new Regex(@"(<\?UMBRACO_MACRO (?:.+)?macroAlias=[""']([^""\'\n\r]+?)[""'].+?)(?:/>|>.*?</\?UMBRACO_MACRO>)", RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.Singleline);
/// <summary>
/// This formats the persisted string to something useful for the rte so that the macro renders properly since we
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using Umbraco.Core.Logging;
using Umbraco.Core.ObjectResolution;
namespace Umbraco.Core.Macros
@@ -9,13 +10,14 @@ namespace Umbraco.Core.Macros
/// </summary>
internal sealed class XsltExtensionsResolver : LazyManyObjectsResolverBase<XsltExtensionsResolver, XsltExtension>
{
/// <summary>
/// Constructor
/// </summary>
/// <param name="packageActions"></param>
internal XsltExtensionsResolver(Func<IEnumerable<Type>> packageActions)
: base(packageActions, ObjectLifetimeScope.Application)
/// Constructor
/// </summary>
/// <param name="serviceProvider"></param>
/// <param name="logger"></param>
/// <param name="packageActions"></param>
internal XsltExtensionsResolver(IServiceProvider serviceProvider, ILogger logger, Func<IEnumerable<Type>> packageActions)
: base(serviceProvider, logger, packageActions, ObjectLifetimeScope.Application)
{
}
@@ -0,0 +1,35 @@
using System;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Umbraco.Core.IO;
using Umbraco.Core.PropertyEditors;
using Umbraco.Core.Serialization;
namespace Umbraco.Core.Manifest
{
/// <summary>
/// Ensures that virtual paths are taken care of
/// </summary>
internal class GridEditorConverter : JsonCreationConverter<GridEditor>
{
protected override GridEditor Create(Type objectType, JObject jObject)
{
return new GridEditor();
}
protected override void Deserialize(JObject jObject, GridEditor target, JsonSerializer serializer)
{
base.Deserialize(jObject, target, serializer);
if (target.View.IsNullOrWhiteSpace() == false && target.View.StartsWith("~/"))
{
target.View = IOHelper.ResolveUrl(target.View);
}
if (target.Render.IsNullOrWhiteSpace() == false && target.Render.StartsWith("~/"))
{
target.Render = IOHelper.ResolveUrl(target.Render);
}
}
}
}
+20 -3
View File
@@ -39,7 +39,8 @@ namespace Umbraco.Core.Manifest
internal static IEnumerable<GridEditor> GetGridEditors(JArray jsonEditors)
{
return JsonConvert.DeserializeObject<IEnumerable<GridEditor>>(
jsonEditors.ToString());
jsonEditors.ToString(),
new GridEditorConverter());
}
/// <summary>
@@ -209,14 +210,30 @@ namespace Umbraco.Core.Manifest
}
}
}
//replace virtual paths for each property editor
if (deserialized["gridEditors"] != null)
{
foreach (JObject p in deserialized["gridEditors"])
{
if (p["view"] != null)
{
ReplaceVirtualPaths(p["view"]);
}
if (p["render"] != null)
{
ReplaceVirtualPaths(p["render"]);
}
}
}
var manifest = new PackageManifest()
{
JavaScriptInitialize = jConfig,
StylesheetInitialize = cssConfig,
PropertyEditors = propEditors.Any() ? (JArray)deserialized["propertyEditors"] : new JArray(),
ParameterEditors = propEditors.Any() ? (JArray)deserialized["parameterEditors"] : new JArray(),
GridEditors = propEditors.Any() ? (JArray)deserialized["gridEditors"] : new JArray()
ParameterEditors = paramEditors.Any() ? (JArray)deserialized["parameterEditors"] : new JArray(),
GridEditors = gridEditors.Any() ? (JArray)deserialized["gridEditors"] : new JArray()
};
result.Add(manifest);
}
+9 -1
View File
@@ -1,3 +1,4 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Web;
@@ -7,10 +8,17 @@ namespace Umbraco.Core.Manifest
{
internal class ManifestWatcher : DisposableObject
{
private readonly ILogger _logger;
private readonly List<FileSystemWatcher> _fws = new List<FileSystemWatcher>();
private static volatile bool _isRestarting = false;
private static readonly object Locker = new object();
public ManifestWatcher(ILogger logger)
{
if (logger == null) throw new ArgumentNullException("logger");
_logger = logger;
}
public void Start(params string[] packageFolders)
{
foreach (var packageFolder in packageFolders)
@@ -43,7 +51,7 @@ namespace Umbraco.Core.Manifest
{
_isRestarting = true;
LogHelper.Info<ManifestWatcher>("manifest has changed, app pool is restarting (" + e.FullPath + ")");
_logger.Info<ManifestWatcher>("manifest has changed, app pool is restarting (" + e.FullPath + ")");
HttpRuntime.UnloadAppDomain();
Dispose();
}
+19
View File
@@ -0,0 +1,19 @@
using Umbraco.Core.Models.EntityBase;
namespace Umbraco.Core.Models
{
public sealed class AuditItem : Entity, IAggregateRoot
{
public AuditItem(int objectId, string comment, AuditType type, int userId)
{
Id = objectId;
Comment = comment;
AuditType = type;
UserId = userId;
}
public string Comment { get; private set; }
public AuditType AuditType { get; private set; }
public int UserId { get; private set; }
}
}
+85
View File
@@ -0,0 +1,85 @@
namespace Umbraco.Core.Models
{
/// <summary>
/// Enums for vailable types of auditing
/// </summary>
public enum AuditType
{
/// <summary>
/// Used when new nodes are added
/// </summary>
New,
/// <summary>
/// Used when nodes are saved
/// </summary>
Save,
/// <summary>
/// Used when nodes are opened
/// </summary>
Open,
/// <summary>
/// Used when nodes are deleted
/// </summary>
Delete,
/// <summary>
/// Used when nodes are published
/// </summary>
Publish,
/// <summary>
/// Used when nodes are send to publishing
/// </summary>
SendToPublish,
/// <summary>
/// Used when nodes are unpublished
/// </summary>
UnPublish,
/// <summary>
/// Used when nodes are moved
/// </summary>
Move,
/// <summary>
/// Used when nodes are copied
/// </summary>
Copy,
/// <summary>
/// Used when nodes are assígned a domain
/// </summary>
AssignDomain,
/// <summary>
/// Used when public access are changed for a node
/// </summary>
PublicAccess,
/// <summary>
/// Used when nodes are sorted
/// </summary>
Sort,
/// <summary>
/// Used when a notification are send to a user
/// </summary>
Notify,
/// <summary>
/// General system notification
/// </summary>
System,
/// <summary>
/// Used when a node's content is rolled back to a previous version
/// </summary>
RollBack,
/// <summary>
/// Used when a package is installed
/// </summary>
PackagerInstall,
/// <summary>
/// Used when a package is uninstalled
/// </summary>
PackagerUninstall,
/// <summary>
/// Used when a node is send to translation
/// </summary>
SendToTranslate,
/// <summary>
/// Use this log action for custom log messages that should be shown in the audit trail
/// </summary>
Custom
}
}
+13 -72
View File
@@ -160,10 +160,7 @@ namespace Umbraco.Core.Models
/// <summary>
/// Language of the data contained within this Content object.
/// </summary>
/// <remarks>
/// Left internal until multilingual support is implemented.
/// </remarks>
[DataMember]
[Obsolete("This is not used and will be removed from the codebase in future versions")]
public string Language
{
get { return _language; }
@@ -321,6 +318,17 @@ namespace Umbraco.Core.Models
[DataMember]
internal PublishedState PublishedState { get; set; }
/// <summary>
/// Gets or sets the unique identifier of the published version, if any.
/// </summary>
[IgnoreDataMember]
public Guid PublishedVersionGuid { get; internal set; }
/// <summary>
/// Gets a value indicating whether the content has a published version.
/// </summary>
public bool HasPublishedVersion { get { return PublishedVersionGuid != default(Guid); } }
/// <summary>
/// Changes the Trashed state of the content object
/// </summary>
@@ -337,74 +345,7 @@ namespace Umbraco.Core.Models
ChangePublishedState(PublishedState.Unpublished);
}
}
/// <summary>
/// Indicates whether a specific property on the current <see cref="IContent"/> entity is dirty.
/// </summary>
/// <param name="propertyName">Name of the property to check</param>
/// <returns>True if Property is dirty, otherwise False</returns>
public override bool IsPropertyDirty(string propertyName)
{
bool existsInEntity = base.IsPropertyDirty(propertyName);
if (existsInEntity)
return true;
return Properties.Any(x => x.IsPropertyDirty(propertyName));
}
/// <summary>
/// Indicates whether the current entity is dirty.
/// </summary>
/// <returns>True if entity is dirty, otherwise False</returns>
public override bool IsDirty()
{
return IsEntityDirty() || IsAnyUserPropertyDirty();
}
/// <summary>
/// Returns true if only the entity properties are direty
/// </summary>
/// <returns></returns>
public bool IsEntityDirty()
{
return base.IsDirty();
}
/// <summary>
/// Returns true if any of the properties are dirty
/// </summary>
/// <returns></returns>
public bool IsAnyUserPropertyDirty()
{
return Properties.Any(x => x.IsDirty());
}
/// <summary>
/// Returns a list of all dirty user defined properties
/// </summary>
/// <returns></returns>
public IEnumerable<string> GetDirtyUserProperties()
{
return Properties.Where(x => x.IsDirty()).Select(x => x.Alias);
}
/// <summary>
/// Resets dirty properties by clearing the dictionary used to track changes.
/// </summary>
/// <remarks>
/// Please note that resetting the dirty properties could potentially
/// obstruct the saving of a new or updated entity.
/// </remarks>
public override void ResetDirtyProperties()
{
base.ResetDirtyProperties();
foreach (var property in Properties)
{
property.ResetDirtyProperties();
}
}
/// <summary>
/// Method to call when Entity is being saved
/// </summary>
+87 -2
View File
@@ -436,7 +436,7 @@ namespace Umbraco.Core.Models
return;
}
var propertyType = PropertyTypes.FirstOrDefault(x => x.Alias == propertyTypeAlias);
var propertyType = PropertyTypes.FirstOrDefault(x => x.Alias.InvariantEquals(propertyTypeAlias));
if (propertyType == null)
{
throw new Exception(String.Format("No PropertyType exists with the supplied alias: {0}", propertyTypeAlias));
@@ -466,6 +466,8 @@ namespace Umbraco.Core.Models
public abstract void ChangeTrashedState(bool isTrashed, int parentId = -20);
#region Dirty property handling
/// <summary>
/// We will override this method to ensure that when we reset the dirty properties that we
/// also reset the dirty changes made to the content's Properties (user defined)
@@ -480,6 +482,89 @@ namespace Umbraco.Core.Models
prop.ResetDirtyProperties(rememberPreviouslyChangedProperties);
}
}
/// <summary>
/// Indicates whether the current entity is dirty.
/// </summary>
/// <returns>True if entity is dirty, otherwise False</returns>
public override bool IsDirty()
{
return IsEntityDirty() || this.IsAnyUserPropertyDirty();
}
/// <summary>
/// Indicates whether the current entity was dirty.
/// </summary>
/// <returns>True if entity was dirty, otherwise False</returns>
public override bool WasDirty()
{
return WasEntityDirty() || this.WasAnyUserPropertyDirty();
}
/// <summary>
/// Returns true if only the entity properties are dirty
/// </summary>
/// <returns></returns>
public bool IsEntityDirty()
{
return base.IsDirty();
}
/// <summary>
/// Returns true if only the entity properties were dirty
/// </summary>
/// <returns></returns>
public bool WasEntityDirty()
{
return base.WasDirty();
}
/// <summary>
/// Indicates whether a specific property on the current <see cref="IContent"/> entity is dirty.
/// </summary>
/// <param name="propertyName">Name of the property to check</param>
/// <returns>
/// True if any of the class properties are dirty or
/// True if any of the user defined PropertyType properties are dirty based on their alias,
/// otherwise False
/// </returns>
public override bool IsPropertyDirty(string propertyName)
{
bool existsInEntity = base.IsPropertyDirty(propertyName);
if (existsInEntity)
return true;
if (Properties.Contains(propertyName))
{
return Properties[propertyName].IsDirty();
}
return false;
}
/// <summary>
/// Indicates whether a specific property on the current entity was changed and the changes were committed
/// </summary>
/// <param name="propertyName">Name of the property to check</param>
/// <returns>
/// True if any of the class properties are dirty or
/// True if any of the user defined PropertyType properties are dirty based on their alias,
/// otherwise False
/// </returns>
public override bool WasPropertyDirty(string propertyName)
{
bool existsInEntity = base.WasPropertyDirty(propertyName);
if (existsInEntity)
return true;
if (Properties.Contains(propertyName))
{
return Properties[propertyName].WasDirty();
}
return false;
}
#endregion
}
}
+26 -12
View File
@@ -77,10 +77,9 @@ namespace Umbraco.Core.Models
/// </remarks>
internal static bool RequiresSaving(this IContent entity, PublishedState publishedState)
{
var dirtyEntity = (ICanBeDirty)entity;
var publishedChanged = dirtyEntity.IsPropertyDirty("Published") && publishedState != PublishedState.Unpublished;
var publishedChanged = entity.IsPropertyDirty("Published") && publishedState != PublishedState.Unpublished;
//check if any user prop has changed
var propertyValueChanged = ((Content)entity).IsAnyUserPropertyDirty();
var propertyValueChanged = entity.IsAnyUserPropertyDirty();
//We need to know if any other property apart from Published was changed here
//don't create a new version if the published state has changed to 'Save' but no data has actually been changed
@@ -114,6 +113,25 @@ namespace Umbraco.Core.Models
return ShouldCreateNewVersion(entity, publishedState);
}
/// <summary>
/// Returns a list of all dirty user defined properties
/// </summary>
/// <returns></returns>
public static IEnumerable<string> GetDirtyUserProperties(this IContentBase entity)
{
return entity.Properties.Where(x => x.IsDirty()).Select(x => x.Alias);
}
public static bool IsAnyUserPropertyDirty(this IContentBase entity)
{
return entity.Properties.Any(x => x.IsDirty());
}
public static bool WasAnyUserPropertyDirty(this IContentBase entity)
{
return entity.Properties.Any(x => x.WasDirty());
}
/// <summary>
/// Determines if a new version should be created
/// </summary>
@@ -128,15 +146,13 @@ namespace Umbraco.Core.Models
/// </remarks>
internal static bool ShouldCreateNewVersion(this IContent entity, PublishedState publishedState)
{
var dirtyEntity = (ICanBeDirty)entity;
//check if the published state has changed or the language
var publishedChanged = dirtyEntity.IsPropertyDirty("Published") && publishedState != PublishedState.Unpublished;
var langChanged = dirtyEntity.IsPropertyDirty("Language");
var publishedChanged = entity.IsPropertyDirty("Published") && publishedState != PublishedState.Unpublished;
var langChanged = entity.IsPropertyDirty("Language");
var contentChanged = publishedChanged || langChanged;
//check if any user prop has changed
var propertyValueChanged = ((Content)entity).IsAnyUserPropertyDirty();
var propertyValueChanged = entity.IsAnyUserPropertyDirty();
//return true if published or language has changed
if (contentChanged)
@@ -641,12 +657,10 @@ namespace Umbraco.Core.Models
/// </summary>
/// <param name="content"></param>
/// <returns>True if the content has any published versiom otherwise False</returns>
[Obsolete("Use the HasPublishedVersion property.", false)]
public static bool HasPublishedVersion(this IContent content)
{
if (content.HasIdentity == false)
return false;
return ApplicationContext.Current.Services.ContentService.HasPublishedVersion(content.Id);
return content.HasPublishedVersion;
}
#region Tag methods
-103
View File
@@ -1,103 +0,0 @@
using System;
using System.IO;
using System.Collections.Generic;
namespace Umbraco.Core.Models.Css
{
internal static class CssCompactor
{
#region CssCompactor.Options
[Flags]
public enum Options
{
None = 0x00,
PrettyPrint = 0x01,
Overwrite = 0x02
}
#endregion CssCompactor.Options
#region Public Methods
internal static List<ParseException> Compact(string inputFile, string outputFile, string copyright, string timeStamp, CssCompactor.Options options)
{
if (!System.IO.File.Exists(inputFile))
{
throw new FileNotFoundException(String.Format("File (\"{0}\") not found.", inputFile), inputFile);
}
if ((options & CssCompactor.Options.Overwrite) == 0x0 && System.IO.File.Exists(outputFile))
{
throw new AccessViolationException(String.Format("File (\"{0}\") already exists.", outputFile));
}
if (inputFile.Equals(outputFile, StringComparison.OrdinalIgnoreCase))
{
throw new ApplicationException("Input and output file are set to the same path.");
}
FileUtility.PrepSavePath(outputFile);
using (TextWriter output = System.IO.File.CreateText(outputFile))
{
return CssCompactor.Compact(inputFile, null, output, copyright, timeStamp, options);
}
}
internal static List<ParseException> Compact(string inputFile, string inputSource, TextWriter output, string copyright, string timeStamp, CssCompactor.Options options)
{
if (output == null)
{
throw new NullReferenceException("Output TextWriter was null.");
}
// write out header with copyright and timestamp
CssCompactor.WriteHeader(output, copyright, timeStamp);
// verify, compact and write out results
CssParser parser = new CssParser(inputFile, inputSource);
parser.Write(output, options);
// return any errors
return parser.Errors;
}
#endregion Public Methods
#region Private Methods
private static void WriteHeader(TextWriter writer, string copyright, string timeStamp)
{
if (!String.IsNullOrEmpty(copyright) || !String.IsNullOrEmpty(timeStamp))
{
int width = 6;
if (!String.IsNullOrEmpty(copyright))
{
copyright = copyright.Replace("*/", "");// make sure not to nest commments
width = Math.Max(copyright.Length + 6, width);
}
if (!String.IsNullOrEmpty(timeStamp))
{
timeStamp = DateTime.Now.ToString(timeStamp).Replace("*/", "");// make sure not to nest commments
width = Math.Max(timeStamp.Length + 6, width);
}
writer.WriteLine("/*".PadRight(width, '-') + "*\\");
if (!String.IsNullOrEmpty(copyright))
{
writer.WriteLine("\t" + copyright);
}
if (!String.IsNullOrEmpty(timeStamp))
{
writer.WriteLine("\t" + timeStamp);
}
writer.WriteLine("\\*".PadRight(width, '-') + "*/");
}
}
#endregion Private Methods
}
}
-653
View File
@@ -1,653 +0,0 @@
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
namespace Umbraco.Core.Models.Css
{
internal class CssParser
{
#region Constants
// this defines comments for CSS
private static readonly ReadFilter[] ReadFilters = new ReadFilter[] { new ReadFilter("/*", "*/") };
private readonly object SyncLock = new object();
#endregion Constants
#region Fields
private readonly List<ParseException> errors = new List<ParseException>();
private LineReader reader;
private CssStyleSheet styleSheet;
private string fileContent;
private string source;
#endregion Fields
#region Init
/// <summary>
/// Ctor.
/// </summary>
/// <param name="fileContent">path to source</param>
public CssParser(string fileContent)
: this(fileContent, null)
{
}
/// <summary>
/// Ctor.
/// </summary>
/// <param name="fileContent">path to source</param>
/// <param name="source">actual source</param>
public CssParser(string fileContent, string source)
{
this.fileContent = fileContent;
this.source = source;
}
#endregion Init
#region Properties
public List<ParseException> Errors
{
get { return this.errors; }
}
public CssStyleSheet StyleSheet
{
get
{
if (this.styleSheet == null)
{
lock (this.SyncLock)
{
// check again in case race condition
// so we don't parse twice
if (this.styleSheet == null)
{
this.styleSheet = this.ParseStyleSheet();
}
}
}
return this.styleSheet;
}
}
private int Position
{
get { return this.reader.Position; }
}
#endregion Properties
#region Parse Methods
#region StyleSheet
/// <summary>
/// (BNF) stylesheet : [ CDO | CDC | S | statement ]*;
/// </summary>
/// <returns>CSS StyleSheet parse tree</returns>
private CssStyleSheet ParseStyleSheet()
{
CssStyleSheet styleSheet = new CssStyleSheet();
using (this.reader = new LineReader(this.fileContent, this.source, CssParser.ReadFilters))
{
this.reader.NormalizeWhiteSpace = true;
#if DEBUG
System.Diagnostics.Stopwatch watch = System.Diagnostics.Stopwatch.StartNew();
#endif
char ch;
while (this.Read(out ch))
{
switch (ch)
{
case '\uFEFF': // BOM (UTF byte order mark)
case '\t': //TAB
case '\n': //LF
case '\r': //CR
case ' ': //Space
{
// skip whitespace
continue;
}
case '<':
{
// CDO (Char Data Open?)
if (!this.Read(out ch) || ch != '-' ||
!this.Read(out ch) || ch != '-')
{
throw new SyntaxError("Expected \"<!--\"", this.reader.FilePath, this.reader.Line, this.reader.Column);
}
continue;
}
case '-':
{
// CDC (Char Data Close?)
if (!this.Read(out ch) || ch != '-' ||
!this.Read(out ch) || ch != '>')
{
throw new SyntaxError("Expected \"-->\"", this.reader.FilePath, this.reader.Line, this.reader.Column);
}
continue;
}
default:
{
try
{
CssStatement statement = this.ParseStatement();
styleSheet.Statements.Add(statement);
}
catch (ParseException ex)
{
this.errors.Add(ex);
while (this.Read(out ch) && ch != '}')
{
// restabilize on next statement
}
}
continue;
}
}
}
#if DEBUG
watch.Stop();
Console.WriteLine("CSS parse duration: {0} ms for {1} chars", watch.ElapsedMilliseconds, this.reader.Length);
#endif
}
this.reader = null;
this.source = null;
return styleSheet;
}
#endregion StyleSheet
#region Statement
/// <summary>
/// (BNF) statement : ruleset | at-rule;
/// </summary>
/// <returns></returns>
private CssStatement ParseStatement()
{
if (this.reader.Current == '@')
{
return this.ParseAtRule();
}
else
{
this.PutBack();
return this.ParseRuleSet();
}
}
#endregion Statement
#region At-Rule
/// <summary>
/// (BNF) at-rule : ATKEYWORD S* any* [ block | ';' S* ];
/// </summary>
/// <returns></returns>
/// <remarks>
/// NOTE: each at-rule might parse differently according to CSS3
/// The @media block for example contains a block of statements
/// while other at-rules with a block contain a block of declarations
/// </remarks>
private CssAtRule ParseAtRule()
{
CssAtRule atRule = new CssAtRule();
int start = this.Position + 1;// start with first char of ident
char ch;
while (this.Read(out ch) && !Char.IsWhiteSpace(ch))
{
// continue consuming
}
atRule.Ident = this.Copy(start);
while (this.Read(out ch) && Char.IsWhiteSpace(ch))
{
// consuming whitespace
}
start = this.Position;// start with current char
do
{
switch (ch)
{
case '{': //Block Begin
{
atRule.Value = this.Copy(start);
bool containsRuleSets = String.Equals(atRule.Ident, CssAtRule.MediaIdent, StringComparison.Ordinal);
while (true)
{
while (this.Read(out ch) && Char.IsWhiteSpace(ch))
{
// consume whitespace
}
if (ch == '}')
{
break;
}
try
{
if (containsRuleSets)
{
// includes @media
CssStatement statement = this.ParseStatement();
atRule.Block.Values.Add(statement);
}
else
{
// includes @font-face, @page
this.PutBack();
CssDeclaration declaration = this.ParseDeclaration();
atRule.Block.Values.Add(declaration);
}
}
catch (ParseException ex)
{
this.errors.Add(ex);
while (this.Read(out ch) && ch != '}')
{
// restabilize on block end
}
break;
}
}
return atRule;
}
case ';': //At-Rule End
{
atRule.Value = this.Copy(start);
return atRule;
}
}
} while (this.Read(out ch));
throw new UnexpectedEndOfFile("Unclosed At-Rule", this.reader.FilePath, this.reader.Line, this.reader.Column);
}
#endregion At-Rule
#region RuleSet
/// <summary>
/// (BNF) ruleset : selector? '{' S* declaration? [ ';' S* declaration? ]* '}' S*;
/// </summary>
/// <returns></returns>
private CssRuleSet ParseRuleSet()
{
char ch;
CssRuleSet ruleSet = new CssRuleSet();
ParseSelectors:
while (true)
{
try
{
CssSelector selector = this.ParseSelector();
if (selector == null)
{
break;
}
ruleSet.Selectors.Add(selector);
}
catch (ParseException ex)
{
this.errors.Add(ex);
while (this.Read(out ch))
{
// restabalize on next rulset
switch (ch)
{
case ',':
{
// continue parsing rest of Selectors
goto ParseSelectors;
}
case '{':
{
goto ParseDeclarations;
}
//case ':':// keep going
case ';':
case '}':
{
throw new SyntaxError("Invalid selector list", this.reader.FilePath, this.reader.Line, this.reader.Column);
}
}
}
}
}
ParseDeclarations:
while (true)
{
try
{
CssDeclaration declaration = this.ParseDeclaration();
if (declaration == null)
{
break;
}
ruleSet.Declarations.Add(declaration);
}
catch (ParseException ex)
{
this.errors.Add(ex);
while (this.Read(out ch))
{
// restabalize on next declaration
switch (ch)
{
case '{':
{
throw new SyntaxError("Invalid ruleset", this.reader.FilePath, this.reader.Line, this.reader.Column);
}
//case ':':// keep going
case ';':
{
// continue parsing rest of delcarations
goto ParseDeclarations;
}
case '}':
{
// no more declarations
return ruleSet;
}
}
}
}
}
return ruleSet;
}
#endregion RuleSet
#region Selector
/// <summary>
/// (BNF) selector: any+;
/// </summary>
/// <returns></returns>
private CssSelector ParseSelector()
{
CssSelector selector = new CssSelector();
char ch;
while (this.Read(out ch) && (Char.IsWhiteSpace(ch) || ch == ','))
{
// skip whitespace, and empty selectors
}
// consume property name
switch (ch)
{
case '{':
{
// no more declarations
return null;
}
//case ':':// pseudoclass
case ';':
case '}':
{
throw new SyntaxError("Invalid chars in selector", this.reader.FilePath, this.reader.Line, this.reader.Column);
}
}
int start = this.Position;// start with current char
while (this.Read(out ch))
{
// continue consuming selector
switch (ch)
{
case ',':
case '{':
{
selector.Value = this.Copy(start);
if (ch == '{')
{
this.PutBack();
}
return selector;
}
//case ':':// pseudoclass
case ';':
case '}':
{
throw new SyntaxError("Invalid selector", this.reader.FilePath, this.reader.Line, this.reader.Column);
}
}
}
throw new UnexpectedEndOfFile("Unclosed ruleset", this.reader.FilePath, this.reader.Line, this.reader.Column);
}
#endregion Selector
#region Declaration
/// <summary>
/// (BNF) declaration : property ':' S* value;
/// (BNF) property : IDENT S*;
/// </summary>
/// <returns></returns>
private CssDeclaration ParseDeclaration()
{
CssDeclaration declaration = new CssDeclaration();
char ch;
while (this.Read(out ch) && (Char.IsWhiteSpace(ch) || ch == ';'))
{
// skip whitespace, and empty declarations
}
// consume property name
switch (ch)
{
case '{':
case ':':
//case ';':
{
throw new SyntaxError("Declaration missing property name", this.reader.FilePath, this.reader.Line, this.reader.Column);
}
case '}':
{
// no more declarations
return null;
}
}
// read property, starting with current char
int start = this.Position;
while (this.Read(out ch) && !Char.IsWhiteSpace(ch) && ch != ':')
{
// consume property name
switch (ch)
{
case '{':
//case ':':
case ';':
{
throw new SyntaxError("Invalid CSS property name: " + this.Copy(start), this.reader.FilePath, this.reader.Line, this.reader.Column);
}
case '}':
{
this.PutBack();
goto case ';';
}
}
}
declaration.Property = this.Copy(start);
if (Char.IsWhiteSpace(ch))
{
while (this.Read(out ch) && (Char.IsWhiteSpace(ch)))
{
// skip whitespace
}
}
if (ch != ':')
{
// missing the property delim and value
if (ch == ';' || ch == '}')
{
// these are good chars for resyncing
// so put them back on the stream to
// not create subsequent errors
this.PutBack();
}
throw new SyntaxError("Expected <property> : <value>", this.reader.FilePath, this.reader.Line, this.reader.Column);
}
CssValueList value = this.ParseValue();
declaration.Value = value;
return declaration;
}
#endregion Declaration
#region Value
/// <summary>
/// (BNF) value : [ any | block | ATKEYWORD S* ]+;
/// (BNF) any : [ IDENT | NUMBER | PERCENTAGE | DIMENSION | STRING
/// | DELIM | URI | HASH | UNICODE-RANGE | INCLUDES
/// | FUNCTION S* any* ')' | DASHMATCH | '(' S* any* ')'
/// | '[' S* any* ']' ] S*;
/// </summary>
/// <returns></returns>
private CssValueList ParseValue()
{
CssValueList value = new CssValueList();
char ch;
while (this.Read(out ch) && Char.IsWhiteSpace(ch))
{
// skip whitespace, and empty declarations
}
switch (ch)
{
case '{':
case ':':
case ';':
case '}':
{
throw new SyntaxError("Invalid char in CSS property value: '" + ch + "'", this.reader.FilePath, this.reader.Line, this.reader.Column);
}
}
// read value, starting with current char
int start = this.Position;
while (this.Read(out ch))
{
// consume declaration value
switch (ch)
{
case '{':
//case ':':// leave in for "filter: progid:DXImageTransform.Microsoft..."
{
throw new SyntaxError("Invalid CSS property value: " + this.Copy(start), this.reader.FilePath, this.reader.Line, this.reader.Column);
}
case '}':
case ';':
{
//Should this parse the value further?
CssString any = new CssString();
any.Value = this.Copy(start);
value.Values.Add(any);
if (ch == '}')
{
this.PutBack();
}
return value;
}
}
}
throw new UnexpectedEndOfFile("Unclosed declaration", this.reader.FilePath, this.reader.Line, this.reader.Column);
}
#endregion Value
#endregion Parse Methods
#region Methods
public void Write(TextWriter writer, CssCompactor.Options options)
{
this.StyleSheet.Write(writer, options);
}
#endregion Methods
#region Reader Methods
/// <summary>
///
/// </summary>
/// <param name="ch"></param>
/// <returns>Success</returns>
private bool Read(out char ch)
{
if (this.reader.EndOfFile)
{
throw new UnexpectedEndOfFile("Unexpected end of file", this.reader.FilePath, this.reader.Line, this.reader.Column);
}
int c = this.reader.Read();
if (c < 0)
{
ch = '\0';
return false;
}
ch = (char)c;
return true;
}
/// <summary>
/// Copies chars from start until the position before the current position
/// </summary>
/// <returns></returns>
private string Copy(int start)
{
// read block
return this.reader.Copy(start, this.reader.Position - 1);
}
/// <summary>
/// Put one character back
/// </summary>
private void PutBack()
{
this.reader.PutBack();
}
#endregion Reader Methods
}
}
-429
View File
@@ -1,429 +0,0 @@
using System;
using System.IO;
using System.Collections.Generic;
using System.Text;
namespace Umbraco.Core.Models.Css
{
#region Base Types
/// <summary>
/// CSS3 inconsistently specifies more than one grammar:
/// http://www.w3.org/TR/css3-syntax/#style
/// http://www.w3.org/TR/css3-syntax/#detailed-grammar
/// </summary>
internal abstract class CssSyntax
{
#region Methods
public abstract void Write(TextWriter writer, CssCompactor.Options options);
protected static bool IsPrettyPrint(CssCompactor.Options options)
{
return (options & CssCompactor.Options.PrettyPrint) > 0;
}
#endregion Methods
#region Object Overrides
public override string ToString()
{
var writer = new StringWriter();
this.Write(writer, CssCompactor.Options.PrettyPrint);
return writer.ToString();
}
#endregion Object Overrides
}
internal interface ICssValue
{
#region Methods
void Write(TextWriter writer, CssCompactor.Options options);
#endregion Methods
}
internal class CssString : CssSyntax
{
#region Fields
private string value;
#endregion Fields
#region Properties
public virtual string Value
{
get { return this.value; }
set { this.value = value; }
}
#endregion Properties
#region Methods
public override void Write(TextWriter writer, CssCompactor.Options options)
{
writer.Write(this.Value);
}
#endregion Methods
}
#endregion Base Types
#region Grammar
internal class CssStyleSheet : CssSyntax
{
#region Fields
private readonly List<CssStatement> statements = new List<CssStatement>();
#endregion Fields
#region Properties
public List<CssStatement> Statements
{
get { return this.statements; }
}
#endregion Properties
#region Methods
public override void Write(TextWriter writer, CssCompactor.Options options)
{
bool prettyPrint = IsPrettyPrint(options);
foreach (CssStatement statement in this.statements)
{
statement.Write(writer, options);
if (prettyPrint)
{
writer.WriteLine();
}
}
}
#endregion Methods
}
internal abstract class CssStatement : CssSyntax, ICssValue
{
}
/// <summary>
///
/// </summary>
/// <remarks>
/// NOTE: each at-rule might parse differently according to CSS3
/// The @media block for example contains a block of statements
/// while other at-rules with a block contain a block of declarations
/// </remarks>
internal class CssAtRule : CssStatement
{
#region Constants
internal const string MediaIdent = "media";
#endregion Constants
#region Fields
private string ident;
private string value;
private CssBlock block;
#endregion Fields
#region Properties
public string Ident
{
get { return this.ident; }
set { this.ident = value; }
}
public string Value
{
get { return this.value; }
set { this.value = value; }
}
public CssBlock Block
{
get
{
if (this.block == null)
{
this.block = new CssBlock();
}
return this.block;
}
set { this.block = value; }
}
#endregion Properties
#region Methods
public override void Write(TextWriter writer, CssCompactor.Options options)
{
bool prettyPrint = IsPrettyPrint(options);
writer.Write('@');
writer.Write(this.ident);
if (!String.IsNullOrEmpty(this.value))
{
writer.Write(' ');
writer.Write(this.value);
}
if (this.block != null)
{
if (prettyPrint)
{
writer.WriteLine();
}
this.block.Write(writer, options);
}
else
{
writer.Write(';');
}
if (prettyPrint)
{
writer.WriteLine();
}
}
#endregion Methods
}
internal class CssBlock : CssSyntax, ICssValue
{
#region Fields
private readonly List<ICssValue> values = new List<ICssValue>();
#endregion Fields
#region Properties
public List<ICssValue> Values
{
get { return this.values; }
}
#endregion Properties
#region Methods
public override void Write(TextWriter writer, CssCompactor.Options options)
{
bool prettyPrint = IsPrettyPrint(options);
writer.Write('{');
if (prettyPrint)
{
writer.WriteLine();
}
foreach (ICssValue value in this.Values)
{
value.Write(writer, options);
}
if (prettyPrint)
{
writer.WriteLine();
}
writer.Write('}');
}
#endregion Methods
}
internal class CssRuleSet : CssStatement
{
#region Fields
private readonly List<CssSelector> selectors = new List<CssSelector>();
private readonly List<CssDeclaration> declarations = new List<CssDeclaration>();
#endregion Fields
#region Properties
public List<CssSelector> Selectors
{
get { return this.selectors; }
}
public List<CssDeclaration> Declarations
{
get { return this.declarations; }
}
#endregion Properties
#region Methods
public override void Write(TextWriter writer, CssCompactor.Options options)
{
bool prettyPrint = IsPrettyPrint(options);
bool comma = false;
foreach (CssString selector in this.Selectors)
{
if (comma)
{
writer.Write(",");
if (prettyPrint)
{
writer.WriteLine();
}
}
else
{
comma = true;
}
selector.Write(writer, options);
}
if (prettyPrint)
{
writer.WriteLine();
}
writer.Write("{");
if (prettyPrint)
{
writer.WriteLine();
}
foreach (CssDeclaration dec in this.Declarations)
{
dec.Write(writer, options);
}
writer.Write("}");
if (prettyPrint)
{
writer.WriteLine();
}
}
#endregion Methods
}
internal class CssSelector : CssString
{
}
internal class CssDeclaration : CssSyntax, ICssValue
{
#region Fields
private string property;
private CssValueList value;
#endregion Fields
#region Properties
public string Property
{
get { return this.property; }
set { this.property = value; }
}
public CssValueList Value
{
get { return this.value; }
set { this.value = value; }
}
#endregion Properties
#region Methods
public override void Write(TextWriter writer, CssCompactor.Options options)
{
bool prettyPrint = IsPrettyPrint(options);
if (prettyPrint)
{
writer.Write('\t');
}
writer.Write(this.Property);
writer.Write(':');
if (prettyPrint)
{
writer.Write(" ");
}
this.Value.Write(writer, options);
writer.Write(";");
if (prettyPrint)
{
writer.WriteLine();
}
}
#endregion Methods
}
internal class CssValueList : CssSyntax
{
#region Fields
private readonly List<CssString> values = new List<CssString>();
#endregion Fields
#region Properties
public List<CssString> Values
{
get { return this.values; }
}
#endregion Properties
#region Methods
public override void Write(TextWriter writer, CssCompactor.Options options)
{
bool space = false;
foreach (CssString value in this.Values)
{
if (space)
{
writer.Write(" ");
}
else
{
space = true;
}
value.Write(writer, options);
}
}
#endregion Methods
}
#endregion Grammar
}
@@ -1,71 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
namespace Umbraco.Core.Models.Css
{
internal class FileUtility
{
#region Constants
private static readonly char[] IllegalChars;
#endregion Constants
#region Init
static FileUtility()
{
var chars = new List<char>(Path.GetInvalidPathChars());
foreach (char ch in Path.GetInvalidFileNameChars())
{
if (!chars.Contains(ch) && ch != Path.DirectorySeparatorChar)
{
chars.Add(ch);
}
}
IllegalChars = chars.ToArray();
}
#endregion Init
#region Methods
/// <summary>
/// Makes sure directory exists and if file exists is not readonly.
/// </summary>
/// <param name="filename"></param>
/// <returns>if valid path</returns>
internal static bool PrepSavePath(string filename)
{
if (System.IO.File.Exists(filename))
{
// make sure not readonly
FileAttributes attributes = System.IO.File.GetAttributes(filename);
attributes &= ~FileAttributes.ReadOnly;
System.IO.File.SetAttributes(filename, attributes);
}
else
{
string dir = Path.GetDirectoryName(filename);
if (!String.IsNullOrEmpty(dir) && dir.IndexOfAny(IllegalChars) >= 0)
{
return false;
}
if (!String.IsNullOrEmpty(dir) && !Directory.Exists(dir))
{
// make sure path exists
Directory.CreateDirectory(dir);
}
string file = Path.GetFileName(filename);
if (!String.IsNullOrEmpty(file) && file.IndexOfAny(Path.GetInvalidFileNameChars()) >= 0)
{
return false;
}
}
return true;
}
#endregion Methods
}
}
-80
View File
@@ -1,80 +0,0 @@
using System;
using System.Collections.Generic;
namespace Umbraco.Core.Models.Css
{
/// <summary>
/// Defines a character sequence to filter out when reading.
/// </summary>
/// <remarks>
/// If the sequence exists in the read source, it will be read out as if it was never there.
/// </remarks>
internal struct ReadFilter
{
#region Fields
public readonly string StartToken;
public readonly string EndToken;
#endregion Fields
#region Init
public ReadFilter(string start, string end)
{
if (String.IsNullOrEmpty(start))
{
throw new ArgumentNullException("start");
}
if (String.IsNullOrEmpty(end))
{
throw new ArgumentNullException("end");
}
this.StartToken = start;
this.EndToken = end;
}
#endregion Init
}
/// <summary>
/// Creates a Trie out of ReadFilters
/// </summary>
internal class FilterTrie : TrieNode<char, string>
{
#region Constants
private const int DefaultTrieWidth = 1;
#endregion Constants
#region Init
internal FilterTrie(IEnumerable<ReadFilter> filters)
: base(DefaultTrieWidth)
{
// load trie
foreach (ReadFilter filter in filters)
{
TrieNode<char, string> node = this;
// build out the path for StartToken
foreach (char ch in filter.StartToken)
{
if (!node.Contains(ch))
{
node[ch] = new TrieNode<char, string>(DefaultTrieWidth);
}
node = (TrieNode<char, string>)node[ch];
}
// at the end of StartToken path is the EndToken
node.Value = filter.EndToken;
}
}
#endregion Init
}
}
-464
View File
@@ -1,464 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
namespace Umbraco.Core.Models.Css
{
internal class LineReader : TextReader
{
#region Fields
private int line = 1;
private int column = 0;
private int position = -1;
private string filePath;
private string source;
private readonly FilterTrie trie;
private bool normalizeWhiteSpace = false;
#endregion Fields
#region Init
/// <summary>
/// Ctor.
/// </summary>
/// <param name="filePath"></param>
/// <param name="source"></param>
/// <param name="filters"></param>
internal LineReader(string filePath, IEnumerable<ReadFilter> filters) : this(filePath, null, filters) { }
/// <summary>
/// Ctor.
/// </summary>
/// <param name="filePath"></param>
/// <param name="source"></param>
/// <param name="filters"></param>
internal LineReader(string filePath, string source, IEnumerable<ReadFilter> filters)
{
this.trie = new FilterTrie(filters);
this.source = source;
this.filePath = filePath;
if (this.source == null)
{
this.source = filePath;//Changed to direct content string instead of file.
/*if (System.IO.File.Exists(filePath))
{
this.source = System.IO.File.ReadAllText(filePath);
}
else
{
throw new FileError("File not found", filePath, 0, 0);
}*/
}
}
/// <summary>
/// Ctor.
/// </summary>
/// <param name="filePath"></param>
/// <param name="source"></param>
internal LineReader(string filePath, string source)
: this(filePath, source, new ReadFilter[0])
{
}
#endregion Init
#region Properties
/// <summary>
/// Gets the path to the source file
/// </summary>
public string FilePath
{
get { return this.filePath; }
}
/// <summary>
/// Gets the size of source file in chars
/// </summary>
public int Length
{
get { return this.source.Length; }
}
/// <summary>
/// Gets the current line number
/// </summary>
public int Line
{
get { return this.line; }
}
/// <summary>
/// Gets the current col number
/// </summary>
public int Column
{
get { return this.column; }
}
/// <summary>
/// Gets the current char position
/// </summary>
public int Position
{
get { return this.position; }
}
/// <summary>
/// Gets if at end the end of file
/// </summary>
public bool EndOfFile
{
get { return this.position >= this.source.Length; }
}
/// <summary>
/// Gets and sets if whitespace is normalized while reading
/// </summary>
public bool NormalizeWhiteSpace
{
get { return this.normalizeWhiteSpace; }
set { this.normalizeWhiteSpace = value; }
}
/// <summary>
/// Gets the current char
/// </summary>
public int Current
{
get
{
if (this.EndOfFile)
{
return -1;
}
return this.source[this.position];
}
}
#endregion Properties
#region TextReader Members
/// <summary>
/// Unfiltered look ahead
/// </summary>
/// <returns></returns>
public override int Peek()
{
return this.Peek(1);
}
/// <summary>
/// Filtered read of the next source char. Counters are incremented.
/// </summary>
/// <returns></returns>
/// <remarks>
/// NewLine sequences (CR/LF, LF, CR) are normalized to LF.
/// </remarks>
public override int Read()
{
return this.Read(true);
}
#endregion TextReader Members
#region Utility Methods
/// <summary>
/// Backs the current position up one.
/// </summary>
public void PutBack()
{
if (this.position < 0)
{
throw new InvalidOperationException("Already at start of source");
}
switch (this.source[this.position])
{
case '\r': //CR
{
// manipulate CR/LF as one char
if ((this.position + 1 < this.Length) && this.source[this.position + 1] == '\n')
{
this.position--;
}
break;
}
case '\n': //LF
case '\f': //FF
{
this.line--;
break;
}
}
this.column--;
this.position--;
}
/// <summary>
/// Copies a range from the source
/// </summary>
/// <param name="start">starting position, inclusive</param>
/// <param name="end">ending position, inclusive</param>
/// <returns></returns>
public string Copy(int start, int end)
{
if (start < 0)
{
throw new ArgumentOutOfRangeException("start");
}
if (end < 0)
{
throw new ArgumentOutOfRangeException("end");
}
if (end < 1)
{
return null;
}
// set to just before read, next char is start
int copyPosition = start - 1;
// allocate the full range but may not use due to filtering
char[] buffer = new char[end - start + 1];
int count = 0;
while (copyPosition < end)
{
int ch = this.CopyRead(ref copyPosition);
if (ch == -1)
{
throw new UnexpectedEndOfFile("Read past end of file", this.FilePath, this.Line, this.Column);
}
buffer[count] = (char)ch;
count++;
}
if (count < 1)
{
return null;
}
return new String(buffer, 0, count).Trim();
}
#endregion Utility Methods
#region Filter Methods
/// <summary>
/// Peeks with n chars of lookahead.
/// </summary>
/// <param name="lookahead"></param>
/// <returns>unfiltered read</returns>
protected int Peek(int lookahead)
{
int pos = this.position + lookahead;
if (pos >= this.source.Length)
{
return -1;
}
return this.source[pos];
}
/// <summary>
/// Reads the next char
/// </summary>
/// <param name="filter">if filtering</param>
/// <returns>the next char, or -1 if at EOF</returns>
protected int Read(bool filter)
{
if (this.position + 1 >= this.source.Length)
{
this.position = this.source.Length;
return -1;
}
// increment counters
this.position++;
this.column++;
char ch = this.source[this.position];
if (Char.IsWhiteSpace(ch))
{
ch = this.NormalizeSpaces(ch, ref this.position, ref this.line, ref this.column);
}
return filter ? this.Filter(ch) : ch;
}
/// <summary>
/// Normalized CR/CRLF/LF/FF to LF, or all whitespace to SPACE if NormalizeWhiteSpace is true
/// </summary>
/// <param name="ch"></param>
/// <param name="pos"></param>
/// <param name="line"></param>
/// <param name="col"></param>
/// <returns></returns>
private char NormalizeSpaces(char ch, ref int pos, ref int line, ref int col)
{
int length = this.source.Length;
if (this.normalizeWhiteSpace)
{
// normalize runs of WhiteSpace to ' '
while ((pos + 1 < length) && Char.IsWhiteSpace(this.source, pos + 1))
{
pos++;
col++;
// increment line count
switch (this.source[pos])
{
case '\r': //CR
{
// manipulate CR/LF as one char
if ((pos + 1 < length) && this.source[pos + 1] == '\n')
{
pos++;
}
goto case '\n';
}
case '\n': //LF
case '\f': //FF
{
line++;
col = 0;
break;
}
}
}
ch = ' ';
}
else
{
// normalize NewLines to '\n', increment line count
switch (ch)
{
case '\r': //CR
{
// manipulate CR/LF as one char
if ((pos + 1 < length) && this.source[pos + 1] == '\n')
{
pos++;
}
goto case '\n';
}
case '\n': //LF
case '\f': //FF
{
line++;
col = 0;
ch = '\n';
break;
}
}
}
return ch;
}
/// <summary>
/// Read for Copying (doesn't reset line.col counters)
/// </summary>
/// <param name="filter"></param>
/// <returns></returns>
protected int CopyRead(ref int copyPosition)
{
if (copyPosition + 1 >= this.source.Length)
{
return -1;
}
// increment counters
copyPosition++;
char ch = this.source[copyPosition];
if (Char.IsWhiteSpace(ch))
{
int dummyLine = 0, dummyCol = 0;
ch = this.NormalizeSpaces(ch, ref copyPosition, ref dummyLine, ref dummyCol);
}
return this.Filter(ch);
}
/// <summary>
/// Filters based upon an internal Trie
/// </summary>
/// <param name="ch"></param>
/// <returns></returns>
private int Filter(char ch)
{
int lookAhead = 0;
ITrieNode<char, string> node = this.trie[ch];
while (node != null)
{
if (node.HasValue)
{
// found StartToken
string endToken = node.Value;
int length = endToken.Length;
// move to end of StartToken
this.position += lookAhead;
for (int i = 0; i < length; i++)
{
int ch2 = this.Read(false);
if (ch < 0)
{
throw new UnexpectedEndOfFile("Expected " + endToken, this.FilePath, this.Line, this.Column);
}
if (ch2 != endToken[i])
{
// reset search
while (i > 0)
{
i--;
this.PutBack();
}
i--;
}
}
return this.Read(true);
}
else
{
lookAhead++;
int pk = this.Peek(lookAhead);
if (pk < 0)
{
return ch;
}
node = node[(char)pk];
}
}
return ch;
}
#endregion Filter Methods
#region IDisposable Members
/// <summary>
/// Free source resources.
/// </summary>
/// <param name="disposing"></param>
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
this.source = null;
}
#endregion IDisposable Members
}
}
@@ -1,224 +0,0 @@
using System;
namespace Umbraco.Core.Models.Css
{
internal enum ParseExceptionType
{
Warning,
Error
}
[Serializable]
internal abstract class ParseException : ApplicationException
{
#region Constants
// this cannot change every char is important or Visual Studio will not list as error/warning
// http://blogs.msdn.com/msbuild/archive/2006/11/03/msbuild-visual-studio-aware-error-messages-and-message-formats.aspx
private const string MSBuildErrorFormat = "{0}({1},{2}): {3} {4}: {5}";
#endregion Constants
#region Fields
private string file;
private int line;
private int column;
private int code = 0;
#endregion Fields
#region Init
public ParseException(string message, string file, int line, int column)
: base(message)
{
this.file = file;
this.line = line;
this.column = column;
}
public ParseException(string message, string file, int line, int column, Exception innerException)
: base(message, innerException)
{
this.file = file;
this.line = line;
this.column = column;
}
#endregion Init
#region Properties
public abstract ParseExceptionType Type
{
get;
}
public virtual int Code
{
get { return this.code; }
}
public string ErrorCode
{
get
{
string ext = System.IO.Path.GetExtension(file);
if (ext == null || ext.Length < 2)
{
return null;
}
return ext.Substring(1).ToUpperInvariant() + this.Code.ToString("####0000");
}
}
public string File
{
get { return this.file; }
}
public int Line
{
get { return this.line; }
}
public int Column
{
get { return this.column; }
}
#endregion Properties
#region Methods
public virtual string GetCompilerMessage()
{
return this.GetCompilerMessage(this.Type == ParseExceptionType.Warning);
}
public virtual string GetCompilerMessage(bool isWarning)
{
// format exception as a VS2005 error/warning
return String.Format(
ParseException.MSBuildErrorFormat,
this.File,
(this.Line > 0) ? this.Line : 1,
(this.Column > 0) ? this.Column : 1,
isWarning ? "warning" : "error",
this.ErrorCode,
this.Message);
}
#endregion Methods
}
[Serializable]
internal class ParseWarning : ParseException
{
#region Init
public ParseWarning(string message, string file, int line, int column)
: base(message, file, line, column)
{
}
public ParseWarning(string message, string file, int line, int column, Exception innerException)
: base(message, file, line, column, innerException)
{
}
#endregion Init
#region Properties
public override ParseExceptionType Type
{
get { return ParseExceptionType.Warning; }
}
#endregion Properties
}
[Serializable]
internal class ParseError : ParseException
{
#region Init
public ParseError(string message, string file, int line, int column)
: base(message, file, line, column)
{
}
public ParseError(string message, string file, int line, int column, Exception innerException)
: base(message, file, line, column, innerException)
{
}
#endregion Init
#region Properties
public override ParseExceptionType Type
{
get { return ParseExceptionType.Error; }
}
#endregion Properties
}
[Serializable]
internal class UnexpectedEndOfFile : ParseError
{
#region Init
public UnexpectedEndOfFile(string message, string file, int line, int column)
: base(message, file, line, column)
{
}
public UnexpectedEndOfFile(string message, string file, int line, int column, Exception innerException)
: base(message, file, line, column, innerException)
{
}
#endregion Init
}
[Serializable]
internal class FileError : ParseWarning
{
#region Init
public FileError(string message, string file, int line, int column)
: base(message, file, line, column)
{
}
public FileError(string message, string file, int line, int column, Exception innerException)
: base(message, file, line, column, innerException)
{
}
#endregion Init
}
[Serializable]
internal class SyntaxError : ParseError
{
#region Init
public SyntaxError(string message, string file, int line, int column)
: base(message, file, line, column)
{
}
public SyntaxError(string message, string file, int line, int column, Exception innerException)
: base(message, file, line, column, innerException)
{
}
#endregion Init
}
}
-139
View File
@@ -1,139 +0,0 @@
using System;
using System.Collections.Generic;
namespace Umbraco.Core.Models.Css
{
/// <summary>
/// A generic node for building a Trie
/// </summary>
/// <typeparam name="TKey">the Type used for the node path</typeparam>
/// <typeparam name="TValue">the Type used for the node value</typeparam>
/// <remarks>
/// http://en.wikipedia.org/wiki/Trie
/// </remarks>
internal class TrieNode<TKey, TValue> : ITrieNode<TKey, TValue>
{
#region Fields
private readonly IDictionary<TKey, ITrieNode<TKey, TValue>> Children;
private TValue value = default(TValue);
#endregion Fields
#region Init
/// <summary>
/// Ctor
/// </summary>
public TrieNode()
: this(-1)
{
}
/// <summary>
/// Ctor.
/// </summary>
/// <param name="capacity"></param>
public TrieNode(int capacity)
{
if (capacity < 1)
{
this.Children = new Dictionary<TKey, ITrieNode<TKey, TValue>>();
}
else
{
this.Children = new Dictionary<TKey, ITrieNode<TKey, TValue>>(capacity);
}
}
#endregion Init
#region Properties
public ITrieNode<TKey, TValue> this[TKey key]
{
get
{
if (!this.Children.ContainsKey(key))
{
return null;
}
return this.Children[key];
}
// added "internal" to get around change in C# 3.0 modifiers
// this worked fine in C# 2.0 but they fixed that bug
// http://blogs.msdn.com/ericlippert/archive/2008/03/28/why-can-t-i-access-a-protected-member-from-a-derived-class-part-two-why-can-i.aspx
protected internal set { this.Children[key] = value; }
}
public TValue Value
{
get { return this.value; }
// added "internal" to get around change in C# 3.0 modifiers
// this worked fine in C# 2.0 but they fixed that bug
// http://blogs.msdn.com/ericlippert/archive/2008/03/28/why-can-t-i-access-a-protected-member-from-a-derived-class-part-two-why-can-i.aspx
protected internal set
{
if (!EqualityComparer<TValue>.Default.Equals(this.value, default(TValue)))
{
throw new InvalidOperationException("Trie path collision: the value for TrieNode<" + value.GetType().Name + "> has already been assigned.");
}
this.value = value;
}
}
public bool HasValue
{
get
{
return !EqualityComparer<TValue>.Default.Equals(this.value, default(TValue));
}
}
#endregion Properties
#region Methods
/// <summary>
/// Determines if child exists
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
public bool Contains(TKey key)
{
return this.Children.ContainsKey(key);
}
#endregion Methods
}
internal interface ITrieNode<TKey, TValue>
{
#region Properties
ITrieNode<TKey, TValue> this[TKey key]
{
get;
}
TValue Value
{
get;
}
bool HasValue
{
get;
}
#endregion Methods
#region Methods
bool Contains(TKey key);
#endregion Methods
}
}
@@ -33,6 +33,7 @@ namespace Umbraco.Core.Models
private DataTypeDatabaseType _databaseType;
[Obsolete("Property editor's are defined by a string alias from version 7 onwards, use the alternative contructor that specifies an alias")]
[EditorBrowsable(EditorBrowsableState.Never)]
public DataTypeDefinition(int parentId, Guid controlId)
{
_parentId = parentId;
@@ -47,6 +48,9 @@ namespace Umbraco.Core.Models
_additionalData = new Dictionary<string, object>();
}
[Obsolete("Don't use this, parentId is always -1 for data types")]
[EditorBrowsable(EditorBrowsableState.Never)]
public DataTypeDefinition(int parentId, string propertyEditorAlias)
{
_parentId = parentId;
@@ -55,6 +59,14 @@ namespace Umbraco.Core.Models
_additionalData = new Dictionary<string, object>();
}
public DataTypeDefinition(string propertyEditorAlias)
{
_parentId = -1;
_propertyEditorAlias = propertyEditorAlias;
_additionalData = new Dictionary<string, object>();
}
private static readonly PropertyInfo NameSelector = ExpressionHelper.GetPropertyInfo<DataTypeDefinition, string>(x => x.Name);
private static readonly PropertyInfo ParentIdSelector = ExpressionHelper.GetPropertyInfo<DataTypeDefinition, int>(x => x.ParentId);
private static readonly PropertyInfo SortOrderSelector = ExpressionHelper.GetPropertyInfo<DataTypeDefinition, int>(x => x.SortOrder);
@@ -7,25 +7,6 @@ using System.Reflection;
namespace Umbraco.Core.Models
{
/// <summary>
/// Used to attribute properties that have a setter and are a reference type
/// that should be ignored for cloning when using the DeepCloneHelper
/// </summary>
/// <remarks>
///
/// This attribute must be used:
/// * when the property is backed by a field but the result of the property is the un-natural data stored in the field
///
/// This attribute should not be used:
/// * when the property is virtual
/// * when the setter performs additional required logic other than just setting the underlying field
///
/// </remarks>
internal class DoNotCloneAttribute : Attribute
{
}
public static class DeepCloneHelper
{
/// <summary>
+2 -2
View File
@@ -19,7 +19,7 @@ namespace Umbraco.Core.Models
private IEnumerable<IDictionaryTranslation> _translations;
public DictionaryItem(string itemKey)
: this(new Guid("41c7638d-f529-4bff-853e-59a0c2fb1bde"), itemKey)
: this(new Guid(Constants.Conventions.Localization.DictionaryItemRootId), itemKey)
{}
public DictionaryItem(Guid parentId, string itemKey)
@@ -99,7 +99,7 @@ namespace Umbraco.Core.Models
//If ParentId is not set we should default to the root parent id
if(ParentId == Guid.Empty)
_parentId = new Guid("41c7638d-f529-4bff-853e-59a0c2fb1bde");
_parentId = new Guid(Constants.Conventions.Localization.DictionaryItemRootId);
}
}
@@ -18,12 +18,14 @@ namespace Umbraco.Core.Models
public DictionaryTranslation(ILanguage language, string value)
{
if (language == null) throw new ArgumentNullException("language");
_language = language;
_value = value;
}
public DictionaryTranslation(ILanguage language, string value, Guid uniqueId)
{
if (language == null) throw new ArgumentNullException("language");
_language = language;
_value = value;
Key = uniqueId;

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