Compare commits

..

447 Commits

Author SHA1 Message Date
Sebastiaan Janssen 4935525591 Merge pull request #147 from AndyButland/u4-2958
Fix for issue U4-2958 Member can edit & Show on profile do not persist on Member Type editor
2013-10-05 10:04:08 -07:00
Andy Butland 693778fe74 Fixed issue where member type properties would not persist after first save without reloading page 2013-10-02 21:20:05 +02:00
Sebastiaan Janssen 8eee7cae2f Merge branch '6.1.6' 2013-09-30 16:10:14 +02:00
Sebastiaan Janssen 226e35d65a NuSpec update: we can only accept a specific version of MySQL 2013-09-30 14:32:06 +02:00
Sebastiaan Janssen cdda69c4cd U4-2788 Error installing Umbraco 6.1.5 with SQL CE 4 option 2013-09-30 12:39:28 +02:00
Shannon 0cff484113 fixes unit test 2013-09-30 12:12:17 +02:00
Shannon 830fde372e Fixes EditUser.aspx 2013-09-30 11:49:31 +02:00
Shannon 35f65a2c64 re-enables LoadMinimalDocument and adds this to the optimized check, even in optimized model the OnRenderNode can still execute with a minimal doc. 2013-09-30 10:55:38 +02:00
Shannon e5320f0abd Obsoletes the LoadMinimalDocument flag since it no longer serves a purpose. 2013-09-30 10:55:26 +02:00
Sebastiaan Janssen 965a7fc500 Fixes: U4-2925 Tree performance is very poor in 6.1.x when having event subscriptions 2013-09-30 10:55:13 +02:00
Sebastiaan Janssen abbf8aeb42 U4-2709 Error after upgrading from 6.1.3 to 6.1.4 2013-09-30 10:49:33 +02:00
Sebastiaan Janssen 328ada2f38 Bump version number 2013-09-30 10:46:08 +02:00
Sebastiaan Janssen 767252cdf1 Creates IDisposeOnRequestEnd and ensures UmbracoContext and UmbracoDatabase implement it, then we only dispose of these types of objects at the end of the request if they are part of the httpcontext items (U4-2738). Fixes: U4-2988 UmbracoObjectTypesExtensions is not thread safe 2013-09-30 10:31:45 +02:00
Sebastiaan Janssen 010d47c68b Fixes U4-2822 Datepicker throws "Specified cast is not valid" when saving through API 2013-09-30 10:23:43 +02:00
Shandem a353f6fb74 Merge pull request #135 from Myster/master
Fix multiple words in search U4-2509
2013-09-11 19:33:47 -07:00
Murray Roke a64efb93b3 Improved search with "and", partial match U4-2509
- added partial matching on each word.
- fixed bug so 'all' words match rather than 'any' words.
2013-09-12 14:30:42 +12:00
Murray Roke cf9f11ff45 Improved admin search splitting query U4-2509 2013-09-12 13:22:14 +12:00
Murray Roke d7481b5ca4 Fix multiple words in search U4-2509
When multiple words are entered in the search field no results are
returned.
This pull req. contains the fix suggested by Tony.
2013-09-12 10:22:59 +12:00
Niels Hartvig 2fb55cb831 Enhanced permission checking on views and snippets
Thanks to Richard Turnbull from NGS Secure Research who discovered a
minor issue that made it possible for authenticated Umbraco Users to
view files beyond their permissions
2013-09-02 14:23:27 +02:00
Sebastiaan Janssen 0e6a926a3f Merge branch '6.1.5' 2013-09-02 12:24:26 +02:00
Sebastiaan Janssen 173ac65eb5 Remove misleading comment as this has been moved out of the if statement 2013-09-02 11:41:13 +02:00
Sebastiaan Janssen 7c28e1aeba Fixed U4-2763 Content rollback generates duplicates 2013-09-02 10:56:42 +02:00
Shannon 5989d19f7f Re-fixes the issue with using IDataValueSetter.SetValue on the DefaultData implementation and ensures that when there is a null value that it reverts to an empty string since this was what the default value was in the Value getter of DefaultData when there was no value. Have added a couple unit tests to support. 2013-09-02 13:27:48 +10:00
Shannon da1c33a034 Fixes unit test 2013-09-02 12:57:56 +10:00
Sebastiaan Janssen 2111a5e31e Fix MySQL install failing on UmbracoServer table 2013-09-01 17:28:22 +02:00
Sebastiaan Janssen 5478de911b Merge pull request #115 from stocksr/6.2.0
U4-516 - Fix DatePicker with time default value
2013-09-01 17:24:03 +02:00
Sebastiaan Janssen 7765acb130 Merge pull request #124 from AndyButland/wip-u4-2759
U4-2759 - member authorise attribute was not restricting for group
2013-09-01 17:23:53 +02:00
Morten Christensen 5640daff32 Fixes U4-2752 ContentService.DeleteVersion and DeleteVersions fail
Signed-off-by: Sebastiaan Janssen <sebastiaan@umbraco.com>
2013-08-31 19:19:25 +02:00
Morten Christensen a1cae3f286 Fixes U4-2731 Document.BeforeMove + Document.AfterMove Doesn't get fired.
Using the legacy Document and Media classes for the .Move and .Copy calls as they already use the new services under the hood, so shouldn't make any noticeable difference except that the legacy events will also work.

Signed-off-by: Sebastiaan Janssen <sebastiaan@umbraco.com>
2013-08-31 19:18:47 +02:00
Shannon d22dbb4654 Fixes U4-2734 Don't set the cache references to null when disposing the UmbracoContext 2013-08-31 11:11:25 +02:00
Stephan 4d5a8298b0 U4-2549 - fix it differently 2013-08-30 12:22:58 +02:00
Stephan 9e2733ce69 U4-2549 - fix issue with last chance content finder
Conflicts:
	src/Umbraco.Web/Umbraco.Web.csproj

Conflicts:
	src/Umbraco.Web/Umbraco.Web.csproj
2013-08-30 12:22:36 +02:00
Sebastiaan Janssen fbfdd8d398 Bump version number 2013-08-30 12:00:33 +02:00
Stephan 2552dffdad U4-2691 - fix issue with alt template and internal redirects 2013-08-30 11:59:28 +02:00
Sebastiaan Janssen 52540165f1 Creating a partial view now inherits from UmbracoTemplatePage (in 6.2.0 there will be 2 snippets, one for UmbracoViewPage<dynamic>, for MVC experts and one for UmbracoTemplatePage, the default). 2013-08-30 11:47:39 +02:00
Shannon 2b408df24c Fixes: U4-2727 PluginManager's TypeList can contain duplicates - updates the locks to be upgradeable read locks, changes over all lists/collecitons to be HashSet<T> this ensures no duplicates and also improves performance. 2013-08-30 10:51:06 +02:00
Shannon d559411187 Fixes U4-2300 6.1.0: Changing a template's parent causes tree to collapse 2013-08-30 10:45:13 +02:00
Sebastiaan Janssen 3a4a6579d3 Fixes: U4-2711 DAMP throws unknown exception on image upload with image cropper 2013-08-30 10:40:29 +02:00
Sebastiaan Janssen 1e76cf67d3 Fix merge problem 2013-08-23 08:57:02 +02:00
Sebastiaan Janssen 61149f8112 Merge branch '6.1.4'
Conflicts:
	.gitignore
	src/Umbraco.Web.UI/install/steps/database.ascx
	src/Umbraco.Web/Umbraco.Web.csproj
	src/Umbraco.Web/umbraco.presentation/umbraco/controls/Images/ImageViewer.ascx.cs
	src/umbraco.editorControls/mediapicker/mediaChooser.cs
2013-08-22 14:46:11 +02:00
Sebastiaan Janssen adb059e0da Revert U4-2511 Locallink:NODEID not working as it was breaking expectations of people running site without this fix 2013-08-22 13:13:32 +02:00
Morten Christensen 4337976887 Merge branch '6.1.4' of https://github.com/umbraco/Umbraco-CMS into 6.1.4 2013-08-22 12:59:08 +02:00
Morten Christensen efe5de87a6 Updating readme for nuget packages 2013-08-22 12:58:53 +02:00
Sebastiaan Janssen 389642946e Merge pull request #85 from rolfis/patch-1
Update sv.xml
2013-08-21 09:03:37 -07:00
rolfis 53d30aa3cb Update sv.xml
Changed {0} to %0% in login screen bottomText to display correct end year of copyright notice.
2013-08-21 16:55:53 +02:00
Shannon e233cffb9d Changes the cache keys in PluginManager to reference a const to make it a bit more clear. 2013-08-21 11:19:27 +10:00
Shannon 9e58ebed24 Merge branch '6.1.4' of https://github.com/umbraco/Umbraco-CMS into 6.1.4 2013-08-21 11:14:59 +10:00
Shannon f51c4e332e Fixes: U4-2653 BeginUmbracoForm should use absolute path with query string URLs without the protocol 2013-08-21 11:14:37 +10:00
Sebastiaan Janssen 03a0a0a0e9 Fix a strange VS2012 build targets problem 2013-08-20 18:06:09 +02:00
Sebastiaan Janssen dcb381770f Fix unit test that was looking at the wrong filename 2013-08-19 12:54:20 +02:00
Sebastiaan Janssen 65db0e69a9 Fixes: U4-2642 Make SQL CE more resilient to server crashes 2013-08-19 12:26:01 +02:00
Sebastiaan Janssen 23c6a91e9c Fixes merge issue 2013-08-19 11:47:53 +02:00
Sebastiaan Janssen a03c6dcf13 Merge pull request #80 from ThomasSkyldahl/6.1.4
UmbracoViewPage.WriteLiteral(object value)  optimized memory usage and combined markup injection
2013-08-19 02:34:13 -07:00
Sebastiaan Janssen 3029d97f33 Merge pull request #78 from dprothero/6.1.4
Fixed membership provider to correctly log failed attempts.
2013-08-19 02:06:15 -07:00
Sebastiaan Janssen f41d967864 Fixes: U4-2637 Error adding a User using AD Membership Provider when no Email Address Defined 2013-08-19 10:41:49 +02:00
Thomas Skyldahl Sørensen 4a481b05d4 Optimized WriteLiteral 2013-08-16 10:09:09 +02:00
Shannon 66c6b5b524 Fixes: U4-2632 Remove the recursive permissions check on the move/copy dialog 2013-08-16 12:46:40 +10:00
Shannon e3b0f71549 Merge branch '6.1.4' of https://github.com/umbraco/Umbraco-CMS into 6.1.4 2013-08-16 12:25:55 +10:00
Shannon 973b466798 Fixes: U4-2627 Ensure that the plugins cache files are named with the machine name 2013-08-16 12:25:38 +10:00
Shandem fa0eef4333 Merge pull request #79 from sniffdk/6.1.4
Moved WriteLiteral method to UmbracoViewPage
2013-08-15 19:12:54 -07:00
Mads Krohn a343a76a26 Moved WriteLiteral method to UmbracoViewPage
When we use a custom model through a custom controller, in our view, we
inherit from UmbracoViewPage, so the WriteLiteral method, which provides
preview badge and miniprofiler code, should be placed there.
2013-08-16 00:01:31 +02:00
Morten Christensen d0a9e3236e Promise for the changed unit test was incorrect, so correcting it in this commit 2013-08-15 10:26:24 +02:00
Morten Christensen b899805ec9 Correcting issue introduced in d3b69e04e1 where the returned IProfile would contain the Username and not the Name. This will have changed the Creator and Writer name in the xml cache to be the Login instead of the Name of the user, so for those that use these fields its important to republish to update the xml cache.
Fixes U4-2628 creatorName and writerName should use username - not loginname. Also verified through file history back to v4.
2013-08-15 10:08:59 +02:00
Morten Christensen 766497e355 Refactoring QueryHelper to be a base class instead.
Fix U4-2607 Creating nodes with special characters causes YSOD
2013-08-14 17:07:21 +02:00
Morten Christensen 67a2a9cfe4 Refactoring the optimized Recycle Bin, so that the Recycle Bin's repository is more independent and easier to use with the new events added to the Content- and MediaService. 2013-08-14 16:12:13 +02:00
dprothero 766ba0c8f5 Fixed membership provider to correctly log failed attempts. 2013-08-13 13:46:32 -07:00
Morten Christensen ca71c59880 Fixes U4-2218 Document Type copy looses property tab assignment 2013-08-13 17:41:35 +02:00
Morten Christensen 6c87cf729a Fixes U4-2592 Cannot delete a node when the node has just a closing bracket in the name. 2013-08-13 11:27:39 +02:00
Shannon 5c63afa31a removed my test examine settings 2013-08-13 18:26:32 +10:00
Shannon fa88768c91 removed my test examine settings 2013-08-13 18:25:39 +10:00
Shannon bfabfd9fa5 Updated to latest Examine version (contains bug fix for U4-2180 Problem with Examine MultiIndexSearcher after upgrading from 4.11.3 to 4.11.8) and removes the partially trusted callers attribute from the PDF lib because itextsharp by default doesn't support med trust. 2013-08-13 15:41:40 +10:00
Shannon aa1c411c8c Fixes U4-2618 PDF indexer does not ensure spaces are added to textual content and fixes med trust compat relating to U4-2180 Problem with Examine MultiIndexSearcher after upgrading from 4.11.3 to 4.11.8 2013-08-13 13:47:57 +10:00
Shannon c52c452b36 Fixes issue relating to the fix for U4-2589 where we need to clear the published db flag for previous versions when creating a new published version. 2013-08-13 11:01:49 +10:00
Morten Christensen 86811fe507 Fixes U4-2397 IContent Properties added with incorrect Value when read from Cache, and adds unit test for verifying types saved and returned for 24 standard DataTypes. 2013-08-12 16:20:32 +02:00
Morten Christensen 363de53b82 Updates query to limit results in subquery for MySql according to U4-2329 Browsing Media Slow in 6.1.1 2013-08-12 12:42:21 +02:00
Shandem 958fb66f2c Merge pull request #73 from florisrobbemont/6.1.3
U4-2596: UmbracoControllerFactory method ReleaseController should be virtual
2013-08-11 18:13:06 -07:00
Morten Christensen 30e12c1367 Final piece to the puzzle for U4-2571 Need to optimize empty recycle bin. Needed to hack around the ordering of items in the recycle bin because of the self-referencing constraint - parentID to id in the umbracoNode table by updating all parentID entries, which bypasses any reference issues with the foreignkey. 2013-08-11 21:12:02 +02:00
Morten Christensen 89ff7d85e2 Correcting DELETE FROM query so it works with sql ce as well. 2013-08-09 17:44:57 +02:00
Shannon 61fbf2cfc6 reverts PersistDeletedItem transaction because i forgot that the Commit() method of the UOW already takes care of the transaction. 2013-08-09 10:52:24 +10:00
Shannon ce847e97a8 Updates the PetaPocoRepositoryBase to ensure that the deletion process is wrapped in a transaction so if any of the processes fail, it all gets rolled back. 2013-08-09 10:07:03 +10:00
Shannon 1e61563f79 Ensures the deletions are wrapped in a transaction - for performance and to mitigate db corruption if one of the deletes fails. 2013-08-09 10:01:28 +10:00
Morten Christensen b4f9985695 Last bits to implement U4-2571 Need to optimize empty recycle bin 2013-08-08 15:12:26 +02:00
Morten Christensen 82f19ede8c Merge branch '6.1.4' of https://github.com/umbraco/Umbraco-CMS into 6.1.4 2013-08-08 10:22:38 +02:00
Shannon 0fbc32a87f Fixes up logic for creating new versions (U4-2589 Save and Publish is not creating version of document) 2013-08-08 10:42:06 +10:00
Floris Robbemont dc2de4b5e7 U4-2596: UmbracoControllerFactory method ReleaseController should be virtual 2013-08-07 15:06:41 +02:00
Shannon 5fce741940 another sln update 2013-08-07 11:53:09 +10:00
Shannon 14e4a8061c removes the vs profiling files from the sln. 2013-08-07 11:49:48 +10:00
Shannon 1b9f071581 Fixes: U4-2589 Save and Publish is not creating version of document and adds a few unit tests 2013-08-07 11:39:25 +10:00
Morten Christensen 79141ef86d Initial work on U4-2571 Need to optimize empty recycle bin 2013-08-06 15:08:05 +02:00
Sebastiaan Janssen 08609a887c Merge branch '6.1.4' of github.com:umbraco/Umbraco-CMS into 6.1.4 2013-08-06 10:24:42 +02:00
Sebastiaan Janssen b11932240c Fixes U4-2587 Regression: Hide Preview Button on nodes that have no template
Now also checks if the template still exists and if it's allowed on that document to determine when to enable the preview button
2013-08-06 10:24:20 +02:00
Shannon d47b4517c1 Fixes unit tests 2013-08-06 13:06:25 +10:00
Morten Christensen 226a13c6e1 Minor adjustment related to U4-2560 Working with ContentService can give 2 versions of a document as "newest" 2013-08-05 14:30:03 +02:00
Shannon d78a03a610 Massively improves performance for the packaging service (converting docs to XML) which is used in republishing the tree. 2013-08-05 13:11:47 +10:00
Shannon b7a1123319 U4-2579 BulkPublishController causes YSOD when there are invalid child elements due to InvalidProperties having a null reference 2013-08-02 16:23:32 +10:00
Shannon 7e9cad34db Creates an SQL Server version check for bulk sql imports. 2013-08-02 16:01:54 +10:00
Shannon c4b44ea0e3 Fixes: U4-2577 Can't save umbraco user - without re-filling in the password
Fixes: U4-541 Wrong dictionary key when using in backend template names
This changes the way that the value that is stored in the auth cookie. Previously we just stored a GUID which was the user's contextid stored in the db, now we store encrypted values of a few necessary user objects. In 6.2 we'll actually set a real .Net user object on the HttpContext. For now, the http module will simply just ensure that the culture is set correctly for the currently logged in user.
2013-08-02 15:16:04 +10:00
Sebastiaan Janssen 3435a75e9e U4-2553 Double tabs when installing package that makes use of Dictionary Items to translate document types
Forgto to commit a file :)
2013-08-01 14:39:22 +02:00
Sebastiaan Janssen bdb6c5768a U4-2553 Double tabs when installing package that makes use of Dictionary Items to translate document types
Added GetRawCaptionById method for the packager so the generated XML is correct
2013-08-01 13:40:23 +02:00
Sebastiaan Janssen 87a3c53e22 Merge branch '6.1.4' of github.com:umbraco/Umbraco-CMS into 6.1.4 2013-07-31 18:31:56 +02:00
Sebastiaan Janssen 898d25f3cb Include lang files in project so they'll actually end up in the final build 2013-07-31 18:31:39 +02:00
Shannon 9bc3fdd555 Makes UmbracoContext disposable and fixes the module's DisposeHttpContextItems to actual perform the disposal of each item. 2013-07-31 17:34:42 +10:00
Shannon cbda86fe92 Fixes build error, streamlines all calls to validate a user for base controllers. 2013-07-31 17:24:36 +10:00
Shannon b48f0f52e0 updates uri extensions + tests
Conflicts:
	src/Umbraco.Core/UriExtensions.cs
2013-07-31 17:08:10 +10:00
Shannon e2eeafcbfc Fixes: U4-2232 UmbracoAuthorizeAttribute breaks Relfection methods - ensures that no singleton instances are passed into attributes since they only ever get created once, meaning we're left with a stale version in the attribute. 2013-07-31 16:45:11 +10:00
Shannon ad697db42b Fixes an issue with WebSecurity logout 2013-07-31 11:10:33 +10:00
Shannon 9bb31e9456 Merge branch '6.1.4-cmsContentXml_Optimizations' into 6.1.4 2013-07-29 17:45:48 +10:00
Shannon a195d33332 Added another benchmark for removing/re-inserting records for cmsContentXml table using one transaction which again improves performance. Now have changed the rebuild xml method in the content service to : Lookup all data that it needs to insert first, then we begin a transaction and inside of the one transaction we clear the data and re-insert it so if anything fails in this process it should be rolled back. 2013-07-29 17:45:05 +10:00
Shannon 82a87cbd92 Doh, missed file 2013-07-29 16:46:30 +10:00
Shannon 5b26436862 Removes all references to the legacy Document.RepublishAll and replaces it's logic with the correct logic. 2013-07-29 16:45:54 +10:00
Shannon eed61f9053 Adds unit test for U4-2556 to ensure that it is solved. 2013-07-29 16:42:53 +10:00
Shannon 55c68485e9 Changed the logic of the GetByPublishedVersion to only return from cache if the cache item is published. 2013-07-29 16:03:37 +10:00
Shannon b9ba350a2f Updated the RebuildXmlStructures method with performance improvements. Added cache checking to the GetByPublishedVersion method since published content should always be 'latest' this will speed things up tremendously if items are found there. Added 2 more performance tests which show very large perf improvements, namely the Get_All_Published_Content_Of_Type shows a 77% improvement. 2013-07-29 15:49:56 +10:00
Shannon 696306e7c9 Implements the bulk insert procedure for re-populating the cmsContentXml tables, removes the need to rebuild all xml structures when sorting if in LB environments 2013-07-29 13:25:02 +10:00
Sebastiaan Janssen 9bf86aff09 Merge branch '6.1.4' of github.com:umbraco/Umbraco-CMS into 6.1.4 2013-07-26 15:17:20 +02:00
Sebastiaan Janssen f50de5b049 U4-2550 Could not load file or assembly 'HtmlAgilityPack, Version=1.4.5.0 2013-07-26 15:16:55 +02:00
Sebastiaan Janssen d734ba6136 U4-2543 In the back office its possible to get Response Validation errors 2013-07-26 12:43:19 +02:00
Morten Christensen c49becea53 Cleanup of unused using statements in a few files 2013-07-26 12:35:40 +02:00
Shannon 614aea203d Merge remote-tracking branch 'origin/6.1.4' into 6.1.4-cmsContentXml_Optimizations 2013-07-26 18:14:13 +10:00
Shannon ed88bbf75f Fixed up BaseDatabaseFactoryTests so that it only loads in one db factory with the correct conn strings, now we can easily override to use a custom db. Added benchmark tests for bulk inserting records for the cmsContentXml table which shows how we can improve performance quite a bit especially for larger node sets. Added more unit tests for bulk inserting and fixed it up a bit more. 2013-07-26 18:13:56 +10:00
Sebastiaan Janssen e41d3c7e84 Increase version to 6.1.4 2013-07-25 11:59:37 +02:00
Sebastiaan Janssen a099af39c2 xmlrpcnet was missing from nuspecs 2013-07-25 11:50:56 +02:00
Shannon 118f9b02e2 Fixes: U4-1027 Media Sort Usability -> changed the sorting to use Web API instead of asmx web service. 2013-07-25 12:29:41 +10:00
Sebastiaan Janssen 38778cc7c7 Fixes U4-2488 Edit datatype: Media Picker appears incorrectly 2013-07-24 14:52:25 +02:00
Shannon ffff9efaa8 Fixes: U4-2535 The actions/publish.aspx page does not publish correctly and show the correct publish result 2013-07-24 13:06:25 +10:00
Shannon 7f4abb4893 Fixed editContent.aspx to let the business logic handle the property validation when trying to publish and show the correct status message result (if it was not publishable). Adds the invalid properties collection to the PublishStatus so those can be shown too. 2013-07-24 12:54:10 +10:00
Shannon 4d39ce1202 Fixes Allow At Root styling 2013-07-24 11:44:26 +10:00
Shannon 7164f23a98 Fixes up validation styling and the validation summary close button display. 2013-07-24 11:31:31 +10:00
Shannon 8b2d1b8eab Fixed Template model class to not have it's own NodePath property which was always null since it wasn't mapped (and there was no point in it). 2013-07-24 10:11:05 +10:00
Shannon 80394f08fb Fixed runtime cache provider issues & unit tests. 2013-07-24 09:36:01 +10:00
Sebastiaan Janssen ca1fe5ff2a Unit test for: U4-2514 Checkboxlist prevalues in packages broken 2013-07-23 16:13:20 +02:00
Sebastiaan Janssen a1037ce43c Fixes U4-2187 - Enable support for MySQL on Linux 2013-07-23 15:38:26 +02:00
Sebastiaan Janssen 2cd2f3741d Merge branch '6.1.2' of https://github.com/stevetemple/Umbraco-CMS into stevetemple-6.1.3 2013-07-23 15:20:28 +02:00
Sebastiaan Janssen e634dba4ea 2nd attempt: U4-2514 Checkboxlist prevalues in packages broken 2013-07-23 13:16:18 +02:00
Shannon d1eb8fd9eb Obsoletes UmbracoFile with new UmbracoMediaFile in the Core assembly and wraps the legacy class to use the new one. Improves performance of UmbracoMediaFile by ensuring any IO is lazy loaded and then saved to a local property so it doesn't need to re-read the file for things like length/size.
Conflicts:
	src/Umbraco.Core/Umbraco.Core.csproj
2013-07-23 17:59:44 +10:00
Shannon 2e91c89c02 Fixes null check for changes to RuntimeCacheProvider 2013-07-23 14:00:52 +10:00
Shannon 8be54ba0cc Fixes: U4-1970 v6 API - need to implement caching for templates since we're doing a db lookup on a front-end request. This is a temporary fix until we implement the ApplicationCache properly but it still works by utilizing the existing RuntimeCacheProvider singleton. I've tweaked this provider as well to ensure we use the HttpRuntime.Cache when it is available (during a web session). We don't want to have a seperate caching bucket so that IIS can manage cache memory properly. Have ensured that the template cache is cleared when templates are updated/removed. 2013-07-23 11:46:18 +10:00
Shannon 3da7682415 reverted change for U4-2514 as this change will cause other unwanted problems. Added logging for DefaultDataKeyValue instead of blindly swallowing an exception. 2013-07-23 10:50:48 +10:00
Sebastiaan Janssen 775892ff5a U4-2514 Checkboxlist prevalues in packages broken 2013-07-22 16:23:16 +02:00
Sebastiaan Janssen f30b4c8184 Slight refactor of UmbracoFile 2013-07-22 13:55:10 +02:00
Sebastiaan Janssen 319ba5c791 U4-2524 If tinyMCEImageHelper.DoResize fails, the src gets removed from the img tag 2013-07-22 13:51:13 +02:00
Sebastiaan Janssen 398bc6d767 Fix merge issue 2013-07-22 12:15:54 +02:00
Sebastiaan Janssen 5d3ef8d97f Merge branch '6.1.3' of https://github.com/Myster/Umbraco-CMS into Myster-6.1.3
Conflicts:
	src/Umbraco.Web.UI/umbraco/config/lang/de.xml
	src/Umbraco.Web.UI/umbraco/config/lang/no.xml
2013-07-22 12:09:41 +02:00
Sebastiaan Janssen 08a300fbe5 U4-2370 Style sheet property sorting broken 2013-07-22 10:47:01 +02:00
Sebastiaan Janssen 845770c4bb Merge pull request #69 from abryukhov/patch-2
tinyMCE internal language pack - RU
2013-07-22 00:05:22 -07:00
Sebastiaan Janssen 771dc10c85 Merge pull request #68 from abryukhov/patch-3
tinyMCE internal language pack - RU
2013-07-22 00:04:23 -07:00
Sebastiaan Janssen 2ac76202e5 Merge pull request #67 from abryukhov/patch-4
tinyMCE internal language pack - RU
2013-07-22 00:04:11 -07:00
Sebastiaan Janssen a5ecbe96e2 Merge pull request #66 from abryukhov/patch-5
tinyMCE internal language pack - RU
2013-07-22 00:04:03 -07:00
Sebastiaan Janssen 7240b22e48 Merge pull request #65 from abryukhov/patch-6
tinyMCE internal language pack - RU
2013-07-22 00:03:51 -07:00
Sebastiaan Janssen 1f00589cb4 Merge pull request #64 from abryukhov/patch-7
tinyMCE internal language pack - RU
2013-07-22 00:03:33 -07:00
Sebastiaan Janssen 60b14487a9 Merge pull request #63 from abryukhov/patch-8
tinyMCE internal language pack - RU
2013-07-22 00:03:24 -07:00
Sebastiaan Janssen 33bc85a843 Merge pull request #62 from abryukhov/patch-9
tinyMCE internal language pack - RU
2013-07-22 00:03:14 -07:00
Sebastiaan Janssen e6642674d4 Merge pull request #61 from abryukhov/patch-10
tinyMCE internal language pack - RU
2013-07-22 00:03:01 -07:00
Sebastiaan Janssen 8ad5fb3c44 Merge pull request #60 from abryukhov/patch-11
tinyMCE internal language pack - RU
2013-07-22 00:02:50 -07:00
Sebastiaan Janssen 1752d14c57 Merge pull request #59 from abryukhov/patch-12
tinyMCE internal language pack - RU
2013-07-22 00:02:40 -07:00
Sebastiaan Janssen ec4ccba1a7 Merge pull request #58 from abryukhov/patch-13
tinyMCE internal language pack - RU
2013-07-22 00:02:32 -07:00
Sebastiaan Janssen 0244492a89 Merge pull request #57 from abryukhov/patch-14
tinyMCE internal language pack - RU
2013-07-22 00:02:22 -07:00
Sebastiaan Janssen 546cf2c84d Merge pull request #56 from abryukhov/patch-15
tinyMCE internal language pack - RU
2013-07-22 00:02:14 -07:00
Sebastiaan Janssen d354dde774 Merge pull request #55 from abryukhov/patch-16
tinyMCE internal language pack - RU
2013-07-22 00:02:03 -07:00
Sebastiaan Janssen 22c9e9acd9 Merge pull request #54 from abryukhov/patch-17
tinyMCE internal language pack - RU
2013-07-22 00:01:47 -07:00
Alexander Bryukhov 5dd14723e9 tinyMCE internal language pack - RU 2013-07-22 10:29:12 +07:00
Alexander Bryukhov 7134e80c44 tinyMCE internal language pack - RU 2013-07-22 10:27:31 +07:00
Alexander Bryukhov f7196ee8f9 tinyMCE internal language pack - RU 2013-07-22 10:26:47 +07:00
Alexander Bryukhov fdecd697b7 tinyMCE internal language pack - RU 2013-07-22 10:26:04 +07:00
Alexander Bryukhov 6c03dac869 tinyMCE internal language pack - RU 2013-07-22 10:25:18 +07:00
Alexander Bryukhov 6cdb564a9f tinyMCE internal language pack - RU 2013-07-22 10:24:31 +07:00
Alexander Bryukhov 0da8a8db36 tinyMCE internal language pack - RU 2013-07-22 10:23:51 +07:00
Alexander Bryukhov a4a9620889 tinyMCE internal language pack - RU 2013-07-22 10:22:46 +07:00
Alexander Bryukhov 2307424fb6 tinyMCE internal language pack - RU 2013-07-22 10:22:01 +07:00
Alexander Bryukhov ca124fb662 tinyMCE internal language pack - RU 2013-07-22 10:21:16 +07:00
Alexander Bryukhov 6787252f9b tinyMCE internal language pack - RU 2013-07-22 10:20:36 +07:00
Alexander Bryukhov ef3094f8d9 tinyMCE internal language pack - RU 2013-07-22 10:19:51 +07:00
Alexander Bryukhov a2a20133aa tinyMCE internal language pack - RU 2013-07-22 10:18:38 +07:00
Alexander Bryukhov bb750d186a tinyMCE internal language pack - RU 2013-07-22 10:17:56 +07:00
Alexander Bryukhov f2a7dde5ce tinyMCE internal language pack - RU 2013-07-22 10:16:00 +07:00
Alexander Bryukhov 73e2559a13 tinyMCE internal language pack - RU 2013-07-22 10:14:48 +07:00
Shannon 80f8a9d01c Merge branch '6.1.3' of https://github.com/umbraco/Umbraco-CMS into 6.1.3 2013-07-22 12:44:06 +10:00
Shannon 6f9883d373 Fixes MNTP required validation (U4-1975) 2013-07-22 12:30:12 +10:00
Shannon 41c920a4ec Updated to latest CDF version which contains some fixes. 2013-07-22 11:29:32 +10:00
Sebastiaan Janssen 1f79b71738 Merge branch '6.1.3' of github.com:umbraco/Umbraco-CMS into 6.1.3 2013-07-19 15:59:09 +02:00
Sebastiaan Janssen 64fb588556 defaultDocumentTypeProperty is no longer case-sensitive. Added to the Release config as well so it makes it into the umbraco downloadable package. 2013-07-19 15:41:29 +02:00
Sebastiaan Janssen 90cfd004cb Merge branch 'wip-u4-1949' of https://github.com/AndyButland/Umbraco-CMS into AndyButland-wip-u4-1949 2013-07-19 15:41:15 +02:00
Sebastiaan Janssen b5494546c7 defaultDocumentTypeProperty is no longer case-sensitive. Added to the Release config as well so it makes it into the umbraco downloadable package. 2013-07-19 15:40:12 +02:00
Sebastiaan Janssen 7bac1ef1cd Merge branch 'wip-u4-1949' of https://github.com/AndyButland/Umbraco-CMS into AndyButland-wip-u4-1949 2013-07-19 15:22:05 +02:00
Sebastiaan Janssen ad927ec6c1 Merge pull request #53 from abryukhov/patch-1
Update of ru.xml with latest keys
2013-07-19 06:20:55 -07:00
Sebastiaan Janssen 8a19d28859 Merge pull request #52 from enkelmedia/patch-1
Update to readme to contain info about the support for MVC
2013-07-19 06:20:37 -07:00
Sebastiaan Janssen 7e24af9daf Merge branch '6.1.3' of github.com:umbraco/Umbraco-CMS into 6.1.3 2013-07-19 15:19:27 +02:00
Sebastiaan Janssen 7518b514a7 Merge pull request #51 from kipusoep/master
Updated the download link
2013-07-19 15:19:01 +02:00
Sebastiaan Janssen da15d40b04 Merge pull request #51 from kipusoep/master
Updated the download link
2013-07-19 06:18:13 -07:00
Sebastiaan Janssen 96c38f50e4 Merge pull request #49 from lars-erik/6.1.3
Prettifying norwegian translation
2013-07-19 06:17:48 -07:00
Sebastiaan Janssen e723f1169f Merge pull request #48 from marc303/patch-1
Updated DE to 6.1.2
2013-07-19 06:16:48 -07:00
Sebastiaan Janssen 914005b2b6 Merge pull request #46 from michielvoo/u4-2417
U4-2417 Could the preview thumbnail link to the full image
Conflicts:
	src/Umbraco.Web/Umbraco.Web.csproj
	src/Umbraco.Web/umbraco.presentation/umbraco/controls/Images/ImageViewer.ascx.cs
	src/umbraco.editorControls/mediapicker/mediaChooser.cs
2013-07-19 15:09:07 +02:00
Sebastiaan Janssen 67bd303173 Merge pull request #46 from michielvoo/u4-2417
U4-2417 Could the preview thumbnail link to the full image
2013-07-19 06:02:51 -07:00
Sebastiaan Janssen 972b903f52 Merge pull request #32 from AndyButland/wip-u4-1285
Fix for U4-1285: Apostrophes in member groups cause exceptions
2013-07-19 14:40:28 +02:00
Sebastiaan Janssen 20e6843bf0 Merge pull request #32 from AndyButland/wip-u4-1285
Fix for U4-1285: Apostrophes in member groups cause exceptions
2013-07-19 05:39:38 -07:00
Sebastiaan Janssen 61d072c8d6 Fix merge issue 2013-07-19 13:32:24 +02:00
Sebastiaan Janssen 8740848aac Merge pull request #42 from michielvoo/u4-232
Enabled support for integrated security for SQL Server to the installer.
Conflicts:
	src/Umbraco.Web.UI/install/steps/database.ascx
2013-07-19 13:29:07 +02:00
Sebastiaan Janssen 85c80b07f9 Merge pull request #42 from michielvoo/u4-232
Enabled support for integrated security for SQL Server to the installer.
2013-07-19 04:26:50 -07:00
Sebastiaan Janssen 6766aa9732 Merge pull request #41 from michielvoo/u4-667
U4-667
2013-07-19 13:19:30 +02:00
Sebastiaan Janssen 557dccd88b Merge pull request #41 from michielvoo/u4-667
U4-667
2013-07-19 04:18:29 -07:00
Sebastiaan Janssen a57334d1f7 Merge pull request #40 from michielvoo/u4-663
U4-663
2013-07-19 12:55:16 +02:00
Sebastiaan Janssen 334f0bfd2b Merge pull request #40 from michielvoo/u4-663
U4-663
2013-07-19 03:53:15 -07:00
Sebastiaan Janssen 3dea16fad1 U4-2309 BackOffice / ExamineMngr : "Optimize index" don't ends correctly when website has not members. 2013-07-19 12:39:50 +02:00
Shannon 1bf4121796 Fixes a null check in UmbracoTemplatePage 2013-07-19 12:36:02 +10:00
Shannon 93bebdd50b Merge branch '6.1.3' of https://github.com/umbraco/Umbraco-CMS into 6.1.3 2013-07-19 12:27:59 +10:00
Shannon 6a9532f10a Fixes: U4-1599 [MVC] ChangeContentType doesn't work in macros rendered from a View -> We need to manually reset the ContentType after we execute a webforms based macro because Server.Execute resets the ContentType back to the default. 2013-07-19 12:27:37 +10:00
AndyButland 986d37afd6 Removed debugging console.log reference 2013-07-18 21:23:05 +02:00
Sebastiaan Janssen d88494e90e U4-638 Bug (and fix/solution): Saving inline base64 image (or any attribute value with equal sign at the end) 2013-07-18 17:09:26 +02:00
Sebastiaan Janssen e48f08b657 When using Public Access > Single User Protection the email of the member is empty, this caused errors because the result of GetMembersFromEmail is null 2013-07-18 16:07:39 +02:00
Sebastiaan Janssen a79e349f3d U4-2467 v4.11.1: Membership search does not search on email address anymore 2013-07-18 11:00:56 +02:00
Shannon 1c70570078 Fixes : U4-2055 Unpublish Date Bug in Umbraco 6.0.3 -> with unit test to ensure that all dates are formatted as ISO date standards when used in SQL 2013-07-17 14:16:38 +10:00
Alexander Bryukhov 197dacfae7 Update of ru.xml with latest keys 2013-07-17 09:56:50 +07:00
Shannon d8aad718d5 Fixed broken unit test 2013-07-17 11:28:46 +10:00
Sebastiaan Janssen 1d7bfc2781 U4-2465 "Login Name already exists" when creating a new member that existed before 2013-07-16 13:33:52 +02:00
Sebastiaan Janssen 8063717e4c U4-2511 Locallink:NODEID not working 2013-07-16 13:21:27 +02:00
Lars-Erik Aabech 3900b7ebc8 Remove WebForms from nuspec file
Not just WebForms anymore. :)
2013-07-16 13:09:53 +02:00
Shannon 0296c646cb Fixes up a small code issue for U4-2505 2013-07-16 11:45:28 +10:00
enkelmedia 275dbc83dd Update to readme to contain info about the support for MVC 2013-07-15 19:38:10 +02:00
Sebastiaan Janssen 1cd2dc8a42 Fixes U4-2436 Editing an existing property changes its alias 2013-07-15 16:52:23 +02:00
Sebastiaan Janssen 60867af1a7 Fixes U4-2444 Missing image - /umbraco/images/pinnedIcons/umb.ico
Also fixes casing of folder names
2013-07-15 16:31:19 +02:00
Sebastiaan Janssen 1e129bcc4d Fixes U4-2505 umbraco 6.1.2 throws System.NullReferenceException on the first publish after site compilation 2013-07-15 16:16:39 +02:00
Sebastiaan Janssen e5c758bbc1 Fixes U4-1838 uGoLive Success/Failure Images not showing 2013-07-15 16:07:42 +02:00
Shannon 25780663a6 Fixes: U4-1304 Umbraco.Field not replacing localLink when recursive:true . 2013-07-15 15:26:18 +10:00
Stefan Kip 63ea79a4d6 Updated the download link 2013-07-11 10:03:25 +02:00
Sebastiaan Janssen aa327696fe Fixes U4-2354 MiniProfiler - Show SQL parameter values and more stacktrace info
Refactored duplicate code
2013-07-10 12:35:21 +02:00
Lars-Erik Aabech 1272a7c74b Prettifying norwegian translation
Removed obsolete, translated new, removed incorrect spacing and
hyphenation, misc. improvements in term usage. Ref.
http://i18n.skulelinux.no/nb/Fellesordl.eng-no.html.
2013-07-09 12:56:13 +02:00
esn303 dcbe6726b0 Updated DE to 6.1.2
Markup encoded instead of CDATA blocks
2013-07-09 10:30:20 +02:00
Shannon ba68da5736 Makes Domain.GetDomains public (#U4-2483) 2013-07-09 11:55:29 +10:00
Shannon fdabd945dc Merge branch '6.1.3' of https://github.com/umbraco/Umbraco-CMS into 6.1.3 2013-07-09 11:48:03 +10:00
Shannon 868edee5e6 Fixes: #U4-2161 - permissions inheritance. Fixes up how user permissions cache is invalidated and looked up (it is now lazy and not forced). User permissions are also cached as a low priority for now and only for 20 mins based on #U4-2474. 2013-07-09 11:47:46 +10:00
Shannon b91d0bb117 Updates ContentRepository to bulk insert all parent permissions at once (overload to the AssignEntityPermissions method) 2013-07-09 10:08:31 +10:00
Murray Roke cc91977e94 Fix notification-email link to unpublished page
http://issues.umbraco.org/issue/U4-2482
I've added links to language files which did not contain it.
I used the %5% syntax in the sv.xml file which seems to otherwise use
{5} syntax
2013-07-09 11:19:51 +12:00
Shannon 90b94f6ffb Fixes: #U4-2476 2013-07-08 18:58:38 +10:00
Shannon 3c4cf56309 Fixes: #U4-2475 2013-07-08 18:47:53 +10:00
Shannon b7f6195791 Started adding base PermissionsRepository for sub classes to use for assigning permissions, created a BulkImport extension methods for PetaPoco with tests since we'll be needing that for assigning permissions in a nice way. Wrote unit tests for all sql gen for permissions and assigning permissions. This all starts fixing #U4-2161 but there's still a bit more work to do. 2013-07-08 17:29:26 +10:00
Morten Christensen 42eb82e6ca Merge branch '6.1.3' of https://github.com/umbraco/Umbraco-CMS into 6.1.3 2013-07-05 10:55:12 +02:00
Morten Christensen 93def731ef Fixes #U4-2466 2013-07-05 10:51:19 +02:00
Shannon 60805f91d6 bit of code cleaning. 2013-07-05 16:58:51 +10:00
Shannon 048480d5be Fixes: #U4-2460 - UmbracoHelper.RenderTemplate will now execute the complete MVC cycle when rendering MVC templates whereas before it would only execute the view which means any actionfilters, etc... applied would never have fired (as well as other things) 2013-07-05 14:12:31 +10:00
Morten Christensen 173d388c12 Fixes #U4-2450 2013-07-04 12:31:31 +02:00
Morten Christensen b1285fa7e3 Add missing id to unique naming overload 2013-07-04 12:31:10 +02:00
Morten Christensen e34c857f6c A bit of refactoring around unique naming, and implementing it for media as well 2013-07-04 11:22:59 +02:00
Morten Christensen 7ff0e6cd4b Fixes #U4-2458 2013-07-04 10:50:02 +02:00
Shannon 0683094f84 oops, overwrote previous changes to CmsNode, now merged them back in properly. 2013-07-04 12:20:25 +10:00
Shannon 983b7a85e1 Merge branch '6.1.3' of https://github.com/umbraco/Umbraco-CMS into 6.1.3 2013-07-04 12:13:24 +10:00
Shannon d015780b9f Fixes: #U4-2447 - non thread safe icon lookup 2013-07-04 12:13:02 +10:00
Michiel van Oosterhout e4df176a37 U4-2417: show media picker image as link to the original image.
Order of the views in the markup did not match the order of the Style enum.
ImageViewer control now selects the view by matching the ViewerStyle enum to a View ID. This way the order of the views in the markup is no longer important.

Also:
Removed user control from Umbraco.Web project, moved designer code and added code behind class for user control to Umbraco.Web.UI
Refactored code to use Umbraco.Core.IO
Removed some code that was commented out
2013-07-03 17:36:28 +02:00
Morten Christensen aeece499bb Fixing unit test for PublishedMedia cache, which had expected result set incorrect 2013-07-03 14:00:44 +02:00
Morten Christensen 8465b4e556 Merge branch '6.1.3' of https://github.com/umbraco/Umbraco-CMS into 6.1.3 2013-07-03 12:34:52 +02:00
Morten Christensen e280785f48 Adding Msdeploy PropertyGroup to build prop file, so both FileSystem and MsDeploy package will include the umbraco and umbraco_client folders 2013-07-03 12:30:34 +02:00
Shannon 5e0a59e4b3 Merge branch '6.1.3' of https://github.com/umbraco/Umbraco-CMS into 6.1.3 2013-07-03 19:47:25 +10:00
Morten Christensen 30835797ff Merge branch '6.1.3' of https://github.com/umbraco/Umbraco-CMS into 6.1.3 2013-07-03 11:47:09 +02:00
Shannon 4077a01a6b Fixes: #U4-2344 - fixes examine re-indexing for media and a null check for DataType.Data 2013-07-03 19:47:06 +10:00
Morten Christensen aed70ae40c Updating dependencies in our own nuspec file 2013-07-03 11:46:53 +02:00
Morten Christensen 6d44628352 Merge pull request #45 from jhauge/PublishUmbracoFiles
Add Umbraco files during publish
2013-07-03 02:39:12 -07:00
Jesper Hauge 7a398d34b1 Added file-reg to .nuspec 2013-07-03 11:33:05 +02:00
Morten Christensen 69c5aeb1b3 Updating nuget dependencies for test project 2013-07-03 11:29:58 +02:00
Shannon da545b890b Updated UserRepository to not contain the general query methods, we do those in the service. 2013-07-03 19:26:28 +10:00
Morten Christensen 6609bc09f2 Updating nuget dependency for HtmlAgilityPack 2013-07-03 11:26:17 +02:00
Morten Christensen f06a6f42da Updating nuget dependency for ClientDependency 2013-07-03 11:20:42 +02:00
Jesper Hauge c9065d96a9 These files will add MSBuild target that copies /umbraco /umbraco_client and /App_Browsers files to .csproj files, during install of NuGet package UmbracoCms
Functionality has been tested by creating af copy of the current Nuget package and add these files to the package, then using this package on a new Web application project. Building and doing a VS Publish to the filesystem.
2013-07-03 11:17:47 +02:00
Morten Christensen 9d4e1362c4 Updating nuget references for ASP.NET MVC, Razor, WebPages and WebApi to latest patch release 2013-07-03 11:11:37 +02:00
Shannon d3b69e04e1 Updated IUserService and added more unit tests for new methods. Fixed unit tests that were failing due to incorrectly set settings... not sure how this is working on the server but oh well. 2013-07-03 19:01:37 +10:00
Morten Christensen 0d54e8df89 Updating MySql package dependency 2013-07-03 11:00:26 +02:00
Morten Christensen 8f949d0a2f Merge branch '6.1.3' of https://github.com/umbraco/Umbraco-CMS into 6.1.3 2013-07-03 09:40:17 +02:00
Shannon d67480e98b Updated UserService, didn't need one of the methods on there, updated the unit tests to test all the other methods. 2013-07-03 17:09:14 +10:00
Shannon 5d76ead469 backported changes to IUserRepository from v7 2013-07-03 16:52:00 +10:00
Shannon 2796100067 added another unit test. 2013-07-03 16:45:56 +10:00
Shannon a132f609d7 backports changes for -> Finished upgrading the UserRepository and entities to properly support Users' Allowed Sections & streamlines Persistence/Mappers with less code duplication. 2013-07-03 16:40:22 +10:00
Morten Christensen 7f7456701d Adding license 2013-07-02 15:32:53 +02:00
Michiel van Oosterhout d926180e3a Added special overload for creating a connection string with integrated security.
Actually disable checkbox is the selected database type is not Microsoft SQL Server.
Refactored saveDBConfig for readability.
2013-06-28 16:40:23 +02:00
Sebastiaan Janssen ffce1a3e6b Open new branch for 6.1.3 2013-06-28 14:44:56 +02:00
Sebastiaan Janssen e553f2c671 Correct little mistake in nuspec file 2013-06-28 14:21:25 +02:00
Morten Christensen 42c6533e16 Correcting merge issues 2013-06-28 13:33:41 +02:00
Morten Christensen b0f4cb7d02 Merge branch '6.0.7' into 6.1.2 2013-06-28 13:30:04 +02:00
Morten Christensen f809dec874 Updating repository factory to inject unique name setting into ContentRepository 2013-06-28 13:28:03 +02:00
Morten Christensen 2477500045 Fixes #U4-2414 and removes internal usage of action handlers Yay! 2013-06-28 13:27:23 +02:00
Michiel van Oosterhout 72bb1b3583 U4-667
Added a script to make the checkbox "Render content in editor" dependent on the "Use in editor" checkbox.
Also refactored the create.aspx code-behind so it's easier to see what control is loaded in the dialog when debugging.
2013-06-28 10:44:24 +02:00
Michiel van Oosterhout 240e58e061 U4-663
Do not overwrite existing files when creating a new template.
2013-06-28 10:42:51 +02:00
Michiel van Oosterhout e980296d6d Enabled support for integrated security for SQL Server to the installer. 2013-06-28 10:39:48 +02:00
AndyButland d23482b7a6 Moved setting for DefaultDocumentTypeProperty from GlobalSettings to UmbracoSettings 2013-06-27 16:00:49 +02:00
Morten Christensen d89539a437 Merge branch '6.1.2' of https://github.com/umbraco/Umbraco-CMS into 6.1.2 2013-06-27 15:36:46 +02:00
Morten Christensen 4368f15097 Updating nuspec files which is a bit different for 6.1.x then 6.0.x 2013-06-27 15:36:25 +02:00
Morten Christensen b90150279b Merge branch '6.0.7' into 6.1.2
Conflicts:
	build/Build.proj
	build/NuSpecs/UmbracoCms.Core.nuspec
	src/Umbraco.Tests/Services/ContentTypeServiceTests.cs
2013-06-27 15:27:31 +02:00
Morten Christensen ca1b05e30d Correcting unit test after update to ContentType ctor 2013-06-27 15:23:15 +02:00
Morten Christensen 5c09ba9a2d Updating nuspec files and build 2013-06-27 15:15:27 +02:00
Sebastiaan Janssen cfa3e3aff1 Bump version number 2013-06-27 15:09:44 +02:00
Morten Christensen 59ff4a0484 It hurts having to do this, but Sebastiaan says I have to. So re-wiring the BulkPublishController to use the legacy Document class so legacy events are also fired. 2013-06-27 12:30:16 +02:00
Morten Christensen b1db99f639 Fixing issue in previous fix for #U4-2182 2013-06-27 10:57:49 +02:00
Morten Christensen ccbb838cef Fixing another part of #U4-2186 2013-06-27 10:56:45 +02:00
Steve Temple b12f60e443 Allow for absolute URLs as well as virtual in ResolveUrl to allow for FileSystemProviders that use CDNs 2013-06-27 00:04:37 +01:00
Sebastiaan Janssen 0d5ec8bfd5 Merge branch '6.0.7' into 6.1.2 2013-06-26 20:57:32 +02:00
Sebastiaan Janssen 5f67e85471 Merge branch '6.0.7' of github.com:umbraco/Umbraco-CMS into 6.0.7 2013-06-26 20:55:11 +02:00
Sebastiaan Janssen d9228c368f Fixes U4-2404 Photo gallery broken on Azure - Since the template saving routine is doing ToSafeAlias, we should also do it when setting the default template 2013-06-26 20:54:36 +02:00
AndyButland 212800f706 Added config setting for default document type property; used setting to set default new property type 2013-06-26 17:25:44 +02:00
Morten Christensen 8226505e5b Merge branch '6.0.7' into 6.1.2 2013-06-26 15:55:49 +02:00
Morten Christensen 41b8de09b7 Fixes U4-2234 including test case from issue 2013-06-26 15:49:00 +02:00
Morten Christensen bbf06cd13d Fixes U4-2234 2013-06-26 14:31:36 +02:00
Morten Christensen 639cb17741 Fixes U4-2182 and U4-2167 2013-06-26 14:31:10 +02:00
Morten Christensen 4643d34546 Moving generation of xml from ContentExtensions to the PackagingService 2013-06-26 13:30:54 +02:00
Sebastiaan Janssen 50035eae49 Merge pull request #33 from bokmadsen/6.0.7
Bugfix for previous pullrequest "Duplicate e-mail addresses: U4-315, U4-...
2013-06-26 02:43:34 -07:00
Bo Kingo Damgaard 2d857a8635 Bugfix for previous pullrequest "Duplicate e-mail addresses: U4-315, U4-2147, U4-304"
There was a bug in the previous pullrequest that didn't allow a member
to saved if the email wasn't changed. Furthermore duplicate emails are
now prevented if requireUniqueEmail was false, but is switched to true
(when saving a member)
2013-06-26 10:47:27 +02:00
AndyButland d47ff4005c Support for deleting member groups with apostrophes 2013-06-26 06:16:39 +02:00
AndyButland dfeb1c7a0b Support for displaying and editing member groups with apostrophes 2013-06-26 06:16:23 +02:00
Morten Christensen e4387b8dae Adding some internal bits in the ServiceContextManager and PackagingService 2013-06-25 13:43:57 +02:00
Morten Christensen 188aca499a Merge branch '6.0.7' into 6.1.2 2013-06-25 11:54:24 +02:00
Morten Christensen 3040d362ef Fixes #U4-2361 2013-06-25 11:48:37 +02:00
Shannon a57aa07721 Updated default controller resolver to use new IRenderMvcController interface, fixed some merge issues. 2013-06-25 09:55:45 +10:00
Shannon f2b8e3407b Merge remote-tracking branch 'origin/6.0.7' into 6.1.2
Conflicts:
	src/Umbraco.Web/Mvc/RenderControllerFactory.cs
	src/Umbraco.Web/Mvc/RenderMvcController.cs
	src/Umbraco.Web/Mvc/RenderRouteHandler.cs
	src/Umbraco.Web/Umbraco.Web.csproj
2013-06-25 09:41:27 +10:00
Shannon 1ec7cd3b89 Implements: #U4-2342 - IRenderMvcController 2013-06-25 09:33:48 +10:00
Sebastiaan Janssen bd77463fa4 Merge branch '6.0.7' into 6.1.2
Conflicts:
	build/NuSpecs/UmbracoCms.Core.nuspec
	src/Umbraco.Core/Models/ContentTypeBase.cs
	src/Umbraco.Core/Models/IContentTypeBase.cs
	src/Umbraco.Core/Models/PropertyGroupCollection.cs
2013-06-24 12:06:58 +02:00
Sebastiaan Janssen 368954226a Update to not require specific version of MVC4, just 4.0.20710.0 and higher 2013-06-24 12:05:22 +02:00
Sebastiaan Janssen 496d51c2a0 Merge pull request #25 from kipusoep/Duplicate-words-domainHelp
Duplicate words removed
2013-06-24 01:30:04 -07:00
Stefan Kip b01b4f7aa7 Forgot to update XML comments
Signed-off-by: Sebastiaan Janssen <sebastiaan@umbraco.com>
2013-06-24 10:29:03 +02:00
Stefan Kip 49a699c858 Added RemovePropertyGroup method
Signed-off-by: Sebastiaan Janssen <sebastiaan@umbraco.com>
2013-06-24 10:28:42 +02:00
Morten Christensen f68571ef7c Merge pull request #24 from kipusoep/U4-2421-RemovePropertyGroup
U4-2421 Added RemovePropertyGroup method
2013-06-24 01:18:21 -07:00
Stefan Kip 6cc1735363 Duplicate words removed 2013-06-23 21:49:43 +02:00
Stefan Kip d553dfd4b0 Forgot to update XML comments 2013-06-23 20:24:22 +02:00
Stefan Kip f3e737720b Added RemovePropertyGroup method 2013-06-23 16:38:11 +02:00
Stefan Kip 22cf59345c Removed space before UmbracoModule
Removed space before UmbracoModule
Conflicts:
	src/Umbraco.Web.UI/web.Template.config
2013-06-23 16:02:02 +02:00
Michiel van Oosterhout 16a46a4ea4 Changed default user email address to use the example domain, instead of domain.com 2013-06-23 16:01:04 +02:00
Sebastiaan Janssen 09d9728fb8 Merge branch '6.0.7' into 6.1.2
Conflicts:
	src/Umbraco.Web.UI/Umbraco.Web.UI.csproj
2013-06-23 15:16:44 +02:00
Sebastiaan Janssen c0df3e0202 Match IIS Express port number to Umbraco version so it's easier to use a few copies of the repo locally
(you don't have to re-map your port to the correct folder)
2013-06-23 15:13:27 +02:00
Sebastiaan Janssen d09e283900 Merge branch '6.0.7' into 6.1.2
Conflicts:
	.hgtags
2013-06-23 15:00:14 +02:00
Sebastiaan Janssen 507c6c23b9 If you never had VS2010 installed, the build now works, checking if the Publishing Tasks dll exists now 2013-06-23 14:57:53 +02:00
Sebastiaan Janssen 3daf936623 Remove hgignore files 2013-06-23 14:52:45 +02:00
Sebastiaan Janssen e93c910347 Fix more unit tests 2013-06-22 17:32:22 +02:00
Sebastiaan Janssen 7139e30296 Don't delete the config file directory, it can't sometimes
For now, don't delete umbracoSettings.config either, it makes a lot of tests fail
2013-06-22 15:53:10 +02:00
Sebastiaan Janssen df1940a01c Fix unit test by ensuring config file is copied if it doesn't exist 2013-06-22 15:07:40 +02:00
Sebastiaan Janssen aafb5a0285 Merge branch '6.0.7' into 6.1.2
Conflicts:
	src/Umbraco.Tests/PublishedCache/PublishedContentCacheTests.cs
2013-06-22 14:22:43 +02:00
Sebastiaan Janssen 033f981718 Fix unit test 2013-06-22 14:19:22 +02:00
Sebastiaan Janssen 5bd55bdd09 Merge branch '6.0.7' into 6.1.2 2013-06-21 17:33:42 +02:00
Sebastiaan Janssen 76358e3e13 U4-2374 Mono port to do: dealing with empty string 2013-06-21 17:29:55 +02:00
Sebastiaan Janssen 35c0eb3b0c U4-2377 Mono port to do: Universal currency character does not work as split character unless given in unicode. 2013-06-21 17:22:13 +02:00
Sebastiaan Janssen 7fad8ca98b U4-2378 Mono port to do: TypeFinder needs exclusions for Monodevelop Nunit 2013-06-21 17:15:42 +02:00
Sebastiaan Janssen a2da27121e U4-2335 [Regression] YSOD when editing stylesheet property on 6.0.6 2013-06-21 17:00:40 +02:00
Sebastiaan Janssen 23ec07276a U4-2369 Wrong path for Umbraco/Config/Lang/xx.xml for publish notification mail 2013-06-21 16:56:59 +02:00
Sebastiaan Janssen 96cec0b407 U4-2410 EditRelationType.aspx missing virtual path - 6.0.6 2013-06-21 16:30:44 +02:00
Sebastiaan Janssen 47b94e68e3 Merge branch '6.0.7' of github.com:umbraco/Umbraco-CMS into 6.0.7 2013-06-21 15:26:10 +02:00
Sebastiaan Janssen 0f4b1752e0 U4-2416 Missing colon in file ListChildPagesOrderedByProperty causes Web site not to run 2013-06-21 15:25:46 +02:00
Shannon eac66f5696 Merge branch '6.0.7' into 6.1.2 2013-06-21 13:00:56 +10:00
Shannon b2c604f7b3 updated ignore 2013-06-21 11:26:23 +10:00
Shannon 3f626b444f re-enables CDF logger 2013-06-21 10:55:38 +10:00
Shannon c5b8931aa6 Merge branch '6.0.7' into 6.1.2
Conflicts:
	src/Umbraco.Web.UI/config/ClientDependency.config
2013-06-21 10:50:35 +10:00
Shannon 818d22ba61 updates CDF config examples (#U4-2331) 2013-06-21 10:49:27 +10:00
Shannon f9902964b0 Merge branch '6.0.7' into 6.1.2
Conflicts:
	src/Umbraco.Web.UI/config/Dashboard.config
	src/Umbraco.Web.UI/config/ExamineIndex.config
2013-06-21 09:20:53 +10:00
Shannon 27fdb1ebab removed custom dashboard, re-put back in the external index (must have got removed by accident) 2013-06-21 09:19:50 +10:00
Shannon 1368ba8dc9 Fixes unit tests 2013-06-21 08:47:01 +10:00
Sebastiaan Janssen 9a3c2bbc5c Merge pull request #19 from michielvoo/master
Changed default email address in the installer
2013-06-20 07:47:50 -07:00
Michiel van Oosterhout 0b0fb92cf1 Changed default user email address to use the example domain, instead of domain.com 2013-06-20 16:01:03 +02:00
Sebastiaan Janssen 6f09da0927 Merge pull request #17 from kipusoep/patch-1
Removed space before UmbracoModule
2013-06-20 06:18:21 -07:00
Stefan Kip febe6ec241 Removed space before UmbracoModule
Removed space before UmbracoModule
2013-06-20 14:56:39 +02:00
Shannon 3618722574 Fixed some merging issues. 2013-06-20 15:57:23 +10:00
Shannon 24a76f53b4 Merge branch '6.0.7' into 6.1.2
Conflicts:
	src/Umbraco.Core/Umbraco.Core.csproj
	src/Umbraco.Core/Xml/XmlNodeExtensions.cs
	src/Umbraco.Web.UI/config/ClientDependency.config
	src/Umbraco.Web.UI/config/Dashboard.config
	src/Umbraco.Web/DefaultPublishedContentStore.cs
	src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/moveOrCopy.aspx.cs
	src/umbraco.businesslogic/BasePages/BasePage.cs
2013-06-20 15:49:55 +10:00
Shannon 86ce48ddc8 Fixes: #U4-2312 - Moving content with the new API (and in the old api when calling library.UpdateDocumentCache(p.Id)) The document is actually moved properly in the content XML structure without republishing it and then rebuilding the entire XML structure, it just does it inline. Have also updated MoveAndCopy.aspx dialog to use the new API which now saves on about 20+ queries that were not needed. Also updated the MoveAndCopy dialog to have the correct code behind structure. 2013-06-20 15:34:57 +10:00
Shannon cb592d687c Merge branch '6.0.7' into 6.1.2 2013-06-20 11:26:01 +10:00
Shannon 2161ec98b0 Fixes: #U4-2324 - Umbraco.Field will now work with custom routed pages. 2013-06-20 11:25:33 +10:00
Shannon 5a6ee168c3 Merge branch '6.0.7' into 6.1.2 2013-06-20 10:08:50 +10:00
Shannon 52292cab60 Fixes: #U4-2403 2013-06-20 10:08:02 +10:00
Stephan 2933c879e1 U4-2327 - fix PublishedContentRequest redirect vs. permanent 2013-06-19 20:30:43 +02:00
Sebastiaan Janssen c8a19dff44 Merge branch '6.0.7' into 6.1.2
Conflicts:
	src/Umbraco.Web/Media/ImageUrl.cs
	src/Umbraco.Web/Media/ImageUrlProviders/ImageUrlProvider.cs
	src/Umbraco.Web/umbraco.presentation/umbraco/uQuery/MediaExtensions.cs
2013-06-19 18:26:45 +02:00
WadeKallhoff a6768263d3 image thumb extension fix 2013-06-19 18:11:28 +02:00
kensykora e66306978a macro rendering fix 2013-06-19 17:59:30 +02:00
Phil Dye 7f22809ebf U4-1478 Create button still visible when not active 2013-06-19 17:55:00 +02:00
Edwin de Koning 302ebde422 Translating the word "or" 2013-06-19 16:28:58 +02:00
Murray@tbpc10.terabyte.co.nz cf5624f377 #U4-2326 Added Try Catch for PlatformNotSupportedException
Signed-off-by: Sebastiaan Janssen <sebastiaan@umbraco.com>
2013-06-19 16:24:09 +02:00
Morten Bock f386c9d024 U4-1226 Umbraco:image control 2013-06-19 16:18:15 +02:00
Edwin de Koning 530fcf0ea3 Fixes U4-2261 2013-06-19 16:04:56 +02:00
Sebastiaan Janssen 26e4091f28 Due to previous fix we don't need to sort individually any more
(see changeset 32f86f750e)
2013-06-19 16:01:50 +02:00
Dennis Ravn Pedersen 32f86f750e Query would reverse logic sorting of children. Would make move operations ignore sorting.
Signed-off-by: Sebastiaan Janssen <sebastiaan@umbraco.com>
2013-06-19 15:36:08 +02:00
Sebastiaan Janssen ebad631140 Merge branch '6.0.7' into 6.1.2 2013-06-19 15:16:32 +02:00
Sebastiaan Janssen b8304c03ee Merge branch '6.0.7' of https://github.com/bokmadsen/Umbraco-CMS into bokmadsen-6.0.7 2013-06-19 14:50:41 +02:00
Sebastiaan Janssen 556c2d625f Merge branch '6.0.7' into 6.1.2
Conflicts:
	src/umbraco.cms/businesslogic/member/Member.cs
2013-06-19 14:42:14 +02:00
Sebastiaan Janssen 6f85eefd85 updated ignore file with correct case sensitivity
Conflicts:
	.gitignore
2013-06-19 14:39:21 +02:00
Sebastiaan Janssen aaa4469def Merge branch '6.0.7' of github.com:umbraco/Umbraco-CMS into 6.0.7 2013-06-19 14:36:17 +02:00
Sebastiaan Janssen baa0069262 Merge branch 'master' into 6.0.7
Conflicts:
	README.md
2013-06-19 14:22:57 +02:00
Sebastiaan Janssen 9ac4c7aef5 Merge branch 'master' of https://github.com/umbraco/Umbraco-CMS 2013-06-19 14:14:51 +02:00
Sebastiaan Janssen cb2a35594f Merge branch '6.0.6'
Conflicts:
	src/Umbraco.Core/TypeFinder.cs
2013-06-19 14:13:09 +02:00
Sebastiaan Janssen dd501d0198 Merge pull request #16 from darrenferguson/master
Remove obsoletion of Member methods
2013-06-19 05:07:35 -07:00
Sebastiaan Janssen b724d8fb32 Merge pull request #15 from pynej/master
Fix for U4-2384. Author not changed to current user when a node is copied.
2013-06-19 05:06:23 -07:00
Darren Ferguson 7c6aee17e9 Remove obsolete messages from member class
I've removed the obsolete methods from the member class because many of
the suggested alternatives don't work. and some require a lot of
configuration to get working.

Also, the member methods return Members - so they are not obsolete if
you want a reference to a member, you can choose to use System
membership if you want, but for custom properties and groups you need to
fallback to the Umbraco API, so these shouldn't be obsolete! :)
2013-06-19 13:02:58 +01:00
Jeremy Pyne 5e2c3a0a8b Fixed a type on content copy. 2013-06-18 10:38:08 -04:00
Jeremy Pyne f5121bd183 Fix for U4-2384. Author not changed to current user when a node is copied. 2013-06-18 09:35:33 -04:00
Bo Kingo Damgaard 51b5334126 Duplicate e-mail addresses: U4-315, U4-2147, U4-304
- Allows for duplicate e-mail addresses in member section by opt-in
(requiresUniqueEmail="false" in
web.config/membership/providers/"UmbracoMembershipProvider").
- Fixes issues with backoffice not checking for duplicate emails when
changing member after creation.
- Lower cases email addresses upon creating member and when searching to
prevent duplicates.
- Added Member.GetMembersByEmail to get alle members with specific email
2013-06-18 14:23:05 +02:00
Shannon 273c1956ab Fixes: #U4-2343 for api controllers, already fixed for surface controllers 2013-06-18 15:46:36 +10:00
Shannon f7c474ac2c fixed merge issue and ensures UseNamespaceFallback are set for plugin controllers. 2013-06-18 15:24:44 +10:00
Shannon 4143dbd02d Fixed some merge issues 2013-06-18 15:20:18 +10:00
Shannon 768eb3d1ed Merge branch '6.0.7' into 6.1.2
Conflicts:
	src/Umbraco.Web/Mvc/AreaRegistrationExtensions.cs
	src/Umbraco.Web/Mvc/PluginControllerArea.cs
	src/Umbraco.Web/Umbraco.Web.csproj
	src/Umbraco.Web/WebBootManager.cs
2013-06-18 15:13:43 +10:00
Shannon 120bdca9eb removed constraint names on SurfaceControllers, they don't need to be suffixed with SurfaceController, only Controller. 2013-06-18 15:05:13 +10:00
Shannon a5041aa34e Backported changes to use a real Area to do Umbraco area routes and updates our extension methods with the UseNamespaceFallback data token to only check in one namespace. 2013-06-18 14:59:00 +10:00
Shandem 59811c2841 Merge pull request #11 from florisrobbemont/6.1.2
Fix U4-2286 - IFilteredControllerFactory classes are not resolved by Umb...
2013-06-17 21:27:19 -07:00
Shannon 38eee6135e Merge branch '6.0.7' into 6.1.2 2013-06-18 14:21:11 +10:00
Shannon d3780848dc updated ignore file with correct case sensitivity 2013-06-18 14:20:50 +10:00
Shannon 5719820fad Merge branch '6.0.7' into 6.1.2
Conflicts:
	.gitignore
	src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadPackages.cs
2013-06-18 14:18:17 +10:00
Shannon 9d15228c68 manually applies patch for drag/drop fix in media for vdir 2013-06-17 03:06:24 +02:00
Shannon c9c3623457 updated ignore
Signed-off-by: Shannon <sdeminick@gmail.com>
2013-06-17 02:59:00 +02:00
Floris Robbemont aecc3d28bf Fix U4-2286 - IFilteredControllerFactory classes are not resolved by Umbraco
Simple fix, just made the FilteredCOntrollerFactoriesResolver public. This way developers can add their own on application start
2013-06-15 22:46:01 +02:00
Sebastiaan Janssen b51022575f Merge pull request #8 from mattbrailsford/6.1.2
Updated RenderMvcController to have the view engines test for file existance
2013-06-13 03:42:34 -07:00
Sebastiaan Janssen 6600e9c899 Merge pull request #6 from dpen2000/UserPermisionsFixIn6.1.2
Fix U4-2320 - Error on saving User Permissions (for 6.1.2 release)
2013-06-13 03:18:37 -07:00
Sebastiaan Janssen 68aa2abbc0 Merge pull request #7 from pynej/6.1.2
Fixed Ctl+S on stylesheets editor.
2013-06-13 03:11:57 -07:00
Sebastiaan Janssen e0a483ca48 Merge pull request #5 from tcmorris/patch-1
Update README.md
2013-06-13 02:05:43 -07:00
mattbrailsford 9b78cb3f7c Updated RenderMvcController to have the view engines test for file existance, rather than assuming views will always be razor. This allows alternative MVC view engines to be used. 2013-06-13 09:26:45 +01:00
Jeremy Pyne c6c90fde44 Fixed Ctl+S on stylesheets editor. 2013-06-12 23:41:49 -03:00
david.pendray 773500332b Fix U4-2320 - Error on saving User Permissions
Nodes can be null but NodeIds property always returns a collection and this will return Ids from Nodes if _nodeIds are null and Nodes is not.
2013-06-13 02:50:25 +01:00
Thomas Morris 95eb00a81c Update README.md
Updating link and formatting
2013-06-12 18:24:54 +02:00
Sebastiaan Janssen 3921b0974e Merge pull request #3 from Jayshoe/patch-1
Sitemap provider be gone! Issue #U4-1950
2013-06-12 07:19:56 -07:00
Jayshoe 2cd07c841f Sitemap provider be gone! Issue #U4-1950 2013-06-12 16:19:14 +02:00
Sebastiaan Janssen 8f80f0e95c Merge pull request #2 from Jeavon/patch-1
Update README.md
2013-06-12 06:38:32 -07:00
Jeavon 73ac2c0309 Update README.md
Readme.md corrections and updates
2013-06-12 15:34:26 +02:00
Sebastiaan Janssen a5ddb6c818 Merge pull request #1 from dpen2000/patch-1
Update README.md
2013-06-12 06:10:28 -07:00
dpen2000 458e61e049 Update README.md
Fix link to Umbraco releases page
2013-06-12 14:45:41 +02:00
Sebastiaan Janssen 0815842640 Update README.md 2013-06-12 11:10:18 +03:00
Sebastiaan Janssen 53b31a5c1b Update README.md 2013-06-12 10:04:31 +02:00
Sebastiaan Janssen 292dd9115b Update README.md 2013-06-11 00:57:36 +02:00
Sebastiaan Janssen c6d0a9be00 Update README.md 2013-06-11 00:57:34 +02:00
Sebastiaan Janssen 14c3acc4b7 Create README.md 2013-06-11 00:57:31 +02:00
Sebastiaan Janssen a4098b5d25 Update README.md 2013-06-11 00:57:03 +02:00
Sebastiaan Janssen acdcca0b91 Add missing files 2013-06-11 00:48:29 +02:00
Sebastiaan Janssen 33ff82e766 Add missing files 2013-06-11 00:47:44 +02:00
Sebastiaan Janssen 5fd90e1c13 Update README.md 2013-06-10 19:17:37 +03:00
Sebastiaan Janssen a6eaec9ecb Update README.md 2013-06-10 19:09:03 +03:00
Sebastiaan Janssen f5553bcc06 Create README.md 2013-06-10 18:05:07 +02:00
leekelleher e0c68a8e1c Resolves #U4-184 Upgrade package when installing a newer version.
Multiple package versions can be installed, only the latest version is listed under "Installed Packages".
When the installed package is viewed, a list of previously installed versions (of that package) are listed.
2013-06-10 13:55:58 -01:00
Morten Christensen bc1b2dc5f4 Fixes #U4-2333 2013-06-07 05:19:45 -02:00
Morten Christensen 0bb643672f Adding some minor changes/adjustments to the TypeFinder to make a bit more flexible for external usage. 2013-06-07 05:19:25 -02:00
Shannon Deminick 813d60521c Merge with 6.0.7 2013-06-03 16:27:20 -10:00
Shannon Deminick 5212d17f49 Fixes: #U4-2313 - manually adding a reserved route value in BeginUmbracoForm 2013-06-03 14:56:15 -10:00
Shannon Deminick 932115585e Fixes: #U4-2315 - CDF grouping issue, updated to new version 2013-06-03 13:35:41 -10:00
Sebastiaan Janssen 948ffe4796 Merge with 6.0.7 2013-06-03 15:11:44 -02:00
Sebastiaan Janssen 6b1dd07310 Fixes U4-2254 [Object object] error when selecting media link for content. 2013-06-03 15:11:23 -02:00
Sebastiaan Janssen dc2554c6d0 Fixes U4-2254 [Object object] error when selecting media link for content. 2013-06-03 15:08:56 -02:00
Sebastiaan Janssen 5c6514929e Opening branch 6.1.2 2013-06-03 06:16:19 -02:00
Sebastiaan Janssen 9739b3e2ef Closing branch 6.1.1 2013-06-03 06:15:57 -02:00
Sebastiaan Janssen 0b1f72f139 Added tag release-6.1.1 for changeset 7271ae03cb53 2013-06-03 06:15:31 -02:00
Shannon Deminick af51465a6a Merge 2013-04-29 19:57:44 -10:00
Sebastiaan Janssen c2057656bc Merge with 6.0.4 2013-04-25 11:23:31 -02:00
Sebastiaan Janssen 09a4e33f3f Closing again.. 2013-04-25 11:20:21 -02:00
Thomas Skyldahl Sørensen c12f9d0272 Optimization for issue: U4-1187
Url: http://issues.umbraco.org/issue/U4-1187

Added assembly filtering, to stop scanning of third party assemblies
that doesn't reference the types we are looking for.
this limits the amount of possible missing references we encounter
when checking against the types
2013-04-17 14:03:54 -02:00
Sebastiaan Janssen d2d1843e03 Fix default branch 2013-04-08 07:03:57 -02:00
Sebastiaan Janssen a89a122b09 Merge with 6.0.3 2013-03-27 11:56:44 -01:00
Shannon Deminick e5e22f75fc Merge 2013-03-11 18:47:36 +06:00
Sebastiaan Janssen cab21e9d48 Merge with 6.0.1 2013-03-01 06:51:38 -01:00
Sebastiaan Janssen 2e7c26fcc0 Closing branch 6.0.1 2013-03-01 06:49:59 -01:00
Sebastiaan Janssen 0f6c41679c Added tag Release-6.0.1 for changeset 92410e141d9c 2013-03-01 06:49:45 -01:00
Sebastiaan Janssen 777d397ae7 Merge with 6.0.0 2013-01-31 14:07:05 -01:00
Adam Nelson 41258104f6 U4-497 - Razor errors should be completely silent when UmbracoDebug=false.
Modified implementation to have a single global setting in UmbracoSettings.config
which can now be overridden when the umbraco.macro.Error event is handled on a
per-macro basis if desired.
2013-01-16 00:45:18 -11:00
Adam Nelson 08a8e6b816 U4-497 : Razor errors should be completely silent when UmbracoDebug=false.
Optionally requires macroErrors.config to define macro error behaviour.
See http://issues.umbraco.org/issue/U4-497.
2013-01-14 00:48:54 -11:00
455 changed files with 16547 additions and 9469 deletions
+86
View File
@@ -0,0 +1,86 @@
*.obj
*.pdb
*.user
*.aps
*.pch
*.vspscc
[Bb]in
[Db]ebug*/
obj/
[Rr]elease*/
_ReSharper*/
_NCrunch_*/
*.ncrunchsolution
*.ncrunchsolution.user
*.ncrunchproject
*.crunchsolution.cache
[Tt]est[Rr]esult*
[Bb]uild[Ll]og.*
*.[Pp]ublish.xml
*.suo
[sS]ource
[sS]andbox
umbraco.config
*.vs10x
App_Data/TEMP/*
[Uu]mbraco/[Pp]resentation/[Uu]mbraco/[Pp]lugins/*
[Uu]mbraco/[Pp]resentation/[Uu]ser[Cc]ontrols/*
[Uu]mbraco/[Pp]resentation/[Ss]cripts/*
[Uu]mbraco/[Pp]resentation/[Ff]onts/*
[Uu]mbraco/[Pp]resentation/[Cc]ss/*
src/Umbraco.Web.UI/[Cc]ss/*
src/Umbraco.Web.UI/App_Code/*
src/Umbraco.Web.UI/App_Data/*
src/Umbraco.Tests/App_Data/*
src/Umbraco.Web.UI/[Mm]edia/*
src/Umbraco.Web.UI/[Mm]aster[Pp]ages/*
src/Umbraco.Web.UI/[Mm]acro[Ss]cripts/*
src/Umbraco.Web.UI/[Xx]slt/*
src/Umbraco.Web.UI/[Ii]mages/*
src/Umbraco.Web.UI/[Ss]cripts/*
src/Umbraco.Web.UI/Web.*.config.transformed
umbraco/presentation/umbraco/plugins/uComponents/uComponentsInstaller.ascx
umbraco/presentation/packages/uComponents/MultiNodePicker/CustomTreeService.asmx
_BuildOutput/*
build/UmbracoCms.AllBinaries*zip
build/UmbracoCms.WebPI*zip
build/UmbracoCms*zip
build/*.nupkg
src/Umbraco.Tests/config/applications.config
src/Umbraco.Tests/config/trees.config
src/Umbraco.Web.UI/web.config
*.orig
src/Umbraco.Tests/config/404handlers.config
src/Umbraco.Web.UI/[Vv]iews/*.cshtml
src/Umbraco.Web.UI/[Vv]iews/*.vbhtml
src/Umbraco.Tests/[Cc]onfig/umbracoSettings.config
src/Umbraco.Web.UI/[Vv]iews/*
src/packages/
src/packages/repositories.config
src/Umbraco.Web.UI/[Ww]eb.config
*.transformed
webpihash.txt
node_modules
src/Umbraco.Web.UI/[Uu]mbraco/[Ll]ib/*
src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/umbraco.*
src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/routes.js
src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/main.js
src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/app.js
src/Umbraco.Web.UI/[Uu]mbraco/[Vv]iews/**/*.js
src/Umbraco.Web.UI/[Uu]mbraco/[Vv]iews/**/*.css
src/Umbraco.Web.UI/[Uu]mbraco/[Vv]iews/**/*.html
src/Umbraco.Web.UI/[Uu]mbraco/[Aa]ssets/*
src/Umbraco.Web.UI.Client/[Bb]uild/*
src/Umbraco.Web.UI.Client/[Bb]uild/[Bb]elle/
src/Umbraco.Web.UI/[Uu]ser[Cc]ontrols/
build/_BuildOutput/
tools/NDepend/
src/*.vspx
src/*.psess
NDependOut/*
QueryResult.htm
*.ndproj
-70
View File
@@ -1,70 +0,0 @@
syntax: regexp
^src/packages/(?!repositories.config$)
web.Template.[a-zA-Z0-9]*.Debug.config
syntax: glob
*.obj
*.pdb
*.user
*.aps
*.pch
*.vspscc
[Bb]in
[Db]ebug*/
obj/
[Rr]elease*/
_ReSharper*/
_NCrunch_*/
*.ncrunchsolution
*.ncrunchsolution.user
*.ncrunchproject
*.crunchsolution.cache
[Tt]est[Rr]esult*
[Bb]uild[Ll]og.*
*.[Pp]ublish.xml
*.suo
[sS]ource
[sS]andbox
umbraco.config
*.vs10x
App_Data\TEMP\*
umbraco\presentation\umbraco\plugins\*
umbraco\presentation\usercontrols\*
umbraco\presentation\scripts\*
umbraco\presentation\fonts\*
umbraco\presentation\css\*
src\Umbraco.Web.UI\[Cc]ss\*
src\Umbraco.Web.UI\App_Code\*
src\Umbraco.Web.UI\App_Data\*
src\Umbraco.Tests\App_Data\*
src\Umbraco.Web.UI\[Mm]edia\*
src\Umbraco.Web.UI\[Mm]aster[Pp]ages\*
src\Umbraco.Web.UI\[Mm]acro[Ss]cripts\*
src\Umbraco.Web.UI\[Xx]slt\*
src\Umbraco.Web.UI\[Ii]mages\*
src\Umbraco.Web.UI\[Ss]cripts\*
src\Umbraco.Web.UI\Web.*.config.transformed
umbraco\presentation\umbraco\plugins\uComponents\uComponentsInstaller.ascx
umbraco\presentation\packages\uComponents\MultiNodePicker\CustomTreeService.asmx
_BuildOutput/*
*.ncrunchsolution
build/UmbracoCms.AllBinaries*zip
build/UmbracoCms.WebPI*zip
build/UmbracoCms*zip
build/*.nupkg
src/Umbraco.Tests/config/applications.config
src/Umbraco.Tests/config/trees.config
src/Umbraco.Web.UI/web.config
*.orig
src/Umbraco.Tests/config/404handlers.config
src/Umbraco.Web.UI/Views/*.cshtml
src/Umbraco.Web.UI/Views/*.vbhtml
src/Umbraco.Tests/config/umbracoSettings.config
src/Umbraco.Web.UI/App_Plugins/*
src/Umbraco.Web.UI/Views/*
src/packages/
src\Umbraco.Web.UI\[W]eb.config
*.transformed
-37
View File
@@ -1,37 +0,0 @@
d0aba247db91d1b70c39c6397b965ca370a67497 Sprint-Juno-A
0b8f67be2ca8faf008151d87f232c698de69e735 Release-4.5.0
5960c073250926d202861a09472f5f334da6e283 Sprint-Juno-B
f15d4ff81a8368e9d42788f7e0ae726f7a70a3b1 Release-4.0.3
283065df4d3c27245267709dd2644a479c4f62a5 Release-4.0.4.2
ffc34b23e1a03785e4098afa4290d8c03cf10115 Release-4.5.2
d03fcffb8834a9583a56813bb44b6abbd9f042cc Release-4.6.0
1809f7b2593270c192cd47bdcfdb392100686f79 4.7.2
488779dec0ceb1d2874bcef906241b919325c904 4.8.0-beta
096f20bb0575d6199f20fcb3147b63554e765a74 Release-4.8.0
8f8a203857886b373148af29edd57460a42940be Release-4.8.1
de73e687ddf6086ed52b6554676c1632865d07f2 Release-4.9.0
8d7d8609e2e4b971da99cd97f72132ce85ce3333 Release-4.9.1
f6da531fbb4c251ff61d314e2a7effb13c71e74a Release-4.10.0
20e4dff821d8ac2527a5353618fa1a23ea1d8b34 Release-4.11.0
7f827760cb49d749616859f528d19dde64807947 Release-4.11.1
7f827760cb49d749616859f528d19dde64807947 Release-4.11.1
6eb5f2fb5a88aa29ea544499df9160a1b31b5638 Release-4.11.1
73711b806a4044dbf0d7d7c095ddfdda23b09932 4.11.2
73711b806a4044dbf0d7d7c095ddfdda23b09932 4.11.2
0000000000000000000000000000000000000000 4.11.2
73711b806a4044dbf0d7d7c095ddfdda23b09932 Release-4.11.2
77db220b89e166b3c0736ed321ecfd6416cddbcd Release-4.11.2.1
54cde33b809dcb3a1f7e7ae0d5375f6dd0d89c8d Release-4.11.2.2
ff3bb24ea0c915878396a6ae27f1ff164e8ac150 Release-6.0.0-beta
56015ac26f5ab60e3c61b1d09075297b660afa07 Release-6.0.0-RC
1719fbd857f28b376639ac2aa0abada0ef2e7560 Release-6.0.0
e02f5aebb87e3f07d27376647756caa9762931d8 Release-4.11.4
14338b0ab1738fbd8987677ecdb9a73d79fc229d release-4.11.6
ce47176bc6b9298741783e20f1fe2672c811f744 release-4.11.7
b247b35d821144849f551e02da8ba719f91d5fb0 Release-6.0.2
aed55cba29009ad3db48880a7cfb66407ce9805f release-6.0.3
87cf618a39e38ec58df916d10e6a924de62ae37d release-6.1.0-beta
0dee9964687ea51ea797984cf7cce3655d6a6558 release-6.0.4
7670bb47a671a9ecc15118589d8048907ea76241 release-6.1.0-beta2
953c466faf8fcfd6e85e06ccd04c2346bbdb88a8 release-6.0.6
8309c3bd6db5885c9ef37e71db0672b8947fcb59 release-6.1.0
+9
View File
@@ -0,0 +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.
+33
View File
@@ -0,0 +1,33 @@
Umbraco CMS
===========
## Watch a five minute introduction video ##
[![ScreenShot](http://umbraco.com/images/whatisumbraco.png)](http://umbraco.org/help-and-support/video-tutorials/getting-started/what-is-umbraco)
## Umbraco - the simple, flexible and friendly ASP.NET CMS ##
**More than 177,000 sites trust Umbraco**
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 has award-winning integration capabilities and supports ASP.NET MVC or Web Forms, including User and Custom Controls, out of the box. It's a developers dream and your users will love it too.
Used by more than 177,000 active websites including [http://daviscup.com](http://daviscup.com), [http://heinz.com](http://heinz.com), [http://peugeot.com](http://peugeot.com), [http://www.hersheys.com/](http://www.hersheys.com/) and **The Official ASP.NET and IIS.NET website from Microsoft** ([http://asp.net](http://asp.net) / [http://iis.net](http://iis.net)) you can be sure that the technology is proven, stable and scales.
To view more examples please visit [http://umbraco.com/why-umbraco/#caseStudies](http://umbraco.com/why-umbraco/#caseStudies)
## Downloading ##
The downloadable Umbraco releases live at [http://our.umbraco.org/download](http://our.umbraco.org/download).
## Forums ##
We have a forum running on [http://our.umbraco.org](http://our.umbraco.org). The discussions group on [Google Groups](https://groups.google.com/forum/#!forum/umbraco-dev) is for discussions on developing the core, and not on Umbraco-implementations or extensions in general. For those topics, please use [http://our.umbraco.org](http://our.umbraco.org).
## Contribute to Umbraco ##
If you want to contribute back to Umbraco you should check out our [guide to contributing](http://our.umbraco.org/contribute).
## Found a bug? ##
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 for reporting issues](http://our.umbraco.org/contribute/report-an-issue-or-request-a-feature).
To view existing issues please visit [http://issues.umbraco.org](http://issues.umbraco.org)
+3 -1
View File
@@ -1,10 +1,12 @@
@ECHO OFF
SET release=6.1.1
SET release=6.1.6
SET comment=
SET version=%release%
IF [%comment%] EQU [] (SET version=%release%) ELSE (SET version=%release%-%comment%)
ReplaceIISExpressPortNumber.exe ..\src\Umbraco.Web.UI\Umbraco.Web.UI.csproj %release%
%windir%\Microsoft.NET\Framework\v4.0.30319\msbuild.exe "Build.proj" /p:BUILD_RELEASE=%release% /p:BUILD_COMMENT=%comment%
echo This file is only here so that the containing folder will be included in the NuGet package, it is safe to delete. > .\_BuildOutput\WebApp\App_Code\dummy.txt
+32 -2
View File
@@ -82,6 +82,7 @@
<SolutionBinFolder>$(BuildFolder)bin\</SolutionBinFolder>
<WebAppFolder>$(BuildFolder)WebApp\</WebAppFolder>
<WebPiFolder>$(BuildFolder)WebPi\</WebPiFolder>
<ConfigsFolder>$(BuildFolder)Configs\</ConfigsFolder>
<SolutionBinFolderRelativeToProjects>$(BuildFolderRelativeToProjects)bin\</SolutionBinFolderRelativeToProjects>
<SolutionBinFolderAbsolutePath>$(BuildFolderAbsolutePath)bin\</SolutionBinFolderAbsolutePath>
<WebAppFolderRelativeToProjects>$(BuildFolderRelativeToProjects)WebApp\</WebAppFolderRelativeToProjects>
@@ -197,7 +198,7 @@
</Target>
<!-- Copy the transformed web.config file to the root -->
<Target Name="CopyTransformedWebConfig" DependsOnTargets="CopyXmlDocumentation">
<Target Name="CopyTransformedWebConfig" DependsOnTargets="CopyTransformedConfig">
<ItemGroup>
<WebConfigFile Include="..\src\Umbraco.Web.UI\web.$(BuildConfiguration).Config.transformed" />
</ItemGroup>
@@ -206,10 +207,28 @@
DestinationFiles="$(WebAppFolder)Web.config"
OverwriteReadOnlyFiles="true"
SkipUnchangedFiles="false" />
</Target>
<!-- Copy the config files and rename them to *.config.transform -->
<Target Name="CopyTransformedConfig" DependsOnTargets="CopyXmlDocumentation">
<ItemGroup>
<ConfigFiles Include="$(WebAppFolder)config\*.config" />
<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 -->
<Target Name="CopyXmlDocumentation" DependsOnTargets="CompileProjects">
<Target Name="CopyXmlDocumentation" DependsOnTargets="CleanupPresentation">
<ItemGroup>
<XmlDocumentationFiles Include="$(SolutionBinFolder)*.xml" />
</ItemGroup>
@@ -221,6 +240,17 @@
<Message Text="CopyXmlDocumentation" />
</Target>
<!-- Unlike 2010, the VS2012 build targets file doesn't clean up the umbraco.presentation dir, do it manually -->
<!-- Also, it places umbraco.XmlSerializers.dll in the root, even though it's also in the bin folder. Kill! -->
<Target Name="CleanupPresentation" DependsOnTargets="CompileProjects">
<ItemGroup>
<PresentationFolderToDelete Include="$(WebAppFolder)umbraco.presentation" />
<XmlSerializersDll Include="$(WebAppFolder)umbraco.XmlSerializers.dll" />
</ItemGroup>
<RemoveDir Directories="@(PresentationFolderToDelete)" />
<Delete Files="@(XmlSerializersDll)" />
</Target>
<Target Name="CompileProjects" DependsOnTargets="CompileExternalExamineProjects">
<Message Text="Compiling web project to build\$(BuildFolder)" Importance="high" />
+53 -54
View File
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-16"?>
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>UmbracoCms.Core</id>
<version>6.0.0-alpha</version>
<version>6.2.0</version>
<title>Umbraco Cms Core Binaries</title>
<authors>Morten Christensen</authors>
<owners>Umbraco HQ</owners>
@@ -14,58 +14,57 @@
<summary>Contains the core assemblies needed to run Umbraco Cms</summary>
<language>en-US</language>
<tags>umbraco</tags>
<dependencies>
<dependency id="Microsoft.AspNet.Mvc" version="[4.0.20710.0]" />
<dependency id="Microsoft.AspNet.WebApi" version="4.0.20710.0" />
<dependency id="Microsoft.AspNet.Mvc.FixedDisplayModes" version="1.0.0" />
<dependency id="MiniProfiler" version="2.1.0" />
<dependencies>
<dependency id="Microsoft.AspNet.Mvc" version="4.0" />
<dependency id="Microsoft.AspNet.WebApi" version="4.0" />
<dependency id="Microsoft.AspNet.Mvc.FixedDisplayModes" version="1.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="xmlrpcnet" version="[2.5.0, 3.0.0)" />
<dependency id="ClientDependency" version="[1.7.0, 2.0.0)" />
<dependency id="ClientDependency-Mvc" version="[1.7.0, 2.0.0)" />
</dependencies>
</metadata>
<files>
<file src="..\_BuildOutput\WebApp\bin\businesslogic.dll" target="lib\businesslogic.dll" />
<file src="..\_BuildOutput\WebApp\bin\businesslogic.xml" target="lib\businesslogic.xml" />
<file src="..\_BuildOutput\WebApp\bin\ClientDependency.Core.dll" target="lib\ClientDependency.Core.dll" />
<file src="..\_BuildOutput\WebApp\bin\ClientDependency.Core.Mvc.dll" target="lib\ClientDependency.Core.Mvc.dll" />
<file src="..\_BuildOutput\WebApp\bin\cms.dll" target="lib\cms.dll" />
<file src="..\_BuildOutput\WebApp\bin\cms.xml" target="lib\cms.xml" />
<file src="..\_BuildOutput\WebApp\bin\controls.dll" target="lib\controls.dll" />
<file src="..\_BuildOutput\WebApp\bin\controls.xml" target="lib\controls.xml" />
<file src="..\_BuildOutput\WebApp\bin\CookComputing.XmlRpcV2.dll" target="lib\CookComputing.XmlRpcV2.dll" />
<file src="..\_BuildOutput\WebApp\bin\Examine.dll" target="lib\Examine.dll" />
<file src="..\_BuildOutput\WebApp\bin\HtmlAgilityPack.dll" target="lib\HtmlAgilityPack.dll" />
<file src="..\_BuildOutput\WebApp\bin\ICSharpCode.SharpZipLib.dll" target="lib\ICSharpCode.SharpZipLib.dll" />
<file src="..\_BuildOutput\WebApp\bin\interfaces.dll" target="lib\interfaces.dll" />
<file src="..\_BuildOutput\WebApp\bin\interfaces.xml" target="lib\interfaces.xml" />
<file src="..\_BuildOutput\WebApp\bin\log4net.dll" target="lib\log4net.dll" />
<file src="..\_BuildOutput\WebApp\bin\Lucene.Net.dll" target="lib\Lucene.Net.dll" />
<file src="..\_BuildOutput\WebApp\bin\Lucene.Net.xml" target="lib\Lucene.Net.xml" />
<file src="..\_BuildOutput\WebApp\bin\Microsoft.ApplicationBlocks.Data.dll" target="lib\Microsoft.ApplicationBlocks.Data.dll" />
<file src="..\_BuildOutput\WebApp\bin\Microsoft.Web.Helpers.dll" target="lib\Microsoft.Web.Helpers.dll" />
<file src="..\_BuildOutput\WebApp\bin\MySql.Data.dll" target="lib\MySql.Data.dll" />
<file src="..\_BuildOutput\WebApp\bin\Our.Umbraco.uGoLive.47x.dll" target="lib\Our.Umbraco.uGoLive.47x.dll" />
<file src="..\_BuildOutput\WebApp\bin\Our.Umbraco.uGoLive.Checks.dll" target="lib\Our.Umbraco.uGoLive.Checks.dll" />
<file src="..\_BuildOutput\WebApp\bin\Our.Umbraco.uGoLive.dll" target="lib\Our.Umbraco.uGoLive.dll" />
<file src="..\_BuildOutput\WebApp\bin\SQLCE4Umbraco.dll" target="lib\SQLCE4Umbraco.dll" />
<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" />
<file src="..\_BuildOutput\WebApp\bin\Umbraco.Core.dll" target="lib\Umbraco.Core.dll" />
<file src="..\_BuildOutput\WebApp\bin\Umbraco.Core.xml" target="lib\Umbraco.Core.xml" />
<file src="..\_BuildOutput\WebApp\bin\umbraco.DataLayer.dll" target="lib\umbraco.DataLayer.dll" />
<file src="..\_BuildOutput\WebApp\bin\umbraco.DataLayer.xml" target="lib\umbraco.DataLayer.xml" />
<file src="..\_BuildOutput\WebApp\bin\umbraco.dll" target="lib\umbraco.dll" />
<file src="..\_BuildOutput\WebApp\bin\umbraco.xml" target="lib\umbraco.xml" />
<file src="..\_BuildOutput\WebApp\bin\umbraco.editorControls.dll" target="lib\umbraco.editorControls.dll" />
<file src="..\_BuildOutput\WebApp\bin\umbraco.editorControls.xml" target="lib\umbraco.editorControls.xml" />
<file src="..\_BuildOutput\WebApp\bin\umbraco.MacroEngines.dll" target="lib\umbraco.MacroEngines.dll" />
<file src="..\_BuildOutput\WebApp\bin\umbraco.MacroEngines.xml" target="lib\umbraco.MacroEngines.xml" />
<file src="..\_BuildOutput\WebApp\bin\umbraco.macroRenderings.dll" target="lib\umbraco.macroRenderings.dll" />
<file src="..\_BuildOutput\WebApp\bin\umbraco.macroRenderings.xml" target="lib\umbraco.macroRenderings.xml" />
<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.XmlSerializers.dll" target="lib\umbraco.XmlSerializers.dll" />
<file src="..\_BuildOutput\WebApp\bin\UmbracoExamine.dll" target="lib\UmbracoExamine.dll" />
<file src="..\_BuildOutput\WebApp\bin\UrlRewritingNet.UrlRewriter.dll" target="lib\UrlRewritingNet.UrlRewriter.dll" />
</files>
<files>
<file src="..\_BuildOutput\WebApp\bin\businesslogic.dll" target="lib\businesslogic.dll" />
<file src="..\_BuildOutput\WebApp\bin\businesslogic.xml" target="lib\businesslogic.xml" />
<file src="..\_BuildOutput\WebApp\bin\cms.dll" target="lib\cms.dll" />
<file src="..\_BuildOutput\WebApp\bin\cms.xml" target="lib\cms.xml" />
<file src="..\_BuildOutput\WebApp\bin\controls.dll" target="lib\controls.dll" />
<file src="..\_BuildOutput\WebApp\bin\controls.xml" target="lib\controls.xml" />
<file src="..\_BuildOutput\WebApp\bin\Examine.dll" target="lib\Examine.dll" />
<file src="..\_BuildOutput\WebApp\bin\interfaces.dll" target="lib\interfaces.dll" />
<file src="..\_BuildOutput\WebApp\bin\interfaces.xml" target="lib\interfaces.xml" />
<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\Microsoft.Web.Helpers.dll" target="lib\Microsoft.Web.Helpers.dll" />
<file src="..\_BuildOutput\WebApp\bin\Our.Umbraco.uGoLive.47x.dll" target="lib\Our.Umbraco.uGoLive.47x.dll" />
<file src="..\_BuildOutput\WebApp\bin\Our.Umbraco.uGoLive.Checks.dll" target="lib\Our.Umbraco.uGoLive.Checks.dll" />
<file src="..\_BuildOutput\WebApp\bin\Our.Umbraco.uGoLive.dll" target="lib\Our.Umbraco.uGoLive.dll" />
<file src="..\_BuildOutput\WebApp\bin\SQLCE4Umbraco.dll" target="lib\SQLCE4Umbraco.dll" />
<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" />
<file src="..\_BuildOutput\WebApp\bin\Umbraco.Core.dll" target="lib\Umbraco.Core.dll" />
<file src="..\_BuildOutput\WebApp\bin\Umbraco.Core.xml" target="lib\Umbraco.Core.xml" />
<file src="..\_BuildOutput\WebApp\bin\umbraco.DataLayer.dll" target="lib\umbraco.DataLayer.dll" />
<file src="..\_BuildOutput\WebApp\bin\umbraco.DataLayer.xml" target="lib\umbraco.DataLayer.xml" />
<file src="..\_BuildOutput\WebApp\bin\umbraco.dll" target="lib\umbraco.dll" />
<file src="..\_BuildOutput\WebApp\bin\umbraco.xml" target="lib\umbraco.xml" />
<file src="..\_BuildOutput\WebApp\bin\umbraco.editorControls.dll" target="lib\umbraco.editorControls.dll" />
<file src="..\_BuildOutput\WebApp\bin\umbraco.editorControls.xml" target="lib\umbraco.editorControls.xml" />
<file src="..\_BuildOutput\WebApp\bin\umbraco.MacroEngines.dll" target="lib\umbraco.MacroEngines.dll" />
<file src="..\_BuildOutput\WebApp\bin\umbraco.MacroEngines.xml" target="lib\umbraco.MacroEngines.xml" />
<file src="..\_BuildOutput\WebApp\bin\umbraco.macroRenderings.dll" target="lib\umbraco.macroRenderings.dll" />
<file src="..\_BuildOutput\WebApp\bin\umbraco.macroRenderings.xml" target="lib\umbraco.macroRenderings.xml" />
<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.XmlSerializers.dll" target="lib\umbraco.XmlSerializers.dll" />
<file src="..\_BuildOutput\WebApp\bin\UmbracoExamine.dll" target="lib\UmbracoExamine.dll" />
<file src="..\_BuildOutput\WebApp\bin\UrlRewritingNet.UrlRewriter.dll" target="lib\UrlRewritingNet.UrlRewriter.dll" />
</files>
</package>
+8 -7
View File
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-16"?>
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>UmbracoCms</id>
<version>6.0.0-alpha</version>
<version>6.1.2</version>
<title>Umbraco Cms</title>
<authors>Morten Christensen</authors>
<owners>Umbraco HQ</owners>
@@ -10,8 +10,8 @@
<projectUrl>http://umbraco.com/</projectUrl>
<iconUrl>http://umbraco.com/media/357769/100px_transparent.png</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Installs Umbraco Cms in your Visual Studio ASP.NET Webforms project</description>
<summary>Installs Umbraco Cms in your Visual Studio ASP.NET Webforms project</summary>
<description>Installs Umbraco Cms in your Visual Studio ASP.NET project</description>
<summary>Installs Umbraco Cms in your Visual Studio ASP.NET project</summary>
<language>en-US</language>
<tags>umbraco</tags>
<dependencies>
@@ -21,14 +21,14 @@
<files>
<file src="..\_BuildOutput\WebApp\bin\amd64\**" target="Content\bin\amd64" />
<file src="..\_BuildOutput\WebApp\bin\x86\**" target="Content\bin\x86" />
<file src="..\_BuildOutput\WebApp\config\*.config" target="Content\config" />
<file src="..\_BuildOutput\Configs\**" target="Content\config" exclude="..\_BuildOutput\Configs\Web.config.transform" />
<file src="..\_BuildOutput\WebApp\css\**" target="Content\css" />
<file src="..\_BuildOutput\WebApp\macroScripts\**" target="Content\macroScripts" />
<file src="..\_BuildOutput\WebApp\masterpages\**" target="Content\masterpages" />
<file src="..\_BuildOutput\WebApp\media\**" target="Content\media" />
<file src="..\_BuildOutput\WebApp\scripts\**" target="Content\scripts" />
<file src="..\_BuildOutput\WebApp\usercontrols\**" target="Content\usercontrols" />
<file src="..\_BuildOutput\WebApp\Views\**" target="Content\Views" />
<file src="..\_BuildOutput\WebApp\Views\**" target="Content\Views" exclude="..\_BuildOutput\WebApp\Views\Web.config" />
<file src="..\_BuildOutput\WebApp\xslt\**" target="Content\xslt" />
<file src="..\_BuildOutput\WebApp\default.aspx" target="Content\default.aspx" />
<file src="..\_BuildOutput\WebApp\Web.config" target="Content\Web.config" />
@@ -36,7 +36,7 @@
<file src="..\_BuildOutput\WebApp\App_Code\**" target="UmbracoFiles\App_Code" />
<file src="..\_BuildOutput\WebApp\App_Data\**" target="UmbracoFiles\App_Data" />
<file src="..\_BuildOutput\WebApp\App_Plugins\**" target="UmbracoFiles\App_Plugins" />
<file src="..\_BuildOutput\WebApp\config\**" target="UmbracoFiles\config" />
<file src="..\_BuildOutput\WebApp\config\splashes\**" target="UmbracoFiles\config\splashes" />
<file src="..\_BuildOutput\WebApp\install\**" target="UmbracoFiles\install" />
<file src="..\_BuildOutput\WebApp\umbraco\**" target="UmbracoFiles\umbraco" />
<file src="..\_BuildOutput\WebApp\umbraco_client\**" target="UmbracoFiles\umbraco_client" />
@@ -44,5 +44,6 @@
<file src="..\_BuildOutput\WebApp\Web.config" target="UmbracoFiles\Web.config" />
<file src="tools\install.ps1" target="tools\install.ps1" />
<file src="tools\Readme.txt" target="tools\Readme.txt" />
<file src="build\**" target="build" />
</files>
</package>
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<CopyAllFilesToSingleFolderForPackageDependsOn>
AddUmbracoFilesToOutput;
$(CopyAllFilesToSingleFolderForPackageDependsOn);
</CopyAllFilesToSingleFolderForPackageDependsOn>
<CopyAllFilesToSingleFolderForMsdeployDependsOn>
AddUmbracoFilesToOutput;
$(CopyAllFilesToSingleFolderForPackageDependsOn);
</CopyAllFilesToSingleFolderForMsdeployDependsOn>
</PropertyGroup>
</Project>
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="AddUmbracoFilesToOutput">
<ItemGroup>
<UmbracoFiles Include=".\umbraco\**\*;" />
<UmbracoClientFiles Include=".\umbraco_client\**\*;" />
<AppBrowsersFiles Include=".\App_Browsers\**\*" />
<FilesForPackagingFromProject Include="%(UmbracoFiles.Identity)">
<DestinationRelativePath>umbraco\%(RecursiveDir)%(Filename)%(Extension)</DestinationRelativePath>
</FilesForPackagingFromProject>
<FilesForPackagingFromProject Include="%(UmbracoClientFiles.Identity)">
<DestinationRelativePath>umbraco_client\%(RecursiveDir)%(Filename)%(Extension)</DestinationRelativePath>
</FilesForPackagingFromProject>
<FilesForPackagingFromProject Include="%(AppBrowsersFiles.Identity)">
<DestinationRelativePath>App_Browsers\%(RecursiveDir)%(Filename)%(Extension)</DestinationRelativePath>
</FilesForPackagingFromProject>
</ItemGroup>
</Target>
</Project>
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<CopyAllFilesToSingleFolderForPackageDependsOn>
AddUmbracoFilesToOutput;
$(CopyAllFilesToSingleFolderForPackageDependsOn);
</CopyAllFilesToSingleFolderForPackageDependsOn>
<CopyAllFilesToSingleFolderForMsdeployDependsOn>
AddUmbracoFilesToOutput;
$(CopyAllFilesToSingleFolderForPackageDependsOn);
</CopyAllFilesToSingleFolderForMsdeployDependsOn>
</PropertyGroup>
</Project>
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="AddUmbracoFilesToOutput">
<ItemGroup>
<UmbracoFiles Include=".\umbraco\**\*;" />
<UmbracoClientFiles Include=".\umbraco_client\**\*;" />
<AppBrowsersFiles Include=".\App_Browsers\**\*" />
<FilesForPackagingFromProject Include="%(UmbracoFiles.Identity)">
<DestinationRelativePath>umbraco\%(RecursiveDir)%(Filename)%(Extension)</DestinationRelativePath>
</FilesForPackagingFromProject>
<FilesForPackagingFromProject Include="%(UmbracoClientFiles.Identity)">
<DestinationRelativePath>umbraco_client\%(RecursiveDir)%(Filename)%(Extension)</DestinationRelativePath>
</FilesForPackagingFromProject>
<FilesForPackagingFromProject Include="%(AppBrowsersFiles.Identity)">
<DestinationRelativePath>App_Browsers\%(RecursiveDir)%(Filename)%(Extension)</DestinationRelativePath>
</FilesForPackagingFromProject>
</ItemGroup>
</Target>
</Project>
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<CopyAllFilesToSingleFolderForPackageDependsOn>
AddUmbracoFilesToOutput;
$(CopyAllFilesToSingleFolderForPackageDependsOn);
</CopyAllFilesToSingleFolderForPackageDependsOn>
<CopyAllFilesToSingleFolderForMsdeployDependsOn>
AddUmbracoFilesToOutput;
$(CopyAllFilesToSingleFolderForPackageDependsOn);
</CopyAllFilesToSingleFolderForMsdeployDependsOn>
</PropertyGroup>
</Project>
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="AddUmbracoFilesToOutput">
<ItemGroup>
<UmbracoFiles Include=".\umbraco\**\*;" />
<UmbracoClientFiles Include=".\umbraco_client\**\*;" />
<AppBrowsersFiles Include=".\App_Browsers\**\*" />
<FilesForPackagingFromProject Include="%(UmbracoFiles.Identity)">
<DestinationRelativePath>umbraco\%(RecursiveDir)%(Filename)%(Extension)</DestinationRelativePath>
</FilesForPackagingFromProject>
<FilesForPackagingFromProject Include="%(UmbracoClientFiles.Identity)">
<DestinationRelativePath>umbraco_client\%(RecursiveDir)%(Filename)%(Extension)</DestinationRelativePath>
</FilesForPackagingFromProject>
<FilesForPackagingFromProject Include="%(AppBrowsersFiles.Identity)">
<DestinationRelativePath>App_Browsers\%(RecursiveDir)%(Filename)%(Extension)</DestinationRelativePath>
</FilesForPackagingFromProject>
</ItemGroup>
</Target>
</Project>
+13 -9
View File
@@ -1,15 +1,19 @@
A note about running Umbraco from Visual Studio.
When upgrading your website using nuget a backup of config files and web.config will be created and the files will
be overwritten with those from the current release. This means that you'll have to merge the files if you made any
changes to the previous config files.
When upgrading your website using nuget a backup of config files and web.config will be created. Only the web.config will
be overwritten by default to ensure that it has the necessary settings from the current release. This means that you'll
have to merge the files if you made any changes to the previous config files.
The config files found in the config folder will usually not be changed for patch releases, so they can usually be skipped,
but the web.config will have to have its previous "umbracoConfigurationStatus"-appsetting and "umbracoDbDSN" connection string
copied over (as a minimum).
It's not possible to create a deploy package from Visual Studio, which contains everything out of the box. This is
due to a number of files and folders that are not added to the Visual Studio project. These folders include:
install, umbraco and umbraco_client.
A custom deploy script will be added in a later release.
This nuget package includes build targets that extends 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.
These folders will now be automatically included when creating a deploy package or publishing to the file system:
umbraco and umbraco_client.
Please read the release notes on Codeplex:
http://umbraco.codeplex.com/releases
Please read the release notes on our.umbraco.org:
http://our.umbraco.org/contribute/releases
- Umbraco
Binary file not shown.
Binary file not shown.
+6 -5
View File
@@ -17,7 +17,8 @@
</PropertyGroup>
<ItemGroup Condition=" '$(PackageSources)' == '' ">
<!-- Package sources used to restore packages. By default will used the registered sources under %APPDATA%\NuGet\NuGet.Config -->
<!-- Package sources used to restore packages. By default, registered sources under %APPDATA%\NuGet\NuGet.Config will be used -->
<!-- The official NuGet package source (https://nuget.org/api/v2/) will be excluded if package sources are specified and it does not appear in the list -->
<!--
<PackageSource Include="https://nuget.org/api/v2/" />
<PackageSource Include="https://my-nuget-source/nuget/" />
@@ -54,10 +55,10 @@
<BuildCommand>$(NuGetCommand) pack "$(ProjectPath)" -p Configuration=$(Configuration) -o "$(PackageOutputDir)" -symbols</BuildCommand>
<!-- We need to ensure packages are restored prior to assembly resolve -->
<ResolveReferencesDependsOn Condition="$(RestorePackages) == 'true'">
<BuildDependsOn Condition="$(RestorePackages) == 'true'">
RestorePackages;
$(ResolveReferencesDependsOn);
</ResolveReferencesDependsOn>
$(BuildDependsOn);
</BuildDependsOn>
<!-- Make the build depend on restore packages -->
<BuildDependsOn Condition="$(BuildPackage) == 'true'">
@@ -75,7 +76,7 @@
This effectively acts as a lock that makes sure that the download operation will only happen once and all
parallel builds will have to wait for it to complete.
-->
<MsBuild Targets="_DownloadNuGet" Projects="$(MSBuildThisFileFullPath)" Properties="Configuration=NOT_IMPORTANT" />
<MsBuild Targets="_DownloadNuGet" Projects="$(MSBuildThisFileFullPath)" Properties="Configuration=NOT_IMPORTANT;DownloadNuGetExe=$(DownloadNuGetExe)" />
</Target>
<Target Name="_DownloadNuGet">
+1
View File
@@ -31,6 +31,7 @@ namespace Umbraco.Core.Cache
public const string UserContextCacheKey = "UmbracoUserContext";
public const string UserContextTimeoutCacheKey = "UmbracoUserContextTimeout";
public const string UserCacheKey = "UmbracoUser";
public const string UserPermissionsCacheKey = "UmbracoUserPermissions";
public const string ContentTypeCacheKey = "UmbracoContentType";
@@ -8,7 +8,7 @@ namespace Umbraco.Core.Cache
/// An abstract class for implementing a runtime cache provider
/// </summary>
/// <remarks>
/// THIS MUST REMAIN INTERNAL UNTIL WE STREAMLINE HOW ALL CACHE IS HANDLED, WE NEED TO SUPPORT HTTP RUNTIME CACHE, IN MEMORY CACHE, ETC...
/// THIS MUST REMAIN INTERNAL UNTIL WE STREAMLINE HOW ALL CACHE IS HANDLED, WE NEED TO SUPPORT HTTP RUNTIME CACHE, IN MEMORY CACHE, REQUEST CACHE, ETC...
/// </remarks>
internal abstract class RuntimeCacheProviderBase : CacheProviderBase
{
@@ -5,6 +5,7 @@ using System.Linq;
using System.Threading;
using System.Web;
using System.Web.Caching;
using System.Web.Security;
using System.Xml;
using System.Configuration;
@@ -299,6 +300,32 @@ namespace Umbraco.Core.Configuration
}
}
internal static string AuthCookieName
{
get
{
var value = GetKey("/settings/security/authCookieName");
if (string.IsNullOrEmpty(value) == false)
{
return value;
}
return "UMB_UCONTEXT";
}
}
internal static string AuthCookieDomain
{
get
{
var value = GetKey("/settings/security/authCookieDomain");
if (string.IsNullOrEmpty(value) == false)
{
return value;
}
return FormsAuthentication.CookieDomain;
}
}
/// <summary>
/// Enables the experimental canvas (live) editing on the frontend of the website
/// </summary>
@@ -1305,6 +1332,25 @@ namespace Umbraco.Core.Configuration
}
}
/// <summary>
/// Gets the default document type property used when adding new properties through the back-office
/// </summary>
/// <value>Configured text for the default document type property</value>
/// <remarks>If undefined, 'Textstring' is the default</remarks>
public static string DefaultDocumentTypeProperty
{
get
{
var defaultDocumentTypeProperty = GetKey("/settings/content/defaultDocumentTypeProperty");
if (string.IsNullOrEmpty(defaultDocumentTypeProperty))
{
defaultDocumentTypeProperty = "Textstring";
}
return defaultDocumentTypeProperty;
}
}
/// <summary>
/// Configuration regarding webservices
/// </summary>
@@ -5,7 +5,7 @@ namespace Umbraco.Core.Configuration
{
public class UmbracoVersion
{
private static readonly Version Version = new Version("6.1.1");
private static readonly Version Version = new Version("6.1.6");
/// <summary>
/// Gets the current version of Umbraco.
+78 -12
View File
@@ -112,7 +112,7 @@ namespace Umbraco.Core
public void ConfigureEmbeddedDatabaseConnection()
{
const string providerName = "System.Data.SqlServerCe.4.0";
const string connectionString = @"Data Source=|DataDirectory|\Umbraco.sdf";
const string connectionString = @"Data Source=|DataDirectory|\Umbraco.sdf;Flush Interval=1;";
SaveConnectionString(connectionString, providerName);
@@ -169,6 +169,20 @@ namespace Umbraco.Core
Initialize(providerName);
}
/// <summary>
/// Configures a ConnectionString for the Umbraco database that uses Microsoft SQL Server integrated security.
/// </summary>
/// <param name="server">Name or address of the database server</param>
/// <param name="databaseName">Name of the database</param>
public void ConfigureIntegratedSecurityDatabaseConnection(string server, string databaseName)
{
const string providerName = "System.Data.SqlClient";
string connectionString = String.Format("Server={0};Database={1};Integrated Security=true", server, databaseName);
SaveConnectionString(connectionString, providerName);
Initialize(providerName);
}
internal string BuildAzureConnectionString(string server, string databaseName, string user, string password)
{
if (server.Contains(".") && ServerStartsWithTcp(server) == false)
@@ -282,16 +296,15 @@ namespace Umbraco.Core
if (databaseSettings != null && string.IsNullOrWhiteSpace(databaseSettings.ConnectionString) == false && string.IsNullOrWhiteSpace(databaseSettings.ProviderName) == false)
{
var providerName = "System.Data.SqlClient";
string connString = null;
if (!string.IsNullOrEmpty(ConfigurationManager.ConnectionStrings[GlobalSettings.UmbracoConnectionName].ProviderName))
{
providerName = ConfigurationManager.ConnectionStrings[GlobalSettings.UmbracoConnectionName].ProviderName;
_connectionString =
ConfigurationManager.ConnectionStrings[GlobalSettings.UmbracoConnectionName].ConnectionString;
connString = ConfigurationManager.ConnectionStrings[GlobalSettings.UmbracoConnectionName].ConnectionString;
}
Initialize(providerName, connString);
Initialize(providerName);
DetermineSqlServerVersion();
}
else if (ConfigurationManager.AppSettings.ContainsKey(GlobalSettings.UmbracoConnectionName) && string.IsNullOrEmpty(ConfigurationManager.AppSettings[GlobalSettings.UmbracoConnectionName]) == false)
{
@@ -328,6 +341,8 @@ namespace Umbraco.Core
//Remove the legacy connection string, so we don't end up in a loop if something goes wrong.
GlobalSettings.RemoveSetting(GlobalSettings.UmbracoConnectionName);
DetermineSqlServerVersion();
}
else
{
@@ -355,6 +370,55 @@ namespace Umbraco.Core
}
}
internal void Initialize(string providerName, string connectionString)
{
_connectionString = connectionString;
Initialize(providerName);
}
/// <summary>
/// Set the lazy resolution of determining the SQL server version if that is the db type we're using
/// </summary>
private void DetermineSqlServerVersion()
{
var sqlServerSyntax = SqlSyntaxContext.SqlSyntaxProvider as SqlServerSyntaxProvider;
if (sqlServerSyntax != null)
{
//this will not execute now, it is lazy so will only execute when we need to actually know
// the sql server version.
sqlServerSyntax.VersionName = new Lazy<SqlServerVersionName>(() =>
{
try
{
var database = this._factory.CreateDatabase();
var version = database.ExecuteScalar<string>("SELECT SERVERPROPERTY('productversion')");
var firstPart = version.Split('.')[0];
switch (firstPart)
{
case "11":
return SqlServerVersionName.V2012;
case "10":
return SqlServerVersionName.V2008;
case "9":
return SqlServerVersionName.V2005;
case "8":
return SqlServerVersionName.V2000;
case "7":
return SqlServerVersionName.V7;
default:
return SqlServerVersionName.Other;
}
}
catch (Exception)
{
return SqlServerVersionName.Invalid;
}
});
}
}
internal DatabaseSchemaResult ValidateDatabaseSchema()
{
if (_configured == false || (string.IsNullOrEmpty(_connectionString) || string.IsNullOrEmpty(ProviderName)))
@@ -393,8 +457,8 @@ namespace Umbraco.Core
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>" +
"<p>You can fix this by changing the following two settings in your my.ini file in your MySQL installation directory:</p>" +
"<pre>lower_case_table_names=1\nlower_case_file_system=1</pre><br />" +
"<p>You can fix this by changing the following setting in your my.ini file in your MySQL installation directory:</p>" +
"<pre>lower_case_table_names=1</pre><br />" +
"<p>Note: Make sure to check with your hosting provider if they support case insensitive queries as well.</p>" +
"<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>";
@@ -404,8 +468,8 @@ namespace Umbraco.Core
else if (supportsCaseInsensitiveQueries == null)
{
message = "<p>&nbsp;</p><p>Warning! Could not check if your database type supports case insensitive queries. <br />We currently do not support these databases that do not support case insensitive queries.</p>" +
"<p>You can check this by looking for the following two settings in your my.ini file in your MySQL installation directory:</p>" +
"<pre>lower_case_table_names=1\nlower_case_file_system=1</pre><br />" +
"<p>You can check this by looking for the following setting in your my.ini file in your MySQL installation directory:</p>" +
"<pre>lower_case_table_names=1</pre><br />" +
"<p>Note: Make sure to check with your hosting provider if they support case insensitive queries as well.</p>" +
"<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>";
@@ -418,8 +482,8 @@ namespace Umbraco.Core
"<p>Note: You're using MySQL and the database instance you're connecting to seems to support case insensitive queries.</p>" +
"<p>However, your hosting provider may not support this option. Umbraco does not currently support MySQL installs that do not support case insensitive queries</p>" +
"<p>Make sure to check with your hosting provider if they support case insensitive queries as well.</p>" +
"<p>They can check this by looking for the following two settings in the my.ini file in their MySQL installation directory:</p>" +
"<pre>lower_case_table_names=1\nlower_case_file_system=1</pre><br />" +
"<p>They can check this by looking for the following setting in the my.ini file in their MySQL installation directory:</p>" +
"<pre>lower_case_table_names=1</pre><br />" +
"<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>";
}
@@ -446,6 +510,8 @@ namespace Umbraco.Core
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);
return new Result { Message = message, Success = true, Percentage = "100" };
+22
View File
@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Umbraco.Core
{
public static class DateTimeExtensions
{
/// <summary>
/// Returns the DateTime as an ISO formatted string that is globally expectable
/// </summary>
/// <param name="dt"></param>
/// <returns></returns>
public static string ToIsoString(this DateTime dt)
{
return dt.ToString("yyyy-MM-dd HH:mm:ss");
}
}
}
@@ -0,0 +1,63 @@
using System;
using System.Collections.Generic;
namespace Umbraco.Core.Events
{
public class RecycleBinEventArgs : CancellableEventArgs
{
public RecycleBinEventArgs(Guid nodeObjectType, IEnumerable<int> ids, List<string> files, bool emptiedSuccessfully)
: base(false)
{
NodeObjectType = nodeObjectType;
Ids = ids;
Files = files;
RecycleBinEmptiedSuccessfully = emptiedSuccessfully;
}
public RecycleBinEventArgs(Guid nodeObjectType, IEnumerable<int> ids, List<string> files)
: base(true)
{
NodeObjectType = nodeObjectType;
Ids = ids;
Files = files;
}
/// <summary>
/// Gets the Id of the node object type of the items
/// being deleted from the Recycle Bin.
/// </summary>
public Guid NodeObjectType { get; private set; }
/// <summary>
/// Gets the list of Ids for each of the items being deleted from the Recycle Bin.
/// </summary>
public IEnumerable<int> Ids { get; private set; }
/// <summary>
/// Gets the list of Files that should be deleted as part
/// of emptying the Recycle Bin.
/// </summary>
public List<string> Files { get; private set; }
/// <summary>
/// Boolean indicating whether the Recycle Bin was emptied successfully
/// </summary>
public bool RecycleBinEmptiedSuccessfully { get; private set; }
/// <summary>
/// Boolean indicating whether this event was fired for the Content's Recycle Bin.
/// </summary>
public bool IsContentRecycleBin
{
get { return NodeObjectType == new Guid(Constants.ObjectTypes.Document); }
}
/// <summary>
/// Boolean indicating whether this event was fired for the Media's Recycle Bin.
/// </summary>
public bool IsMediaRecycleBin
{
get { return NodeObjectType == new Guid(Constants.ObjectTypes.Media); }
}
}
}
+14
View File
@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Umbraco.Core
{
/// <summary>
/// Any class implementing this interface that is added to the httpcontext.items keys or values will be disposed of at the end of the request.
/// </summary>
public interface IDisposeOnRequestEnd : IDisposable
{
}
}
+28
View File
@@ -45,6 +45,8 @@ namespace Umbraco.Core.IO
{
if (virtualPath.StartsWith("~"))
return virtualPath.Replace("~", SystemDirectories.Root).Replace("//", "/");
else if (Uri.IsWellFormedUriString(virtualPath, UriKind.Absolute))
return virtualPath;
else
return VirtualPathUtility.ToAbsolute(virtualPath, SystemDirectories.Root);
}
@@ -249,6 +251,32 @@ namespace Umbraco.Core.IO
return _rootDir;
}
internal static string GetRootDirectoryBinFolder()
{
string binFolder = string.Empty;
if (string.IsNullOrEmpty(_rootDir))
{
binFolder = Assembly.GetExecutingAssembly().GetAssemblyFile().Directory.FullName;
return binFolder;
}
binFolder = Path.Combine(GetRootDirectorySafe(), "bin");
#if DEBUG
var debugFolder = Path.Combine(binFolder, "debug");
if (Directory.Exists(debugFolder))
return debugFolder;
#endif
var releaseFolder = Path.Combine(binFolder, "release");
if (Directory.Exists(releaseFolder))
return releaseFolder;
if (Directory.Exists(binFolder))
return binFolder;
return _rootDir;
}
/// <summary>
/// Allows you to overwrite RootDirectory, which would otherwise be resolved
/// automatically upon application start.
+20
View File
@@ -0,0 +1,20 @@
namespace Umbraco.Core.IO
{
internal class ResizedImage
{
public ResizedImage()
{
}
public ResizedImage(int width, int height, string fileName)
{
Width = width;
Height = height;
FileName = fileName;
}
public int Width { get; set; }
public int Height { get; set; }
public string FileName { get; set; }
}
}
+253
View File
@@ -0,0 +1,253 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Web;
using Umbraco.Core.Configuration;
namespace Umbraco.Core.IO
{
public class UmbracoMediaFile
{
private readonly MediaFileSystem _fs;
#region Constructors
public UmbracoMediaFile()
{
_fs = FileSystemProviderManager.Current.GetFileSystemProvider<MediaFileSystem>();
}
public UmbracoMediaFile(string path)
{
_fs = FileSystemProviderManager.Current.GetFileSystemProvider<MediaFileSystem>();
Path = path;
Initialize();
}
#endregion
#region Static Methods
//MB: Do we really need all these overloads? looking through the code, only one of them is actually used
public static UmbracoMediaFile Save(HttpPostedFile file, string path)
{
return Save(file.InputStream, path);
}
public static UmbracoMediaFile Save(HttpPostedFileBase file, string path)
{
return Save(file.InputStream, path);
}
public static UmbracoMediaFile Save(Stream inputStream, string path)
{
var fs = FileSystemProviderManager.Current.GetFileSystemProvider<MediaFileSystem>();
fs.AddFile(path, inputStream);
return new UmbracoMediaFile(path);
}
public static UmbracoMediaFile Save(byte[] file, string relativePath)
{
return Save(new MemoryStream(file), relativePath);
}
public static UmbracoMediaFile Save(HttpPostedFile file)
{
var tempDir = System.IO.Path.Combine("uploads", Guid.NewGuid().ToString());
return Save(file, tempDir);
}
//filebase overload...
public static UmbracoMediaFile Save(HttpPostedFileBase file)
{
var tempDir = System.IO.Path.Combine("uploads", Guid.NewGuid().ToString());
return Save(file, tempDir);
}
#endregion
private long? _length;
private Size? _size;
/// <summary>
/// Initialized values that don't require opening the file.
/// </summary>
private void Initialize()
{
Filename = _fs.GetFileName(Path);
Extension = _fs.GetExtension(Path) != null
? _fs.GetExtension(Path).Substring(1).ToLowerInvariant()
: "";
Url = _fs.GetUrl(Path);
}
public string Filename { get; private set; }
public string Extension { get; private set; }
public string Path { get; private set; }
public string Url { get; private set; }
/// <summary>
/// Get the length of the file in bytes
/// </summary>
/// <remarks>
/// We are lazy loading this, don't go opening the file on ctor like we were doing.
/// </remarks>
public long Length
{
get
{
if (_length == null)
{
_length = _fs.GetSize(Path);
}
return _length.Value;
}
}
public bool SupportsResizing
{
get
{
return ("," + UmbracoSettings.ImageFileTypes + ",").Contains(string.Format(",{0},", Extension));
}
}
public string GetFriendlyName()
{
return Filename.SplitPascalCasing().ToFirstUpperInvariant();
}
public Size GetDimensions()
{
if (_size == null)
{
EnsureFileSupportsResizing();
var fs = _fs.OpenFile(Path);
var image = Image.FromStream(fs);
var fileWidth = image.Width;
var fileHeight = image.Height;
fs.Close();
image.Dispose();
_size = new Size(fileWidth, fileHeight);
}
return _size.Value;
}
public string Resize(int width, int height)
{
EnsureFileSupportsResizing();
var fileNameThumb = DoResize(width, height, 0, string.Empty);
return _fs.GetUrl(fileNameThumb);
}
public string Resize(int maxWidthHeight, string fileNameAddition)
{
EnsureFileSupportsResizing();
var fileNameThumb = DoResize(GetDimensions().Width, GetDimensions().Height, maxWidthHeight, fileNameAddition);
return _fs.GetUrl(fileNameThumb);
}
private string DoResize(int width, int height, int maxWidthHeight, string fileNameAddition)
{
using (var fs = _fs.OpenFile(Path))
{
using (var image = Image.FromStream(fs))
{
var fileNameThumb = string.IsNullOrWhiteSpace(fileNameAddition)
? string.Format("{0}_UMBRACOSYSTHUMBNAIL.jpg", Path.Substring(0, Path.LastIndexOf(".", StringComparison.Ordinal)))
: string.Format("{0}_{1}.jpg", Path.Substring(0, Path.LastIndexOf(".", StringComparison.Ordinal)), fileNameAddition);
var thumbnail = GenerateThumbnail(image, maxWidthHeight, width, height, fileNameThumb, maxWidthHeight == 0);
return thumbnail.FileName;
}
}
}
private void EnsureFileSupportsResizing()
{
if (SupportsResizing == false)
throw new InvalidOperationException(string.Format("The file {0} is not an image, so can't get dimensions", Filename));
}
private ResizedImage GenerateThumbnail(Image image, int maxWidthHeight, int fileWidth, int fileHeight, string thumbnailFileName, bool useFixedDimensions)
{
// Generate thumbnail
float f = 1;
if (useFixedDimensions == false)
{
var fx = (float)image.Size.Width / (float)maxWidthHeight;
var fy = (float)image.Size.Height / (float)maxWidthHeight;
// must fit in thumbnail size
f = Math.Max(fx, fy);
}
var widthTh = (int)Math.Round((float)fileWidth / f);
var heightTh = (int)Math.Round((float)fileHeight / f);
// fixes for empty width or height
if (widthTh == 0)
widthTh = 1;
if (heightTh == 0)
heightTh = 1;
// Create new image with best quality settings
using (var bp = new Bitmap(widthTh, heightTh))
{
using (var g = Graphics.FromImage(bp))
{
g.SmoothingMode = SmoothingMode.HighQuality;
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.PixelOffsetMode = PixelOffsetMode.HighQuality;
g.CompositingQuality = CompositingQuality.HighQuality;
// Copy the old image to the new and resized
var rect = new Rectangle(0, 0, widthTh, heightTh);
g.DrawImage(image, rect, 0, 0, image.Width, image.Height, GraphicsUnit.Pixel);
// Copy metadata
var imageEncoders = ImageCodecInfo.GetImageEncoders();
var codec = Extension.ToLower() == "png" || Extension.ToLower() == "gif"
? imageEncoders.Single(t => t.MimeType.Equals("image/png"))
: imageEncoders.Single(t => t.MimeType.Equals("image/jpeg"));
// Set compresion ratio to 90%
var ep = new EncoderParameters();
ep.Param[0] = new EncoderParameter(Encoder.Quality, 90L);
// Save the new image using the dimensions of the image
var newFileName = thumbnailFileName.Replace("UMBRACOSYSTHUMBNAIL", string.Format("{0}x{1}", widthTh, heightTh));
using (var ms = new MemoryStream())
{
bp.Save(ms, codec, ep);
ms.Seek(0, 0);
_fs.AddFile(newFileName, ms);
}
return new ResizedImage(widthTh, heightTh, newFileName);
}
}
}
}
}
+39 -5
View File
@@ -22,7 +22,7 @@ namespace Umbraco.Core.Models
private DateTime? _expireDate;
private int _writer;
private string _nodeName;//NOTE Once localization is introduced this will be the non-localized Node Name.
private bool _permissionsChanged;
/// <summary>
/// Constructor for creating a Content object
/// </summary>
@@ -82,6 +82,7 @@ namespace Umbraco.Core.Models
private static readonly PropertyInfo ExpireDateSelector = ExpressionHelper.GetPropertyInfo<Content, DateTime?>(x => x.ExpireDate);
private static readonly PropertyInfo WriterSelector = ExpressionHelper.GetPropertyInfo<Content, int>(x => x.WriterId);
private static readonly PropertyInfo NodeNameSelector = ExpressionHelper.GetPropertyInfo<Content, string>(x => x.NodeName);
private static readonly PropertyInfo PermissionsChangedSelector = ExpressionHelper.GetPropertyInfo<Content, bool>(x => x.PermissionsChanged);
/// <summary>
/// Gets or sets the template used by the Content.
@@ -138,7 +139,10 @@ namespace Umbraco.Core.Models
/// <summary>
/// Boolean indicating whether this Content is Published or not
/// </summary>
/// <remarks>Setting Published to true/false should be private or internal</remarks>
/// <remarks>
/// Setting Published to true/false should be private or internal and should ONLY be used for wiring up the value
/// from the db or modifying it based on changing the published state.
/// </remarks>
[DataMember]
public bool Published
{
@@ -243,6 +247,22 @@ namespace Umbraco.Core.Models
}
}
/// <summary>
/// Used internally to track if permissions have been changed during the saving process for this entity
/// </summary>
internal bool PermissionsChanged
{
get { return _permissionsChanged; }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_permissionsChanged = value;
return _permissionsChanged;
}, _permissionsChanged, PermissionsChangedSelector);
}
}
/// <summary>
/// Gets the ContentType used by this content object
/// </summary>
@@ -355,11 +375,25 @@ namespace Umbraco.Core.Models
/// <returns>True if entity is dirty, otherwise False</returns>
public override bool IsDirty()
{
bool dirtyEntity = base.IsDirty();
return IsEntityDirty() || IsAnyUserPropertyDirty();
}
bool dirtyProperties = Properties.Any(x => x.IsDirty());
/// <summary>
/// Returns true if only the entity properties are direty
/// </summary>
/// <returns></returns>
internal bool IsEntityDirty()
{
return base.IsDirty();
}
return dirtyEntity || dirtyProperties;
/// <summary>
/// Returns true if any of the properties are dirty
/// </summary>
/// <returns></returns>
internal bool IsAnyUserPropertyDirty()
{
return Properties.Any(x => x.IsDirty());
}
/// <summary>
+31 -2
View File
@@ -27,6 +27,7 @@ namespace Umbraco.Core.Models
private bool _trashed;
private int _contentTypeId;
private PropertyCollection _properties;
private readonly List<Property> _lastInvalidProperties = new List<Property>();
/// <summary>
/// Protected constructor for ContentBase (Base for Content and Media)
@@ -292,7 +293,10 @@ namespace Umbraco.Core.Models
/// <returns><see cref="Property"/> Value as a <see cref="TPassType"/></returns>
public virtual TPassType GetValue<TPassType>(string propertyTypeAlias)
{
return (TPassType)Properties[propertyTypeAlias].Value;
if (Properties[propertyTypeAlias].Value is TPassType)
return (TPassType)Properties[propertyTypeAlias].Value;
return (TPassType)Convert.ChangeType(Properties[propertyTypeAlias].Value, typeof(TPassType));
}
/// <summary>
@@ -421,9 +425,34 @@ namespace Umbraco.Core.Models
/// <returns>True if content is valid otherwise false</returns>
public virtual bool IsValid()
{
return Properties.Any(property => !property.IsValid()) == false;
_lastInvalidProperties.Clear();
_lastInvalidProperties.AddRange(Properties.Where(property => property.IsValid() == false));
return _lastInvalidProperties.Any() == false;
}
/// <summary>
/// Returns a collection of the result of the last validation process, this collection contains all invalid properties.
/// </summary>
internal IEnumerable<Property> LastInvalidProperties
{
get { return _lastInvalidProperties; }
}
public abstract void ChangeTrashedState(bool isTrashed, int parentId = -20);
/// <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)
/// </summary>
/// <param name="rememberPreviouslyChangedProperties"></param>
internal override void ResetDirtyProperties(bool rememberPreviouslyChangedProperties)
{
base.ResetDirtyProperties(rememberPreviouslyChangedProperties);
foreach (var prop in Properties)
{
prop.ResetDirtyProperties(rememberPreviouslyChangedProperties);
}
}
}
}
+153 -84
View File
@@ -12,16 +12,119 @@ using System.Xml.Linq;
using Umbraco.Core.Configuration;
using Umbraco.Core.IO;
using Umbraco.Core.Media;
using Umbraco.Core.Models.EntityBase;
using Umbraco.Core.Models.Membership;
using Umbraco.Core.Strings;
using Umbraco.Core.Persistence;
using Umbraco.Core.Persistence.UnitOfWork;
using Umbraco.Core.Services;
namespace Umbraco.Core.Models
{
public static class ContentExtensions
{
#region IContent
/// <summary>
/// Determines if a new version should be created
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
/// <remarks>
/// A new version needs to be created when:
/// * The publish status is changed
/// * The language is changed
/// * The item is already published and is being published again and any property value is changed (to enable a rollback)
/// </remarks>
internal static bool ShouldCreateNewVersion(this IContent entity)
{
var publishedState = ((Content)entity).PublishedState;
return ShouldCreateNewVersion(entity, publishedState);
}
/// <summary>
/// Determines if a new version should be created
/// </summary>
/// <param name="entity"></param>
/// <param name="publishedState"></param>
/// <returns></returns>
/// <remarks>
/// A new version needs to be created when:
/// * The publish status is changed
/// * The language is changed
/// * The item is already published and is being published again and any property value is changed (to enable a rollback)
/// </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 contentChanged =
(dirtyEntity.IsPropertyDirty("Published") && publishedState != PublishedState.Unpublished)
|| dirtyEntity.IsPropertyDirty("Language");
//return true if published or language has changed
if (contentChanged)
{
return true;
}
//check if any user prop has changed
var propertyValueChanged = ((Content) entity).IsAnyUserPropertyDirty();
//check if any content prop has changed
var contentDataChanged = ((Content) entity).IsEntityDirty();
//return true if the item is published and a property has changed or if any content property has changed
return (propertyValueChanged && publishedState == PublishedState.Published) || contentDataChanged;
}
/// <summary>
/// Determines if the published db flag should be set to true for the current entity version and all other db
/// versions should have their flag set to false.
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
/// <remarks>
/// This is determined by:
/// * If a new version is being created and the entity is published
/// * If the published state has changed and the entity is published OR the entity has been un-published.
/// </remarks>
internal static bool ShouldClearPublishedFlagForPreviousVersions(this IContent entity)
{
var publishedState = ((Content)entity).PublishedState;
return entity.ShouldClearPublishedFlagForPreviousVersions(publishedState, entity.ShouldCreateNewVersion(publishedState));
}
/// <summary>
/// Determines if the published db flag should be set to true for the current entity version and all other db
/// versions should have their flag set to false.
/// </summary>
/// <param name="entity"></param>
/// <param name="publishedState"></param>
/// <param name="isCreatingNewVersion"></param>
/// <returns></returns>
/// <remarks>
/// This is determined by:
/// * If a new version is being created and the entity is published
/// * If the published state has changed and the entity is published OR the entity has been un-published.
/// </remarks>
internal static bool ShouldClearPublishedFlagForPreviousVersions(this IContent entity, PublishedState publishedState, bool isCreatingNewVersion)
{
if (isCreatingNewVersion && entity.Published)
{
return true;
}
//If Published state has changed then previous versions should have their publish state reset.
//If state has been changed to unpublished the previous versions publish state should also be reset.
if (((ICanBeDirty)entity).IsPropertyDirty("Published") && (entity.Published || publishedState == PublishedState.Unpublished))
{
return true;
}
return false;
}
/// <summary>
/// Returns a list of the current contents ancestors, not including the content itself.
/// </summary>
@@ -105,6 +208,50 @@ namespace Umbraco.Core.Models
}
#endregion
/// <summary>
/// Checks if the IContentBase has children
/// </summary>
/// <param name="content"></param>
/// <param name="services"></param>
/// <returns></returns>
/// <remarks>
/// This is a bit of a hack because we need to type check!
/// </remarks>
internal static bool HasChildren(IContentBase content, ServiceContext services)
{
if (content is IContent)
{
return services.ContentService.HasChildren(content.Id);
}
if (content is IMedia)
{
return services.MediaService.HasChildren(content.Id);
}
return false;
}
/// <summary>
/// Returns the children for the content base item
/// </summary>
/// <param name="content"></param>
/// <param name="services"></param>
/// <returns></returns>
/// <remarks>
/// This is a bit of a hack because we need to type check!
/// </remarks>
internal static IEnumerable<IContentBase> Children(IContentBase content, ServiceContext services)
{
if (content is IContent)
{
return services.ContentService.GetChildren(content.Id);
}
if (content is IMedia)
{
return services.MediaService.GetChildren(content.Id);
}
return null;
}
/// <summary>
/// Set property values by alias with an annonymous object
/// </summary>
@@ -467,38 +614,7 @@ namespace Umbraco.Core.Models
/// <returns>Xml representation of the passed in <see cref="IContent"/></returns>
internal static XElement ToDeepXml(this IContent content)
{
var xml = content.ToXml();
var descendants = content.Descendants().ToArray();
var currentChildren = descendants.Where(x => x.ParentId == content.Id);
AddChildXml(descendants, currentChildren, xml);
return xml;
}
/// <summary>
/// Used by ToDeepXml to recursively add children
/// </summary>
/// <param name="originalDescendants"></param>
/// <param name="currentChildren"></param>
/// <param name="currentXml"></param>
private static void AddChildXml(
IContent[] originalDescendants,
IEnumerable<IContent> currentChildren,
XElement currentXml)
{
foreach (var child in currentChildren)
{
//add the child's xml
var childXml = child.ToXml();
currentXml.Add(childXml);
//copy local (out of closure)
var c = child;
//get this item's children
var children = originalDescendants.Where(x => x.ParentId == c.Id);
//recurse and add it's children to the child xml element
AddChildXml(originalDescendants, children, childXml);
}
return ApplicationContext.Current.Services.PackagingService.Export(content, true);
}
/// <summary>
@@ -508,18 +624,7 @@ namespace Umbraco.Core.Models
/// <returns>Xml representation of the passed in <see cref="IContent"/></returns>
public static XElement ToXml(this IContent content)
{
//nodeName should match Casing.SafeAliasWithForcingCheck(content.ContentType.Alias);
var nodeName = UmbracoSettings.UseLegacyXmlSchema ? "node" : content.ContentType.Alias.ToSafeAliasWithForcingCheck();
var x = content.ToXml(nodeName);
x.Add(new XAttribute("nodeType", content.ContentType.Id));
x.Add(new XAttribute("creatorName", content.GetCreatorProfile().Name));
x.Add(new XAttribute("writerName", content.GetWriterProfile().Name));
x.Add(new XAttribute("writerID", content.WriterId));
x.Add(new XAttribute("template", content.Template == null ? "0" : content.Template.Id.ToString()));
x.Add(new XAttribute("nodeTypeAlias", content.ContentType.Alias));
return x;
return ApplicationContext.Current.Services.PackagingService.Export(content);
}
/// <summary>
@@ -529,49 +634,13 @@ namespace Umbraco.Core.Models
/// <returns>Xml representation of the passed in <see cref="IContent"/></returns>
public static XElement ToXml(this IMedia media)
{
//nodeName should match Casing.SafeAliasWithForcingCheck(content.ContentType.Alias);
var nodeName = UmbracoSettings.UseLegacyXmlSchema ? "node" : media.ContentType.Alias.ToSafeAliasWithForcingCheck();
var x = media.ToXml(nodeName);
x.Add(new XAttribute("nodeType", media.ContentType.Id));
x.Add(new XAttribute("writerName", media.GetCreatorProfile().Name));
x.Add(new XAttribute("writerID", media.CreatorId));
x.Add(new XAttribute("version", media.Version));
x.Add(new XAttribute("template", 0));
x.Add(new XAttribute("nodeTypeAlias", media.ContentType.Alias));
return x;
return ApplicationContext.Current.Services.PackagingService.Export(media);
}
/// <summary>
/// Creates the xml representation for the <see cref="IContentBase"/> object
/// </summary>
/// <param name="contentBase"><see cref="IContent"/> to generate xml for</param>
/// <param name="nodeName"></param>
/// <returns>Xml representation of the passed in <see cref="IContent"/></returns>
private static XElement ToXml(this IContentBase contentBase, string nodeName)
internal static XElement ToDeepXml(this IMedia media)
{
// note: that one will take care of umbracoUrlName
var url = contentBase.GetUrlSegment();
var xml = new XElement(nodeName,
new XAttribute("id", contentBase.Id),
new XAttribute("parentID", contentBase.Level > 1 ? contentBase.ParentId : -1),
new XAttribute("level", contentBase.Level),
new XAttribute("creatorID", contentBase.CreatorId),
new XAttribute("sortOrder", contentBase.SortOrder),
new XAttribute("createDate", contentBase.CreateDate.ToString("s")),
new XAttribute("updateDate", contentBase.UpdateDate.ToString("s")),
new XAttribute("nodeName", contentBase.Name),
new XAttribute("urlName", url),
new XAttribute("path", contentBase.Path),
new XAttribute("isDoc", ""));
foreach (var property in contentBase.Properties.Where(p => p != null))
xml.Add(property.ToXml());
return xml;
}
return ApplicationContext.Current.Services.PackagingService.Export(media, true);
}
/// <summary>
/// Creates the xml representation for the <see cref="IContent"/> object
+32
View File
@@ -181,6 +181,38 @@ namespace Umbraco.Core.Models
}
}
/// <summary>
/// Creates a clone of the current entity
/// </summary>
/// <returns></returns>
public IContentType Clone(string alias)
{
var clone = (ContentType)this.MemberwiseClone();
clone.Alias = alias;
clone.Key = Guid.Empty;
var propertyGroups = this.PropertyGroups.Select(x => x.Clone()).ToList();
clone.PropertyGroups = new PropertyGroupCollection(propertyGroups);
clone.PropertyTypes = this.PropertyTypeCollection.Select(x => x.Clone()).ToList();
clone.ResetIdentity();
clone.ResetDirtyProperties(false);
foreach (var propertyGroup in clone.PropertyGroups)
{
propertyGroup.ResetIdentity();
foreach (var propertyType in propertyGroup.PropertyTypes)
{
propertyType.ResetIdentity();
}
}
foreach (var propertyType in clone.PropertyTypes.Where(x => x.HasIdentity))
{
propertyType.ResetIdentity();
}
return clone;
}
/// <summary>
/// Method to call when Entity is being saved
/// </summary>
@@ -477,6 +477,15 @@ namespace Umbraco.Core.Models
}
}
/// <summary>
/// Removes a PropertyGroup from the current ContentType
/// </summary>
/// <param name="propertyGroupName">Name of the <see cref="PropertyGroup"/> to remove</param>
public void RemovePropertyGroup(string propertyGroupName)
{
PropertyGroups.RemoveItem(propertyGroupName);
}
/// <summary>
/// Sets the ParentId from the lazy integer id
/// </summary>
@@ -485,5 +494,14 @@ namespace Umbraco.Core.Models
{
_parentId = id;
}
/// <summary>
/// PropertyTypes that are not part of a PropertyGroup
/// </summary>
[IgnoreDataMember]
internal PropertyTypeCollection PropertyTypeCollection
{
get { return _propertyTypes; }
}
}
}
@@ -75,7 +75,7 @@ namespace Umbraco.Core.Models
if (contentType.ContentTypeComposition.Any(x => x.CompositionAliases().Any(ContentTypeCompositionExists)))
return false;
if (!ContentTypeCompositionExists(contentType.Alias))
if (ContentTypeCompositionExists(contentType.Alias) == false)
{
_contentTypeComposition.Add(contentType);
OnPropertyChanged(ContentTypeCompositionSelector);
@@ -108,7 +108,7 @@ namespace Umbraco.Core.Models.EntityBase
/// Please note that resetting the dirty properties could potentially
/// obstruct the saving of a new or updated entity.
/// </remarks>
internal void ResetDirtyProperties(bool rememberPreviouslyChangedProperties)
internal virtual void ResetDirtyProperties(bool rememberPreviouslyChangedProperties)
{
if (rememberPreviouslyChangedProperties)
{
@@ -64,6 +64,12 @@ namespace Umbraco.Core.Models
/// <param name="propertyTypeAlias">Alias of the <see cref="PropertyType"/> to remove</param>
void RemovePropertyType(string propertyTypeAlias);
/// <summary>
/// Removes a PropertyGroup from the current ContentType
/// </summary>
/// <param name="propertyGroupName">Name of the <see cref="PropertyGroup"/> to remove</param>
void RemovePropertyGroup(string propertyGroupName);
/// <summary>
/// Sets the ParentId from the lazy integer id
/// </summary>
@@ -1,6 +1,5 @@
using System;
using Umbraco.Core.Models.EntityBase;
using Umbraco.Core.Persistence.Mappers;
namespace Umbraco.Core.Models
{
+12 -4
View File
@@ -7,17 +7,25 @@ namespace Umbraco.Core.Models.Membership
/// Defines the interface for a <see cref="User"/>
/// </summary>
/// <remarks>Will be left internal until a proper Membership implementation is part of the roadmap</remarks>
internal interface IUser : IMembershipUser
internal interface IUser : IMembershipUser, IUserProfile
{
string Name { get; set; }
new object Id { get; set; }
//string Name { get; set; }
int SessionTimeout { get; set; }
int StartContentId { get; set; }
int StartMediaId { get; set; }
string Language { get; set; }
bool DefaultToLiveEditing { get; set; }
IEnumerable<string> Applications { get; set; }
bool NoConsole { get; set; }
IUserType UserType { get; }
string Permissions { get; set; }
string DefaultPermissions { get; set; }
}
internal interface IUserProfile : IProfile
{
IEnumerable<string> AllowedSections { get; }
void RemoveAllowedSection(string sectionAlias);
void AddAllowedSection(string sectionAlias);
}
}
+57 -5
View File
@@ -1,5 +1,7 @@
using System;
using System.Reflection;
using System.Runtime.Serialization;
using Umbraco.Core.Models.EntityBase;
namespace Umbraco.Core.Models.Membership
{
@@ -8,7 +10,7 @@ namespace Umbraco.Core.Models.Membership
/// </summary>
[Serializable]
[DataContract(IsReference = true)]
internal class Profile : IProfile
internal class Profile : TracksChangesEntityBase, IProfile, IRememberBeingDirty
{
/// <summary>
/// Initializes a new instance of the <see cref="Profile"/> class.
@@ -25,11 +27,47 @@ namespace Umbraco.Core.Models.Membership
Name = name;
}
[DataMember]
public object Id { get; set; }
private object _id;
private string _name;
private Type _userTypeKey;
private static readonly PropertyInfo IdSelector = ExpressionHelper.GetPropertyInfo<Profile, object>(x => x.Id);
private static readonly PropertyInfo NameSelector = ExpressionHelper.GetPropertyInfo<Profile, string>(x => x.Name);
private static readonly PropertyInfo UserTypeKeySelector = ExpressionHelper.GetPropertyInfo<Profile, Type>(x => x.ProviderUserKeyType);
[DataMember]
public string Name { get; set; }
public object Id
{
get
{
return _id;
}
set
{
SetPropertyValueAndDetectChanges(o =>
{
_id = value;
return _id;
}, _id, IdSelector);
}
}
[DataMember]
public string Name
{
get
{
return _name;
}
set
{
SetPropertyValueAndDetectChanges(o =>
{
_name = value;
return _name;
}, _name, NameSelector);
}
}
[IgnoreDataMember]
public virtual object ProviderUserKey
@@ -45,7 +83,21 @@ namespace Umbraco.Core.Models.Membership
/// The type of the provider user key.
/// </value>
[IgnoreDataMember]
internal Type ProviderUserKeyType { get; private set; }
internal Type ProviderUserKeyType
{
get
{
return _userTypeKey;
}
private set
{
SetPropertyValueAndDetectChanges(o =>
{
_userTypeKey = value;
return _userTypeKey;
}, _userTypeKey, UserTypeKeySelector);
}
}
/// <summary>
/// Sets the type of the provider user key.
+5 -4
View File
@@ -22,7 +22,7 @@ namespace Umbraco.Core.Models.Membership
public User(IUserType userType)
{
Groups = new List<object> {userType};
Groups = new List<object> { userType };
}
#region Implementation of IEntity
@@ -91,7 +91,8 @@ namespace Umbraco.Core.Models.Membership
[DataMember]
public string Language { get; set; }
[DataMember]
public string Permissions { get; set; }
public string DefaultPermissions { get; set; }
[DataMember]
public bool DefaultToLiveEditing { get; set; }
[DataMember]
@@ -100,8 +101,8 @@ namespace Umbraco.Core.Models.Membership
[IgnoreDataMember]
public IUserType UserType
{
get
{
get
{
var type = Groups.FirstOrDefault();
return type as IUserType;
}
+138 -11
View File
@@ -1,6 +1,9 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.Linq;
using System.Reflection;
using System.Runtime.Serialization;
namespace Umbraco.Core.Models.Membership
@@ -14,14 +17,29 @@ namespace Umbraco.Core.Models.Membership
/// </remarks>
[Serializable]
[DataContract(IsReference = true)]
internal class UserProfile : Profile
internal class UserProfile : Profile, IUserProfile
{
public UserProfile()
{
SessionTimeout = 60;
Applications = Enumerable.Empty<string>();
_sectionCollection = new ObservableCollection<string>();
_addedSections = new List<string>();
_removedSections = new List<string>();
_sectionCollection.CollectionChanged += SectionCollectionChanged;
}
private readonly List<string> _addedSections;
private readonly List<string> _removedSections;
private readonly ObservableCollection<string> _sectionCollection;
private int _sessionTimeout;
private int _startContentId;
private int _startMediaId;
private static readonly PropertyInfo SessionTimeoutSelector = ExpressionHelper.GetPropertyInfo<UserProfile, int>(x => x.SessionTimeout);
private static readonly PropertyInfo StartContentIdSelector = ExpressionHelper.GetPropertyInfo<UserProfile, int>(x => x.StartContentId);
private static readonly PropertyInfo StartMediaIdSelector = ExpressionHelper.GetPropertyInfo<UserProfile, int>(x => x.StartMediaId);
private static readonly PropertyInfo AllowedSectionsSelector = ExpressionHelper.GetPropertyInfo<UserProfile, IEnumerable<string>>(x => x.AllowedSections);
/// <summary>
/// Gets or sets the session timeout.
/// </summary>
@@ -29,7 +47,21 @@ namespace Umbraco.Core.Models.Membership
/// The session timeout.
/// </value>
[DataMember]
public int SessionTimeout { get; set; }
public int SessionTimeout
{
get
{
return _sessionTimeout;
}
set
{
SetPropertyValueAndDetectChanges(o =>
{
_sessionTimeout = value;
return _sessionTimeout;
}, _sessionTimeout, SessionTimeoutSelector);
}
}
/// <summary>
/// Gets or sets the start content id.
@@ -38,7 +70,21 @@ namespace Umbraco.Core.Models.Membership
/// The start content id.
/// </value>
[DataMember]
public int StartContentId { get; set; }
public int StartContentId
{
get
{
return _startContentId;
}
set
{
SetPropertyValueAndDetectChanges(o =>
{
_startContentId = value;
return _startContentId;
}, _startContentId, StartContentIdSelector);
}
}
/// <summary>
/// Gets or sets the start media id.
@@ -47,15 +93,96 @@ namespace Umbraco.Core.Models.Membership
/// The start media id.
/// </value>
[DataMember]
public int StartMediaId { get; set; }
public int StartMediaId
{
get
{
return _startMediaId;
}
set
{
SetPropertyValueAndDetectChanges(o =>
{
_startMediaId = value;
return _startMediaId;
}, _startMediaId, StartMediaIdSelector);
}
}
public IEnumerable<string> AllowedSections
{
get { return _sectionCollection; }
}
public void RemoveAllowedSection(string sectionAlias)
{
_sectionCollection.Remove(sectionAlias);
}
public void AddAllowedSection(string sectionAlias)
{
if (!_sectionCollection.Contains(sectionAlias))
{
_sectionCollection.Add(sectionAlias);
}
}
/// <summary>
/// Gets or sets the applications.
/// Whenever resetting occurs, clear the remembered add/removed collections, even if
/// rememberPreviouslyChangedProperties is true, the AllowedSections property will still
/// be flagged as dirty.
/// </summary>
/// <value>
/// The applications.
/// </value>
[DataMember]
public IEnumerable<string> Applications { get; set; }
/// <param name="rememberPreviouslyChangedProperties"></param>
internal override void ResetDirtyProperties(bool rememberPreviouslyChangedProperties)
{
_addedSections.Clear();
_removedSections.Clear();
base.ResetDirtyProperties(rememberPreviouslyChangedProperties);
}
/// <summary>
/// Used internally to check if we need to add a section in the repository to the db
/// </summary>
internal IEnumerable<string> AddedSections
{
get { return _addedSections; }
}
/// <summary>
/// Used internally to check if we need to remove a section in the repository to the db
/// </summary>
internal IEnumerable<string> RemovedSections
{
get { return _removedSections; }
}
/// <summary>
/// Handles the collection changed event in order for us to flag the AllowedSections property as changed
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void SectionCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
{
OnPropertyChanged(AllowedSectionsSelector);
if (e.Action == NotifyCollectionChangedAction.Add)
{
//remove from the removed/added sections (since people could add/remove all they want in one request)
_removedSections.RemoveAll(s => s == e.NewItems.Cast<string>().First());
_addedSections.RemoveAll(s => s == e.NewItems.Cast<string>().First());
//add to the added sections
_addedSections.Add(e.NewItems.Cast<string>().First());
}
else if (e.Action == NotifyCollectionChangedAction.Remove)
{
//remove from the removed/added sections (since people could add/remove all they want in one request)
_removedSections.RemoveAll(s => s == e.OldItems.Cast<string>().First());
_addedSections.RemoveAll(s => s == e.OldItems.Cast<string>().First());
//add to the added sections
_removedSections.Add(e.OldItems.Cast<string>().First());
}
}
}
}
+30 -4
View File
@@ -1,7 +1,15 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Xml;
using System.Xml.Linq;
using System.Xml.XPath;
using Umbraco.Core.Configuration;
using Umbraco.Core.Models.Rdbms;
using Umbraco.Core.Services;
using umbraco.interfaces;
namespace Umbraco.Core.Models
{
@@ -14,10 +22,15 @@ namespace Umbraco.Core.Models
/// <returns>Xml of the property and its value</returns>
public static XElement ToXml(this Property property)
{
string nodeName = UmbracoSettings.UseLegacyXmlSchema ? "data" : property.Alias.ToSafeAlias();
return property.ToXml(ApplicationContext.Current.Services.DataTypeService);
}
internal static XElement ToXml(this Property property, IDataTypeService dataTypeService)
{
var nodeName = UmbracoSettings.UseLegacyXmlSchema ? "data" : property.Alias.ToSafeAlias();
var xd = new XmlDocument();
XmlNode xmlNode = xd.CreateNode(XmlNodeType.Element, nodeName, "");
var xmlNode = xd.CreateNode(XmlNodeType.Element, nodeName, "");
//Add the property alias to the legacy schema
if (UmbracoSettings.UseLegacyXmlSchema)
@@ -28,8 +41,21 @@ namespace Umbraco.Core.Models
}
//This seems to fail during testing
xmlNode.AppendChild(property.PropertyType.DataType(property.Id).Data.ToXMl(xd));
//SD: With the new null checks below, this shouldn't fail anymore.
var dt = property.PropertyType.DataType(property.Id, dataTypeService);
if (dt != null && dt.Data != null)
{
//We've already got the value for the property so we're going to give it to the
// data type's data property so it doesn't go re-look up the value from the db again.
var defaultData = dt.Data as IDataValueSetter;
if (defaultData != null)
{
defaultData.SetValue(property.Value, property.PropertyType.DataTypeDatabaseType.ToString());
}
xmlNode.AppendChild(dt.Data.ToXMl(xd));
}
var element = xmlNode.GetXElement();
return element;
}
+17
View File
@@ -108,6 +108,23 @@ namespace Umbraco.Core.Models
}
}
internal PropertyGroup Clone()
{
var clone = (PropertyGroup) this.MemberwiseClone();
var collection = new PropertyTypeCollection();
foreach (var propertyType in this.PropertyTypes)
{
var property = propertyType.Clone();
property.ResetIdentity();
property.ResetDirtyProperties(false);
collection.Add(property);
}
clone.PropertyTypes = collection;
clone.ResetIdentity();
clone.ResetDirtyProperties(false);
return clone;
}
/// <summary>
/// Sets the ParentId from the lazy integer id
/// </summary>
@@ -97,6 +97,14 @@ namespace Umbraco.Core.Models
return this.Any(x => x.Name == groupName);
}
public void RemoveItem(string propertyGroupName)
{
var key = IndexOfKey(propertyGroupName);
//Only removes an item if the key was found
if (key != -1)
RemoveItem(key);
}
public int IndexOfKey(string key)
{
for (var i = 0; i < this.Count; i++)
+8
View File
@@ -378,6 +378,14 @@ namespace Umbraco.Core.Models
return true;
}
internal PropertyType Clone()
{
var clone = (PropertyType) this.MemberwiseClone();
clone.ResetIdentity();
clone.ResetDirtyProperties(false);
return clone;
}
public bool Equals(PropertyType other)
{
//Check whether the compared object is null.
@@ -1,4 +1,5 @@
using umbraco.interfaces;
using Umbraco.Core.Services;
using umbraco.interfaces;
namespace Umbraco.Core.Models
{
@@ -9,6 +10,7 @@ namespace Umbraco.Core.Models
/// </summary>
/// <param name="propertyType">PropertyType that references a DataType</param>
/// <param name="propertyId">Id of the Property which references this DataType through its PropertyType</param>
/// <param name="dataTypeService"></param>
/// <returns><see cref="IDataType"/></returns>
/// <remarks>
/// This extension method is left internal because we don't want to take
@@ -16,10 +18,14 @@ namespace Umbraco.Core.Models
/// be replaced by PropertyEditors. It is however needed to generate xml
/// for a property/propertytype when publishing.
/// </remarks>
internal static IDataType DataType(this PropertyType propertyType, int propertyId)
internal static IDataType DataType(this PropertyType propertyType, int propertyId, IDataTypeService dataTypeService)
{
Mandate.ParameterNotNull(propertyType, "propertyType");
var dataType = ApplicationContext.Current.Services.DataTypeService.GetDataTypeById(propertyType.DataTypeId);
var dataType = dataTypeService.GetDataTypeById(propertyType.DataTypeId);
if (dataType == null)
{
return null;
}
dataType.DataTypeDefinitionId = propertyType.DataTypeDefinitionId;
dataType.Data.PropertyId = propertyId;
return dataType;
@@ -65,12 +65,12 @@ namespace Umbraco.Core.Models.Rdbms
return Date.Value;
}
if(!string.IsNullOrEmpty(VarChar))
if(string.IsNullOrEmpty(VarChar) == false)
{
return VarChar;
}
if(!string.IsNullOrEmpty(Text))
if(string.IsNullOrEmpty(Text) == false)
{
return Text;
}
+5 -1
View File
@@ -1,4 +1,5 @@
using Umbraco.Core.Persistence;
using System.Collections.Generic;
using Umbraco.Core.Persistence;
using Umbraco.Core.Persistence.DatabaseAnnotations;
namespace Umbraco.Core.Models.Rdbms
@@ -59,5 +60,8 @@ namespace Umbraco.Core.Models.Rdbms
[Column("defaultToLiveEditing")]
[Constraint(Default = "0")]
public bool DefaultToLiveEditing { get; set; }
[ResultColumn]
public List<User2AppDto> User2AppDtos { get; set; }
}
}
+1 -17
View File
@@ -20,7 +20,6 @@ namespace Umbraco.Core.Models
private int _level;
private int _sortOrder;
private int _parentId;
private string _nodePath;
private int _masterTemplateId;
private string _masterTemplateAlias;
@@ -28,7 +27,6 @@ namespace Umbraco.Core.Models
private static readonly PropertyInfo LevelSelector = ExpressionHelper.GetPropertyInfo<Template, int>(x => x.Level);
private static readonly PropertyInfo SortOrderSelector = ExpressionHelper.GetPropertyInfo<Template, int>(x => x.SortOrder);
private static readonly PropertyInfo ParentIdSelector = ExpressionHelper.GetPropertyInfo<Template, int>(x => x.ParentId);
private static readonly PropertyInfo NodePathSelector = ExpressionHelper.GetPropertyInfo<Template, string>(x => x.NodePath);
//private static readonly PropertyInfo MasterTemplateIdSelector = ExpressionHelper.GetPropertyInfo<Template, int>(x => x.MasterTemplateId);
private static readonly PropertyInfo MasterTemplateAliasSelector = ExpressionHelper.GetPropertyInfo<Template, string>(x => x.MasterTemplateAlias);
@@ -104,21 +102,7 @@ namespace Umbraco.Core.Models
}, _parentId, ParentIdSelector);
}
}
[DataMember]
internal string NodePath
{
get { return _nodePath; }
set
{
SetPropertyValueAndDetectChanges(o =>
{
_nodePath = value;
return _nodePath;
}, _nodePath, NodePathSelector);
}
}
[DataMember]
internal Lazy<int> MasterTemplateId { get; set; }
@@ -1,4 +1,5 @@
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using Umbraco.Core.CodeAnnotations;
@@ -9,7 +10,8 @@ namespace Umbraco.Core.Models
/// </summary>
public static class UmbracoObjectTypesExtensions
{
private static readonly Dictionary<UmbracoObjectTypes, Guid> UmbracoObjectTypeCache = new Dictionary<UmbracoObjectTypes,Guid>();
//MUST be concurrent to avoid thread collisions!
private static readonly ConcurrentDictionary<UmbracoObjectTypes, Guid> UmbracoObjectTypeCache = new ConcurrentDictionary<UmbracoObjectTypes, Guid>();
/// <summary>
/// Get an UmbracoObjectTypes value from it's name
@@ -48,24 +50,22 @@ namespace Umbraco.Core.Models
/// <returns>a GUID value of the UmbracoObjectTypes</returns>
public static Guid GetGuid(this UmbracoObjectTypes umbracoObjectType)
{
if (UmbracoObjectTypeCache.ContainsKey(umbracoObjectType))
return UmbracoObjectTypeCache[umbracoObjectType];
return UmbracoObjectTypeCache.GetOrAdd(umbracoObjectType, types =>
{
var type = typeof(UmbracoObjectTypes);
var memInfo = type.GetMember(umbracoObjectType.ToString());
var attributes = memInfo[0].GetCustomAttributes(typeof(UmbracoObjectTypeAttribute),
false);
var type = typeof(UmbracoObjectTypes);
var memInfo = type.GetMember(umbracoObjectType.ToString());
var attributes = memInfo[0].GetCustomAttributes(typeof(UmbracoObjectTypeAttribute),
false);
if (attributes.Length == 0)
return Guid.Empty;
if (attributes.Length == 0)
return Guid.Empty;
var attribute = ((UmbracoObjectTypeAttribute)attributes[0]);
if (attribute == null)
return Guid.Empty;
var attribute = ((UmbracoObjectTypeAttribute)attributes[0]);
if (attribute == null)
return Guid.Empty;
UmbracoObjectTypeCache.Add(umbracoObjectType, attribute.ObjectId);
return attribute.ObjectId;
return attribute.ObjectId;
});
}
/// <summary>
+50
View File
@@ -0,0 +1,50 @@
using System;
namespace Umbraco.Core
{
/// <summary>
/// Currently just used to get the machine name in med trust and to format a machine name for use with file names
/// </summary>
internal class NetworkHelper
{
/// <summary>
/// Returns the machine name that is safe to use in file paths.
/// </summary>
/// <remarks>
/// see: https://github.com/Shandem/ClientDependency/issues/4
/// </remarks>
public static string FileSafeMachineName
{
get { return MachineName.ReplaceNonAlphanumericChars('-'); }
}
/// <summary>
/// Returns the current machine name
/// </summary>
/// <remarks>
/// Tries to resolve the machine name, if it cannot it uses the config section.
/// </remarks>
public static string MachineName
{
get
{
try
{
return Environment.MachineName;
}
catch
{
try
{
return System.Net.Dns.GetHostName();
}
catch
{
//if we get here it means we cannot access the machine name
throw new ApplicationException("Cannot resolve the current machine name eithe by Environment.MachineName or by Dns.GetHostname()");
}
}
}
}
}
}
@@ -1,9 +1,11 @@
using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Caching;
using System.Threading;
using System.Web;
using Umbraco.Core.Models.EntityBase;
namespace Umbraco.Core.Persistence.Caching
@@ -11,6 +13,23 @@ namespace Umbraco.Core.Persistence.Caching
/// <summary>
/// The Runtime Cache provider looks up objects in the Runtime cache for fast retrival
/// </summary>
/// <remarks>
///
/// If a web session is detected then the HttpRuntime.Cache will be used for the runtime cache, otherwise a custom
/// MemoryCache instance will be used. It is important to use the HttpRuntime.Cache when a web session is detected so
/// that the memory management of cache in IIS can be handled appopriately.
///
/// When a web sessions is detected we will pre-fix all HttpRuntime.Cache entries so that when we clear it we are only
/// clearing items that have been inserted by this provider.
///
/// NOTE: These changes are all temporary until we finalize the ApplicationCache implementation which will support static cache, runtime cache
/// and request based cache which will all live in one central location so it is easily managed.
///
/// Also note that we don't always keep checking if HttpContext.Current == null and instead check for _memoryCache != null. This is because
/// when there are async requests being made even in the context of a web request, the HttpContext.Current will be null but the HttpRuntime.Cache will
/// always be available.
///
/// </remarks>
internal sealed class RuntimeCacheProvider : IRepositoryCacheProvider
{
#region Singleton
@@ -21,19 +40,25 @@ namespace Umbraco.Core.Persistence.Caching
private RuntimeCacheProvider()
{
if (HttpContext.Current == null)
{
_memoryCache = new MemoryCache("in-memory");
}
}
#endregion
//TODO Save this in cache as well, so its not limited to a single server usage
private readonly ConcurrentHashSet<string> _keyTracker = new ConcurrentHashSet<string>();
private ObjectCache _memoryCache = new MemoryCache("in-memory");
private ObjectCache _memoryCache;
private static readonly ReaderWriterLockSlim ClearLock = new ReaderWriterLockSlim();
public IEntity GetById(Type type, Guid id)
{
var key = GetCompositeId(type, id);
var item = _memoryCache.Get(key);
var item = _memoryCache != null
? _memoryCache.Get(key)
: HttpRuntime.Cache.Get(key);
return item as IEntity;
}
@@ -41,7 +66,11 @@ namespace Umbraco.Core.Persistence.Caching
{
foreach (var guid in ids)
{
yield return _memoryCache.Get(GetCompositeId(type, guid)) as IEntity;
var item = _memoryCache != null
? _memoryCache.Get(GetCompositeId(type, guid))
: HttpRuntime.Cache.Get(GetCompositeId(type, guid));
yield return item as IEntity;
}
}
@@ -49,9 +78,13 @@ namespace Umbraco.Core.Persistence.Caching
{
foreach (var key in _keyTracker)
{
if (key.StartsWith(type.Name))
if (key.StartsWith(string.Format("{0}{1}-", CacheItemPrefix, type.Name)))
{
yield return _memoryCache.Get(key) as IEntity;
var item = _memoryCache != null
? _memoryCache.Get(key)
: HttpRuntime.Cache.Get(key);
yield return item as IEntity;
}
}
}
@@ -59,21 +92,34 @@ namespace Umbraco.Core.Persistence.Caching
public void Save(Type type, IEntity entity)
{
var key = GetCompositeId(type, entity.Id);
var exists = _memoryCache.GetCacheItem(key) != null;
_keyTracker.TryAdd(key);
if (exists)
//NOTE: Before we were checking if it already exists but the MemoryCache.Set handles this implicitly and does
// an add or update, same goes for HttpRuntime.Cache.Insert.
if (_memoryCache != null)
{
_memoryCache.Set(key, entity, new CacheItemPolicy { SlidingExpiration = TimeSpan.FromMinutes(5) });
return;
}
_memoryCache.Add(key, entity, new CacheItemPolicy { SlidingExpiration = TimeSpan.FromMinutes(5) });
else
{
HttpRuntime.Cache.Insert(key, entity, null, System.Web.Caching.Cache.NoAbsoluteExpiration, TimeSpan.FromMinutes(5));
}
}
public void Delete(Type type, IEntity entity)
{
var key = GetCompositeId(type, entity.Id);
_memoryCache.Remove(key);
if (_memoryCache != null)
{
_memoryCache.Remove(key);
}
else
{
HttpRuntime.Cache.Remove(key);
}
_keyTracker.Remove(key);
}
@@ -88,14 +134,21 @@ namespace Umbraco.Core.Persistence.Caching
var keys = new string[_keyTracker.Count];
_keyTracker.CopyTo(keys, 0);
var keysToRemove = new List<string>();
foreach (var key in keys.Where(x => x.StartsWith(string.Format("{0}-", type.Name))))
foreach (var key in keys.Where(x => x.StartsWith(string.Format("{0}{1}-", CacheItemPrefix, type.Name))))
{
_keyTracker.Remove(key);
keysToRemove.Add(key);
}
foreach (var key in keysToRemove)
{
_memoryCache.Remove(key);
if (_memoryCache != null)
{
_memoryCache.Remove(key);
}
else
{
HttpRuntime.Cache.Remove(key);
}
}
}
}
@@ -105,19 +158,40 @@ namespace Umbraco.Core.Persistence.Caching
using (new WriteLock(ClearLock))
{
_keyTracker.Clear();
_memoryCache.DisposeIfDisposable();
_memoryCache = new MemoryCache("in-memory");
if (_memoryCache != null)
{
_memoryCache.DisposeIfDisposable();
_memoryCache = new MemoryCache("in-memory");
}
else
{
foreach (DictionaryEntry c in HttpRuntime.Cache)
{
if (c.Key is string && ((string)c.Key).InvariantStartsWith(CacheItemPrefix))
{
if (HttpRuntime.Cache[(string)c.Key] == null) return;
HttpRuntime.Cache.Remove((string)c.Key);
}
}
}
}
}
/// <summary>
/// We prefix all cache keys with this so that we know which ones this class has created when
/// using the HttpRuntime cache so that when we clear it we don't clear other entries we didn't create.
/// </summary>
private const string CacheItemPrefix = "umbrtmche_";
private string GetCompositeId(Type type, Guid id)
{
return string.Format("{0}-{1}", type.Name, id.ToString());
return string.Format("{0}{1}-{2}", CacheItemPrefix, type.Name, id.ToString());
}
private string GetCompositeId(Type type, int id)
{
return string.Format("{0}-{1}", type.Name, id.ToGuid());
return string.Format("{0}{1}-{2}", CacheItemPrefix, type.Name, id.ToGuid());
}
}
}
@@ -3,6 +3,7 @@ using System.Data;
using System.Linq;
using System.Reflection;
using Umbraco.Core.Persistence.DatabaseAnnotations;
using Umbraco.Core.Persistence.SqlSyntax;
namespace Umbraco.Core.Persistence.DatabaseModelDefinitions
{
@@ -107,6 +108,12 @@ namespace Umbraco.Core.Persistence.DatabaseModelDefinitions
var constraintAttribute = propertyInfo.FirstAttribute<ConstraintAttribute>();
if (constraintAttribute != null)
{
//Special case for MySQL as it can't have multiple default DateTime values, which
//is what the umbracoServer table definition is trying to create
if (SqlSyntaxContext.SqlSyntaxProvider is MySqlSyntaxProvider && definition.TableName == "umbracoServer" &&
definition.TableName.ToLowerInvariant() == "lastNotifiedDate".ToLowerInvariant())
return definition;
definition.ConstraintName = constraintAttribute.Name ?? string.Empty;
definition.DefaultValue = constraintAttribute.Default ?? string.Empty;
}
@@ -14,9 +14,9 @@ namespace Umbraco.Core.Persistence
/// </remarks>
internal class DefaultDatabaseFactory : DisposableObject, IDatabaseFactory
{
private readonly string _connectionStringName;
private readonly string _connectionString;
private readonly string _providerName;
private readonly string _connectionStringName;
public string ConnectionString { get; private set; }
public string ProviderName { get; private set; }
//very important to have ThreadStatic:
// see: http://issues.umbraco.org/issue/U4-2172
@@ -52,8 +52,8 @@ namespace Umbraco.Core.Persistence
{
Mandate.ParameterNotNullOrEmpty(connectionString, "connectionString");
Mandate.ParameterNotNullOrEmpty(providerName, "providerName");
_connectionString = connectionString;
_providerName = providerName;
ConnectionString = connectionString;
ProviderName = providerName;
}
public UmbracoDatabase CreateDatabase()
@@ -68,8 +68,8 @@ namespace Umbraco.Core.Persistence
//double check
if (_nonHttpInstance == null)
{
_nonHttpInstance = string.IsNullOrEmpty(_connectionString) == false && string.IsNullOrEmpty(_providerName) == false
? new UmbracoDatabase(_connectionString, _providerName)
_nonHttpInstance = string.IsNullOrEmpty(ConnectionString) == false && string.IsNullOrEmpty(ProviderName) == false
? new UmbracoDatabase(ConnectionString, ProviderName)
: new UmbracoDatabase(_connectionStringName);
}
}
@@ -81,8 +81,8 @@ namespace Umbraco.Core.Persistence
if (HttpContext.Current.Items.Contains(typeof(DefaultDatabaseFactory)) == false)
{
HttpContext.Current.Items.Add(typeof (DefaultDatabaseFactory),
string.IsNullOrEmpty(_connectionString) == false && string.IsNullOrEmpty(_providerName) == false
? new UmbracoDatabase(_connectionString, _providerName)
string.IsNullOrEmpty(ConnectionString) == false && string.IsNullOrEmpty(ProviderName) == false
? new UmbracoDatabase(ConnectionString, ProviderName)
: new UmbracoDatabase(_connectionStringName));
}
return (UmbracoDatabase)HttpContext.Current.Items[typeof(DefaultDatabaseFactory)];
@@ -67,17 +67,18 @@ namespace Umbraco.Core.Persistence.Factories
if (property.HasIdentity)
dto.Id = property.Id;
if (property.DataTypeDatabaseType == DataTypeDatabaseType.Integer && property.Value != null && string.IsNullOrWhiteSpace(property.Value.ToString()) == false)
if (property.DataTypeDatabaseType == DataTypeDatabaseType.Integer)
{
if (property.Value is bool)
if (property.Value is bool || property.PropertyType.DataTypeId == new Guid("38b352c1-e9f8-4fd8-9324-9a2eab06d97a"))
{
int val = Convert.ToInt32(property.Value);
dto.Integer = val;
dto.Integer = property.Value != null && string.IsNullOrEmpty(property.Value.ToString())
? 0
: Convert.ToInt32(property.Value);
}
else
{
int val;
if (int.TryParse(property.Value.ToString(), out val))
if ((property.Value != null && string.IsNullOrWhiteSpace(property.Value.ToString()) == false) && int.TryParse(property.Value.ToString(), out val))
{
dto.Integer = val;
}
@@ -37,7 +37,7 @@ namespace Umbraco.Core.Persistence.Factories
Level = dto.NodeDto.Level,
ParentId = dto.NodeDto.ParentId,
SortOrder = dto.NodeDto.SortOrder,
NodePath = dto.NodeDto.Path
Path = dto.NodeDto.Path
};
if(dto.Master.HasValue)
@@ -83,7 +83,7 @@ namespace Umbraco.Core.Persistence.Factories
Level = short.Parse(entity.Level.ToString(CultureInfo.InvariantCulture)),
NodeObjectType = _nodeObjectTypeId,
ParentId = entity.ParentId,
Path = entity.NodePath,
Path = entity.Path,
SortOrder = entity.SortOrder,
Text = entity.Name,
Trashed = false,
@@ -1,4 +1,5 @@
using Umbraco.Core.Models.Membership;
using System.Collections.Generic;
using Umbraco.Core.Models.Membership;
using Umbraco.Core.Models.Rdbms;
namespace Umbraco.Core.Persistence.Factories
@@ -16,8 +17,7 @@ namespace Umbraco.Core.Persistence.Factories
public IUser BuildEntity(UserDto dto)
{
//TODO Add list of applications for user
return new User(_userType)
var user = new User(_userType)
{
Id = dto.Id,
ProfileId = dto.Id,
@@ -32,8 +32,19 @@ namespace Umbraco.Core.Persistence.Factories
Language = dto.UserLanguage,
DefaultToLiveEditing = dto.DefaultToLiveEditing,
NoConsole = dto.NoConsole,
Permissions = dto.DefaultPermissions
DefaultPermissions = dto.DefaultPermissions
};
foreach (var app in dto.User2AppDtos)
{
user.AddAllowedSection(app.AppAlias);
}
//on initial construction we don't want to have dirty properties tracked
// http://issues.umbraco.org/issue/U4-1946
user.ResetDirtyProperties(false);
return user;
}
public UserDto BuildDto(IUser entity)
@@ -51,9 +62,24 @@ namespace Umbraco.Core.Persistence.Factories
UserLanguage = entity.Language,
UserName = entity.Name,
Type = short.Parse(entity.UserType.Id.ToString()),
DefaultPermissions = entity.Permissions
DefaultPermissions = entity.DefaultPermissions,
User2AppDtos = new List<User2AppDto>()
};
foreach (var app in entity.AllowedSections)
{
var appDto = new User2AppDto
{
AppAlias = app
};
if (entity.Id != null)
{
appDto.UserId = (int) entity.Id;
}
dto.User2AppDtos.Add(appDto);
}
if (entity.HasIdentity)
dto.Id = entity.Id.SafeCast<int>();
@@ -1,4 +1,5 @@
using System;
using System.Collections.Concurrent;
using System.Linq.Expressions;
using System.Reflection;
using Umbraco.Core.Persistence.SqlSyntax;
@@ -7,11 +8,24 @@ namespace Umbraco.Core.Persistence.Mappers
{
public abstract class BaseMapper
{
internal abstract ConcurrentDictionary<string, DtoMapModel> PropertyInfoCache { get; }
internal abstract void BuildMap();
internal abstract string Map(string propertyName);
internal string Map(string propertyName)
{
DtoMapModel dtoTypeProperty;
return PropertyInfoCache.TryGetValue(propertyName, out dtoTypeProperty)
? GetColumnName(dtoTypeProperty.Type, dtoTypeProperty.PropertyInfo)
: string.Empty;
}
internal abstract void CacheMap<TSource, TDestination>(Expression<Func<TSource, object>> sourceMember, Expression<Func<TDestination, object>> destinationMember);
internal void CacheMap<TSource, TDestination>(Expression<Func<TSource, object>> sourceMember, Expression<Func<TDestination, object>> destinationMember)
{
var property = ResolveMapping(sourceMember, destinationMember);
PropertyInfoCache.AddOrUpdate(property.SourcePropertyName, property, (x, y) => property);
}
internal DtoMapModel ResolveMapping<TSource, TDestination>(Expression<Func<TSource, object>> sourceMember, Expression<Func<TDestination, object>> destinationMember)
{
@@ -14,7 +14,7 @@ namespace Umbraco.Core.Persistence.Mappers
[MapperFor(typeof(IContent))]
public sealed class ContentMapper : BaseMapper
{
private static readonly ConcurrentDictionary<string, DtoMapModel> PropertyInfoCache = new ConcurrentDictionary<string, DtoMapModel>();
private static readonly ConcurrentDictionary<string, DtoMapModel> PropertyInfoCacheInstance = new ConcurrentDictionary<string, DtoMapModel>();
//NOTE: its an internal class but the ctor must be public since we're using Activator.CreateInstance to create it
// otherwise that would fail because there is no public constructor.
@@ -25,6 +25,11 @@ namespace Umbraco.Core.Persistence.Mappers
#region Overrides of BaseMapper
internal override ConcurrentDictionary<string, DtoMapModel> PropertyInfoCache
{
get { return PropertyInfoCacheInstance; }
}
internal override void BuildMap()
{
if(PropertyInfoCache.IsEmpty)
@@ -52,23 +57,7 @@ namespace Umbraco.Core.Persistence.Mappers
//CacheMap<Content, DocumentDto>(src => src.Template, dto => dto.TemplateId);
}
}
internal override string Map(string propertyName)
{
if (!PropertyInfoCache.ContainsKey(propertyName))
return string.Empty;
var dtoTypeProperty = PropertyInfoCache[propertyName];
return base.GetColumnName(dtoTypeProperty.Type, dtoTypeProperty.PropertyInfo);
}
internal override void CacheMap<TSource, TDestination>(Expression<Func<TSource, object>> sourceMember, Expression<Func<TDestination, object>> destinationMember)
{
var property = base.ResolveMapping(sourceMember, destinationMember);
PropertyInfoCache.AddOrUpdate(property.SourcePropertyName, property, (x, y) => property);
}
#endregion
}
}
@@ -14,7 +14,7 @@ namespace Umbraco.Core.Persistence.Mappers
[MapperFor(typeof(IContentType))]
public sealed class ContentTypeMapper : BaseMapper
{
private static readonly ConcurrentDictionary<string, DtoMapModel> PropertyInfoCache = new ConcurrentDictionary<string, DtoMapModel>();
private static readonly ConcurrentDictionary<string, DtoMapModel> PropertyInfoCacheInstance = new ConcurrentDictionary<string, DtoMapModel>();
//NOTE: its an internal class but the ctor must be public since we're using Activator.CreateInstance to create it
// otherwise that would fail because there is no public constructor.
@@ -25,6 +25,11 @@ namespace Umbraco.Core.Persistence.Mappers
#region Overrides of BaseMapper
internal override ConcurrentDictionary<string, DtoMapModel> PropertyInfoCache
{
get { return PropertyInfoCacheInstance; }
}
internal override void BuildMap()
{
if (PropertyInfoCache.IsEmpty)
@@ -48,22 +53,6 @@ namespace Umbraco.Core.Persistence.Mappers
}
}
internal override string Map(string propertyName)
{
if (!PropertyInfoCache.ContainsKey(propertyName))
return string.Empty;
var dtoTypeProperty = PropertyInfoCache[propertyName];
return base.GetColumnName(dtoTypeProperty.Type, dtoTypeProperty.PropertyInfo);
}
internal override void CacheMap<TSource, TDestination>(Expression<Func<TSource, object>> sourceMember, Expression<Func<TDestination, object>> destinationMember)
{
var property = base.ResolveMapping(sourceMember, destinationMember);
PropertyInfoCache.AddOrUpdate(property.SourcePropertyName, property, (x, y) => property);
}
#endregion
}
}
@@ -14,7 +14,7 @@ namespace Umbraco.Core.Persistence.Mappers
[MapperFor(typeof(IDataTypeDefinition))]
public sealed class DataTypeDefinitionMapper : BaseMapper
{
private static readonly ConcurrentDictionary<string, DtoMapModel> PropertyInfoCache = new ConcurrentDictionary<string, DtoMapModel>();
private static readonly ConcurrentDictionary<string, DtoMapModel> PropertyInfoCacheInstance = new ConcurrentDictionary<string, DtoMapModel>();
//NOTE: its an internal class but the ctor must be public since we're using Activator.CreateInstance to create it
// otherwise that would fail because there is no public constructor.
@@ -25,6 +25,11 @@ namespace Umbraco.Core.Persistence.Mappers
#region Overrides of BaseMapper
internal override ConcurrentDictionary<string, DtoMapModel> PropertyInfoCache
{
get { return PropertyInfoCacheInstance; }
}
internal override void BuildMap()
{
CacheMap<DataTypeDefinition, NodeDto>(src => src.Id, dto => dto.NodeId);
@@ -42,22 +47,6 @@ namespace Umbraco.Core.Persistence.Mappers
}
internal override string Map(string propertyName)
{
if (!PropertyInfoCache.ContainsKey(propertyName))
return string.Empty;
var dtoTypeProperty = PropertyInfoCache[propertyName];
return base.GetColumnName(dtoTypeProperty.Type, dtoTypeProperty.PropertyInfo);
}
internal override void CacheMap<TSource, TDestination>(Expression<Func<TSource, object>> sourceMember, Expression<Func<TDestination, object>> destinationMember)
{
var property = base.ResolveMapping(sourceMember, destinationMember);
PropertyInfoCache.AddOrUpdate(property.SourcePropertyName, property, (x, y) => property);
}
#endregion
}
}
@@ -14,7 +14,7 @@ namespace Umbraco.Core.Persistence.Mappers
[MapperFor(typeof(IDictionaryItem))]
public sealed class DictionaryMapper : BaseMapper
{
private static readonly ConcurrentDictionary<string, DtoMapModel> PropertyInfoCache = new ConcurrentDictionary<string, DtoMapModel>();
private static readonly ConcurrentDictionary<string, DtoMapModel> PropertyInfoCacheInstance = new ConcurrentDictionary<string, DtoMapModel>();
//NOTE: its an internal class but the ctor must be public since we're using Activator.CreateInstance to create it
// otherwise that would fail because there is no public constructor.
@@ -25,6 +25,11 @@ namespace Umbraco.Core.Persistence.Mappers
#region Overrides of BaseMapper
internal override ConcurrentDictionary<string, DtoMapModel> PropertyInfoCache
{
get { return PropertyInfoCacheInstance; }
}
internal override void BuildMap()
{
CacheMap<DictionaryItem, DictionaryDto>(src => src.Id, dto => dto.PrimaryKey);
@@ -32,23 +37,7 @@ namespace Umbraco.Core.Persistence.Mappers
CacheMap<DictionaryItem, DictionaryDto>(src => src.ItemKey, dto => dto.Key);
CacheMap<DictionaryItem, DictionaryDto>(src => src.ParentId, dto => dto.Parent);
}
internal override string Map(string propertyName)
{
if (!PropertyInfoCache.ContainsKey(propertyName))
return string.Empty;
var dtoTypeProperty = PropertyInfoCache[propertyName];
return base.GetColumnName(dtoTypeProperty.Type, dtoTypeProperty.PropertyInfo);
}
internal override void CacheMap<TSource, TDestination>(Expression<Func<TSource, object>> sourceMember, Expression<Func<TDestination, object>> destinationMember)
{
var property = base.ResolveMapping(sourceMember, destinationMember);
PropertyInfoCache.AddOrUpdate(property.SourcePropertyName, property, (x, y) => property);
}
#endregion
}
}
@@ -14,7 +14,7 @@ namespace Umbraco.Core.Persistence.Mappers
[MapperFor(typeof(IDictionaryTranslation))]
public class DictionaryTranslationMapper : BaseMapper
{
private static readonly ConcurrentDictionary<string, DtoMapModel> PropertyInfoCache = new ConcurrentDictionary<string, DtoMapModel>();
private static readonly ConcurrentDictionary<string, DtoMapModel> PropertyInfoCacheInstance = new ConcurrentDictionary<string, DtoMapModel>();
//NOTE: its an internal class but the ctor must be public since we're using Activator.CreateInstance to create it
// otherwise that would fail because there is no public constructor.
@@ -25,6 +25,11 @@ namespace Umbraco.Core.Persistence.Mappers
#region Overrides of BaseMapper
internal override ConcurrentDictionary<string, DtoMapModel> PropertyInfoCache
{
get { return PropertyInfoCacheInstance; }
}
internal override void BuildMap()
{
CacheMap<DictionaryTranslation, LanguageTextDto>(src => src.Id, dto => dto.PrimaryKey);
@@ -33,22 +38,6 @@ namespace Umbraco.Core.Persistence.Mappers
CacheMap<DictionaryTranslation, LanguageTextDto>(src => src.Value, dto => dto.Value);
}
internal override string Map(string propertyName)
{
if (!PropertyInfoCache.ContainsKey(propertyName))
return string.Empty;
var dtoTypeProperty = PropertyInfoCache[propertyName];
return base.GetColumnName(dtoTypeProperty.Type, dtoTypeProperty.PropertyInfo);
}
internal override void CacheMap<TSource, TDestination>(Expression<Func<TSource, object>> sourceMember, Expression<Func<TDestination, object>> destinationMember)
{
var property = base.ResolveMapping(sourceMember, destinationMember);
PropertyInfoCache.AddOrUpdate(property.SourcePropertyName, property, (x, y) => property);
}
#endregion
}
}
@@ -14,7 +14,7 @@ namespace Umbraco.Core.Persistence.Mappers
[MapperFor(typeof(Language))]
public sealed class LanguageMapper : BaseMapper
{
private static readonly ConcurrentDictionary<string, DtoMapModel> PropertyInfoCache = new ConcurrentDictionary<string, DtoMapModel>();
private static readonly ConcurrentDictionary<string, DtoMapModel> PropertyInfoCacheInstance = new ConcurrentDictionary<string, DtoMapModel>();
//NOTE: its an internal class but the ctor must be public since we're using Activator.CreateInstance to create it
// otherwise that would fail because there is no public constructor.
@@ -25,6 +25,11 @@ namespace Umbraco.Core.Persistence.Mappers
#region Overrides of BaseMapper
internal override ConcurrentDictionary<string, DtoMapModel> PropertyInfoCache
{
get { return PropertyInfoCacheInstance; }
}
internal override void BuildMap()
{
CacheMap<Language, LanguageDto>(src => src.Id, dto => dto.Id);
@@ -32,22 +37,6 @@ namespace Umbraco.Core.Persistence.Mappers
CacheMap<Language, LanguageDto>(src => src.CultureName, dto => dto.CultureName);
}
internal override string Map(string propertyName)
{
if (!PropertyInfoCache.ContainsKey(propertyName))
return string.Empty;
var dtoTypeProperty = PropertyInfoCache[propertyName];
return base.GetColumnName(dtoTypeProperty.Type, dtoTypeProperty.PropertyInfo);
}
internal override void CacheMap<TSource, TDestination>(Expression<Func<TSource, object>> sourceMember, Expression<Func<TDestination, object>> destinationMember)
{
var property = base.ResolveMapping(sourceMember, destinationMember);
PropertyInfoCache.AddOrUpdate(property.SourcePropertyName, property, (x, y) => property);
}
#endregion
}
}
@@ -14,7 +14,7 @@ namespace Umbraco.Core.Persistence.Mappers
[MapperFor(typeof(Umbraco.Core.Models.Media))]
public sealed class MediaMapper : BaseMapper
{
private static readonly ConcurrentDictionary<string, DtoMapModel> PropertyInfoCache = new ConcurrentDictionary<string, DtoMapModel>();
private static readonly ConcurrentDictionary<string, DtoMapModel> PropertyInfoCacheInstance = new ConcurrentDictionary<string, DtoMapModel>();
//NOTE: its an internal class but the ctor must be public since we're using Activator.CreateInstance to create it
// otherwise that would fail because there is no public constructor.
@@ -25,6 +25,11 @@ namespace Umbraco.Core.Persistence.Mappers
#region Overrides of BaseMapper
internal override ConcurrentDictionary<string, DtoMapModel> PropertyInfoCache
{
get { return PropertyInfoCacheInstance; }
}
internal override void BuildMap()
{
if (PropertyInfoCache.IsEmpty)
@@ -45,22 +50,6 @@ namespace Umbraco.Core.Persistence.Mappers
}
}
internal override string Map(string propertyName)
{
if (!PropertyInfoCache.ContainsKey(propertyName))
return string.Empty;
var dtoTypeProperty = PropertyInfoCache[propertyName];
return base.GetColumnName(dtoTypeProperty.Type, dtoTypeProperty.PropertyInfo);
}
internal override void CacheMap<TSource, TDestination>(Expression<Func<TSource, object>> sourceMember, Expression<Func<TDestination, object>> destinationMember)
{
var property = base.ResolveMapping(sourceMember, destinationMember);
PropertyInfoCache.AddOrUpdate(property.SourcePropertyName, property, (x, y) => property);
}
#endregion
}
}
@@ -14,7 +14,7 @@ namespace Umbraco.Core.Persistence.Mappers
[MapperFor(typeof(MediaType))]
public sealed class MediaTypeMapper : BaseMapper
{
private static readonly ConcurrentDictionary<string, DtoMapModel> PropertyInfoCache = new ConcurrentDictionary<string, DtoMapModel>();
private static readonly ConcurrentDictionary<string, DtoMapModel> PropertyInfoCacheInstance = new ConcurrentDictionary<string, DtoMapModel>();
//NOTE: its an internal class but the ctor must be public since we're using Activator.CreateInstance to create it
// otherwise that would fail because there is no public constructor.
@@ -25,6 +25,11 @@ namespace Umbraco.Core.Persistence.Mappers
#region Overrides of BaseMapper
internal override ConcurrentDictionary<string, DtoMapModel> PropertyInfoCache
{
get { return PropertyInfoCacheInstance; }
}
internal override void BuildMap()
{
if (PropertyInfoCache.IsEmpty)
@@ -48,22 +53,6 @@ namespace Umbraco.Core.Persistence.Mappers
}
}
internal override string Map(string propertyName)
{
if (!PropertyInfoCache.ContainsKey(propertyName))
return string.Empty;
var dtoTypeProperty = PropertyInfoCache[propertyName];
return base.GetColumnName(dtoTypeProperty.Type, dtoTypeProperty.PropertyInfo);
}
internal override void CacheMap<TSource, TDestination>(Expression<Func<TSource, object>> sourceMember, Expression<Func<TDestination, object>> destinationMember)
{
var property = base.ResolveMapping(sourceMember, destinationMember);
PropertyInfoCache.AddOrUpdate(property.SourcePropertyName, property, (x, y) => property);
}
#endregion
}
}
@@ -13,7 +13,7 @@ namespace Umbraco.Core.Persistence.Mappers
[MapperFor(typeof(PropertyGroup))]
public sealed class PropertyGroupMapper : BaseMapper
{
private static readonly ConcurrentDictionary<string, DtoMapModel> PropertyInfoCache = new ConcurrentDictionary<string, DtoMapModel>();
private static readonly ConcurrentDictionary<string, DtoMapModel> PropertyInfoCacheInstance = new ConcurrentDictionary<string, DtoMapModel>();
//NOTE: its an internal class but the ctor must be public since we're using Activator.CreateInstance to create it
// otherwise that would fail because there is no public constructor.
@@ -24,6 +24,11 @@ namespace Umbraco.Core.Persistence.Mappers
#region Overrides of BaseMapper
internal override ConcurrentDictionary<string, DtoMapModel> PropertyInfoCache
{
get { return PropertyInfoCacheInstance; }
}
internal override void BuildMap()
{
CacheMap<PropertyGroup, PropertyTypeGroupDto>(src => src.Id, dto => dto.Id);
@@ -32,22 +37,6 @@ namespace Umbraco.Core.Persistence.Mappers
CacheMap<PropertyGroup, PropertyTypeGroupDto>(src => src.Name, dto => dto.Text);
}
internal override string Map(string propertyName)
{
if (!PropertyInfoCache.ContainsKey(propertyName))
return string.Empty;
var dtoTypeProperty = PropertyInfoCache[propertyName];
return base.GetColumnName(dtoTypeProperty.Type, dtoTypeProperty.PropertyInfo);
}
internal override void CacheMap<TSource, TDestination>(Expression<Func<TSource, object>> sourceMember, Expression<Func<TDestination, object>> destinationMember)
{
var property = base.ResolveMapping(sourceMember, destinationMember);
PropertyInfoCache.AddOrUpdate(property.SourcePropertyName, property, (x, y) => property);
}
#endregion
}
}
@@ -9,7 +9,7 @@ namespace Umbraco.Core.Persistence.Mappers
[MapperFor(typeof(Property))]
public sealed class PropertyMapper : BaseMapper
{
private static readonly ConcurrentDictionary<string, DtoMapModel> PropertyInfoCache = new ConcurrentDictionary<string, DtoMapModel>();
private static readonly ConcurrentDictionary<string, DtoMapModel> PropertyInfoCacheInstance = new ConcurrentDictionary<string, DtoMapModel>();
//NOTE: its an internal class but the ctor must be public since we're using Activator.CreateInstance to create it
// otherwise that would fail because there is no public constructor.
@@ -20,6 +20,11 @@ namespace Umbraco.Core.Persistence.Mappers
#region Overrides of BaseMapper
internal override ConcurrentDictionary<string, DtoMapModel> PropertyInfoCache
{
get { return PropertyInfoCacheInstance; }
}
internal override void BuildMap()
{
CacheMap<Property, PropertyDataDto>(src => src.Id, dto => dto.Id);
@@ -27,22 +32,6 @@ namespace Umbraco.Core.Persistence.Mappers
CacheMap<Property, PropertyDataDto>(src => src.PropertyTypeId, dto => dto.PropertyTypeId);
}
internal override string Map(string propertyName)
{
if (!PropertyInfoCache.ContainsKey(propertyName))
return string.Empty;
var dtoTypeProperty = PropertyInfoCache[propertyName];
return base.GetColumnName(dtoTypeProperty.Type, dtoTypeProperty.PropertyInfo);
}
internal override void CacheMap<TSource, TDestination>(Expression<Func<TSource, object>> sourceMember, Expression<Func<TDestination, object>> destinationMember)
{
var property = base.ResolveMapping(sourceMember, destinationMember);
PropertyInfoCache.AddOrUpdate(property.SourcePropertyName, property, (x, y) => property);
}
#endregion
}
}
@@ -13,7 +13,7 @@ namespace Umbraco.Core.Persistence.Mappers
[MapperFor(typeof(PropertyType))]
public sealed class PropertyTypeMapper : BaseMapper
{
private static readonly ConcurrentDictionary<string, DtoMapModel> PropertyInfoCache = new ConcurrentDictionary<string, DtoMapModel>();
private static readonly ConcurrentDictionary<string, DtoMapModel> PropertyInfoCacheInstance = new ConcurrentDictionary<string, DtoMapModel>();
//NOTE: its an internal class but the ctor must be public since we're using Activator.CreateInstance to create it
// otherwise that would fail because there is no public constructor.
@@ -24,6 +24,11 @@ namespace Umbraco.Core.Persistence.Mappers
#region Overrides of BaseMapper
internal override ConcurrentDictionary<string, DtoMapModel> PropertyInfoCache
{
get { return PropertyInfoCacheInstance; }
}
internal override void BuildMap()
{
if(PropertyInfoCache.IsEmpty)
@@ -42,22 +47,6 @@ namespace Umbraco.Core.Persistence.Mappers
}
}
internal override string Map(string propertyName)
{
if (!PropertyInfoCache.ContainsKey(propertyName))
return string.Empty;
var dtoTypeProperty = PropertyInfoCache[propertyName];
return base.GetColumnName(dtoTypeProperty.Type, dtoTypeProperty.PropertyInfo);
}
internal override void CacheMap<TSource, TDestination>(Expression<Func<TSource, object>> sourceMember, Expression<Func<TDestination, object>> destinationMember)
{
var property = base.ResolveMapping(sourceMember, destinationMember);
PropertyInfoCache.AddOrUpdate(property.SourcePropertyName, property, (x, y) => property);
}
#endregion
}
}
@@ -13,7 +13,7 @@ namespace Umbraco.Core.Persistence.Mappers
[MapperFor(typeof(Relation))]
public sealed class RelationMapper : BaseMapper
{
private static readonly ConcurrentDictionary<string, DtoMapModel> PropertyInfoCache = new ConcurrentDictionary<string, DtoMapModel>();
private static readonly ConcurrentDictionary<string, DtoMapModel> PropertyInfoCacheInstance = new ConcurrentDictionary<string, DtoMapModel>();
//NOTE: its an internal class but the ctor must be public since we're using Activator.CreateInstance to create it
// otherwise that would fail because there is no public constructor.
@@ -24,6 +24,11 @@ namespace Umbraco.Core.Persistence.Mappers
#region Overrides of BaseMapper
internal override ConcurrentDictionary<string, DtoMapModel> PropertyInfoCache
{
get { return PropertyInfoCacheInstance; }
}
internal override void BuildMap()
{
CacheMap<Relation, RelationDto>(src => src.Id, dto => dto.Id);
@@ -33,23 +38,7 @@ namespace Umbraco.Core.Persistence.Mappers
CacheMap<Relation, RelationDto>(src => src.ParentId, dto => dto.ParentId);
CacheMap<Relation, RelationDto>(src => src.RelationTypeId, dto => dto.RelationType);
}
internal override string Map(string propertyName)
{
if (!PropertyInfoCache.ContainsKey(propertyName))
return string.Empty;
var dtoTypeProperty = PropertyInfoCache[propertyName];
return base.GetColumnName(dtoTypeProperty.Type, dtoTypeProperty.PropertyInfo);
}
internal override void CacheMap<TSource, TDestination>(Expression<Func<TSource, object>> sourceMember, Expression<Func<TDestination, object>> destinationMember)
{
var property = base.ResolveMapping(sourceMember, destinationMember);
PropertyInfoCache.AddOrUpdate(property.SourcePropertyName, property, (x, y) => property);
}
#endregion
}
}
@@ -13,7 +13,7 @@ namespace Umbraco.Core.Persistence.Mappers
[MapperFor(typeof(RelationType))]
public sealed class RelationTypeMapper : BaseMapper
{
private static readonly ConcurrentDictionary<string, DtoMapModel> PropertyInfoCache = new ConcurrentDictionary<string, DtoMapModel>();
private static readonly ConcurrentDictionary<string, DtoMapModel> PropertyInfoCacheInstance = new ConcurrentDictionary<string, DtoMapModel>();
//NOTE: its an internal class but the ctor must be public since we're using Activator.CreateInstance to create it
// otherwise that would fail because there is no public constructor.
@@ -24,6 +24,11 @@ namespace Umbraco.Core.Persistence.Mappers
#region Overrides of BaseMapper
internal override ConcurrentDictionary<string, DtoMapModel> PropertyInfoCache
{
get { return PropertyInfoCacheInstance; }
}
internal override void BuildMap()
{
CacheMap<RelationType, RelationTypeDto>(src => src.Id, dto => dto.Id);
@@ -33,23 +38,7 @@ namespace Umbraco.Core.Persistence.Mappers
CacheMap<RelationType, RelationTypeDto>(src => src.Name, dto => dto.Name);
CacheMap<RelationType, RelationTypeDto>(src => src.ParentObjectType, dto => dto.ParentObjectType);
}
internal override string Map(string propertyName)
{
if (!PropertyInfoCache.ContainsKey(propertyName))
return string.Empty;
var dtoTypeProperty = PropertyInfoCache[propertyName];
return base.GetColumnName(dtoTypeProperty.Type, dtoTypeProperty.PropertyInfo);
}
internal override void CacheMap<TSource, TDestination>(Expression<Func<TSource, object>> sourceMember, Expression<Func<TDestination, object>> destinationMember)
{
var property = base.ResolveMapping(sourceMember, destinationMember);
PropertyInfoCache.AddOrUpdate(property.SourcePropertyName, property, (x, y) => property);
}
#endregion
}
}
@@ -9,7 +9,7 @@ namespace Umbraco.Core.Persistence.Mappers
[MapperFor(typeof(ServerRegistration))]
public sealed class ServerRegistrationMapper : BaseMapper
{
private static readonly ConcurrentDictionary<string, DtoMapModel> PropertyInfoCache = new ConcurrentDictionary<string, DtoMapModel>();
private static readonly ConcurrentDictionary<string, DtoMapModel> PropertyInfoCacheInstance = new ConcurrentDictionary<string, DtoMapModel>();
//NOTE: its an internal class but the ctor must be public since we're using Activator.CreateInstance to create it
// otherwise that would fail because there is no public constructor.
@@ -20,6 +20,11 @@ namespace Umbraco.Core.Persistence.Mappers
#region Overrides of BaseMapper
internal override ConcurrentDictionary<string, DtoMapModel> PropertyInfoCache
{
get { return PropertyInfoCacheInstance; }
}
internal override void BuildMap()
{
CacheMap<ServerRegistration, ServerRegistrationDto>(src => src.Id, dto => dto.Id);
@@ -30,22 +35,6 @@ namespace Umbraco.Core.Persistence.Mappers
CacheMap<ServerRegistration, ServerRegistrationDto>(src => src.ComputerName, dto => dto.ComputerName);
}
internal override string Map(string propertyName)
{
if (!PropertyInfoCache.ContainsKey(propertyName))
return string.Empty;
var dtoTypeProperty = PropertyInfoCache[propertyName];
return base.GetColumnName(dtoTypeProperty.Type, dtoTypeProperty.PropertyInfo);
}
internal override void CacheMap<TSource, TDestination>(Expression<Func<TSource, object>> sourceMember, Expression<Func<TDestination, object>> destinationMember)
{
var property = base.ResolveMapping(sourceMember, destinationMember);
PropertyInfoCache.AddOrUpdate(property.SourcePropertyName, property, (x, y) => property);
}
#endregion
}
}
@@ -9,8 +9,7 @@ namespace Umbraco.Core.Persistence.Mappers
[MapperFor(typeof (IUmbracoEntity))]
public sealed class UmbracoEntityMapper : BaseMapper
{
private static readonly ConcurrentDictionary<string, DtoMapModel> PropertyInfoCache =
new ConcurrentDictionary<string, DtoMapModel>();
private static readonly ConcurrentDictionary<string, DtoMapModel> PropertyInfoCacheInstance = new ConcurrentDictionary<string, DtoMapModel>();
//NOTE: its an internal class but the ctor must be public since we're using Activator.CreateInstance to create it
// otherwise that would fail because there is no public constructor.
@@ -21,6 +20,11 @@ namespace Umbraco.Core.Persistence.Mappers
#region Overrides of BaseMapper
internal override ConcurrentDictionary<string, DtoMapModel> PropertyInfoCache
{
get { return PropertyInfoCacheInstance; }
}
internal override void BuildMap()
{
CacheMap<IUmbracoEntity, NodeDto>(src => src.Id, dto => dto.NodeId);
@@ -34,24 +38,7 @@ namespace Umbraco.Core.Persistence.Mappers
CacheMap<IUmbracoEntity, NodeDto>(src => src.Key, dto => dto.UniqueId);
CacheMap<IUmbracoEntity, NodeDto>(src => src.CreatorId, dto => dto.UserId);
}
internal override string Map(string propertyName)
{
if (!PropertyInfoCache.ContainsKey(propertyName))
return string.Empty;
var dtoTypeProperty = PropertyInfoCache[propertyName];
return base.GetColumnName(dtoTypeProperty.Type, dtoTypeProperty.PropertyInfo);
}
internal override void CacheMap<TSource, TDestination>(Expression<Func<TSource, object>> sourceMember,
Expression<Func<TDestination, object>> destinationMember)
{
var property = base.ResolveMapping(sourceMember, destinationMember);
PropertyInfoCache.AddOrUpdate(property.SourcePropertyName, property, (x, y) => property);
}
#endregion
}
}
@@ -10,7 +10,7 @@ namespace Umbraco.Core.Persistence.Mappers
[MapperFor(typeof(User))]
public sealed class UserMapper : BaseMapper
{
private static readonly ConcurrentDictionary<string, DtoMapModel> PropertyInfoCache = new ConcurrentDictionary<string, DtoMapModel>();
private static readonly ConcurrentDictionary<string, DtoMapModel> PropertyInfoCacheInstance = new ConcurrentDictionary<string, DtoMapModel>();
//NOTE: its an internal class but the ctor must be public since we're using Activator.CreateInstance to create it
// otherwise that would fail because there is no public constructor.
@@ -21,6 +21,11 @@ namespace Umbraco.Core.Persistence.Mappers
#region Overrides of BaseMapper
internal override ConcurrentDictionary<string, DtoMapModel> PropertyInfoCache
{
get { return PropertyInfoCacheInstance; }
}
internal override void BuildMap()
{
CacheMap<User, UserDto>(src => src.Id, dto => dto.Id);
@@ -28,7 +33,7 @@ namespace Umbraco.Core.Persistence.Mappers
CacheMap<User, UserDto>(src => src.Username, dto => dto.Login);
CacheMap<User, UserDto>(src => src.Password, dto => dto.Password);
CacheMap<User, UserDto>(src => src.Name, dto => dto.UserName);
CacheMap<User, UserDto>(src => src.Permissions, dto => dto.DefaultPermissions);
CacheMap<User, UserDto>(src => src.DefaultPermissions, dto => dto.DefaultPermissions);
CacheMap<User, UserDto>(src => src.StartMediaId, dto => dto.MediaStartId);
CacheMap<User, UserDto>(src => src.StartContentId, dto => dto.ContentStartId);
CacheMap<User, UserDto>(src => src.DefaultToLiveEditing, dto => dto.DefaultToLiveEditing);
@@ -38,22 +43,6 @@ namespace Umbraco.Core.Persistence.Mappers
CacheMap<User, UserDto>(src => src.Language, dto => dto.UserLanguage);
}
internal override string Map(string propertyName)
{
if (!PropertyInfoCache.ContainsKey(propertyName))
return string.Empty;
var dtoTypeProperty = PropertyInfoCache[propertyName];
return base.GetColumnName(dtoTypeProperty.Type, dtoTypeProperty.PropertyInfo);
}
internal override void CacheMap<TSource, TDestination>(Expression<Func<TSource, object>> sourceMember, Expression<Func<TDestination, object>> destinationMember)
{
var property = base.ResolveMapping(sourceMember, destinationMember);
PropertyInfoCache.AddOrUpdate(property.SourcePropertyName, property, (x, y) => property);
}
#endregion
}
}
@@ -14,7 +14,7 @@ namespace Umbraco.Core.Persistence.Mappers
[MapperFor(typeof(UserType))]
public sealed class UserTypeMapper : BaseMapper
{
private static readonly ConcurrentDictionary<string, DtoMapModel> PropertyInfoCache = new ConcurrentDictionary<string, DtoMapModel>();
private static readonly ConcurrentDictionary<string, DtoMapModel> PropertyInfoCacheInstance = new ConcurrentDictionary<string, DtoMapModel>();
//NOTE: its an internal class but the ctor must be public since we're using Activator.CreateInstance to create it
// otherwise that would fail because there is no public constructor.
@@ -25,6 +25,11 @@ namespace Umbraco.Core.Persistence.Mappers
#region Overrides of BaseMapper
internal override ConcurrentDictionary<string, DtoMapModel> PropertyInfoCache
{
get { return PropertyInfoCacheInstance; }
}
internal override void BuildMap()
{
CacheMap<UserType, UserTypeDto>(src => src.Id, dto => dto.Id);
@@ -33,21 +38,6 @@ namespace Umbraco.Core.Persistence.Mappers
CacheMap<UserType, UserTypeDto>(src => src.Permissions, dto => dto.DefaultPermissions);
}
internal override string Map(string propertyName)
{
if (!PropertyInfoCache.ContainsKey(propertyName))
return string.Empty;
var dtoTypeProperty = PropertyInfoCache[propertyName];
return base.GetColumnName(dtoTypeProperty.Type, dtoTypeProperty.PropertyInfo);
}
internal override void CacheMap<TSource, TDestination>(Expression<Func<TSource, object>> sourceMember, Expression<Func<TDestination, object>> destinationMember)
{
var property = base.ResolveMapping(sourceMember, destinationMember);
PropertyInfoCache.AddOrUpdate(property.SourcePropertyName, property, (x, y) => property);
}
#endregion
}
@@ -223,8 +223,6 @@ namespace Umbraco.Core.Persistence.Migrations.Initial
_database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 4, DataTypeId = -88, ControlId = new Guid(Constants.PropertyEditors.Textbox), DbType = "Nvarchar" });
_database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 5, DataTypeId = -89, ControlId = new Guid(Constants.PropertyEditors.TextboxMultiple), DbType = "Ntext" });
_database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 6, DataTypeId = -90, ControlId = new Guid(Constants.PropertyEditors.UploadField), DbType = "Nvarchar" });
//Dropdown list
//_database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 12, DataTypeId = -91, ControlId = new Guid("a74ea9c9-8e18-4d2a-8cf6-73c6206c5da6"), DbType = "Nvarchar" });
_database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 7, DataTypeId = -92, ControlId = new Guid(Constants.PropertyEditors.NoEdit), DbType = "Nvarchar" });
_database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 8, DataTypeId = -36, ControlId = new Guid(Constants.PropertyEditors.DateTime), DbType = "Date" });
_database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 9, DataTypeId = -37, ControlId = new Guid(Constants.PropertyEditors.ColorPicker), DbType = "Nvarchar" });
@@ -234,24 +232,6 @@ namespace Umbraco.Core.Persistence.Migrations.Initial
_database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 13, DataTypeId = -41, ControlId = new Guid(Constants.PropertyEditors.Date), DbType = "Date" });
_database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 14, DataTypeId = -42, ControlId = new Guid(Constants.PropertyEditors.DropDownList), DbType = "Integer" });
_database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 15, DataTypeId = -43, ControlId = new Guid(Constants.PropertyEditors.CheckBoxList), DbType = "Nvarchar" });
// Fix for rich text editor backwards compatibility -> 83722133-f80c-4273-bdb6-1befaa04a612 TinyMCE DataType
//_database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 22, DataTypeId = -44, ControlId = new Guid("a3776494-0574-4d93-b7de-efdfdec6f2d1"), DbType = "Ntext" });
//Radiobutton list
//_database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 23, DataTypeId = -128, ControlId = new Guid("a52c7c1c-c330-476e-8605-d63d3b84b6a6"), DbType = "Nvarchar" });
//Dropdown list multiple
//_database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 24, DataTypeId = -129, ControlId = new Guid("928639ed-9c73-4028-920c-1e55dbb68783"), DbType = "Nvarchar" });
//Dropdown list
//_database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 25, DataTypeId = -130, ControlId = new Guid("a74ea9c9-8e18-4d2a-8cf6-73c6206c5da6"), DbType = "Nvarchar" });
//Dropdown list
//_database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 26, DataTypeId = -131, ControlId = new Guid("a74ea9c9-8e18-4d2a-8cf6-73c6206c5da6"), DbType = "Nvarchar" });
//Dropdown list
//_database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 27, DataTypeId = -132, ControlId = new Guid("a74ea9c9-8e18-4d2a-8cf6-73c6206c5da6"), DbType = "Nvarchar" });
//No edit
//_database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 28, DataTypeId = -133, ControlId = new Guid("6c738306-4c17-4d88-b9bd-6546f3771597"), DbType = "Ntext" });
//Dropdown list multiple
//_database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 29, DataTypeId = -134, ControlId = new Guid("928639ed-9c73-4028-920c-1e55dbb68783"), DbType = "Nvarchar" });
//Not found - maybe a legacy thing?
//_database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 30, DataTypeId = -50, ControlId = new Guid("aaf99bb2-dbbe-444d-a296-185076bf0484"), DbType = "Date" });
_database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 16, DataTypeId = 1034, ControlId = new Guid(Constants.PropertyEditors.ContentPicker), DbType = "Integer" });
_database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 17, DataTypeId = 1035, ControlId = new Guid(Constants.PropertyEditors.MediaPicker), DbType = "Integer" });
_database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 18, DataTypeId = 1036, ControlId = new Guid(Constants.PropertyEditors.MemberPicker), DbType = "Integer" });
+1 -1
View File
@@ -384,7 +384,7 @@ namespace Umbraco.Core.Persistence
}
// Add a parameter to a DB command
void AddParam(IDbCommand cmd, object item, string ParameterPrefix)
internal void AddParam(IDbCommand cmd, object item, string ParameterPrefix)
{
// Convert value to from poco type to db type
if (Database.Mapper != null && item!=null)
@@ -1,9 +1,12 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using Umbraco.Core.Logging;
using Umbraco.Core.Models.Rdbms;
using Umbraco.Core.Persistence.DatabaseModelDefinitions;
using Umbraco.Core.Persistence.Migrations.Initial;
using Umbraco.Core.Persistence.Querying;
using Umbraco.Core.Persistence.SqlSyntax;
namespace Umbraco.Core.Persistence
@@ -28,6 +31,149 @@ namespace Umbraco.Core.Persistence
CreateTable(db, overwrite, tableType);
}
public static void BulkInsertRecords<T>(this Database db, IEnumerable<T> collection)
{
//don't do anything if there are no records.
if (collection.Any() == false)
return;
using (var tr = db.GetTransaction())
{
db.BulkInsertRecords(collection, tr);
}
}
public static void BulkInsertRecords<T>(this Database db, IEnumerable<T> collection, Transaction tr)
{
//don't do anything if there are no records.
if (collection.Any() == false)
return;
try
{
//if it is sql ce or it is a sql server version less than 2008, we need to do individual inserts.
var sqlServerSyntax = SqlSyntaxContext.SqlSyntaxProvider as SqlServerSyntaxProvider;
if ((sqlServerSyntax != null && (int)sqlServerSyntax.VersionName.Value < (int)SqlServerVersionName.V2008)
|| SqlSyntaxContext.SqlSyntaxProvider is SqlCeSyntaxProvider)
{
//SqlCe doesn't support bulk insert statements!
foreach (var poco in collection)
{
db.Insert(poco);
}
}
else
{
string[] sqlStatements;
var cmds = db.GenerateBulkInsertCommand(collection, db.Connection, out sqlStatements);
for (var i = 0; i < sqlStatements.Length; i++)
{
using (var cmd = cmds[i])
{
cmd.CommandText = sqlStatements[i];
cmd.ExecuteNonQuery();
}
}
}
tr.Complete();
}
catch
{
tr.Dispose();
throw;
}
}
/// <summary>
/// Creates a bulk insert command
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="db"></param>
/// <param name="collection"></param>
/// <param name="connection"></param>
/// <param name="sql"></param>
/// <returns>Sql commands with populated command parameters required to execute the sql statement</returns>
/// <remarks>
/// The limits for number of parameters are 2100 (in sql server, I think there's many more allowed in mysql). So
/// we need to detect that many params and split somehow.
/// For some reason the 2100 limit is not actually allowed even though the exception from sql server mentions 2100 as a max, perhaps it is 2099
/// that is max. I've reduced it to 2000 anyways.
/// </remarks>
internal static IDbCommand[] GenerateBulkInsertCommand<T>(
this Database db,
IEnumerable<T> collection,
IDbConnection connection,
out string[] sql)
{
//A filter used below a few times to get all columns except result cols and not the primary key if it is auto-incremental
Func<Database.PocoData, KeyValuePair<string, Database.PocoColumn>, bool> includeColumn = (data, column) =>
{
if (column.Value.ResultColumn) return false;
if (data.TableInfo.AutoIncrement && column.Key == data.TableInfo.PrimaryKey) return false;
return true;
};
var pd = Database.PocoData.ForType(typeof(T));
var tableName = db.EscapeTableName(pd.TableInfo.TableName);
//get all columns to include and format for sql
var cols = string.Join(", ",
pd.Columns
.Where(c => includeColumn(pd, c))
.Select(c => tableName + "." + db.EscapeSqlIdentifier(c.Key)).ToArray());
var itemArray = collection.ToArray();
//calculate number of parameters per item
var paramsPerItem = pd.Columns.Count(i => includeColumn(pd, i));
//Example calc:
// Given: we have 4168 items in the itemArray, each item contains 8 command parameters (values to be inserterted)
// 2100 / 8 = 262.5
// Math.Floor(2100 / 8) = 262 items per trans
// 4168 / 262 = 15.908... = there will be 16 trans in total
//all items will be included if we have disabled db parameters
var itemsPerTrans = Math.Floor(2000.00 / paramsPerItem);
//there will only be one transaction if we have disabled db parameters
var numTrans = Math.Ceiling(itemArray.Length / itemsPerTrans);
var sqlQueries = new List<string>();
var commands = new List<IDbCommand>();
for (var tIndex = 0; tIndex < numTrans; tIndex++)
{
var itemsForTrans = itemArray
.Skip(tIndex * (int)itemsPerTrans)
.Take((int)itemsPerTrans);
var cmd = db.CreateCommand(connection, "");
var pocoValues = new List<string>();
var index = 0;
foreach (var poco in itemsForTrans)
{
var values = new List<string>();
//get all columns except result cols and not the primary key if it is auto-incremental
foreach (var i in pd.Columns.Where(x => includeColumn(pd, x)))
{
db.AddParam(cmd, i.Value.GetValue(poco), "@");
values.Add(string.Format("{0}{1}", "@", index++));
}
pocoValues.Add("(" + string.Join(",", values.ToArray()) + ")");
}
var sqlResult = string.Format("INSERT INTO {0} ({1}) VALUES {2}", tableName, cols, string.Join(", ", pocoValues));
sqlQueries.Add(sqlResult);
commands.Add(cmd);
}
sql = sqlQueries.ToArray();
return commands.ToArray();
}
public static void CreateTable(this Database db, bool overwrite, Type modelType)
{
var tableDefinition = DefinitionFactory.GetTableDefinition(modelType);
@@ -67,7 +213,7 @@ namespace Umbraco.Core.Persistence
//Turn on identity insert if db provider is not mysql
if (SqlSyntaxContext.SqlSyntaxProvider.SupportsIdentityInsert() && tableDefinition.Columns.Any(x => x.IsIdentity))
db.Execute(new Sql(string.Format("SET IDENTITY_INSERT {0} ON ", SqlSyntaxContext.SqlSyntaxProvider.GetQuotedTableName(tableName))));
//Call the NewTable-event to trigger the insert of base/default data
NewTable(tableName, db, e);
@@ -106,7 +252,7 @@ namespace Umbraco.Core.Persistence
public static void DropTable<T>(this Database db)
where T : new()
{
Type type = typeof (T);
Type type = typeof(T);
var tableNameAttribute = type.FirstAttribute<TableNameAttribute>();
if (tableNameAttribute == null)
throw new Exception(
@@ -184,5 +330,5 @@ namespace Umbraco.Core.Persistence
}
}
internal class TableCreationEventArgs : System.ComponentModel.CancelEventArgs{}
internal class TableCreationEventArgs : System.ComponentModel.CancelEventArgs { }
}
@@ -0,0 +1,101 @@
using System;
using System.Globalization;
namespace Umbraco.Core.Persistence.Querying
{
/// <summary>
/// Logic that is shared with the expression helpers
/// </summary>
internal class BaseExpressionHelper
{
public virtual string GetQuotedValue(object value, Type fieldType, Func<object, string> escapeCallback = null, Func<Type, bool> shouldQuoteCallback = null)
{
if (value == null) return "NULL";
if (escapeCallback == null)
{
escapeCallback = EscapeParam;
}
if (shouldQuoteCallback == null)
{
shouldQuoteCallback = ShouldQuoteValue;
}
if (!fieldType.UnderlyingSystemType.IsValueType && fieldType != typeof(string))
{
//if (TypeSerializer.CanCreateFromString(fieldType))
//{
// return "'" + EscapeParam(TypeSerializer.SerializeToString(value)) + "'";
//}
throw new NotSupportedException(
string.Format("Property of type: {0} is not supported", fieldType.FullName));
}
if (fieldType == typeof(int))
return ((int)value).ToString(CultureInfo.InvariantCulture);
if (fieldType == typeof(float))
return ((float)value).ToString(CultureInfo.InvariantCulture);
if (fieldType == typeof(double))
return ((double)value).ToString(CultureInfo.InvariantCulture);
if (fieldType == typeof(decimal))
return ((decimal)value).ToString(CultureInfo.InvariantCulture);
if (fieldType == typeof(DateTime))
{
return "'" + EscapeParam(((DateTime)value).ToIsoString()) + "'";
}
if (fieldType == typeof(bool))
return ((bool)value) ? Convert.ToString(1, CultureInfo.InvariantCulture) : Convert.ToString(0, CultureInfo.InvariantCulture);
return ShouldQuoteValue(fieldType)
? "'" + EscapeParam(value) + "'"
: value.ToString();
}
public virtual string EscapeParam(object paramValue)
{
return paramValue.ToString().Replace("'", "''");
}
public virtual string EscapeAtArgument(string exp)
{
if (exp.StartsWith("@"))
return string.Concat("@", exp);
return exp;
}
public virtual bool ShouldQuoteValue(Type fieldType)
{
return true;
}
protected virtual string RemoveQuote(string exp)
{
if (exp.StartsWith("'") && exp.EndsWith("'"))
{
exp = exp.Remove(0, 1);
exp = exp.Remove(exp.Length - 1, 1);
}
return exp;
}
protected virtual string RemoveQuoteFromAlias(string exp)
{
if ((exp.StartsWith("\"") || exp.StartsWith("`") || exp.StartsWith("'"))
&&
(exp.EndsWith("\"") || exp.EndsWith("`") || exp.EndsWith("'")))
{
exp = exp.Remove(0, 1);
exp = exp.Remove(exp.Length - 1, 1);
}
return exp;
}
}
}
@@ -8,7 +8,7 @@ using Umbraco.Core.Persistence.Mappers;
namespace Umbraco.Core.Persistence.Querying
{
internal class ModelToSqlExpressionHelper<T>
internal class ModelToSqlExpressionHelper<T> : BaseExpressionHelper
{
private string sep = " ";
private BaseMapper _mapper;
@@ -246,7 +246,7 @@ namespace Umbraco.Core.Persistence.Querying
case "ToLower":
return string.Format("lower({0})", r);
case "StartsWith":
return string.Format("upper({0}) like '{1}%'", r, RemoveQuote(args[0].ToString().ToUpper()));
return string.Format("upper({0}) like '{1}%'", r, EscapeAtArgument(RemoveQuote(args[0].ToString().ToUpper())));
case "EndsWith":
return string.Format("upper({0}) like '%{1}'", r, RemoveQuote(args[0].ToString()).ToUpper());
case "Contains":
@@ -435,69 +435,7 @@ namespace Umbraco.Core.Persistence.Querying
public virtual string GetQuotedValue(object value, Type fieldType)
{
if (value == null) return "NULL";
if (!fieldType.UnderlyingSystemType.IsValueType && fieldType != typeof(string))
{
throw new NotSupportedException(
string.Format("Property of type: {0} is not supported", fieldType.FullName));
}
if (fieldType == typeof(int))
return ((int)value).ToString(CultureInfo.InvariantCulture);
if (fieldType == typeof(float))
return ((float)value).ToString(CultureInfo.InvariantCulture);
if (fieldType == typeof(double))
return ((double)value).ToString(CultureInfo.InvariantCulture);
if (fieldType == typeof(decimal))
return ((decimal)value).ToString(CultureInfo.InvariantCulture);
if (fieldType == typeof(DateTime))
return "'" + EscapeParam(((DateTime)value).ToString(CultureInfo.InvariantCulture)) + "'";
if (fieldType == typeof(bool))
return ((bool)value) ? Convert.ToString(1, CultureInfo.InvariantCulture) : Convert.ToString(0, CultureInfo.InvariantCulture);
return ShouldQuoteValue(fieldType)
? "'" + EscapeParam(value) + "'"
: value.ToString();
}
public virtual string EscapeParam(object paramValue)
{
return paramValue.ToString().Replace("'", "''");
}
public virtual bool ShouldQuoteValue(Type fieldType)
{
return true;
}
protected string RemoveQuote(string exp)
{
if (exp.StartsWith("'") && exp.EndsWith("'"))
{
exp = exp.Remove(0, 1);
exp = exp.Remove(exp.Length - 1, 1);
}
return exp;
}
protected string RemoveQuoteFromAlias(string exp)
{
if ((exp.StartsWith("\"") || exp.StartsWith("`") || exp.StartsWith("'"))
&&
(exp.EndsWith("\"") || exp.EndsWith("`") || exp.EndsWith("'")))
{
exp = exp.Remove(0, 1);
exp = exp.Remove(exp.Length - 1, 1);
}
return exp;
return GetQuotedValue(value, fieldType, EscapeParam, ShouldQuoteValue);
}
private string GetTrueExpression()
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Globalization;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
@@ -9,7 +8,7 @@ using Umbraco.Core.Persistence.SqlSyntax;
namespace Umbraco.Core.Persistence.Querying
{
internal class PocoToSqlExpressionHelper<T>
internal class PocoToSqlExpressionHelper<T> : BaseExpressionHelper
{
private string sep = " ";
private Database.PocoData pd;
@@ -251,7 +250,7 @@ namespace Umbraco.Core.Persistence.Querying
case "ToLower":
return string.Format("lower({0})", r);
case "StartsWith":
return string.Format("upper({0}) like '{1}%'", r, RemoveQuote(args[0].ToString().ToUpper()));
return string.Format("upper({0}) like '{1}%'", r, EscapeAtArgument(RemoveQuote(args[0].ToString().ToUpper())));
case "EndsWith":
return string.Format("upper({0}) like '%{1}'", r, RemoveQuote(args[0].ToString()).ToUpper());
case "Contains":
@@ -440,50 +439,7 @@ namespace Umbraco.Core.Persistence.Querying
public virtual string GetQuotedValue(object value, Type fieldType)
{
if (value == null) return "NULL";
if (!fieldType.UnderlyingSystemType.IsValueType && fieldType != typeof(string))
{
//if (TypeSerializer.CanCreateFromString(fieldType))
//{
// return "'" + EscapeParam(TypeSerializer.SerializeToString(value)) + "'";
//}
throw new NotSupportedException(
string.Format("Property of type: {0} is not supported", fieldType.FullName));
}
if (fieldType == typeof(int))
return ((int)value).ToString(CultureInfo.InvariantCulture);
if (fieldType == typeof(float))
return ((float)value).ToString(CultureInfo.InvariantCulture);
if (fieldType == typeof(double))
return ((double)value).ToString(CultureInfo.InvariantCulture);
if (fieldType == typeof(decimal))
return ((decimal)value).ToString(CultureInfo.InvariantCulture);
if(fieldType == typeof(DateTime))
return "'" + EscapeParam(((DateTime)value).ToString(CultureInfo.InvariantCulture)) + "'";
if (fieldType == typeof(bool))
return ((bool)value) ? Convert.ToString(1, CultureInfo.InvariantCulture) : Convert.ToString(0, CultureInfo.InvariantCulture);
return ShouldQuoteValue(fieldType)
? "'" + EscapeParam(value) + "'"
: value.ToString();
}
public virtual string EscapeParam(object paramValue)
{
return paramValue.ToString().Replace("'", "''");
}
public virtual bool ShouldQuoteValue(Type fieldType)
{
return true;
return GetQuotedValue(value, fieldType, EscapeParam, ShouldQuoteValue);
}
protected virtual string GetFieldName(Database.PocoData pocoData, string name)
@@ -494,30 +450,6 @@ namespace Umbraco.Core.Persistence.Querying
SqlSyntaxContext.SqlSyntaxProvider.GetQuotedColumnName(column.Value.ColumnName));
}
protected string RemoveQuote(string exp)
{
if (exp.StartsWith("'") && exp.EndsWith("'"))
{
exp = exp.Remove(0, 1);
exp = exp.Remove(exp.Length - 1, 1);
}
return exp;
}
protected string RemoveQuoteFromAlias(string exp)
{
if ((exp.StartsWith("\"") || exp.StartsWith("`") || exp.StartsWith("'"))
&&
(exp.EndsWith("\"") || exp.EndsWith("`") || exp.EndsWith("'")))
{
exp = exp.Remove(0, 1);
exp = exp.Remove(exp.Length - 1, 1);
}
return exp;
}
private string GetTrueExpression()
{
object o = GetQuotedTrueValue();
@@ -0,0 +1,47 @@
using System.Collections.Generic;
using Umbraco.Core.Models.Rdbms;
namespace Umbraco.Core.Persistence.Relators
{
internal class UserSectionRelator
{
internal UserDto Current;
internal UserDto Map(UserDto a, User2AppDto p)
{
// Terminating call. Since we can return null from this function
// we need to be ready for PetaPoco to callback later with null
// parameters
if (a == null)
return Current;
// Is this the same DictionaryItem as the current one we're processing
if (Current != null && Current.Id == a.Id)
{
// Yes, just add this User2AppDto to the current item's collection
Current.User2AppDtos.Add(p);
// Return null to indicate we're not done with this User yet
return null;
}
// This is a different User to the current one, or this is the
// first time through and we don't have one yet
// Save the current User
var prev = Current;
// Setup the new current User
Current = a;
Current.User2AppDtos = new List<User2AppDto>();
//this can be null since we are doing a left join
if (p.AppAlias != null)
{
Current.User2AppDtos.Add(p);
}
// Return the now populated previous User (or null if first time through)
return prev;
}
}
}
@@ -27,6 +27,8 @@ namespace Umbraco.Core.Persistence.Repositories
{
_contentTypeRepository = contentTypeRepository;
_templateRepository = templateRepository;
EnsureUniqueNaming = true;
}
public ContentRepository(IDatabaseUnitOfWork work, IRepositoryCacheProvider cache, IContentTypeRepository contentTypeRepository, ITemplateRepository templateRepository)
@@ -34,8 +36,12 @@ namespace Umbraco.Core.Persistence.Repositories
{
_contentTypeRepository = contentTypeRepository;
_templateRepository = templateRepository;
EnsureUniqueNaming = true;
}
public bool EnsureUniqueNaming { get; set; }
#region Overrides of RepositoryBase<IContent>
protected override IContent PerformGet(int id)
@@ -164,11 +170,31 @@ namespace Umbraco.Core.Persistence.Repositories
return content;
}
public override void DeleteVersion(Guid versionId)
{
var sql = new Sql()
.Select("*")
.From<DocumentDto>()
.InnerJoin<ContentVersionDto>().On<ContentVersionDto, DocumentDto>(left => left.VersionId, right => right.VersionId)
.Where<ContentVersionDto>(x => x.VersionId == versionId)
.Where<DocumentDto>(x => x.Newest == true);
var dto = Database.Fetch<DocumentDto, ContentVersionDto>(sql).FirstOrDefault();
if(dto == null) return;
using (var transaction = Database.GetTransaction())
{
PerformDeleteVersion(dto.NodeId, versionId);
transaction.Complete();
}
}
protected override void PerformDeleteVersion(int id, Guid versionId)
{
Database.Delete<PreviewXmlDto>("WHERE nodeId = @Id AND versionId = @VersionId", new { Id = id, VersionId = versionId });
Database.Delete<PropertyDataDto>("WHERE nodeId = @Id AND versionId = @VersionId", new { Id = id, VersionId = versionId });
Database.Delete<ContentVersionDto>("WHERE nodeId = @Id AND VersionId = @VersionId", new { Id = id, VersionId = versionId });
Database.Delete<PropertyDataDto>("WHERE contentNodeId = @Id AND versionId = @VersionId", new { Id = id, VersionId = versionId });
Database.Delete<ContentVersionDto>("WHERE ContentId = @Id AND VersionId = @VersionId", new { Id = id, VersionId = versionId });
Database.Delete<DocumentDto>("WHERE nodeId = @Id AND versionId = @VersionId", new { Id = id, VersionId = versionId });
}
@@ -180,6 +206,9 @@ namespace Umbraco.Core.Persistence.Repositories
{
((Content)entity).AddingEntity();
//Ensure unique name on the same level
entity.Name = EnsureUniqueNodeName(entity.ParentId, entity.Name);
var factory = new ContentFactory(NodeObjectTypeId, entity.Id);
var dto = factory.BuildDto(entity);
@@ -197,7 +226,7 @@ namespace Umbraco.Core.Persistence.Repositories
nodeDto.Level = short.Parse(level.ToString(CultureInfo.InvariantCulture));
nodeDto.SortOrder = sortOrder;
var o = Database.IsNew(nodeDto) ? Convert.ToInt32(Database.Insert(nodeDto)) : Database.Update(nodeDto);
//Update with new correct path
nodeDto.Path = string.Concat(parent.Path, ",", nodeDto.NodeId);
Database.Update(nodeDto);
@@ -208,6 +237,24 @@ namespace Umbraco.Core.Persistence.Repositories
entity.SortOrder = sortOrder;
entity.Level = level;
//Assign the same permissions to it as the parent node
// http://issues.umbraco.org/issue/U4-2161
var parentPermissions = GetPermissionsForEntity(entity.ParentId).ToArray();
//if there are parent permissions then assign them, otherwise leave null and permissions will become the
// user's default permissions.
if (parentPermissions.Any())
{
var userPermissions = parentPermissions.Select(
permissionDto => new KeyValuePair<object, string>(
permissionDto.UserId,
permissionDto.Permission));
AssignEntityPermissions(entity, userPermissions);
//flag the entity's permissions changed flag so we can track those changes.
//Currently only used for the cache refreshers to detect if we should refresh all user permissions cache.
((Content) entity).PermissionsChanged = true;
}
//Create the Content specific data - cmsContent
var contentDto = dto.ContentVersionDto.ContentDto;
contentDto.NodeId = nodeDto.NodeId;
@@ -248,8 +295,9 @@ namespace Umbraco.Core.Persistence.Repositories
protected override void PersistUpdatedItem(IContent entity)
{
var publishedState = ((Content) entity).PublishedState;
//A new version should only be created if published state (or language) has changed
bool shouldCreateNewVersion = (((ICanBeDirty)entity).IsPropertyDirty("Published") && publishedState != PublishedState.Unpublished) || ((ICanBeDirty)entity).IsPropertyDirty("Language");
//check if we need to create a new version
bool shouldCreateNewVersion = entity.ShouldCreateNewVersion(publishedState);
if (shouldCreateNewVersion)
{
//Updates Modified date and Version Guid
@@ -260,6 +308,9 @@ namespace Umbraco.Core.Persistence.Repositories
entity.UpdateDate = DateTime.Now;
}
//Ensure unique name on the same level
entity.Name = EnsureUniqueNodeName(entity.ParentId, entity.Name, entity.Id);
//Look up parent to get and set the correct Path and update SortOrder if ParentId has changed
if (((ICanBeDirty)entity).IsPropertyDirty("ParentId"))
{
@@ -271,6 +322,10 @@ namespace Umbraco.Core.Persistence.Repositories
"SELECT coalesce(max(sortOrder),0) FROM umbracoNode WHERE parentid = @ParentId AND nodeObjectType = @NodeObjectType",
new {ParentId = entity.ParentId, NodeObjectType = NodeObjectTypeId});
entity.SortOrder = maxSortOrder + 1;
//Question: If we move a node, should we update permissions to inherit from the new parent if the parent has permissions assigned?
// if we do that, then we'd need to propogate permissions all the way downward which might not be ideal for many people.
// Gonna just leave it as is for now, and not re-propogate permissions.
}
var factory = new ContentFactory(NodeObjectTypeId, entity.Id);
@@ -293,7 +348,8 @@ namespace Umbraco.Core.Persistence.Repositories
//If Published state has changed then previous versions should have their publish state reset.
//If state has been changed to unpublished the previous versions publish state should also be reset.
if (((ICanBeDirty)entity).IsPropertyDirty("Published") && (entity.Published || publishedState == PublishedState.Unpublished))
//if (((ICanBeDirty)entity).IsPropertyDirty("Published") && (entity.Published || publishedState == PublishedState.Unpublished))
if (entity.ShouldClearPublishedFlagForPreviousVersions(publishedState, shouldCreateNewVersion))
{
var publishedDocs = Database.Fetch<DocumentDto>("WHERE nodeId = @Id AND published = @IsPublished", new { Id = entity.Id, IsPublished = true });
foreach (var doc in publishedDocs)
@@ -304,19 +360,18 @@ namespace Umbraco.Core.Persistence.Repositories
}
}
//Look up (newest) entries by id in cmsDocument table to set newest = false
var documentDtos = Database.Fetch<DocumentDto>("WHERE nodeId = @Id AND newest = @IsNewest", new { Id = entity.Id, IsNewest = true });
foreach (var documentDto in documentDtos)
{
var docDto = documentDto;
docDto.Newest = false;
Database.Update(docDto);
}
var contentVersionDto = dto.ContentVersionDto;
if (shouldCreateNewVersion)
{
//Look up (newest) entries by id in cmsDocument table to set newest = false
//NOTE: This is only relevant when a new version is created, which is why its done inside this if-statement.
var documentDtos = Database.Fetch<DocumentDto>("WHERE nodeId = @Id AND newest = @IsNewest", new { Id = entity.Id, IsNewest = true });
foreach (var documentDto in documentDtos)
{
var docDto = documentDto;
docDto.Newest = false;
Database.Update(docDto);
}
//Create a new version - cmsContentVersion
//Assumes a new Version guid and Version date (modified date) has been set
Database.Insert(contentVersionDto);
@@ -415,7 +470,19 @@ namespace Umbraco.Core.Persistence.Repositories
foreach (var dto in dtos)
{
yield return CreateContentFromDto(dto, dto.VersionId);
//Check in the cache first. If it exists there AND it is published
// then we can use that entity. Otherwise if it is not published (which can be the case
// because we only store the 'latest' entries in the cache which might not be the published
// version)
var fromCache = TryGetFromCache(dto.NodeId);
if (fromCache.Success && fromCache.Result.Published)
{
yield return fromCache.Result;
}
else
{
yield return CreateContentFromDto(dto, dto.VersionId);
}
}
}
@@ -435,7 +502,7 @@ namespace Umbraco.Core.Persistence.Repositories
}
#endregion
/// <summary>
/// Private method to create a content object from a DocumentDto, which is used by Get and GetByVersion.
/// </summary>
@@ -489,5 +556,37 @@ namespace Umbraco.Core.Persistence.Repositories
return new PropertyCollection(properties);
}
private string EnsureUniqueNodeName(int parentId, string nodeName, int id = 0)
{
if (EnsureUniqueNaming == false)
return nodeName;
var sql = new Sql();
sql.Select("*")
.From<NodeDto>()
.Where<NodeDto>(x => x.NodeObjectType == NodeObjectTypeId && x.ParentId == parentId && x.Text.StartsWith(nodeName));
int uniqueNumber = 1;
var currentName = nodeName;
var dtos = Database.Fetch<NodeDto>(sql);
if (dtos.Any())
{
var results = dtos.OrderBy(x => x.Text, new SimilarNodeNameComparer());
foreach (var dto in results)
{
if(id != 0 && id == dto.NodeId) continue;
if (dto.Text.ToLowerInvariant().Equals(currentName.ToLowerInvariant()))
{
currentName = nodeName + string.Format(" ({0})", uniqueNumber);
uniqueNumber++;
}
}
}
return currentName;
}
}
}
@@ -203,7 +203,7 @@ namespace Umbraco.Core.Persistence.Repositories
.Where<NodeDto>(x => x.NodeObjectType == new Guid(Constants.ObjectTypes.Document))
.Where<ContentDto>(x => x.ContentTypeId == entity.Id);
var contentDtos = Database.Fetch<DocumentDto, ContentVersionDto, ContentDto, NodeDto>(sql);
var contentDtos = Database.Fetch<ContentDto, NodeDto>(sql);
//Loop through all tracked keys, which corresponds to the ContentTypes that has been removed from the composition
foreach (var key in compositionBase.RemovedContentTypeKeyTracker)
{
@@ -321,7 +321,7 @@ namespace Umbraco.Core.Persistence.Repositories
sql.Select("*")
.From<ContentTypeAllowedContentTypeDto>()
.LeftJoin<ContentTypeDto>()
.On<ContentTypeAllowedContentTypeDto, ContentTypeDto>(left => left.Id, right => right.NodeId)
.On<ContentTypeAllowedContentTypeDto, ContentTypeDto>(left => left.AllowedId, right => right.NodeId)
.Where<ContentTypeAllowedContentTypeDto>(x => x.Id == id);
var allowedContentTypeDtos = Database.Fetch<ContentTypeAllowedContentTypeDto, ContentTypeDto>(sql);
@@ -84,7 +84,7 @@ namespace Umbraco.Core.Persistence.Repositories
{
bool isContent = objectTypeId == new Guid(Constants.ObjectTypes.Document);
bool isMedia = objectTypeId == new Guid(Constants.ObjectTypes.Media);
var sql = GetBaseWhere(GetBase, isContent, isMedia, objectTypeId).Append(GetGroupBy(isContent, isMedia));
var sql = GetBaseWhere(GetBase, isContent, isMedia, string.Empty, objectTypeId).Append(GetGroupBy(isContent, isMedia));
var dtos = isMedia
? _work.Database.Fetch<UmbracoEntityDto, UmbracoPropertyDto, UmbracoEntityDto>(
new UmbracoEntityRelator().Map, sql)
@@ -101,7 +101,8 @@ namespace Umbraco.Core.Persistence.Repositories
public virtual IEnumerable<IUmbracoEntity> GetByQuery(IQuery<IUmbracoEntity> query)
{
var sqlClause = GetBase(false, false);
var wheres = string.Concat(" AND ", string.Join(" AND ", ((Query<IUmbracoEntity>) query).WhereClauses()));
var sqlClause = GetBase(false, false, wheres);
var translator = new SqlTranslator<IUmbracoEntity>(sqlClause, query);
var sql = translator.Translate().Append(GetGroupBy(false, false));
@@ -117,7 +118,9 @@ namespace Umbraco.Core.Persistence.Repositories
{
bool isContent = objectTypeId == new Guid(Constants.ObjectTypes.Document);
bool isMedia = objectTypeId == new Guid(Constants.ObjectTypes.Media);
var sqlClause = GetBaseWhere(GetBase, isContent, isMedia, objectTypeId);
var wheres = string.Concat(" AND ", string.Join(" AND ", ((Query<IUmbracoEntity>)query).WhereClauses()));
var sqlClause = GetBaseWhere(GetBase, isContent, isMedia, wheres, objectTypeId);
var translator = new SqlTranslator<IUmbracoEntity>(sqlClause, query);
var sql = translator.Translate().Append(GetGroupBy(isContent, isMedia));
@@ -136,7 +139,7 @@ namespace Umbraco.Core.Persistence.Repositories
#region Sql Statements
protected virtual Sql GetBase(bool isContent, bool isMedia)
protected virtual Sql GetBase(bool isContent, bool isMedia, string additionWhereStatement = "")
{
var columns = new List<object>
{
@@ -187,42 +190,38 @@ namespace Umbraco.Core.Persistence.Repositories
.On("umbracoNode.id = latest.nodeId");
}
/*if (isContent)
{
sql.LeftJoin(
"(SELECT contentNodeId, versionId, dataNvarchar, controlId FROM cmsPropertyData INNER JOIN cmsPropertyType ON cmsPropertyType.id = cmsPropertyData.propertytypeid" +
" INNER JOIN cmsDataType ON cmsPropertyType.dataTypeId = cmsDataType.nodeId) as property")
.On("umbracoNode.id = property.contentNodeId AND latest.versionId = property.versionId");
}*/
if (isMedia)
{
sql.LeftJoin(
"(SELECT contentNodeId, versionId, dataNvarchar, controlId FROM cmsPropertyData INNER JOIN cmsPropertyType ON cmsPropertyType.id = cmsPropertyData.propertytypeid" +
" INNER JOIN cmsDataType ON cmsPropertyType.dataTypeId = cmsDataType.nodeId) as property")
"(SELECT contentNodeId, versionId, dataNvarchar, controlId FROM cmsPropertyData " +
"INNER JOIN umbracoNode ON cmsPropertyData.contentNodeId = umbracoNode.id " +
"INNER JOIN cmsPropertyType ON cmsPropertyType.id = cmsPropertyData.propertytypeid " +
"INNER JOIN cmsDataType ON cmsPropertyType.dataTypeId = cmsDataType.nodeId "+
"WHERE umbracoNode.nodeObjectType = '" + Constants.ObjectTypes.Media + "'" + additionWhereStatement + ") as property")
.On("umbracoNode.id = property.contentNodeId");
}
return sql;
}
protected virtual Sql GetBaseWhere(Func<bool, bool, Sql> baseQuery, bool isContent, bool isMedia, Guid id)
protected virtual Sql GetBaseWhere(Func<bool, bool, string, Sql> baseQuery, bool isContent, bool isMedia, string additionWhereStatement, Guid id)
{
var sql = baseQuery(isContent, isMedia)
var sql = baseQuery(isContent, isMedia, additionWhereStatement)
.Where("umbracoNode.nodeObjectType = @NodeObjectType", new { NodeObjectType = id });
return sql;
}
protected virtual Sql GetBaseWhere(Func<bool, bool, Sql> baseQuery, bool isContent, bool isMedia, int id)
protected virtual Sql GetBaseWhere(Func<bool, bool, string, Sql> baseQuery, bool isContent, bool isMedia, int id)
{
var sql = baseQuery(isContent, isMedia)
var sql = baseQuery(isContent, isMedia, " AND umbracoNode.id = '"+ id +"'")
.Where("umbracoNode.id = @Id", new { Id = id })
.Append(GetGroupBy(isContent, isMedia));
return sql;
}
protected virtual Sql GetBaseWhere(Func<bool, bool, Sql> baseQuery, bool isContent, bool isMedia, Guid objectId, int id)
protected virtual Sql GetBaseWhere(Func<bool, bool, string, Sql> baseQuery, bool isContent, bool isMedia, Guid objectId, int id)
{
var sql = baseQuery(isContent, isMedia)
var sql = baseQuery(isContent, isMedia, " AND umbracoNode.id = '"+ id +"'")
.Where("umbracoNode.id = @Id AND umbracoNode.nodeObjectType = @NodeObjectType",
new {Id = id, NodeObjectType = objectId});
return sql;
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using Umbraco.Core.Models;
using Umbraco.Core.Persistence.Querying;
@@ -15,7 +16,7 @@ namespace Umbraco.Core.Persistence.Repositories
IContent GetByLanguage(int id, string language);
/// <summary>
/// Gets all published Content byh the specified query
/// Gets all published Content by the specified query
/// </summary>
/// <param name="query">Query to execute against published versions</param>
/// <returns>An enumerable list of <see cref="IContent"/></returns>
@@ -4,6 +4,5 @@ namespace Umbraco.Core.Persistence.Repositories
{
public interface IMediaRepository : IRepositoryVersionable<int, IMedia>
{
}
}
@@ -9,8 +9,7 @@ namespace Umbraco.Core.Persistence.Repositories
/// </summary>
/// <typeparam name="TEntity">Type of <see cref="IAggregateRoot"/> entity for which the repository is used</typeparam>
/// <typeparam name="TId">Type of the Id used for this entity</typeparam>
public interface IRepositoryQueryable<TId, TEntity> : IRepository<TId, TEntity>
where TEntity : IAggregateRoot
public interface IRepositoryQueryable<in TId, TEntity> : IRepository<TId, TEntity>
{
/// <summary>
/// Gets all entities of the specified type and query
@@ -1,9 +1,18 @@
using Umbraco.Core.Models.Membership;
using System.Collections.Generic;
using Umbraco.Core.Models.Membership;
namespace Umbraco.Core.Persistence.Repositories
{
internal interface IUserRepository : IRepositoryQueryable<int, IUser>
{
IProfile GetProfileById(int id);
//IProfile GetProfileById(int id);
//IProfile GetProfileByUserName(string username);
//IUser GetUserByUserName(string username);
/// <summary>
/// This is useful when an entire section is removed from config
/// </summary>
/// <param name="sectionAlias"></param>
IEnumerable<IUser> GetUsersAssignedToSection(string sectionAlias);
}
}
@@ -25,14 +25,20 @@ namespace Umbraco.Core.Persistence.Repositories
: base(work)
{
_mediaTypeRepository = mediaTypeRepository;
EnsureUniqueNaming = true;
}
public MediaRepository(IDatabaseUnitOfWork work, IRepositoryCacheProvider cache, IMediaTypeRepository mediaTypeRepository)
: base(work, cache)
{
_mediaTypeRepository = mediaTypeRepository;
EnsureUniqueNaming = true;
}
public bool EnsureUniqueNaming { get; set; }
#region Overrides of RepositoryBase<int,IMedia>
protected override IMedia PerformGet(int id)
@@ -170,8 +176,8 @@ namespace Umbraco.Core.Persistence.Repositories
protected override void PerformDeleteVersion(int id, Guid versionId)
{
Database.Delete<PreviewXmlDto>("WHERE nodeId = @Id AND versionId = @VersionId", new { Id = id, VersionId = versionId });
Database.Delete<PropertyDataDto>("WHERE nodeId = @Id AND versionId = @VersionId", new { Id = id, VersionId = versionId });
Database.Delete<ContentVersionDto>("WHERE nodeId = @Id AND VersionId = @VersionId", new { Id = id, VersionId = versionId });
Database.Delete<PropertyDataDto>("WHERE contentNodeId = @Id AND versionId = @VersionId", new { Id = id, VersionId = versionId });
Database.Delete<ContentVersionDto>("WHERE ContentId = @Id AND VersionId = @VersionId", new { Id = id, VersionId = versionId });
}
#endregion
@@ -182,6 +188,9 @@ namespace Umbraco.Core.Persistence.Repositories
{
((Models.Media)entity).AddingEntity();
//Ensure unique name on the same level
entity.Name = EnsureUniqueNodeName(entity.ParentId, entity.Name);
var factory = new MediaFactory(NodeObjectTypeId, entity.Id);
var dto = factory.BuildDto(entity);
@@ -246,6 +255,9 @@ namespace Umbraco.Core.Persistence.Repositories
//Updates Modified date
((Models.Media)entity).UpdatingEntity();
//Ensure unique name on the same level
entity.Name = EnsureUniqueNodeName(entity.ParentId, entity.Name, entity.Id);
//Look up parent to get and set the correct Path and update SortOrder if ParentId has changed
if (((ICanBeDirty)entity).IsPropertyDirty("ParentId"))
{
@@ -370,5 +382,37 @@ namespace Umbraco.Core.Persistence.Repositories
return new PropertyCollection(properties);
}
private string EnsureUniqueNodeName(int parentId, string nodeName, int id = 0)
{
if (EnsureUniqueNaming == false)
return nodeName;
var sql = new Sql();
sql.Select("*")
.From<NodeDto>()
.Where<NodeDto>(x => x.NodeObjectType == NodeObjectTypeId && x.ParentId == parentId && x.Text.StartsWith(nodeName));
int uniqueNumber = 1;
var currentName = nodeName;
var dtos = Database.Fetch<NodeDto>(sql);
if (dtos.Any())
{
var results = dtos.OrderBy(x => x.Text, new SimilarNodeNameComparer());
foreach (var dto in results)
{
if (id != 0 && id == dto.NodeId) continue;
if (dto.Text.ToLowerInvariant().Equals(currentName.ToLowerInvariant()))
{
currentName = nodeName + string.Format(" ({0})", uniqueNumber);
uniqueNumber++;
}
}
}
return currentName;
}
}
}
@@ -0,0 +1,154 @@
using System;
using System.Collections.Generic;
using System.Dynamic;
using System.Linq;
using System.Text;
using Umbraco.Core.Models;
using Umbraco.Core.Models.EntityBase;
using Umbraco.Core.Models.Membership;
using Umbraco.Core.Models.Rdbms;
using Umbraco.Core.Persistence.Caching;
using Umbraco.Core.Persistence.SqlSyntax;
using Umbraco.Core.Persistence.UnitOfWork;
namespace Umbraco.Core.Persistence.Repositories
{
/// <summary>
/// A repository that exposes functionality to modify assigned permissions to a node
/// </summary>
/// <typeparam name="TId"></typeparam>
/// <typeparam name="TEntity"></typeparam>
internal abstract class PermissionRepository<TId, TEntity> : PetaPocoRepositoryBase<TId, TEntity>
where TEntity : class, IAggregateRoot
{
protected PermissionRepository(IDatabaseUnitOfWork work)
: base(work)
{
}
protected PermissionRepository(IDatabaseUnitOfWork work, IRepositoryCacheProvider cache)
: base(work, cache)
{
}
protected internal IEnumerable<User2NodePermissionDto> GetPermissionsForEntity(int entityId)
{
var sql = new Sql();
sql.Select("*")
.From<User2NodePermissionDto>()
.Where<User2NodePermissionDto>(dto => dto.NodeId == entityId);
return Database.Fetch<User2NodePermissionDto>(sql);
}
/// <summary>
/// Assigns permissions to an entity for multiple users
/// </summary>
/// <param name="entity"></param>
/// <param name="permissions"></param>
/// <param name="userIds"></param>
protected internal void AssignEntityPermissions(TEntity entity, string permissions, IEnumerable<object> userIds)
{
var actions = userIds.Select(id => new User2NodePermissionDto
{
NodeId = entity.Id,
Permission = permissions,
UserId = (int)id
});
Database.BulkInsertRecords(actions);
}
/// <summary>
/// Assigns permissions to an entity for multiple users/permission entries
/// </summary>
/// <param name="entity"></param>
/// <param name="userPermissions">
/// A key/value pair list containing a userId and a permission to assign
/// </param>
protected internal void AssignEntityPermissions(TEntity entity, IEnumerable<KeyValuePair<object, string>> userPermissions)
{
var actions = userPermissions.Select(p => new User2NodePermissionDto
{
NodeId = entity.Id,
Permission = p.Value,
UserId = (int)p.Key
});
Database.BulkInsertRecords(actions);
}
/// <summary>
/// Replace permissions for an entity for multiple users
/// </summary>
/// <param name="entity"></param>
/// <param name="permissions"></param>
/// <param name="userIds"></param>
protected internal void ReplaceEntityPermissions(TEntity entity, string permissions, IEnumerable<object> userIds)
{
Database.Update<User2NodePermissionDto>(
GenerateReplaceEntityPermissionsSql(entity.Id, permissions, userIds.ToArray()));
}
/// <summary>
/// An overload to replace entity permissions and all replace all descendant permissions
/// </summary>
/// <param name="entity"></param>
/// <param name="permissions"></param>
/// <param name="getDescendantIds">
/// A callback to get the descendant Ids of the current entity
/// </param>
/// <param name="userIds"></param>
protected internal void ReplaceEntityPermissions(TEntity entity, string permissions, Func<IEntity, IEnumerable<int>> getDescendantIds, IEnumerable<object> userIds)
{
Database.Update<User2NodePermissionDto>(
GenerateReplaceEntityPermissionsSql(
new[] {entity.Id}.Concat(getDescendantIds(entity)).ToArray(),
permissions,
userIds.ToArray()));
}
internal static string GenerateReplaceEntityPermissionsSql(int entityId, string permissions, object[] userIds)
{
return GenerateReplaceEntityPermissionsSql(new[] {entityId}, permissions, userIds);
}
internal static string GenerateReplaceEntityPermissionsSql(int[] entityIds, string permissions, object[] userIds)
{
//create the "SET" clause of the update statement
var sqlSet = string.Format("SET {0}={1}",
SqlSyntaxContext.SqlSyntaxProvider.GetQuotedColumnName("permission"),
SqlSyntaxContext.SqlSyntaxProvider.GetQuotedValue(permissions));
//build the nodeIds part of the where clause
var sqlNodeWhere = BuildOrClause(entityIds, "nodeId");
//build up the userIds part of the where clause
var userWhereBuilder = BuildOrClause(userIds, "userId");
var sqlWhere = new Sql();
sqlWhere.Where(string.Format("{0} AND {1}", sqlNodeWhere, userWhereBuilder));
return string.Format("{0} {1}", sqlSet, sqlWhere.SQL);
}
private static string BuildOrClause<T>(IEnumerable<T> ids, string colName)
{
var asArray = ids.ToArray();
var userWhereBuilder = new StringBuilder();
userWhereBuilder.Append("(");
for (var index = 0; index < asArray.Length; index++)
{
var userId = asArray[index];
userWhereBuilder.Append(SqlSyntaxContext.SqlSyntaxProvider.GetQuotedColumnName(colName));
userWhereBuilder.Append("=");
userWhereBuilder.Append(userId);
if (index < asArray.Length - 1)
{
userWhereBuilder.Append(" OR ");
}
}
userWhereBuilder.Append(")");
return userWhereBuilder.ToString();
}
}
}
@@ -0,0 +1,178 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Umbraco.Core.Configuration;
using Umbraco.Core.IO;
using Umbraco.Core.Logging;
using Umbraco.Core.Models.Rdbms;
using Umbraco.Core.Persistence.UnitOfWork;
namespace Umbraco.Core.Persistence.Repositories
{
/// <summary>
/// Represents a repository specific to the Recycle Bins
/// available for Content and Media.
/// </summary>
internal class RecycleBinRepository : DisposableObject
{
private readonly IDatabaseUnitOfWork _unitOfWork;
public RecycleBinRepository(IDatabaseUnitOfWork unitOfWork)
{
_unitOfWork = unitOfWork;
}
/// <summary>
/// Gets a list of files, which are referenced on items in the Recycle Bin.
/// The list is generated by the convention that a file is referenced by
/// the Upload data type or a property type with the alias 'umbracoFile'.
/// </summary>
/// <param name="nodeObjectType"></param>
/// <returns></returns>
public List<string> GetFilesInRecycleBin(Guid nodeObjectType)
{
var db = _unitOfWork.Database;
//Issue query to get all trashed content or media that has the Upload field as a property
//The value for each field is stored in a list: FilesToDelete<string>()
//Alias: Constants.Conventions.Media.File and ControlId: Constants.PropertyEditors.UploadField
var sql = new Sql();
sql.Select("DISTINCT(dataNvarchar)")
.From<PropertyDataDto>()
.InnerJoin<NodeDto>().On<PropertyDataDto, NodeDto>(left => left.NodeId, right => right.NodeId)
.InnerJoin<PropertyTypeDto>().On<PropertyDataDto, PropertyTypeDto>(left => left.PropertyTypeId, right => right.Id)
.InnerJoin<DataTypeDto>().On<PropertyTypeDto, DataTypeDto>(left => left.DataTypeId, right => right.DataTypeId)
.Where("umbracoNode.trashed = '1' AND umbracoNode.nodeObjectType = @NodeObjectType AND dataNvarchar IS NOT NULL AND (cmsPropertyType.Alias = @FileAlias OR cmsDataType.controlId = @ControlId)",
new { FileAlias = Constants.Conventions.Media.File, NodeObjectType = nodeObjectType, ControlId = Constants.PropertyEditors.UploadField });
var files = db.Fetch<string>(sql);
return files;
}
/// <summary>
/// Gets a list of Ids for each of the items in the Recycle Bin.
/// </summary>
/// <param name="nodeObjectType"></param>
/// <returns></returns>
public List<int> GetIdsOfItemsInRecycleBin(Guid nodeObjectType)
{
var db = _unitOfWork.Database;
var idsSql = new Sql();
idsSql.Select("DISTINCT(id)")
.From<NodeDto>()
.Where<NodeDto>(x => x.Trashed && x.NodeObjectType == nodeObjectType);
var ids = db.Fetch<int>(idsSql);
return ids;
}
/// <summary>
/// Empties the Recycle Bin by running single bulk-Delete queries
/// against the Content- or Media's Recycle Bin.
/// </summary>
/// <param name="nodeObjectType"></param>
/// <returns></returns>
public bool EmptyRecycleBin(Guid nodeObjectType)
{
var db = _unitOfWork.Database;
//Construct and execute delete statements for all trashed items by 'nodeObjectType'
var deletes = new List<string>
{
FormatDeleteStatement("umbracoUser2NodeNotify", "nodeId"),
FormatDeleteStatement("umbracoUser2NodePermission", "nodeId"),
FormatDeleteStatement("umbracoRelation", "parentId"),
FormatDeleteStatement("umbracoRelation", "childId"),
FormatDeleteStatement("cmsTagRelationship", "nodeId"),
FormatDeleteStatement("umbracoDomains", "domainRootStructureID"),
FormatDeleteStatement("cmsDocument", "NodeId"),
FormatDeleteStatement("cmsPropertyData", "contentNodeId"),
FormatDeleteStatement("cmsPreviewXml", "nodeId"),
FormatDeleteStatement("cmsContentVersion", "ContentId"),
FormatDeleteStatement("cmsContentXml", "nodeID"),
FormatDeleteStatement("cmsContent", "NodeId"),
"UPDATE umbracoNode SET parentID = '-20' WHERE trashed = '1' AND nodeObjectType = @NodeObjectType",
"DELETE FROM umbracoNode WHERE trashed = '1' AND nodeObjectType = @NodeObjectType"
};
//Wraps in transaction - this improves performance and also ensures
// that if any of the deletions fails that the whole thing is rolled back.
using (var trans = db.GetTransaction())
{
try
{
foreach (var delete in deletes)
{
db.Execute(delete, new { NodeObjectType = nodeObjectType });
}
trans.Complete();
return true;
}
catch (Exception ex)
{
trans.Dispose();
LogHelper.Error<RecycleBinRepository>("An error occurred while emptying the Recycle Bin: " + ex.Message, ex);
return false;
}
}
}
/// <summary>
/// Deletes all files passed in.
/// </summary>
/// <param name="files"></param>
/// <returns></returns>
public bool DeleteFiles(IEnumerable<string> files)
{
try
{
var fs = FileSystemProviderManager.Current.GetFileSystemProvider<MediaFileSystem>();
Parallel.ForEach(files, file =>
{
if (UmbracoSettings.UploadAllowDirectories)
{
var relativeFilePath = fs.GetRelativePath(file);
var parentDirectory = System.IO.Path.GetDirectoryName(relativeFilePath);
fs.DeleteDirectory(parentDirectory, true);
}
else
{
fs.DeleteFile(file, true);
}
});
return true;
}
catch (Exception ex)
{
LogHelper.Error<RecycleBinRepository>("An error occurred while deleting files attached to deleted nodes: " + ex.Message, ex);
return false;
}
}
private string FormatDeleteStatement(string tableName, string keyName)
{
//This query works with sql ce and sql server:
//DELETE FROM umbracoUser2NodeNotify WHERE umbracoUser2NodeNotify.nodeId IN
//(SELECT nodeId FROM umbracoUser2NodeNotify as TB1 INNER JOIN umbracoNode as TB2 ON TB1.nodeId = TB2.id WHERE TB2.trashed = '1' AND TB2.nodeObjectType = 'C66BA18E-EAF3-4CFF-8A22-41B16D66A972')
return
string.Format(
"DELETE FROM {0} WHERE {0}.{1} IN (SELECT TB1.{1} FROM {0} as TB1 INNER JOIN umbracoNode as TB2 ON TB1.{1} = TB2.id WHERE TB2.trashed = '1' AND TB2.nodeObjectType = @NodeObjectType)",
tableName, keyName);
}
/// <summary>
/// Dispose disposable properties
/// </summary>
/// <remarks>
/// Ensure the unit of work is disposed
/// </remarks>
protected override void DisposeResources()
{
_unitOfWork.DisposeIfDisposable();
}
}
}
@@ -85,11 +85,10 @@ namespace Umbraco.Core.Persistence.Repositories
/// <returns></returns>
public TEntity Get(TId id)
{
Guid key = id is int ? ConvertIdToGuid(id) : ConvertStringIdToGuid(id.ToString());
var rEntity = _cache.GetById(typeof(TEntity), key);
if (rEntity != null)
var fromCache = TryGetFromCache(id);
if (fromCache.Success)
{
return (TEntity)rEntity;
return fromCache.Result;
}
var entity = PerformGet(id);
@@ -102,7 +101,7 @@ namespace Umbraco.Core.Persistence.Repositories
{
//on initial construction we don't want to have dirty properties tracked
// http://issues.umbraco.org/issue/U4-1946
Entity asEntity = entity as Entity;
TracksChangesEntityBase asEntity = entity as TracksChangesEntityBase;
if (asEntity != null)
{
asEntity.ResetDirtyProperties(false);
@@ -112,6 +111,17 @@ namespace Umbraco.Core.Persistence.Repositories
return entity;
}
protected Attempt<TEntity> TryGetFromCache(TId id)
{
Guid key = id is int ? ConvertIdToGuid(id) : ConvertStringIdToGuid(id.ToString());
var rEntity = _cache.GetById(typeof(TEntity), key);
if (rEntity != null)
{
return new Attempt<TEntity>(true, (TEntity) rEntity);
}
return Attempt<TEntity>.False;
}
protected abstract IEnumerable<TEntity> PerformGetAll(params TId[] ids);
/// <summary>
/// Gets all entities of type TEntity or a list according to the passed in Ids
@@ -173,14 +183,12 @@ namespace Umbraco.Core.Persistence.Repositories
/// <returns></returns>
public bool Exists(TId id)
{
Guid key = id is int ? ConvertIdToGuid(id) : ConvertStringIdToGuid(id.ToString());
var rEntity = _cache.GetById(typeof(TEntity), key);
if (rEntity != null)
var fromCache = TryGetFromCache(id);
if (fromCache.Success)
{
return true;
}
return PerformExists(id);
return PerformExists(id);
}
protected abstract int PerformCount(IQuery<TEntity> query);
@@ -0,0 +1,45 @@
using System;
using System.Collections.Generic;
namespace Umbraco.Core.Persistence.Repositories
{
/// <summary>
/// Comparer that takes into account the duplicate index of a node name
/// This is needed as a normal alphabetic sort would go Page (1), Page (10), Page (2) etc.
/// </summary>
internal class SimilarNodeNameComparer : IComparer<string>
{
public int Compare(string x, string y)
{
if (x.LastIndexOf('(') != -1 && x.LastIndexOf(')') == x.Length - 1 && y.LastIndexOf(')') == y.Length - 1)
{
if (x.ToLower().Substring(0, x.LastIndexOf('(')) == y.ToLower().Substring(0, y.LastIndexOf('(')))
{
int xDuplicateIndex = ExtractDuplicateIndex(x);
int yDuplicateIndex = ExtractDuplicateIndex(y);
if (xDuplicateIndex != 0 && yDuplicateIndex != 0)
{
return xDuplicateIndex.CompareTo(yDuplicateIndex);
}
}
}
return String.Compare(x.ToLower(), y.ToLower(), StringComparison.Ordinal);
}
private int ExtractDuplicateIndex(string text)
{
int index = 0;
if (text.LastIndexOf('(') != -1 && text.LastIndexOf('(') < text.Length - 2)
{
int startPos = text.LastIndexOf('(') + 1;
int length = text.Length - 1 - startPos;
int.TryParse(text.Substring(startPos, length), out index);
}
return index;
}
}
}
@@ -1,11 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Umbraco.Core.Models;
using Umbraco.Core.Models.EntityBase;
using Umbraco.Core.Models.Membership;
using Umbraco.Core.Models.Rdbms;
using Umbraco.Core.Persistence.Caching;
using Umbraco.Core.Persistence.Factories;
using Umbraco.Core.Persistence.Querying;
using Umbraco.Core.Persistence.Relators;
using Umbraco.Core.Persistence.SqlSyntax;
using Umbraco.Core.Persistence.UnitOfWork;
namespace Umbraco.Core.Persistence.Repositories
@@ -13,17 +17,17 @@ namespace Umbraco.Core.Persistence.Repositories
/// <summary>
/// Represents the UserRepository for doing CRUD operations for <see cref="IUser"/>
/// </summary>
internal class UserRepository : PetaPocoRepositoryBase<int, IUser>, IUserRepository
internal class UserRepository : PermissionRepository<int, IUser>, IUserRepository
{
private readonly IUserTypeRepository _userTypeRepository;
public UserRepository(IDatabaseUnitOfWork work, IUserTypeRepository userTypeRepository)
public UserRepository(IDatabaseUnitOfWork work, IUserTypeRepository userTypeRepository)
: base(work)
{
_userTypeRepository = userTypeRepository;
}
public UserRepository(IDatabaseUnitOfWork work, IRepositoryCacheProvider cache, IUserTypeRepository userTypeRepository)
public UserRepository(IDatabaseUnitOfWork work, IRepositoryCacheProvider cache, IUserTypeRepository userTypeRepository)
: base(work, cache)
{
_userTypeRepository = userTypeRepository;
@@ -36,7 +40,7 @@ namespace Umbraco.Core.Persistence.Repositories
var sql = GetBaseQuery(false);
sql.Where(GetBaseWhereClause(), new { Id = id });
var dto = Database.FirstOrDefault<UserDto>(sql);
var dto = Database.Fetch<UserDto, User2AppDto, UserDto>(new UserSectionRelator().Map, sql).FirstOrDefault();
if (dto == null)
return null;
@@ -52,18 +56,20 @@ namespace Umbraco.Core.Persistence.Repositories
{
if (ids.Any())
{
foreach (var id in ids)
{
yield return Get(id);
}
return PerformGetAllOnIds(ids);
}
else
var sql = GetBaseQuery(false);
return ConvertFromDtos(Database.Fetch<UserDto, User2AppDto, UserDto>(new UserSectionRelator().Map, sql));
}
private IEnumerable<IUser> PerformGetAllOnIds(params int[] ids)
{
if (ids.Any() == false) yield break;
foreach (var id in ids)
{
var userDtos = Database.Fetch<UserDto>("WHERE id >= 0");
foreach (var userDto in userDtos)
{
yield return Get(userDto.Id);
}
yield return Get(id);
}
}
@@ -73,7 +79,7 @@ namespace Umbraco.Core.Persistence.Repositories
var translator = new SqlTranslator<IUser>(sqlClause, query);
var sql = translator.Translate();
var dtos = Database.Fetch<UserDto>(sql);
var dtos = Database.Fetch<UserDto, User2AppDto, UserDto>(new UserSectionRelator().Map, sql);
foreach (var dto in dtos.DistinctBy(x => x.Id))
{
@@ -88,20 +94,41 @@ namespace Umbraco.Core.Persistence.Repositories
protected override Sql GetBaseQuery(bool isCount)
{
var sql = new Sql();
sql.Select(isCount ? "COUNT(*)" : "*")
.From<UserDto>();
if (isCount)
{
sql.Select("COUNT(*)").From<UserDto>();
}
else
{
return GetBaseQuery("*");
}
return sql;
}
private static Sql GetBaseQuery(string columns)
{
var sql = new Sql();
sql.Select(columns)
.From<UserDto>()
.LeftJoin<User2AppDto>()
.On<UserDto, User2AppDto>(left => left.Id, right => right.UserId);
return sql;
}
protected override string GetBaseWhereClause()
{
return "umbracoUser.id = @Id";
}
protected override IEnumerable<string> GetDeleteClauses()
{
{
var list = new List<string>
{
"DELETE FROM umbracoUser2NodePermission WHERE userId = @Id",
"DELETE FROM umbracoUser2NodeNotify WHERE userId = @Id",
"DELETE FROM umbracoUserLogins WHERE userId = @Id",
"DELETE FROM umbracoUser2app WHERE " + SqlSyntaxContext.SqlSyntaxProvider.GetQuotedColumnName("user") + "=@Id",
"DELETE FROM umbracoUser WHERE id = @Id"
};
return list;
@@ -120,6 +147,14 @@ namespace Umbraco.Core.Persistence.Repositories
var id = Convert.ToInt32(Database.Insert(userDto));
entity.Id = id;
foreach (var sectionDto in userDto.User2AppDtos)
{
//need to set the id explicitly here
sectionDto.UserId = id;
Database.Insert(sectionDto);
}
((ICanBeDirty)entity).ResetDirtyProperties();
}
protected override void PersistUpdatedItem(IUser entity)
@@ -128,25 +163,89 @@ namespace Umbraco.Core.Persistence.Repositories
var userDto = userFactory.BuildDto(entity);
Database.Update(userDto);
//update the sections if they've changed
var user = (User)entity;
if (user.IsPropertyDirty("AllowedSections"))
{
//for any that exist on the object, we need to determine if we need to update or insert
foreach (var sectionDto in userDto.User2AppDtos)
{
if (user.AddedSections.Contains(sectionDto.AppAlias))
{
//we need to insert since this was added
Database.Insert(sectionDto);
}
else
{
//we need to manually update this record because it has a composite key
Database.Update<User2AppDto>("SET app=@Section WHERE app=@Section AND " + SqlSyntaxContext.SqlSyntaxProvider.GetQuotedColumnName("user") + "=@UserId",
new { Section = sectionDto.AppAlias, UserId = sectionDto.UserId });
}
}
//now we need to delete any applications that have been removed
foreach (var section in user.RemovedSections)
{
//we need to manually delete thsi record because it has a composite key
Database.Delete<User2AppDto>("WHERE app=@Section AND " + SqlSyntaxContext.SqlSyntaxProvider.GetQuotedColumnName("user") + "=@UserId",
new { Section = section, UserId = (int)user.Id });
}
}
((ICanBeDirty)entity).ResetDirtyProperties();
}
#endregion
#region Implementation of IUserRepository
public IProfile GetProfileById(int id)
public IEnumerable<IUser> GetUsersAssignedToSection(string sectionAlias)
{
//Here we're building up a query that looks like this, a sub query is required because the resulting structure
// needs to still contain all of the section rows per user.
//SELECT *
//FROM [umbracoUser]
//LEFT JOIN [umbracoUser2app]
//ON [umbracoUser].[id] = [umbracoUser2app].[user]
//WHERE umbracoUser.id IN (SELECT umbracoUser.id
// FROM [umbracoUser]
// LEFT JOIN [umbracoUser2app]
// ON [umbracoUser].[id] = [umbracoUser2app].[user]
// WHERE umbracoUser2app.app = 'content')
var sql = GetBaseQuery(false);
sql.Where(GetBaseWhereClause(), new { Id = id });
var innerSql = GetBaseQuery("umbracoUser.id");
innerSql.Where("umbracoUser2app.app = " + SqlSyntaxContext.SqlSyntaxProvider.GetQuotedValue(sectionAlias));
sql.Where(string.Format("umbracoUser.id IN ({0})", innerSql.SQL));
var dto = Database.FirstOrDefault<UserDto>(sql);
if (dto == null)
return null;
return new Profile(dto.Id, dto.UserName);
return ConvertFromDtos(Database.Fetch<UserDto, User2AppDto, UserDto>(new UserSectionRelator().Map, sql));
}
#endregion
private IEnumerable<IUser> ConvertFromDtos(IEnumerable<UserDto> dtos)
{
var foundUserTypes = new Dictionary<short, IUserType>();
return dtos.Select(dto =>
{
//first we need to get the user type
IUserType userType;
if (foundUserTypes.ContainsKey(dto.Type))
{
userType = foundUserTypes[dto.Type];
}
else
{
userType = _userTypeRepository.Get(dto.Type);
//put it in the local cache
foundUserTypes.Add(dto.Type, userType);
}
var userFactory = new UserFactory(userType);
return userFactory.BuildEntity(dto);
});
}
}
}
@@ -32,7 +32,7 @@ namespace Umbraco.Core.Persistence.Repositories
var sql = GetBaseQuery(false);
sql.Where(GetBaseWhereClause(), new { Id = id });
var dto = Database.Query<UserTypeDto>(sql).FirstOrDefault();
var dto = Database.FirstOrDefault<UserTypeDto>(sql);
if (dto == null)
return null;
@@ -8,7 +8,7 @@ using Umbraco.Core.Persistence.UnitOfWork;
namespace Umbraco.Core.Persistence.Repositories
{
internal abstract class VersionableRepositoryBase<TId, TEntity> : PetaPocoRepositoryBase<TId, TEntity>
internal abstract class VersionableRepositoryBase<TId, TEntity> : PermissionRepository<TId, TEntity>
where TEntity : class, IAggregateRoot
{
protected VersionableRepositoryBase(IDatabaseUnitOfWork work) : base(work)
@@ -43,8 +43,8 @@ namespace Umbraco.Core.Persistence.Repositories
public virtual void DeleteVersion(Guid versionId)
{
var dto = Database.FirstOrDefault<ContentVersionDto>("WHERE versionId = @VersionId AND newest = @Newest", new { VersionId = versionId, Newest = false });
Mandate.That<Exception>(dto != null);
var dto = Database.FirstOrDefault<ContentVersionDto>("WHERE versionId = @VersionId", new { VersionId = versionId });
if(dto == null) return;
using (var transaction = Database.GetTransaction())
{
@@ -56,8 +56,8 @@ namespace Umbraco.Core.Persistence.Repositories
public virtual void DeleteVersions(int id, DateTime versionDate)
{
var list = Database.Fetch<ContentVersionDto>("WHERE nodeId = @Id AND VersionDate < @VersionDate", new { Id = id, VersionDate = versionDate });
Mandate.That<Exception>(list.Any());
var list = Database.Fetch<ContentVersionDto>("WHERE ContentId = @Id AND VersionDate < @VersionDate", new { Id = id, VersionDate = versionDate });
if (list.Any() == false) return;
using (var transaction = Database.GetTransaction())
{
@@ -9,41 +9,13 @@ namespace Umbraco.Core.Persistence
/// </summary>
public class RepositoryFactory
{
internal virtual ServerRegistrationRepository CreateServerRegistrationRepository(IDatabaseUnitOfWork uow)
{
return new ServerRegistrationRepository(
uow,
NullCacheProvider.Current);
}
internal virtual IUserTypeRepository CreateUserTypeRepository(IDatabaseUnitOfWork uow)
{
return new UserTypeRepository(
uow,
NullCacheProvider.Current);
}
internal virtual IUserRepository CreateUserRepository(IDatabaseUnitOfWork uow)
{
return new UserRepository(
uow,
NullCacheProvider.Current,
CreateUserTypeRepository(uow));
}
internal virtual IEntityRepository CreateEntityRepository(IDatabaseUnitOfWork uow)
{
return new EntityRepository(uow);
}
public virtual IContentRepository CreateContentRepository(IDatabaseUnitOfWork uow)
{
return new ContentRepository(
uow,
RuntimeCacheProvider.Current,
CreateContentTypeRepository(uow),
CreateTemplateRepository(uow));
CreateTemplateRepository(uow)) { EnsureUniqueNaming = Umbraco.Core.Configuration.UmbracoSettings.EnsureUniqueNaming };
}
public virtual IContentTypeRepository CreateContentTypeRepository(IDatabaseUnitOfWork uow)
@@ -81,7 +53,7 @@ namespace Umbraco.Core.Persistence
return new MediaRepository(
uow,
RuntimeCacheProvider.Current,
CreateMediaTypeRepository(uow));
CreateMediaTypeRepository(uow)) { EnsureUniqueNaming = Umbraco.Core.Configuration.UmbracoSettings.EnsureUniqueNaming };
}
public virtual IMediaTypeRepository CreateMediaTypeRepository(IDatabaseUnitOfWork uow)
@@ -118,7 +90,39 @@ namespace Umbraco.Core.Persistence
public virtual ITemplateRepository CreateTemplateRepository(IDatabaseUnitOfWork uow)
{
return new TemplateRepository(uow, NullCacheProvider.Current);
return new TemplateRepository(uow, RuntimeCacheProvider.Current);
}
internal virtual ServerRegistrationRepository CreateServerRegistrationRepository(IDatabaseUnitOfWork uow)
{
return new ServerRegistrationRepository(
uow,
NullCacheProvider.Current);
}
internal virtual IUserTypeRepository CreateUserTypeRepository(IDatabaseUnitOfWork uow)
{
return new UserTypeRepository(
uow,
NullCacheProvider.Current);
}
internal virtual IUserRepository CreateUserRepository(IDatabaseUnitOfWork uow)
{
return new UserRepository(
uow,
NullCacheProvider.Current,
CreateUserTypeRepository(uow));
}
internal virtual IEntityRepository CreateEntityRepository(IDatabaseUnitOfWork uow)
{
return new EntityRepository(uow);
}
internal virtual RecycleBinRepository CreateRecycleBinRepository(IDatabaseUnitOfWork uow)
{
return new RecycleBinRepository(uow);
}
}
}

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