Compare commits

...

397 Commits

Author SHA1 Message Date
Sebastiaan Janssen 0445588c6b Merge pull request #2033 from umbraco/temp-revert-newstarterkitdefault
Reverts the change for the installer screen which needs to be ready f…
2017-07-06 15:31:45 +02:00
mikkelhm 4d316cf0ce Reverts the change for the installer screen which needs to be ready for the new starterkit and Lessons 2017-07-06 15:06:55 +02:00
Mikkel Holck Madsen 864650193a Merge pull request #2032 from umbraco/temp-U4-10124
U4-10124 Update IFileService to handle MacroScripts and UserControls
2017-07-06 12:58:17 +02:00
Claus cfa7b0a092 U4-10124 Update IFileService to handle MacroScripts and UserControls 2017-07-06 10:44:51 +02:00
Mikkel Holck Madsen 5726420848 Merge pull request #2030 from umbraco/temp-U4-10098
U4-10098 Update FileService to support legacy MacroScript and UserCon…
2017-07-06 09:15:18 +02:00
Claus ca752f74bc updating array length. 2017-07-04 17:29:32 +02:00
Claus b840a0992c adding shadow filesystems. 2017-07-04 14:47:29 +02:00
Claus 51997d0651 U4-10098 Update FileService to support legacy MacroScript and UserControl folders 2017-07-04 14:28:15 +02:00
Shannon Deminick 9482104ec5 Merge pull request #2028 from umbraco/temp-U4-4905
Removed "remove paragraph tags" field
2017-07-04 12:33:25 +10:00
Robert 7053c175f8 Removed "remove paragraph tags" field 2017-07-03 13:44:37 +02:00
Claus b2116480fc fix formatting. 2017-07-03 11:17:05 +02:00
Claus caef6cc623 Merge pull request #2026 from wanddy/dev-v7
Improve Chinese translation
2017-07-03 08:32:47 +02:00
wanddy 280ad246ab Merge remote-tracking branch 'remotes/origin/dev-v7' into dev-v7 2017-06-30 19:46:09 +08:00
Claus 44cfe5da84 missing nullcheck. 2017-06-30 10:46:44 +02:00
Claus d5fd266b19 missing semicolon. 2017-06-30 10:34:58 +02:00
wanddy 5768992ccc Improve Chinese translation to match the newest version based on en.xml file.
Signed-off-by: wanddy <wanddy@163.com>
2017-06-30 12:10:59 +08:00
Mads Rasmussen 81aae79b42 Merge pull request #2015 from umbraco/temp-U4-9839
U4-9839 Media Picker: If I only upload one photo then select it as a …
2017-06-29 14:54:49 +02:00
Claus 9edbb3fc26 Merge pull request #1634 from soreng/patch-2
use already defined variable, instead of mapping the path twice
2017-06-29 14:47:21 +02:00
Claus 7fdd2bcdfc Merge pull request #2018 from AndyButland/u4-4090
Fixes U4-4090 - by preserved line breaks in property descriptions...
2017-06-29 14:43:13 +02:00
Claus ba90fdeb56 Merge pull request #1778 from bjarnef/dev-v7-U4-9585
Allow leading whitespace in textstring prevalue editor
2017-06-29 14:40:10 +02:00
Claus d6bae1b58f Merge pull request #1958 from poornimanayar/U4-9661
U4-9661 Remove "move" button in member section
2017-06-29 14:37:00 +02:00
Claus ef53db52f7 Merge pull request #1850 from pijemcolu/temp-U4-9710
U4-9710 ImageCropDataSet.HasImage returns wrong value
2017-06-29 14:07:59 +02:00
Claus 863b97039c Merge pull request #1632 from bjarnef/dev-v7-U4-9181
U4-9181 - Fix sorting of grid editor config
2017-06-29 13:55:12 +02:00
Claus 1a1adbf647 Merge pull request #2024 from greystate/drobar-partialviews
Updates to partialviews
2017-06-29 13:47:54 +02:00
Claus 5c745565da Merge pull request #2025 from umbraco/temp-U4-8970
U4-8988 Adding translations for Chinese (Taiwan)
2017-06-29 13:28:06 +02:00
Claus 5dec54badb U4-8988 Adding translations for Chinese (Taiwan) 2017-06-29 13:27:31 +02:00
Claus e5e725b376 Merge pull request #2022 from umbraco/temp-U4-5454
Temp u4 5454
2017-06-29 12:32:57 +02:00
Claus f0f25c67c6 refactoring method signatures to prevent breaking changes. 2017-06-29 10:00:16 +02:00
Claus da8c0726b1 Merge branch 'U4-5454' of git://github.com/trt/Umbraco-CMS into temp-U4-5454 2017-06-29 08:59:45 +02:00
Claus 2fbb9721fa updating language files. 2017-06-29 08:53:22 +02:00
Claus de6ffd456c Merge pull request #1972 from wanddy/dev-v7-chnfixnew
Fix translation didn't work in some tree node
2017-06-29 08:47:37 +02:00
Claus 5b3ff58ad8 Merge pull request #1964 from esn303/patch-2
Update "Element hinzufügen" (Add grid element)
2017-06-29 08:14:08 +02:00
Claus 9a4c1972b2 Merge pull request #2020 from umbraco/revert-2008-temp-old-client-files-clean-up
Revert "Removing unused v6 images"
2017-06-28 14:49:05 +02:00
Claus b993ce953b Revert "Removing unused v6 images" 2017-06-28 14:48:41 +02:00
Claus dde0f1aa36 Merge pull request #2008 from umbraco/temp-old-client-files-clean-up
Removing unused v6 images
2017-06-28 13:07:19 +02:00
Stephan 3fd6754057 Merge branch 'dev-v7' of https://github.com/umbraco/Umbraco-CMS into dev-v7 2017-06-28 12:46:46 +02:00
Stephan 8fbb459233 fix and annotate some tests 2017-06-28 12:46:40 +02:00
Shannon cb6f934792 fixes cache bust value 2017-06-27 19:40:24 +10:00
Shannon Deminick 7adbecf9a1 Merge pull request #2019 from lars-erik/U4-6695-internalsvisibleto-unittesting-adapter
U4-6695 Adds InternalsVisibleTo("Umbraco.UnitTesting.Adapter")
2017-06-27 10:06:36 +10:00
Claus 2fdf148610 localizing text https://github.com/umbraco/Umbraco-CMS/pull/1250 2017-06-26 15:41:17 +02:00
Claus 9d9e5e8274 Merge branch 'rodyvansambeek-patch-1' into dev-v7 2017-06-26 15:33:27 +02:00
Claus 89895dd592 Merge branch 'patch-1' of git://github.com/rodyvansambeek/Umbraco-CMS into rodyvansambeek-patch-1
# Conflicts:
#	src/Umbraco.Web.UI/umbraco/config/lang/nl.xml
2017-06-26 15:32:47 +02:00
Lars-Erik Aabech f9252372ea Adds InternalsVisibleTo("Umbraco.UnitTesting.Adapter") for more imperative exposure to custom unit test adapters. 2017-06-26 12:39:57 +02:00
Claus 02a2178029 Merge branch 'benjaminketron-temp-U4-9464' into dev-v7 2017-06-26 11:33:27 +02:00
Claus ee775a2fde adding a few more tests. 2017-06-26 11:31:46 +02:00
Claus 22af206626 Merge branch 'temp-U4-9464' of git://github.com/benjaminketron/Umbraco-CMS into benjaminketron-temp-U4-9464 2017-06-26 11:23:24 +02:00
AndyButland 67e109c0e6 Preserved line breaks in property descriptions when rendering in content area 2017-06-23 11:40:43 +02:00
Sebastiaan Janssen 8a4d85771b Merge pull request #2016 from mikecp/U4-10047
U4 10047
2017-06-23 11:14:49 +02:00
Sebastiaan Janssen 4688ac104e Merge pull request #1494 from AndyButland/u4-8999
U4-8999 - health check, debug compilation mode is being reported in error when config missing
2017-06-23 08:31:29 +02:00
Michael Latouche 032dbe5bf5 Update fr.xml 2017-06-23 00:52:10 +02:00
Michael Latouche a7695163b9 Update fr.xml 2017-06-23 00:21:33 +02:00
Michael Latouche cb4569677e Update fr.xml 2017-06-23 00:10:22 +02:00
Michael Latouche 4be704b968 Update fr.xml 2017-06-23 00:09:52 +02:00
Michael Latouche b7a5cb046a Update fr.xml 2017-06-22 23:56:33 +02:00
Claus eb52dafb33 U4-9839 Media Picker: If I only upload one photo then select it as a part of the upload process 2017-06-22 13:01:29 +02:00
Sebastiaan Janssen af382c171b Merge pull request #2009 from umbraco/temp-U4-10034
U4-10034 Package install may not wait for app domain restart in all cases
2017-06-22 11:22:18 +02:00
Claus 54fdfdd639 adding grunt watch interval to prevent insane cpu load. 2017-06-22 11:05:42 +02:00
Claus c4c99ef0b8 Merge pull request #2014 from umbraco/temp-deploy-348
deploy-348 - add support for languages
2017-06-22 10:53:31 +02:00
Stephan 0bd233815e deploy-348 - add support for languages 2017-06-22 10:04:48 +02:00
Michael Latouche 4c9fd4029f Merge pull request #3 from umbraco/dev-v7
Resync
2017-06-22 00:32:36 +02:00
Claus 3d65afabbf Merge branch 'temp-U4-10043' into dev-v7 2017-06-21 14:27:34 +02:00
Claus ef9bf155ef typo. 2017-06-21 14:21:39 +02:00
Sebastiaan Janssen e947f661a9 Merge pull request #2011 from akierczynska/patch-1
Updating pl.xml language version to cover en.xml
2017-06-21 14:20:19 +02:00
Claus 0eb8ebd82e fixing up translations. 2017-06-21 14:04:15 +02:00
Claus bc76fa8687 Merge branch 'localization-v764' of git://github.com/abryukhov/Umbraco-CMS into temp-U4-10043 2017-06-21 12:03:25 +02:00
Sebastiaan Janssen 8681d535f2 Merge pull request #2010 from umbraco/temp-U4-10035
Turns out when we empty the recycle bin we weren't removing associate…
2017-06-21 11:51:47 +02:00
Shannon 6d81705ece fixes the restart check 2017-06-21 18:34:22 +10:00
Sebastiaan Janssen b433af8611 Merge pull request #2013 from umbraco/temp-U4-10046
U4-10046 Stop resolving TreeController from the PluginManager for eve…
2017-06-21 10:15:07 +02:00
Shannon b0f4d0e16b U4-10046 Stop resolving TreeController from the PluginManager for every back office request 2017-06-21 18:11:03 +10:00
Shannon 2f24dfb8f0 changes name from versionHash to cacheBuster
(cherry picked from commit 439c30e2fd)
2017-06-21 08:26:44 +02:00
Shannon ad63050078 Fixes issue of rendering the umb version in the html markup
(cherry picked from commit c13b2fae4b)
2017-06-21 08:26:20 +02:00
Alexander Bryukhov 552c2ed4dc Localizing hardcoded strings 2017-06-21 02:45:18 +07:00
Alexander Bryukhov d7e522132e Localizing hardcoded strings 2017-06-21 02:45:12 +07:00
Alexander Bryukhov ca7c43d944 Localizing hardcoded strings 2017-06-21 02:45:05 +07:00
Alexander Bryukhov c35e842391 Localizing hardcoded strings 2017-06-21 02:44:59 +07:00
Alexander Bryukhov dae20cc986 Localizing hardcoded strings 2017-06-21 02:44:52 +07:00
Alexander Bryukhov c466514e7f Localizing hardcoded strings 2017-06-21 02:44:45 +07:00
Alexander Bryukhov 5e2aa7fa68 Localizing hardcoded strings 2017-06-21 02:44:39 +07:00
Alexander Bryukhov 11ccc88bc8 Localizing hardcoded strings 2017-06-21 02:44:33 +07:00
Alexander Bryukhov c83009c879 Localizing hardcoded strings 2017-06-21 02:44:26 +07:00
Alexander Bryukhov d6b9b41776 Localizing hardcoded strings 2017-06-21 02:44:19 +07:00
Alexander Bryukhov 508a4c32b4 Localizing hardcoded strings 2017-06-21 02:44:12 +07:00
Alexander Bryukhov dbf2538aae Localizing hardcoded strings 2017-06-21 02:44:06 +07:00
Alexander Bryukhov 5293b3bcc7 Localizing hardcoded strings 2017-06-21 02:44:00 +07:00
Alexander Bryukhov 940caba2c4 Localizing hardcoded strings 2017-06-21 02:43:53 +07:00
Alexander Bryukhov e31daef4fa Localizing hardcoded strings 2017-06-21 02:43:47 +07:00
Alexander Bryukhov 7984626433 Localizing hardcoded strings 2017-06-21 02:43:40 +07:00
Alexander Bryukhov ffa557b097 Localizing hardcoded strings 2017-06-21 02:43:33 +07:00
Alexander Bryukhov 9236bcbcd8 Localizing hardcoded strings 2017-06-21 02:43:26 +07:00
Alexander Bryukhov 1b875b0c67 Localizing hardcoded strings 2017-06-21 02:43:19 +07:00
Alexander Bryukhov ecce68da0a Localizing hardcoded strings 2017-06-21 02:43:12 +07:00
Alexander Bryukhov e27a882d2b Localizing hardcoded strings 2017-06-21 02:43:06 +07:00
Alexander Bryukhov c7ae379fd1 Localizing hardcoded strings 2017-06-21 02:42:59 +07:00
Alexander Bryukhov 8ad13f6853 Localizing hardcoded strings 2017-06-21 02:42:52 +07:00
Alexander Bryukhov e4ae40c2fe Localizing hardcoded strings 2017-06-21 02:42:45 +07:00
Alexander Bryukhov be61270e42 Localizing hardcoded strings 2017-06-21 02:42:38 +07:00
Alexander Bryukhov bd00b532eb Localizing hardcoded strings 2017-06-21 02:42:32 +07:00
Alexander Bryukhov ebc9478f2d Localizing hardcoded strings 2017-06-21 02:42:25 +07:00
Alexander Bryukhov ab72808a10 Localizing hardcoded strings 2017-06-21 02:42:18 +07:00
Alexander Bryukhov 068e82172a Localizing hardcoded strings 2017-06-21 02:42:10 +07:00
Alexander Bryukhov 45988d4f0c Localizing hardcoded strings 2017-06-21 02:42:02 +07:00
Alexander Bryukhov db330b3223 Localizing hardcoded strings 2017-06-21 02:41:54 +07:00
Alexander Bryukhov 03fd06cfa7 Localizing hardcoded strings 2017-06-21 02:41:45 +07:00
Alexander Bryukhov 775148d241 Localizing hardcoded strings 2017-06-21 02:41:37 +07:00
Alexander Bryukhov 8e65ecdc4a Localizing hardcoded strings 2017-06-21 02:41:27 +07:00
Alexander Bryukhov 6a43dd41c6 Localizing hardcoded strings 2017-06-21 02:41:19 +07:00
Alexander Bryukhov 82ae6a1aef Added localizationService
and localized two hardcoded strings
2017-06-21 02:41:04 +07:00
Alexander Bryukhov a127683d92 Adding & changing keys
for the views localization check
2017-06-21 02:40:47 +07:00
Alexander Bryukhov 06f3f4b191 Adding & changing keys
for the views localization check
2017-06-21 02:40:31 +07:00
Alexander Bryukhov a2f45a38f7 Adding & changing keys
for the views localization check
2017-06-21 02:40:05 +07:00
akierczynska 4b966ebe91 Update pl.xml 2017-06-20 17:31:18 +01:00
akierczynska da9e87d0ab Update pl.xml 2017-06-20 17:18:58 +01:00
akierczynska 84a206ce5e Update pl.xml 2017-06-20 16:12:12 +01:00
akierczynska 3c3c31c36e Update pl.xml 2017-06-20 16:08:17 +01:00
akierczynska 585f8e07f7 Update pl.xml 2017-06-20 16:03:46 +01:00
akierczynska f7c0e02bfd Update pl.xml 2017-06-20 16:00:47 +01:00
akierczynska e767eaa08b Update pl.xml
Update pl.xml to match en.xml and complete the translation
2017-06-20 15:57:50 +01:00
Claus ef32eda874 Merge branch 'temp-U4-8664' into dev-v7
fixing language selection.
2017-06-20 14:09:43 +02:00
Claus 01ccf8a6a6 Merge branch 'U4-8664' of https://github.com/DoctaJonez/Umbraco-CMS into temp-U4-8664 2017-06-20 12:59:28 +02:00
Sebastiaan Janssen c27ca1fb0d U4-9724 Tiny MCE error when adding a link "Cannot read property 'href' of undefined" 2017-06-20 10:16:00 +02:00
Shannon 68e287cf12 fixes $q reference 2017-06-20 18:11:26 +10:00
Shannon ad6946aa26 fixes error handler reference 2017-06-20 18:07:17 +10:00
Shannon Deminick 42d7c83a6d Merge pull request #2004 from umbraco/temp-u4-10026
U4-10026 - use id-key map for getting by guid
2017-06-20 17:01:35 +10:00
Stephan 1a435148d8 U4-10026 - inject idkmap 2017-06-20 08:55:08 +02:00
Stephan de348a9946 Merge remote-tracking branch 'origin/dev-v7' into temp-u4-10026 2017-06-20 08:41:04 +02:00
akierczynska 791e6a5f92 Update pl.xml 2017-06-19 18:19:35 +01:00
Shannon 1f6f8df5b5 Turns out when we empty the recycle bin we weren't removing associated cmsTask info. This also adds a null check since a SingleOrDefault call can return null. I've only seen this cause a problem when there is corrupt data but it should still be checked. 2017-06-19 23:48:18 +10:00
Niels Hartvig 7f5eff6e53 Fixes build, removes more unused client files 2017-06-19 15:43:53 +02:00
Shannon d885265818 Changes restart tracking to use code we used to have in there which is an in memory marker for the app domain, this is a little cleaner 2017-06-19 23:40:51 +10:00
Niels Hartvig be6140a38b Revert "More client files clean-up (including a duplicate tinymce)"
This reverts commit 8ee05063a2.
2017-06-19 15:27:36 +02:00
Niels Hartvig 8ee05063a2 More client files clean-up (including a duplicate tinymce) 2017-06-19 15:05:02 +02:00
Shannon 7920383904 U4-10034 Package install may not wait for app domain restart in all cases 2017-06-19 23:02:06 +10:00
Niels Hartvig 1a3d9e27f4 Removing unused v6 images 2017-06-19 14:46:21 +02:00
Shannon Deminick 2654f9189f Merge pull request #1973 from marcemarc/marcemarc-u4-9480
Revised fix for issue: U4-9489 - Just fix logResource.js parameters
2017-06-19 20:33:37 +10:00
Sebastiaan Janssen d7453b5a6e Updating the CG link so we can modify it without releasing a new version
Updated links to our/tv to be https
2017-06-19 09:49:15 +02:00
Sebastiaan Janssen 5ed8ceb85e Merge pull request #2000 from umbraco/updates-installer-764
Update installer photo + tlc on starter kit install screen
2017-06-19 09:34:40 +02:00
Mikkel Holck Madsen b7ea0840a9 Merge pull request #2007 from abryukhov/patch-6
Update ru.xml UI resources
2017-06-19 09:29:45 +02:00
Shannon Deminick 6b65f1c197 Merge pull request #1970 from Sam7/dev-v7
U4-9973 Remove sealed modifier from ExternalSignInAutoLinkOptions class
2017-06-19 17:27:24 +10:00
Alexander Bryukhov bc7dc8629e Update ru.xml UI resources
Couple of translation corrections
2017-06-18 18:35:48 +07:00
Michael Latouche d3c2b0a247 Merge pull request #2 from umbraco/dev-v7
Merge dev-v7 into my fork
2017-06-17 01:16:26 +02:00
Stephan 464711d3c8 U4-10026 - use id-key map for getting by guid 2017-06-16 14:09:20 +02:00
Mikkel Holck Madsen b15fd4496a Merge pull request #1699 from richarth/patch-2
Spelling and Grammar changes
2017-06-15 15:24:56 +02:00
Mikkel Holck Madsen b3ea0c83f9 Merge pull request #1832 from leekelleher/issue/U4-8098
Fixes U4-8900 - XPath: "$current" on Multinodetreepicker gives error in Document Type editor
2017-06-15 15:02:14 +02:00
Shannon Deminick c1aefe0686 Merge pull request #2002 from rmorrin/obsolete-namespace-errors
Fix incorrect namespace in deprecated class messages
2017-06-15 14:16:30 +02:00
Ryan Morrin 907dd8092a Fix incorrect namespace in deprecated class messages 2017-06-15 13:04:30 +01:00
Sebastiaan Janssen 7b5568ecb4 Merge pull request #1993 from AndersBrohus/U4-10008
U4-10008 - New danish translation for "Preview" - button
2017-06-15 12:43:25 +02:00
Shannon Deminick 2fd383960d Merge pull request #1997 from umbraco/temp-U4-10014
U4-10014 Making package install events public
2017-06-14 22:41:11 +02:00
Niels Hartvig a2c5c35394 Update installer photo + tlc on starter kit install screen 2017-06-14 11:45:03 +02:00
Mikkel Holck Madsen c0616a37bf Merge pull request #1999 from umbraco/temp-tryAscii
Enable trying to convert urls to ascii
2017-06-14 10:12:58 +02:00
Mikkel Holck Madsen da4be3be65 Merge pull request #1995 from umbraco/temp-backofficeguids
Adds hoverstates for metadata(documenttypes, datatypes etc), making it possible to see their guids in the backoffice
2017-06-14 08:27:41 +02:00
Shannon Deminick 08c4a75af7 Merge pull request #1945 from protherj/U4-9792-fips-support
U4-9792 -- Update Umbraco to be FIPS compliant
2017-06-13 15:05:21 +02:00
Claus 308c381e17 U4-10014 Making package install events public 2017-06-13 13:28:23 +02:00
Jason Prothero e99309aa2f Merge pull request #3 from protherj/fips-refactoring
Added RFC 4122 compliant GUID support to StrringExtensions ToGuid()
2017-06-12 13:47:26 -07:00
Jason Prothero 917a2b78dd Added RFC 4122 compliant GUID support to the ToGuid() method on StrringExtensions.cs. Verified the SHA1 hash works with the ToGuid() method via unit tests. 2017-06-12 13:44:42 -07:00
Mads Rasmussen e559a6d485 add key as hover on name 2017-06-12 14:55:12 +02:00
Claus 160518e977 adding guids to backoffice. 2017-06-12 12:12:14 +02:00
Anders Brohus f985725118 Create da.xml 2017-06-11 22:01:57 +02:00
= 7f75802e4e allow DecimalValueConverter to understand signs in the front of the number. wonder if this could be more configurable as there are many other options avaialble." 2017-06-06 22:18:12 -06:00
Jeavon Leopold 5eb330b7d7 Add GetAbsoluteMediaUrl method to UrlHelper for the Open Graph starter kit lesson 2017-06-05 17:32:05 +02:00
Sebastiaan Janssen 2191d33844 Bumps version 2017-06-05 16:33:47 +02:00
Sebastiaan Janssen 92a507bc87 New CG year 2017-06-05 16:02:04 +02:00
Niels Hartvig 1b844421fc Updates to installer to use the new starter kit (and updates core version) 2017-06-04 20:47:33 +02:00
Niels Hartvig df9c6baed7 Updates a few numbers in the installer 2017-06-04 18:10:29 +02:00
Sebastiaan Janssen 53357b0582 Merge pull request #1976 from umbraco/temp-U4-9980
Temp u4 9980
2017-06-04 14:55:23 +02:00
Sebastiaan Janssen 1164f1cdbb Merge branch 'dev-v7' into temp-U4-9980 2017-06-04 14:55:03 +02:00
Niels Hartvig 7f05b80a22 Make Seb happy 2017-06-04 14:02:05 +02:00
Niels Hartvig 20239a9b71 Adds a null check to avoid breaking tests (and to comform to coding standards) 2017-06-04 14:00:51 +02:00
Sebastiaan Janssen c4b07cc3ae Merge pull request #1974 from umbraco/temp-U4-9980
Adds support for keys in package content
2017-06-03 18:36:28 +02:00
Sebastiaan Janssen 771935b8a5 Update PackagingService.cs 2017-06-03 18:36:00 +02:00
Niels Hartvig 73bb401f81 Updating to TryParse to make Sir Janssen happy :-) 2017-06-03 18:34:09 +02:00
Niels Hartvig 8ccbe4c1e4 Adds support for keys in package content 2017-06-03 17:34:31 +02:00
Marc Goodson cf3343749f Revert fix to umbrequesthelper.service it was NEVER meant to be able to receive an array of a single dictionary item - actual fix is to change logResource to not pass params in this way 2017-06-02 21:04:12 +01:00
Marc Goodson 079df4a8b7 Pass logType and SinceDate as an array of key value pairs and not an array of a single dictionary - the logapi was never meant to be able to receive a dictionary... see comments on http://issues.umbraco.org/issue/U4-9489 for details 2017-06-02 21:02:46 +01:00
wanddy 7612884705 revert MediaService.cs 2017-06-02 23:41:19 +08:00
wanddy 74dc2d80fd Merge remote-tracking branch 'remotes/origin/dev-v7.6-chnfix' into dev-v7-chnfixnew
# Conflicts:
#	src/Umbraco.Core/Services/MediaService.cs
2017-06-02 23:33:16 +08:00
Wanddy Huang(黄仁祥) 647ebee34d Merge pull request #1 from umbraco/master-v7
merger umbraco/dev-v7  to my dev-v7
2017-06-02 22:43:44 +08:00
wanddy bc444847f4 Merge branch 'dev-v7.6' of https://github.com/umbraco/Umbraco-CMS into dev-v7.6-chnfix 2017-06-02 21:47:03 +08:00
Sam Sperling b5c2fc82bb U4-9973 Remove sealed modifier from ExternalSignInAutoLinkOptions class 2017-06-02 11:43:06 +10:00
Stephan a50256d381 Enable trying to convert urls to ascii 2017-06-01 17:58:22 +02:00
Sebastiaan Janssen 92f609ff71 Merge pull request #1969 from umbraco/temp-U4-9974
U4-9974 EnablePropertyValueConverter does the opposite
2017-06-01 13:32:51 +02:00
Sebastiaan Janssen 7e6f7f8a2b Bumps version 2017-06-01 13:04:31 +02:00
Claus c5419e700b the legacy converter should not be associated to RelatedLinks2Alias and should only be enabled if EnablePropertyValueConverters is false, otherwise the other converter should be used. 2017-06-01 13:03:56 +02:00
Sebastiaan Janssen cb09094632 U4-9974 EnablePropertyValueConverter does the opposite 2017-06-01 10:57:15 +02:00
Sebastiaan Janssen 72404e68a0 Merge pull request #1968 from umbraco/temp-u4-9927
U4-9927 - fix migration
2017-05-31 16:36:42 +02:00
Sebastiaan Janssen 2c451c5cfe Remove debug tracing 2017-05-31 16:29:26 +02:00
Stephan af7f83f0f6 U4-9927 - fix migration 2017-05-31 15:49:15 +02:00
Shannon 5b3c2178a2 Revert "Merge pull request #1729 from marcemarc/marcemarc-U4-9480"
This reverts commit 145f789631, reversing
changes made to 78bc38fe1b.
2017-05-31 15:26:22 +02:00
Shannon Deminick 145f789631 Merge pull request #1729 from marcemarc/marcemarc-U4-9480
U4-9489 - dictonaryToQueryString only returns first dictionary item
2017-05-31 15:17:11 +02:00
Sebastiaan Janssen e27e95cb1a U4-9952 Can not save XSLT files in 7.6 2017-05-31 11:11:56 +02:00
Mikkel Holck Madsen cdbc3fa8cd Merge pull request #1967 from umbraco/temp-U4-9971
U4-9971 Special "square bracket" notation in Umbraco.Field not working
2017-05-31 10:55:17 +02:00
Sebastiaan Janssen 6feb7b222f U4-9971 Special "square bracket" notation in Umbraco.Field not working 2017-05-31 10:18:10 +02:00
mikkelhm b0a739b4ac Bump version to 7.6.2 2017-05-29 15:07:37 +02:00
Sebastiaan Janssen 728dee070f Merge pull request #1965 from umbraco/temp-U4-9894-2
U4-9894 UDI Pickers and all 'v2' property editors shouldn't observe t…
2017-05-29 14:27:18 +02:00
Claus 4a735770e2 Merge pull request #1961 from umbraco/temp-U4-9937
fixes: U4-9937 RTE Media Picker - Cannot add image to RTE after searching
2017-05-29 11:42:05 +02:00
Shannon d54b3a0cc3 U4-9894 UDI Pickers and all 'v2' property editors shouldn't observe the EnablePropertyValueConverters setting 2017-05-29 09:38:16 +02:00
Claus f962a3db20 Merge pull request #1953 from umbraco/temp-U4-9935
U4-9935 UmbracoHelper doesn't have querying methods for handling UDI
2017-05-29 09:34:29 +02:00
mikkelhm 39851d2475 Ignoring the StringEncodingTest2 as AppVeyors framework settings is doing weird things, that makes it fail 2017-05-26 13:31:29 +02:00
Mikkel Holck Madsen 28adbc17ef Merge pull request #1963 from umbraco/temp-deploy-324
deploy-324 - fix udi encoding
2017-05-26 13:14:29 +02:00
Shannon Deminick 4b9a13078e Merge pull request #1957 from umbraco/temp-U4-9940
U4-9940 Make it easy to get the integer Id of an item from it's Udi
2017-05-25 23:58:23 +10:00
Sebastiaan Janssen 17cce9a666 Make EntityService private 2017-05-25 15:40:26 +02:00
Sebastiaan Janssen 39da34e1c7 Attempt to force .NET 4.5 for tests 2017-05-25 13:14:56 +02:00
Sebastiaan Janssen 55dc927c8b Does this help get the StringEncodingTest2 to run? Doubt it. 2017-05-25 12:07:20 +02:00
Sebastiaan Janssen 6e3ff59dfb Adds GetIdForUdi to UmbracoHelper 2017-05-25 11:04:40 +02:00
Sebastiaan Janssen 08eab00627 Adds GetIdForUdi method to IEntityService 2017-05-25 10:48:28 +02:00
Sebastiaan Janssen c4fae9b272 Remove extension method 2017-05-25 10:47:15 +02:00
Marc Stöcker 8b299a070f Update "Element hinzufügen" (Add grid element)
Key no longer used for first element exclusively for ages. New label just hints the (+) as button to add an element (being it the first one or not) -- very generic and thus hopefully future proof.
2017-05-24 12:16:46 +02:00
Stephan 51186bea24 deploy-324 - fix udi encoding 2017-05-24 11:20:01 +02:00
Shannon Deminick 5c5bacaab4 Merge pull request #1962 from bjarnef/dev-v7-U4-9571
Fix overwriting background repeat and position on legacy tree icons
2017-05-24 18:00:18 +10:00
Bjarne Fyrstenborg 5a4e6df99c Merge remote-tracking branch 'upstream/dev-v7' into dev-v7-U4-9571
# Conflicts:
#	src/Umbraco.Web.UI.Client/src/less/tree.less
2017-05-24 09:40:14 +02:00
Bjarne Fyrstenborg 22f8a4c5dd Fix overwriting background repeat and position on legacy tree icons 2017-05-24 09:24:26 +02:00
Shannon Deminick aaf7ae0331 Merge pull request #1960 from umbraco/temp-u4-9936
U4-9936 - fix xml cache refresh in lb
2017-05-24 16:15:03 +10:00
Shannon Deminick 8459a058c6 Merge pull request #1956 from umbraco/temp-U4-9898
U4-9898 Reset password should unlock a locked account
2017-05-24 15:36:33 +10:00
Mads Rasmussen dc5089a9d6 fix svg preview 2017-05-23 14:38:52 +02:00
Mads Rasmussen 45a246d8b6 handle entity and full media objects in media grid 2017-05-23 14:38:34 +02:00
Mads Rasmussen 65bcd78872 add helper to get file extension 2017-05-23 14:37:51 +02:00
Mads Rasmussen a0fd7001e9 fixes image select in details overlay 2017-05-23 14:37:26 +02:00
Stephan 09ceb15d08 U4-9936 - fix xml cache refresh 2017-05-23 14:19:32 +02:00
Sebastiaan Janssen 25335446d0 Merge pull request #1959 from umbraco/temp-U4-9907
U4-9907 Translations Section : Getting "open datareader" Issue : Rela…
2017-05-23 14:11:23 +02:00
Stephan 63d8ef7560 U4-9936 - fix xml cache refresh in lb 2017-05-23 11:21:18 +02:00
Shannon 27428bf545 U4-9907 Translations Section : Getting "open datareader" Issue : Relates to (U4-9201) 2017-05-23 16:23:40 +10:00
Poornima Nayar 782193b17a U4-9661 Remove "move" button in member section 2017-05-22 23:17:17 +01:00
Sebastiaan Janssen b9c418e458 Fix updating the actual lockout 2017-05-22 08:36:02 +02:00
Sebastiaan Janssen c843e634ba Merge pull request #1954 from aburok/dev-v7.6-ScheduledPublishing_RequestLogging
add log if request to ScheduledPublishController fails without exception
2017-05-21 13:40:29 +02:00
Sebastiaan Janssen 8eb0d254da U4-9940 Make it easy to get the integer Id of an item from it's Udi 2017-05-21 13:35:29 +02:00
Sebastiaan Janssen 70921e88f6 Okay, I give up.. disabling failing tests 2017-05-21 12:59:53 +02:00
Sebastiaan Janssen d9b71995e1 Try to make sure TestingDefaults is set to false else IsFileAllowedForUpload_WithWhitelist fails 2017-05-21 12:42:54 +02:00
Sebastiaan Janssen f517e750b9 Some more debugging to see if we are actually testing the correct config 2017-05-21 12:16:45 +02:00
Sebastiaan Janssen 07d91ce9ac Removes some code duplication by using parameterized test
Add some debugging to unit test to figure out what's wrong with it
2017-05-21 11:34:21 +02:00
dkoruba ac8ee92bb8 fix typo 2017-05-20 20:55:40 +02:00
Sebastiaan Janssen aee06c4574 U4-9898 Reset password should unlock a locked account 2017-05-20 14:33:33 +02:00
Sebastiaan Janssen d0f69907db Ignore one test for now that only seems to fail on build server 2017-05-20 13:08:48 +02:00
Sebastiaan Janssen 71db33f4cd Merge pull request #1955 from umbraco/dev-v7.6
Oops, wrong branch was targetted for U4-9908
2017-05-20 12:30:56 +02:00
Sebastiaan Janssen cec6322a84 Merge pull request #1948 from umbraco/temp-u4-9908
U4-9908 - fix scope-related issues
2017-05-20 12:21:40 +02:00
Sebastiaan Janssen eb85e8cd78 Merge branch 'AndyButland-u4-9558' into dev-v7 2017-05-20 12:13:47 +02:00
Sebastiaan Janssen cf7c0dffb0 Merge branch 'u4-9558' of https://github.com/AndyButland/Umbraco-CMS into AndyButland-u4-9558 2017-05-20 11:48:47 +02:00
Sebastiaan Janssen 78d91a353a Merge branch 'jamescoxhead-U4-9872' into dev-v7 2017-05-20 11:35:02 +02:00
Sebastiaan Janssen 22d778ed28 Adds UDI redirect for FollowExternalRedirect
Checks if the redirect property exists before trying to get it's value
Simplified conversions by asking for the property value by type
2017-05-20 11:34:03 +02:00
Sebastiaan Janssen a3a2b6499e Merge branch 'U4-9872' of https://github.com/jamescoxhead/Umbraco-CMS into jamescoxhead-U4-9872 2017-05-20 09:49:12 +02:00
dkoruba 65ed69cf06 add log if request to ScheduledPublishController fails without exception 2017-05-19 22:14:10 +02:00
Shannon Deminick c09cd95eb6 Merge pull request #1951 from umbraco/temp-U4-9919
U4-9919 Updated media files are deleted
2017-05-19 13:17:35 +10:00
Shannon Deminick 1d3490eb82 Merge pull request #1950 from umbraco/temp-U4-9646
U4-9646 RTE Link dialog should auto focus on url
2017-05-19 12:05:05 +10:00
Shannon b78c334589 Merge remote-tracking branch 'origin/master-v7' into dev-v7 2017-05-19 12:04:27 +10:00
Shannon Deminick b41de9b623 Merge pull request #1944 from umbraco/temp-U4-9848
U4-9848 Make sure NuGet version 3.4.4+ is installed in NuGet to prevent update errors
2017-05-19 12:02:11 +10:00
Shannon Deminick c51d29da52 Merge pull request #1947 from umbraco/temp-U4-9896
U4-9896 SqlCEconnection Type A originates from Version=4.0.0.0, Type B originates from 4.0.0.1
2017-05-19 11:54:40 +10:00
Shannon 54967e0150 U4-9935 UmbracoHelper doesn't have querying methods for handling UDI 2017-05-19 11:42:58 +10:00
Shannon 73e47402cb Fixes docs build 2017-05-19 10:20:00 +10:00
Claus 79844154fb U4-9919 Updated media files are deleted 2017-05-18 11:30:11 +02:00
Claus 067a1ba8e6 U4-9646 RTE Link dialog should auto focus on url 2017-05-18 10:02:46 +02:00
Warren Buckley 120cb964a5 Merge pull request #1949 from umbraco/temp-u4-9926
U4-9926 - fix partial view macro udis
2017-05-17 13:39:48 +01:00
Stephan 147a1daf6d U4-9926 - fix partial view macro udis 2017-05-17 12:09:28 +02:00
Shannon 9badb35c05 fix merge issue 2017-05-17 20:08:53 +10:00
Shannon 765decf3b1 Merge remote-tracking branch 'origin/dev-v7.6' into dev-v7
# Conflicts:
#	build/UmbracoVersion.txt
#	src/SolutionInfo.cs
#	src/Umbraco.Core/Configuration/UmbracoVersion.cs
#	src/Umbraco.Core/Services/MediaService.cs
#	src/Umbraco.Web.UI/Umbraco.Web.UI.csproj
#	src/Umbraco.Web/Trees/PartialViewMacrosTree.cs
#	src/Umbraco.Web/Trees/PartialViewsTree.cs
2017-05-17 20:00:29 +10:00
AndyButland eb35791003 Reverted media picker behaviour when selecting images to use just configured image types 2017-05-16 21:16:11 +01:00
Jason Prothero 65654de06a Merge pull request #2 from protherj/fips-refactoring
Update Unit Tests to check for the correct version of Examine
2017-05-16 11:10:55 -07:00
Jason Prothero 2334596bf3 Update Unit Tests to check for the correct version of Examine 2017-05-16 11:06:00 -07:00
Jason Prothero 1d664bce52 Merge pull request #1 from protherj/fips-refactoring
Updated Examine Nuget to latest version 1.8.3
2017-05-16 09:14:02 -07:00
Jason Prothero 9a515de43f Updated Examine Nuget to latest version 1.8.3 2017-05-16 09:12:50 -07:00
mikkelhm 69775c369a Bump version to 7.5.14 2017-05-16 08:33:19 +02:00
mikkelhm 3f25d3637a Bump version to 7.5.14 2017-05-16 08:32:33 +02:00
Stephan 02136d3060 U4-9908 - fix scope-related issues 2017-05-16 08:09:11 +02:00
Sebastiaan Janssen 99d4b13bb0 Adds SQLCE assembly redirect on fresh installs and upgrades 2017-05-15 22:54:46 +02:00
Sebastiaan Janssen e7b007386a U4-9848 Make sure NuGet version 3.4.4+ is installed in NuGet to prevent update errors 2017-05-15 19:00:05 +02:00
Claus 5dc3e0a3fc Merge pull request #1880 from marcemarc/temp-U4-9765
debug logging when there is a distributed calls config issue
2017-05-15 10:28:26 +02:00
Claus d146df43e6 Merge pull request #1903 from HarveyWilliams/dev-v7
U4-9806 Media Picker media hover should show full title
2017-05-15 10:19:04 +02:00
James Coxhead 451826a329 Fixes umbracoInternalRedirectId property to work with UDI IDs 2017-05-14 21:52:45 +01:00
Jason Prothero b55d065d45 Update to mark some methods as Obsolete and not seen by the VS editor 2017-05-11 09:17:56 -07:00
wanddy 83db63c5a8 Merge branch 'dev-v7.6-chnfix' of https://github.com/wanddy/Umbraco-CMS into dev-v7.6-chnfix 2017-05-11 16:29:10 +08:00
wanddy 1fb0b95428 Fix translation didn't work in some tree node. 2017-05-11 16:25:02 +08:00
wanddy 53e23f09dc Fix translation didn't work in some tree node. 2017-05-11 10:10:13 +08:00
wanddy 9e781173fc Merge branch 'dev-v7-chnfix' into dev-v7.6-chnfix 2017-05-11 09:25:02 +08:00
Jason Prothero fead30db38 Removed commented code for hash algorithm refactoring 2017-05-10 15:49:03 -07:00
Jason Prothero d8811d6b46 Refactored code for FIPS compliance support. Added/converted to using a more generic Hash() method instead of directly using MD5. 2017-05-10 13:35:28 -07:00
Mikkel Holck Madsen 080150baa3 Merge pull request #1924 from wanddy/dev-v7
Fix missing translation for some menu tree item
2017-05-10 21:18:58 +02:00
wanddy bc51a98cfd Merge branch 'dev-v7-chnfix' into dev-v7.6-chnfix
# Conflicts:
#	src/Umbraco.Core/Services/MediaService.cs
#	src/Umbraco.Web/Trees/PartialViewMacrosTree.cs
#	src/Umbraco.Web/Trees/PartialViewsTree.cs
Fix some menu tree header won't be translated.
This may be caused by the explicit definition of tree node name.
Add missing translation item for en.xml and zh.xml
2017-05-10 23:25:03 +08:00
wanddy c6bc5ae6aa Merge branch 'dev-v7' of https://github.com/umbraco/Umbraco-CMS into dev-v7 2017-05-10 22:37:47 +08:00
Shannon Deminick f84d3b435b Merge pull request #1898 from DaveLong/U4-9799
Fixed Serialization issue in ValidatePasswordResetCodeModel
2017-05-10 14:59:04 +10:00
Shannon Deminick 99855bce11 Adds AppVeyor build badge 2017-05-10 14:51:40 +10:00
Shannon d0b2f10a8c U4-9836 CreatorId on a media is overwritten on save 2017-05-10 14:32:09 +10:00
Shannon Deminick 70507501bd Merge pull request #1937 from AndyButland/u4-9836
U4-9836 - retains original media creator when media is updated
2017-05-10 14:31:34 +10:00
Shannon Deminick bbfd570b8a Merge pull request #1938 from suedeapple/U4-9886
U4 9886 - automaticly - > automatically (typo fix up)
2017-05-10 14:24:36 +10:00
AndyButland 4a593a0814 Reverted to empty whitelist for default. 2017-05-09 23:59:43 +02:00
AndyButland 3cc0df0273 Fixed media picker calculation of intersection of allowed whitelist and images list 2017-05-09 23:44:31 +02:00
AndyButland 712cd29fea Upload checks to utilise whitelist. Refactored check on white and black list to common extension method. 2017-05-09 23:29:30 +02:00
AndyButland 3d21448f89 Validated file uploads using white list if provided, before falling back to blacklist 2017-05-09 18:12:51 +02:00
suedeapple 7b4912b1e7 automaticly - > automatically 2017-05-09 16:47:36 +01:00
suedeapple 8c6362d947 automaticly - > automatically 2017-05-09 16:40:59 +01:00
AndyButland 01dd28fc61 Retains original media creator when media is updated 2017-05-09 16:01:06 +02:00
mikkelhm 67e2c911f7 Re adds the umbraco.presentation.targets for Umbraco.Web.UI as it handles default transormations for confg files 2017-05-09 00:26:40 +02:00
mikkelhm 36e60c774f Bump version to 7.6.1 2017-05-08 14:06:03 +02:00
mikkelhm 745252341f Merge branch 'dev-v7' into dev-v7.6
# Conflicts:
#	src/Umbraco.Core/Persistence/Migrations/MigrationBase.cs
#	src/Umbraco.Web.UI.Client/src/common/directives/components/imaging/umbimagegravity.directive.js
2017-05-08 13:58:08 +02:00
Mikkel Holck Madsen a2df4c5232 Merge pull request #1933 from umbraco/temp-U4-9864
U4-9864 Missing import and xss check in other PermissionEditor.aspx
2017-05-08 10:29:03 +02:00
Shannon Deminick d012d8e8b6 Merge pull request #1925 from SaDa1337/dev-v7
fixed console error on media picker
2017-05-08 17:11:28 +10:00
Mikkel Holck Madsen 9318da2883 Merge pull request #1931 from umbraco/temp-U4-9849-2
U4-9849 Query Builder not working in template editor. Always returns …
2017-05-08 09:05:29 +02:00
Shannon Deminick a08849f60a Merge pull request #1935 from jamescoxhead/U4-9869
Fix typo error in upgrade installer
2017-05-08 13:40:36 +10:00
Shannon Deminick 9792d8df25 Merge pull request #1930 from TomSteer/U4-9852
Change Context to be public on MigrationBase
2017-05-08 13:39:06 +10:00
Shannon Deminick 635cfe6b20 Merge pull request #1932 from dawoe/patch-1
Return empty string when e-mail is not filled
2017-05-08 13:37:48 +10:00
James Coxhead 9ccf7bdbab Fix typo error in upgrade installer
Changed "your" to "you're"
2017-05-07 16:22:54 +01:00
Chriztian Steinmeier 75e375ff54 Minor edits to the comments
Mainly "Id's" => "Ids" and "html" => "HTML" 👀
2017-05-05 23:55:23 +02:00
Chriztian Steinmeier 1a29a3237d Add files from Douglas Robar 2017-05-05 23:20:37 +02:00
Sebastiaan Janssen 0c520f2b43 Merge branch 'dev-v7' into dev-v7.6
# Conflicts:
#	build/Build.bat
2017-05-05 16:19:54 +02:00
Sebastiaan Janssen 85d10014c2 Make new build work when there's spaces in the current path 2017-05-05 16:14:59 +02:00
Claus 3c4b3f44c7 U4-9864 Missing import and xss check in other PermissionEditor.aspx 2017-05-05 14:52:01 +02:00
Sebastiaan Janssen c6956b5e98 Merge branch 'dev-v7' into dev-v7.6
# Conflicts:
#	.gitignore
#	build/Build.bat
2017-05-05 14:30:08 +02:00
Sebastiaan Janssen fcf5ecc166 Uses vswhere to figure out where VS17 is installed (if needed)
Removes targets file that was almost unused, moved the relevant bits to the main csproj
Updates BuildBelle.bat to be completely independent of installed version of node & npm on the machine
2017-05-05 14:14:37 +02:00
Dave Woestenborghs c5c87ff50d Return empty string when e-mail is not filled
Fix for http://issues.umbraco.org/issue/U4-9862
2017-05-05 13:27:32 +02:00
Stephan eb949e2cbc Fix UdiString to escape paths 2017-05-05 12:46:20 +02:00
Claus 8a096cd826 Merge pull request #1794 from TheBekker/fix-U4-9038
[fix-U4-9038] get and set media start node for mediaPickerOverlay in …
2017-05-05 10:51:31 +02:00
Claus 3b236ba724 Merge pull request #1794 from TheBekker/fix-U4-9038
[fix-U4-9038] get and set media start node for mediaPickerOverlay in …
2017-05-05 10:47:52 +02:00
Claus e7eaf6959f U4-9849 Query Builder not working in template editor. Always returns Model.Content.Site().Children()
adding missing nullchecks in the endpoint action.
ensuring promise returns before setting init data - the unresolved promise was being used on the query model instead of the actual text string the promise returns - causing the endpoint to fail to bind the model.
2017-05-04 15:08:37 +02:00
Tom Steer 3e294e290b Change Context to be public on MigrationBase 2017-05-04 09:10:35 +01:00
Shannon Deminick 751dc8df23 Merge pull request #1926 from avatart0ph/dev-v7.6
fix Add basic xss prevention logic
2017-05-04 11:05:49 +10:00
Morten Christensen 91047182fa Merge pull request #1929 from umbraco/temp-U4-9704
U4-9704 Sorting UDI media picker items, makes it store Int's
2017-05-03 13:20:25 +02:00
Claus 1030fd5294 U4-9704 Sorting UDI media picker items, makes it store Int's 2017-05-03 10:21:00 +02:00
Denise Michelle del Bando be2eb3f555 fix Add basic xss prevention logic
missing import on CleanForXss
2017-05-02 23:16:32 -04:00
Maciej Sadowski 0eafa14246 fixed console error on media picker 2017-05-02 15:36:39 +02:00
wanddy b807b84466 Merge branch 'dev-v7' of https://github.com/umbraco/Umbraco-CMS into dev-v7 2017-05-02 14:23:36 +08:00
wanddy ab551b2c96 Fix some menu tree header won't be translated.
This may be caused by the explicit definition of tree node name.

Signed-off-by: wanddy <wanddy@163.com>
2017-05-02 14:20:44 +08:00
wanddy 1520fa77d5 Add missing translation item for en.xml and zh.xml
Signed-off-by: wanddy <wanddy@163.com>
2017-05-02 14:12:58 +08:00
Shannon c1853e8c51 bumps version to 7.6.0 rtm 2017-05-02 13:42:20 +10:00
Shannon 31c965ae42 Merge remote-tracking branch 'origin/dev-v7' into dev-v7.6 2017-05-02 13:41:03 +10:00
Shannon Deminick d91fc6ce60 Merge pull request #1887 from umbraco/temp-U4-9775
U4-9775 AlreadyClosedException is thrown when retrieving media if the…
2017-05-02 13:40:28 +10:00
Shannon d5124e9739 Ensures that an UmbracoContext exist before emitting the cache handler events 2017-05-01 21:10:22 +10:00
Shannon d9b507c947 bumps version to RC4 so we can build new dependencies against forms/deploy 2017-04-30 23:26:04 +10:00
Shannon d3fcdfb176 updates nuget semver ref in nuspec 2017-04-30 23:24:26 +10:00
Shannon 2479c5a272 updates other nuget refs that shouldnt be there 2017-04-30 23:21:19 +10:00
Shannon fee071db22 Merge branch 'dev-v7.6' of https://github.com/umbraco/Umbraco-CMS into dev-v7.6 2017-04-30 23:20:16 +10:00
Shannon 004e00599d Fixing nuget package issues , semver 2 is only for 452+ which we dont have, we shouldnt be using it and it adds more dependencies that we don't need right now 2017-04-30 23:19:45 +10:00
Morten Christensen 2e2e8b43b0 Merge pull request #1917 from Frozire/patch-1
Edit DA with minor spelling and compound word changes
2017-04-30 14:05:14 +02:00
Morten Christensen e77c5f8667 Keep the Concierge Product name 2017-04-30 14:04:00 +02:00
Shannon Deminick 3509a2c40f Merge pull request #1908 from umbraco/temp-scope-events-stale-entities
POC to normalize all event entities when we track events so that all …
2017-04-30 19:28:19 +10:00
Shannon 378d0f7939 chagnes test params to be slightly less hacky 2017-04-30 19:21:13 +10:00
Shannon d64fa7f92d Fixes tests, ensures we null check when generating hashes for items in a collection 2017-04-30 19:14:36 +10:00
Stephan ea14170272 minor cleanup 2017-04-30 10:14:48 +02:00
Shannon 73209d7e2c Merge branch 'dev-v7' into dev-v7.6 2017-04-30 17:13:14 +10:00
Shannon Deminick cf8ead62ac Merge pull request #1904 from jwoods1/patch-2
Fixed issue on line 216
2017-04-30 17:11:44 +10:00
Shannon Deminick 8461aea7d8 Merge pull request #1907 from wanddy/dev-v7
Improve Chinese translation.
2017-04-30 17:10:58 +10:00
Shannon Deminick 034de1651b Merge pull request #1910 from abryukhov/patch-9
ru.xml - Missing newest area & key from en.xml
2017-04-30 17:09:30 +10:00
Shannon Deminick dcb8aa7e56 Merge pull request #1909 from abryukhov/patch-8
en_us.xml - Missing newest area & key from en.xml
2017-04-30 17:09:15 +10:00
Shannon Deminick e8a52a95da Merge pull request #1914 from dawoe/patch-1
Added dutch translation for usernameHint
2017-04-30 17:08:42 +10:00
Shannon Deminick 42c99e0f07 Merge pull request #1916 from stelim/patch-1
Adding login hint to German language file
2017-04-30 17:08:29 +10:00
Shannon Deminick a31b368b60 Merge pull request #1919 from NathalieLarsson/patch-1
Adding login hint to Swedish language file
2017-04-30 17:05:29 +10:00
Shannon Deminick 77f6d28a74 Merge pull request #1920 from camaya/patch-1
Add Spanish translation for usernameHint
2017-04-30 17:04:56 +10:00
Shannon Deminick 0b8d3ef214 Merge pull request #1921 from mikecp/patch-1
Adding login hint to French language file
2017-04-30 17:04:44 +10:00
Shannon Deminick a4f83f9c00 Merge pull request #1922 from abryukhov/patch-10
Adding 'usernameHint' key to ru.xml lang file
2017-04-30 17:04:30 +10:00
Shannon Deminick 85467976ad Merge pull request #1913 from umbraco/temp-U4-9824-v76
Change username to email in login dialog
2017-04-30 17:04:16 +10:00
Alexander Bryukhov d7e93fe466 Adding 'usernameHint' key to ru.xml lang file 2017-04-30 11:56:47 +07:00
Sebastiaan Janssen 660f048b4f U4-9812 FailedLoginAttempts should be reset to 0 after a successfull login attempt
(cherry picked from commit 3242b31a8a)
2017-04-29 10:22:57 +02:00
Sebastiaan Janssen 9fa76a0133 Merge pull request #1911 from umbraco/temp-U4-9812
U4-9812 FailedLoginAttempts should be reset to 0 after a successfull …
2017-04-29 10:19:26 +02:00
Michael Latouche 444c444f0e Adding login hint to French language file 2017-04-29 00:03:57 +02:00
Cristhian Amaya 383bbbe7e0 Add Spanish translation for usernameHint 2017-04-28 15:19:27 -05:00
Stephan 72eddca3c6 Merge branch 'dev-v7.6' into temp-scope-events-stale-entities 2017-04-28 19:19:36 +02:00
Nicklas Kevin Frank 7c2ddde311 Fixed typo in Dokumenttype 2017-04-28 17:24:43 +02:00
Nathalie Festin c6229e4fcb Adding login hint to Swedish language file
Added usernamehint to placeholders
2017-04-28 15:44:46 +02:00
Nicklas Kevin Frank fbac0aba8b Update da.xml with translation for concierge 2017-04-28 14:56:57 +02:00
Nicklas Kevin Frank f01511c592 Edit DA with minor spelling and compound word changes 2017-04-28 14:48:32 +02:00
Stefan Limbacher 187354f0bd Adding login hint to German language file 2017-04-28 14:29:13 +02:00
Dave Woestenborghs 2f540b1bfa Translated the usually part 2017-04-28 14:25:21 +02:00
Dave Woestenborghs b1f104d1de Changed it to be more consisten
Changed to be more consistent with other dutch translations
2017-04-28 14:24:10 +02:00
Dave Woestenborghs ba5fcad09a Added dutch translation for usernameHint 2017-04-28 14:17:51 +02:00
Niels Hartvig d553eb2978 Change it back to username and then with a hint for email (for backwards compat.) 2017-04-28 13:57:29 +02:00
Niels Hartvig d1e6c0e835 Change username to email in login dialog 2017-04-28 13:37:19 +02:00
Sebastiaan Janssen 3242b31a8a U4-9812 FailedLoginAttempts should be reset to 0 after a successfull login attempt 2017-04-28 12:46:58 +02:00
Shannon 1274fbaefd Fixes up the equality members for the event args types to include Gethash code and sequence equal checking, this is done by a base class used by event args that deal with collections. 2017-04-28 18:14:50 +10:00
Shannon 8140dfdc04 ads notes 2017-04-28 16:57:13 +10:00
Shannon a69eba61c8 Fixes detecting enumerable and ensures that the event is added to the result if we can't cast to IEntity 2017-04-28 14:54:08 +10:00
Alexander Bryukhov 46078a841c Missing newest area & key from en.xml 2017-04-28 11:43:50 +07:00
Alexander Bryukhov 0eb5e5f6e4 Missing newest area & key from en.xml 2017-04-28 11:41:20 +07:00
Shannon ec9020f63e Fixes mappings 2017-04-28 13:34:32 +10:00
Shannon 0b61685fc8 Adds ability to supersede events so we don't have an issue of saved event being raised for an entity after it's been deleted. 2017-04-28 13:26:56 +10:00
Shannon 3779b3c782 Updates base entities to contain a DeletedDate if the entity gets deleted 2017-04-28 11:15:19 +10:00
Shannon 5b0e824301 Merge branch 'dev-v7.6' into temp-scope-events-stale-entities 2017-04-28 10:32:01 +10:00
Shannon 9cd7e09986 POC to normalize all event entities when we track events so that all args contain the latest (non stale) entity 2017-04-28 10:04:43 +10:00
Jason Woods f737004544 Removed space before svalue 2017-04-27 16:13:41 -06:00
Jason Woods 850e354b11 wrapped all values in double quotes
Wrapped image src and crop values in double quotes to keep consistent across all saves and updates.
2017-04-27 16:03:45 -06:00
wanddy 0a2830aece Improve Chinese translation.
Signed-off-by: wanddy <wanddy@163.com>
2017-04-27 22:59:17 +08:00
Jason Woods 23816665f3 Fixed issue on line 216
Found that when uploading media from the folder browser caused an issue of invalid JSON object being stored in the database.  Added quotes around the property values.
2017-04-25 08:21:02 -06:00
Harvey Williams 81354cea3c U4-9806 Media Picker media hover should show full title
Added title to all media items in the media picker rather than just SVG and normal images.

Solving an issue where whole titles could not be visible if the title was too long.
2017-04-24 16:29:35 +01:00
Dave Long b88e714050 Fixed Serialization issue in Password Reset Validate Model 2017-04-21 08:33:21 +02:00
Shannon 13ccd86192 Adds another check for not being able to read the index 2017-04-18 12:35:21 +10:00
Shannon 336266c0eb U4-9775 AlreadyClosedException is thrown when retrieving media if the app domain is currently in a shutdown state and the site is under heavy load 2017-04-18 12:32:44 +10:00
Marc Goodson 58f9ff4b79 Add some debug logging when there is a distributed calls configuration issue 2017-04-11 20:37:59 +01:00
Mike 8d8bb4e237 fix HasImage() 2017-03-31 17:24:18 +02:00
leekelleher 6772b1de35 MNTP Content Picker - when rendering using the DocumentType Editor, querying for the 'startNodeId' is unrequired and could throw exceptions.
This would patch would resolve the following issues...

- U4-7602 - "7.4 Data Types with xpath queries specified caused Document Type edit/creation issues."
- U4-8098 - "Content Type editor can fail while rendering"
- U4-8900 - "XPath: "$current" on Multinodetreepicker gives error in Document Type editor"
2017-03-25 13:45:57 +00:00
TheBekker ab14b65078 [fix-U4-9038] get and set media start node for mediaPickerOverlay in grid 2017-03-13 22:54:20 +01:00
Bjarne Fyrstenborg ea13989b7e Allow leading whitespace in textstring prevalue editor 2017-03-02 23:19:45 +01:00
Marc Goodson 78bc38fe1b getUserLog and getLog don't have an id parameter
these methods blow up when the api doesn't return because they referenced an id variable that does not exist
2017-02-04 18:40:28 +00:00
Marc Goodson edb0a934a1 Fixes U4-9480
Allow more than one item from the dictionary object to be returned on the querystring
2017-02-04 18:35:47 +00:00
richarth f726dd59bf Spelling and Grammar changes
Spelling and Grammar changes
2017-01-20 11:47:10 +00:00
Michael Latouche 1c3b870ad2 Merge pull request #1 from umbraco/dev-v7
update my dev-v7 branch
2016-12-06 13:04:36 +01:00
Søren Gregersen 6a5002495c use already defined variable, instead of mapping the path twice
also fixed a slight indentation issue
2016-11-24 08:58:57 +01:00
bjarnef b3938cd7b2 Fix sorting of grid editor config 2016-11-22 20:39:18 +01:00
gmargol 1e73bb12ac Fixing failing unit tests 2016-11-03 16:26:14 +00:00
Matthew Jones 662bf16a4f Fixed issue: U4-8664 TnyMCE RTE is not in the scope of UI localization.
The rich text editor previously had no knowledge of the current localisation region.

The complexity arrived from the $locale regions not having a direct mapping to TinyMce regions.  $locale regions are in the format of "de-de", "ru-ru", "en-gb", "en-us", etc.  The TinyMce locales are in the format of "de", "ru" and "en".  I've added some code in rte.controller.js to map from the former to the latter, but a fallback to "en" will need to be added if the current locale isn't supported by TinyMce, otherwise a runtime crash will occur.

The same is true of the codemirror plugin for TinyMce.  Language files don't exist for the plugin, but they are expected when different locales are provided.  I have therefore created placeholders that are equivalent to the TinyMce language files, but all are currently copied from english.
2016-11-03 16:13:03 +00:00
gmargol 26d450ad9a Adding optional parameters to tests 2016-11-03 11:31:33 +00:00
gmargol bab4c7715d Adding optional isApproved parameter instead of hardcoding 'true' value 2016-11-03 11:21:53 +00:00
AndyButland 27f121f25c Fixes debug setting health check to correctly indicate no issue if config setting is missing 2016-09-21 15:15:44 +02:00
rodyvansambeek b199f4072c Improved and added dutch translation
Added and changed some dutch translations, especially for members and subnodes (in a listview). The term "kinderen" only relates to children (persons), not items or nodes.
2016-02-17 09:46:49 +01:00
352 changed files with 9732 additions and 2544 deletions
+3 -1
View File
@@ -142,4 +142,6 @@ build/ui-docs.zip
build/csharp-docs.zip
build/msbuild.log
.vs/
src/packages/
src/packages/
build/tools/
src/PrecompiledWeb/*
+2
View File
@@ -1,3 +1,5 @@
[![Build status](https://ci.appveyor.com/api/projects/status/ikpgqxiw9v8opltv/branch/dev-v7?svg=true)](https://ci.appveyor.com/project/Umbraco/umbraco-cms-hs8dx/branch/dev-v7)
Umbraco CMS
===========
The friendliest, most flexible and fastest growing ASP.NET CMS used by more than 390,000 websites worldwide: [https://umbraco.com](https://umbraco.com)
+46 -3
View File
@@ -113,18 +113,61 @@ REM This is necessary because SETLOCAL is on in InstallGit.cmd so that one might
REM but the path setting is lost due to SETLOCAL
SET PATH="C:\Program Files (x86)\Git\cmd";"C:\Program Files\Git\cmd";%PATH%
SET toolsFolder=%CD%\tools\
IF NOT EXIST "%toolsFolder%" (
MD tools
)
SET nuGetExecutable=%CD%\tools\nuget.exe
IF NOT EXIST "%nuGetExecutable%" (
ECHO Getting NuGet so we can fetch some tools
ECHO Downloading https://dist.nuget.org/win-x86-commandline/latest/nuget.exe to %nuGetExecutable%
powershell -Command "(New-Object Net.WebClient).DownloadFile('https://dist.nuget.org/win-x86-commandline/latest/nuget.exe', '%nuGetExecutable%')"
)
:: We need 7za.exe for BuildBelle.bat
IF NOT EXIST "%toolsFolder%7za.exe" (
ECHO 7zip not found - fetching now
"%nuGetExecutable%" install 7-Zip.CommandLine -OutputDirectory tools -Verbosity quiet
)
:: We need vswhere.exe for VS2017+
IF NOT EXIST "%toolsFolder%vswhere.exe" (
ECHO vswhere not found - fetching now
"%nuGetExecutable%" install vswhere -OutputDirectory tools -Verbosity quiet
)
:: Put 7za.exe and vswhere.exe in a predictable path (not version specific)
FOR /f "delims=" %%A in ('dir "%toolsFolder%7-Zip.CommandLine.*" /b') DO SET "sevenZipExePath=%toolsFolder%%%A\"
MOVE "%sevenZipExePath%tools\7za.exe" "%toolsFolder%7za.exe"
FOR /f "delims=" %%A in ('dir "%toolsFolder%vswhere.*" /b') DO SET "vswhereExePath=%toolsFolder%%%A\"
MOVE "%vswhereExePath%tools\vswhere.exe" "%toolsFolder%vswhere.exe"
ECHO.
ECHO Making sure we have a web.config
IF NOT EXIST "%CD%\..\src\Umbraco.Web.UI\web.config" COPY "%CD%\..\src\Umbraco.Web.UI\web.Template.config" "%CD%\..\src\Umbraco.Web.UI\web.config"
for /f "usebackq tokens=1* delims=: " %%i in (`"%CD%\tools\vswhere.exe" -latest -requires Microsoft.Component.MSBuild`) do (
if /i "%%i"=="installationPath" set InstallDir=%%j
)
SET VSWherePath="%InstallDir%\MSBuild"
ECHO.
ECHO Visual Studio is installed in: %InstallDir%
SET MSBUILDPATH=C:\Program Files (x86)\MSBuild\14.0\Bin
SET MSBUILD="%MSBUILDPATH%\MsBuild.exe"
ECHO.
ECHO Reporting NuGet version
"%CD%\..\src\.nuget\NuGet.exe" help | findstr "^NuGet Version:"
"%nuGetExecutable%" help | findstr "^NuGet Version:"
ECHO.
ECHO Restoring NuGet packages
ECHO Into %nuGetFolder%
"%CD%\..\src\.nuget\NuGet.exe" restore "%CD%\..\src\umbraco.sln" -Verbosity Quiet -NonInteractive -PackagesDirectory "%nuGetFolder%"
"%nuGetExecutable%" restore "%CD%\..\src\umbraco.sln" -Verbosity Quiet -NonInteractive -PackagesDirectory "%nuGetFolder%"
IF ERRORLEVEL 1 GOTO :error
ECHO.
@@ -134,7 +177,7 @@ ECHO This takes a few minutes and logging is set to report warnings
ECHO and errors only so it might seems like nothing is happening for a while.
ECHO You can check the msbuild.log file for progress.
ECHO.
%MSBUILD% "Build.proj" /p:BUILD_RELEASE=%RELEASE% /p:BUILD_COMMENT=%COMMENT% /p:NugetPackagesDirectory="%nuGetFolder%" /consoleloggerparameters:Summary;ErrorsOnly /fileLogger
%MSBUILD% "Build.proj" /p:BUILD_RELEASE=%RELEASE% /p:BUILD_COMMENT=%COMMENT% /p:NugetPackagesDirectory="%nuGetFolder%" /p:VSWherePath=%VSWherePath% /consoleloggerparameters:Summary;ErrorsOnly /fileLogger
IF ERRORLEVEL 1 GOTO error
ECHO.
+48 -22
View File
@@ -1,33 +1,59 @@
@ECHO OFF
SETLOCAL
:: SETLOCAL is on, so changes to the path not persist to the actual user's path
SET release=%1
ECHO Installing Npm NuGet Package
SET nuGetFolder=%CD%\..\src\packages\
ECHO Configured packages folder: %nuGetFolder%
SET toolsFolder=%CD%\tools\
ECHO Current folder: %CD%
%CD%\..\src\.nuget\NuGet.exe install Npm.js -OutputDirectory %nuGetFolder% -Verbosity quiet
SET nodeFileName=node-v6.9.1-win-x86.7z
SET nodeExtractFolder=%toolsFolder%node.js.691
for /f "delims=" %%A in ('dir %nuGetFolder%node.js.* /b') do set "nodePath=%nuGetFolder%%%A\"
for /f "delims=" %%A in ('dir %nuGetFolder%npm.js.* /b') do set "npmPath=%nuGetFolder%%%A\tools\"
IF NOT EXIST "%nodeExtractFolder%" (
ECHO Downloading http://nodejs.org/dist/v6.9.1/%nodeFileName% to %toolsFolder%%nodeFileName%
powershell -Command "(New-Object Net.WebClient).DownloadFile('http://nodejs.org/dist/v6.9.1/%nodeFileName%', '%toolsFolder%%nodeFileName%')"
ECHO Extracting %nodeFileName% to %nodeExtractFolder%
"%toolsFolder%\7za.exe" x "%toolsFolder%\%nodeFileName%" -o"%nodeExtractFolder%" -aos > nul
)
FOR /f "delims=" %%A in ('dir "%nodeExtractFolder%\node*" /b') DO SET "nodePath=%nodeExtractFolder%\%%A"
ECHO Adding Npm and Node to path
REM SETLOCAL is on, so changes to the path not persist to the actual user's path
PATH=%npmPath%;%nodePath%;%PATH%
SET buildFolder=%CD%
SET nuGetExecutable=%CD%\tools\nuget.exe
IF NOT EXIST "%nuGetExecutable%" (
ECHO Downloading https://dist.nuget.org/win-x86-commandline/latest/nuget.exe to %nuGetExecutable%
powershell -Command "(New-Object Net.WebClient).DownloadFile('https://dist.nuget.org/win-x86-commandline/latest/nuget.exe', '%nuGetExecutable%')"
)
ECHO Change directory to %CD%\..\src\Umbraco.Web.UI.Client\
CD %CD%\..\src\Umbraco.Web.UI.Client\
SET drive=%CD:~0,2%
SET nuGetFolder=%drive%\packages\
FOR /f "delims=" %%A in ('dir "%nuGetFolder%npm.*" /b') DO SET "npmPath=%nuGetFolder%%%A\"
ECHO Do npm install and the grunt build of Belle
call npm cache clean --quiet
call npm install --quiet
call npm install -g grunt-cli --quiet
call npm install -g bower --quiet
call grunt build --buildversion=%release%
IF [%npmPath%] == [] GOTO :installnpm
IF NOT [%npmPath%] == [] GOTO :build
ECHO Move back to the build folder
CD %buildFolder%
:installnpm
ECHO Downloading npm
ECHO Configured packages folder: %nuGetFolder%
ECHO Installing Npm NuGet Package
"%nuGetExecutable%" install Npm -OutputDirectory %nuGetFolder% -Verbosity detailed
REM Ensures that we look for the just downloaded NPM, not whatever the user has installed on their machine
FOR /f "delims=" %%A in ('dir %nuGetFolder%npm.* /b') DO SET "npmPath=%nuGetFolder%%%A\"
GOTO :build
:build
ECHO Adding Npm and Node to path
REM SETLOCAL is on, so changes to the path not persist to the actual user's path
PATH="%npmPath%";"%nodePath%";%PATH%
SET buildFolder=%CD%
ECHO Change directory to %CD%\..\src\Umbraco.Web.UI.Client\
CD %CD%\..\src\Umbraco.Web.UI.Client\
ECHO Do npm install and the grunt build of Belle
call npm cache clean --quiet
call npm install --quiet
call npm install -g grunt-cli --quiet
call npm install -g bower --quiet
call grunt build --buildversion=%release%
ECHO Move back to the build folder
CD "%buildFolder%"
+14
View File
@@ -57,6 +57,20 @@ $IndexPath = "../src/umbraco.web.ui.client/docs/api/index.html"
# Build the solution in debug mode
$SolutionPath = Join-Path -Path $SolutionRoot -ChildPath "umbraco.sln"
# Go get nuget.exe if we don't hae it
$NuGet = "$ToolsRoot\nuget.exe"
$FileExists = Test-Path $NuGet
If ($FileExists -eq $False) {
Write-Host "Retrieving nuget.exe..."
$SourceNugetExe = "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe"
Invoke-WebRequest $SourceNugetExe -OutFile $NuGet
}
#restore nuget packages
Write-Host "Restoring nuget packages..."
& $NuGet restore $SolutionPath
& $MSBuild "$SolutionPath" /p:Configuration=Debug /maxcpucount /t:Clean
if (-not $?)
{
+4 -4
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<metadata minClientVersion="3.4.4">
<id>UmbracoCms.Core</id>
<version>7.0.0</version>
<title>Umbraco Cms Core Binaries</title>
@@ -34,11 +34,11 @@
<dependency id="ClientDependency-Mvc5" version="[1.8.0.0, 2.0.0)" />
<dependency id="AutoMapper" version="[3.3.1, 4.0.0)" />
<dependency id="Newtonsoft.Json" version="[10.0.2, 11.0.0)" />
<dependency id="Examine" version="[0.1.82, 1.0.0)" />
<dependency id="Examine" version="[0.1.83, 1.0.0)" />
<dependency id="ImageProcessor" version="[2.5.3, 3.0.0)" />
<dependency id="ImageProcessor.Web" version="[4.8.3, 5.0.0)" />
<dependency id="semver" version="[2.0.4, 3.0.0)" />
<!-- Markdown can not be updated due to: https://github.com/hey-red/markdownsharp/issues/71#issuecomment-233585487 -->
<dependency id="semver" version="[1.1.2, 3.0.0)" />
<!-- Markdown can not be updated due to: https://github.com/hey-red/markdownsharp/issues/71#issuecomment-233585487 -->
<dependency id="Markdown" version="[1.14.7, 2.0.0)" />
<dependency id="System.Threading.Tasks.Dataflow" version="[4.7.0, 5.0.0)" />
</dependencies>
+2 -2
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata minClientVersion="2.8">
<metadata minClientVersion="3.4.4">
<id>UmbracoCms</id>
<version>7.0.0</version>
<title>Umbraco Cms</title>
@@ -19,7 +19,7 @@
<dependency id="Newtonsoft.Json" version="[10.0.2, 11.0.0)" />
<dependency id="Umbraco.ModelsBuilder" version="[3.0.7, 4.0.0)" />
<dependency id="Microsoft.AspNet.SignalR.Core" version="[2.2.1, 3.0.0)" />
<dependency id="ImageProcessor.Web.Config" version="[2.3.0, 3.0.0)" />
<dependency id="ImageProcessor.Web.Config" version="[2.3.0, 3.0.0)" />
</dependencies>
</metadata>
<files>
@@ -332,6 +332,7 @@
<dependentAssembly xdt:Locator="Condition(./_defaultNamespace:assemblyIdentity/@name='System.Net.Http.Formatting')" xdt:Transform="Remove" />
<dependentAssembly xdt:Locator="Condition(./_defaultNamespace:assemblyIdentity/@name='Microsoft.CodeAnalysis.CSharp')" xdt:Transform="Remove" />
<dependentAssembly xdt:Locator="Condition(./_defaultNamespace:assemblyIdentity/@name='log4net')" xdt:Transform="Remove" />
<dependentAssembly xdt:Locator="Condition(./_defaultNamespace:assemblyIdentity/@name='System.Data.SqlServerCe')" xdt:Transform="Remove" />
</assemblyBinding>
</runtime>
@@ -389,6 +390,10 @@
<assemblyIdentity name="log4net" publicKeyToken="669e0ddf0bb1aa2a" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-2.0.8.0" newVersion="2.0.8.0"/>
</dependentAssembly>
<dependentAssembly xdt:Transform="Insert">
<assemblyIdentity name="System.Data.SqlServerCe" publicKeyToken="89845DCD8080CC91" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.0.0.1" newVersion="4.0.0.1"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
+1 -2
View File
@@ -1,3 +1,2 @@
# Usage: on line 2 put the release version, on line 3 put the version comment (example: beta)
7.6.0
RC3
7.6.4
+2 -2
View File
@@ -11,5 +11,5 @@ using System.Resources;
[assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyFileVersion("7.6.0")]
[assembly: AssemblyInformationalVersion("7.6.0-RC3")]
[assembly: AssemblyFileVersion("7.6.4")]
[assembly: AssemblyInformationalVersion("7.6.4")]
+6 -6
View File
@@ -23,12 +23,12 @@ namespace Umbraco.Core
: base(serviceProvider, logger, packageActions)
{
}
/// <summary>
/// Gets the <see cref="IPackageAction"/> implementations.
/// </summary>
public IEnumerable<IAction> Actions
}
/// <summary>
/// Gets the <see cref="IAction"/> implementations.
/// </summary>
public IEnumerable<IAction> Actions
{
get
{
+22 -22
View File
@@ -48,7 +48,7 @@ namespace Umbraco.Core
/// <param name="cache"></param>
[Obsolete("Use the other constructor specifying a ProfilingLogger instead")]
public ApplicationContext(DatabaseContext dbContext, ServiceContext serviceContext, CacheHelper cache)
: this(dbContext, serviceContext, cache,
: this(dbContext, serviceContext, cache,
new ProfilingLogger(LoggerResolver.Current.Logger, ProfilerResolver.Current.Profiler))
{
}
@@ -89,7 +89,7 @@ namespace Umbraco.Core
/// <param name="replaceContext">If set to true and the singleton is already set, it will be replaced</param>
/// <returns></returns>
/// <remarks>
/// This is NOT thread safe
/// This is NOT thread safe
/// </remarks>
public static ApplicationContext EnsureContext(ApplicationContext appContext, bool replaceContext)
{
@@ -107,14 +107,14 @@ namespace Umbraco.Core
/// </summary>
/// <param name="cache"></param>
/// <param name="replaceContext">
/// If set to true will replace the current singleton instance - This should only be used for unit tests or on app
/// If set to true will replace the current singleton instance - This should only be used for unit tests or on app
/// startup if for some reason the boot manager is not the umbraco boot manager.
/// </param>
/// <param name="dbContext"></param>
/// <param name="serviceContext"></param>
/// <returns></returns>
/// <remarks>
/// This is NOT thread safe
/// This is NOT thread safe
/// </remarks>
[Obsolete("Use the other method specifying an ProfilingLogger instead")]
public static ApplicationContext EnsureContext(DatabaseContext dbContext, ServiceContext serviceContext, CacheHelper cache, bool replaceContext)
@@ -135,14 +135,14 @@ namespace Umbraco.Core
/// <param name="cache"></param>
/// <param name="logger"></param>
/// <param name="replaceContext">
/// If set to true will replace the current singleton instance - This should only be used for unit tests or on app
/// If set to true will replace the current singleton instance - This should only be used for unit tests or on app
/// startup if for some reason the boot manager is not the umbraco boot manager.
/// </param>
/// <param name="dbContext"></param>
/// <param name="serviceContext"></param>
/// <returns></returns>
/// <remarks>
/// This is NOT thread safe
/// This is NOT thread safe
/// </remarks>
public static ApplicationContext EnsureContext(DatabaseContext dbContext, ServiceContext serviceContext, CacheHelper cache, ProfilingLogger logger, bool replaceContext)
{
@@ -175,7 +175,7 @@ namespace Umbraco.Core
public CacheHelper ApplicationCache { get; private set; }
/// <summary>
/// Exposes the global ProfilingLogger - this should generally not be accessed via the UmbracoContext and should normally just be exposed
/// Exposes the global ProfilingLogger - this should generally not be accessed via the UmbracoContext and should normally just be exposed
/// on most base classes or injected with IoC
/// </summary>
public ProfilingLogger ProfilingLogger { get; private set; }
@@ -213,7 +213,7 @@ namespace Umbraco.Core
// GlobalSettings.CurrentVersion returns the hard-coded "current version"
// the system is configured if they match
// if they don't, install runs, updates web.config (presumably) and updates GlobalSettings.ConfiguredStatus
public bool IsConfigured
{
get { return _configured.Value; }
@@ -226,8 +226,8 @@ namespace Umbraco.Core
{
get
{
if (IsConfigured == false
&& DatabaseContext != null
if (IsConfigured == false
&& DatabaseContext != null
&& DatabaseContext.IsDatabaseConfigured)
{
var schemaresult = DatabaseContext.ValidateDatabaseSchema();
@@ -274,12 +274,12 @@ namespace Umbraco.Core
private Lazy<bool> _configured;
internal MainDom MainDom { get; private set; }
private void Init()
{
MainDom = new MainDom(ProfilingLogger.Logger);
MainDom.Acquire();
//Create the lazy value to resolve whether or not the application is 'configured'
_configured = new Lazy<bool>(() =>
{
@@ -289,7 +289,7 @@ namespace Umbraco.Core
var currentVersion = UmbracoVersion.GetSemanticVersion();
var ok =
//we are not configured if this is null
//we are not configured if this is null
string.IsNullOrWhiteSpace(configStatus) == false
//they must match
&& configStatus == currentVersion;
@@ -303,7 +303,7 @@ namespace Umbraco.Core
var found = Services.MigrationEntryService.FindEntry(Constants.System.UmbracoMigrationName, UmbracoVersion.GetSemanticVersion());
if (found == null)
{
//we haven't executed this migration in this environment, so even though the config versions match,
//we haven't executed this migration in this environment, so even though the config versions match,
// this db has not been updated.
ProfilingLogger.Logger.Debug<ApplicationContext>(string.Format("The migration for version: '{0} has not been executed, there is no record in the database", currentVersion.ToSemanticString()));
ok = false;
@@ -323,7 +323,7 @@ namespace Umbraco.Core
return false;
}
});
});
}
private string ConfigurationStatus
@@ -338,7 +338,7 @@ namespace Umbraco.Core
{
return String.Empty;
}
}
}
}
private void AssertIsNotReady()
@@ -363,7 +363,7 @@ namespace Umbraco.Core
}
internal set { _databaseContext = value; }
}
/// <summary>
/// Gets the current ServiceContext
/// </summary>
@@ -417,7 +417,7 @@ namespace Umbraco.Core
ResolverCollection.ResetAll();
//reset resolution itself (though this should be taken care of by resetting any of the resolvers above)
Resolution.Reset();
//reset the instance objects
this.ApplicationCache = null;
if (_databaseContext != null) //need to check the internal field here
@@ -430,14 +430,14 @@ namespace Umbraco.Core
/*
if (DatabaseContext.IsDatabaseConfigured && DatabaseContext.Database != null)
{
DatabaseContext.Database.Dispose();
}
*/
DatabaseContext.Database.Dispose();
}
*/
}
this.DatabaseContext = null;
this.Services = null;
this._isReady = false; //set the internal field
// Indicate that the instance has been disposed.
_disposed = true;
}
+2 -2
View File
@@ -89,7 +89,7 @@ namespace Umbraco.Core.Cache
public const string DataTypeCacheKey = "UmbracoDataTypeDefinition";
public const string DataTypePreValuesCacheKey = "UmbracoPreVal";
public const string IdToKeyCacheKey = "UI2K";
public const string KeyToIdCacheKey = "UK2I";
public const string IdToKeyCacheKey = "UI2K__";
public const string KeyToIdCacheKey = "UK2I__";
}
}
@@ -139,6 +139,12 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
internal CommaDelimitedConfigurationElement DisallowedUploadFiles
{
get { return GetOptionalDelimitedElement("disallowedUploadFiles", new[] {"ashx", "aspx", "ascx", "config", "cshtml", "vbhtml", "asmx", "air", "axd"}); }
}
[ConfigurationProperty("allowedUploadFiles")]
internal CommaDelimitedConfigurationElement AllowedUploadFiles
{
get { return GetOptionalDelimitedElement("allowedUploadFiles", new string[0]); }
}
[ConfigurationProperty("cloneXmlContent")]
@@ -307,6 +313,11 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
IEnumerable<string> IContentSection.DisallowedUploadFiles
{
get { return DisallowedUploadFiles; }
}
IEnumerable<string> IContentSection.AllowedUploadFiles
{
get { return AllowedUploadFiles; }
}
bool IContentSection.CloneXmlContent
@@ -0,0 +1,19 @@
using System.Linq;
namespace Umbraco.Core.Configuration.UmbracoSettings
{
public static class ContentSectionExtensions
{
/// <summary>
/// Determines if file extension is allowed for upload based on (optional) white list and black list
/// held in settings.
/// Allow upload if extension is whitelisted OR if there is no whitelist and extension is NOT blacklisted.
/// </summary>
public static bool IsFileAllowedForUpload(this IContentSection contentSection, string extension)
{
return contentSection.AllowedUploadFiles.Any(x => x.InvariantEquals(extension)) ||
(contentSection.AllowedUploadFiles.Any() == false &&
contentSection.DisallowedUploadFiles.Any(x => x.InvariantEquals(extension)) == false);
}
}
}
@@ -52,7 +52,9 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
MacroErrorBehaviour MacroErrorBehaviour { get; }
IEnumerable<string> DisallowedUploadFiles { get; }
IEnumerable<string> DisallowedUploadFiles { get; }
IEnumerable<string> AllowedUploadFiles { get; }
bool CloneXmlContent { get; }
@@ -12,6 +12,8 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
bool ConvertUrlsToAscii { get; }
bool TryConvertUrlsToAscii { get; }
IEnumerable<IChar> CharCollection { get; }
}
}
@@ -111,7 +111,12 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
bool IRequestHandlerSection.ConvertUrlsToAscii
{
get { return UrlReplacing.ConvertUrlsToAscii; }
get { return UrlReplacing.ConvertUrlsToAscii.InvariantEquals("true"); }
}
bool IRequestHandlerSection.TryConvertUrlsToAscii
{
get { return UrlReplacing.ConvertUrlsToAscii.InvariantEquals("try"); }
}
IEnumerable<IChar> IRequestHandlerSection.CharCollection
@@ -11,10 +11,10 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
get { return (bool) base["removeDoubleDashes"]; }
}
[ConfigurationProperty("toAscii", DefaultValue = false)]
internal bool ConvertUrlsToAscii
[ConfigurationProperty("toAscii", DefaultValue = "false")]
internal string ConvertUrlsToAscii
{
get { return (bool)base["toAscii"]; }
get { return (string) base["toAscii"]; }
}
[ConfigurationCollection(typeof(CharCollection), AddItemName = "char")]
@@ -6,7 +6,7 @@ namespace Umbraco.Core.Configuration
{
public class UmbracoVersion
{
private static readonly Version Version = new Version("7.6.0");
private static readonly Version Version = new Version("7.6.4");
/// <summary>
/// Gets the current version of Umbraco.
@@ -24,7 +24,7 @@ namespace Umbraco.Core.Configuration
/// Gets the version comment (like beta or RC).
/// </summary>
/// <value>The version comment.</value>
public static string CurrentComment { get { return "RC3"; } }
public static string CurrentComment { get { return ""; } }
// Get the version of the umbraco.dll by looking at a class in that dll
// Had to do it like this due to medium trust issues, see: http://haacked.com/archive/2010/11/04/assembly-location-and-medium-trust.aspx
@@ -33,9 +33,9 @@ namespace Umbraco.Core.Configuration
public static SemVersion GetSemanticVersion()
{
return new SemVersion(
Current.Major,
Current.Major,
Current.Minor,
Current.Build,
Current.Build,
CurrentComment.IsNullOrWhiteSpace() ? null : CurrentComment,
Current.Revision > 0 ? Current.Revision.ToInvariantString() : null);
}
+10
View File
@@ -212,6 +212,16 @@ namespace Umbraco.Core
/// Guid for a Forms DataSource.
/// </summary>
public static readonly Guid FormsDataSourceGuid = new Guid(FormsDataSource);
/// <summary>
/// Guid for a Language.
/// </summary>
public const string Language = "6B05D05B-EC78-49BE-A4E4-79E274F07A77";
/// <summary>
/// Guid for a Forms DataSource.
/// </summary>
public static readonly Guid LanguageGuid = new Guid(Language);
}
}
}
@@ -1,85 +1,177 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Security.Permissions;
using Umbraco.Core.Models;
using Umbraco.Core.Models.EntityBase;
namespace Umbraco.Core.Events
{
/// <summary>
/// Event args for a strongly typed object that can support cancellation
/// </summary>
/// <typeparam name="T"></typeparam>
[HostProtection(SecurityAction.LinkDemand, SharedState = true)]
public class CancellableObjectEventArgs<T> : CancellableEventArgs, IEquatable<CancellableObjectEventArgs<T>>
{
public CancellableObjectEventArgs(T eventObject, bool canCancel, EventMessages messages, IDictionary<string, object> additionalData)
/// <summary>
/// Used as a base class for the generic type CancellableObjectEventArgs{T} so that we can get direct 'object' access to the underlying EventObject
/// </summary>
[HostProtection(SecurityAction.LinkDemand, SharedState = true)]
public abstract class CancellableObjectEventArgs : CancellableEventArgs
{
protected CancellableObjectEventArgs(object eventObject, bool canCancel, EventMessages messages, IDictionary<string, object> additionalData)
: base(canCancel, messages, additionalData)
{
{
EventObject = eventObject;
}
public CancellableObjectEventArgs(T eventObject, bool canCancel, EventMessages eventMessages)
protected CancellableObjectEventArgs(object eventObject, bool canCancel, EventMessages eventMessages)
: base(canCancel, eventMessages)
{
EventObject = eventObject;
}
public CancellableObjectEventArgs(T eventObject, EventMessages eventMessages)
protected CancellableObjectEventArgs(object eventObject, EventMessages eventMessages)
: this(eventObject, true, eventMessages)
{
}
protected CancellableObjectEventArgs(object eventObject, bool canCancel)
: base(canCancel)
{
EventObject = eventObject;
}
protected CancellableObjectEventArgs(object eventObject)
: this(eventObject, true)
{
}
/// <summary>
/// Returns the object relating to the event
/// </summary>
/// <remarks>
/// This is protected so that inheritors can expose it with their own name
/// </remarks>
internal object EventObject { get; set; }
}
/// <summary>
/// Event args for a strongly typed object that can support cancellation
/// </summary>
/// <typeparam name="T"></typeparam>
[HostProtection(SecurityAction.LinkDemand, SharedState = true)]
public class CancellableObjectEventArgs<T> : CancellableObjectEventArgs, IEquatable<CancellableObjectEventArgs<T>>
{
public CancellableObjectEventArgs(T eventObject, bool canCancel, EventMessages messages, IDictionary<string, object> additionalData)
: base(eventObject, canCancel, messages, additionalData)
{
}
public CancellableObjectEventArgs(T eventObject, bool canCancel, EventMessages eventMessages)
: base(eventObject, canCancel, eventMessages)
{
}
public CancellableObjectEventArgs(T eventObject, EventMessages eventMessages)
: base(eventObject, eventMessages)
{
}
public CancellableObjectEventArgs(T eventObject, bool canCancel)
: base(canCancel)
{
EventObject = eventObject;
}
: base(eventObject, canCancel)
{
}
public CancellableObjectEventArgs(T eventObject)
: this(eventObject, true)
{
}
public CancellableObjectEventArgs(T eventObject)
: base(eventObject)
{
}
/// <summary>
/// Returns the object relating to the event
/// </summary>
/// <remarks>
/// This is protected so that inheritors can expose it with their own name
/// </remarks>
protected T EventObject { get; set; }
/// <summary>
/// Returns the object relating to the event
/// </summary>
/// <remarks>
/// This is protected so that inheritors can expose it with their own name
/// </remarks>
protected new T EventObject
{
get { return (T) base.EventObject; }
set { base.EventObject = value; }
}
public bool Equals(CancellableObjectEventArgs<T> other)
{
if (ReferenceEquals(null, other)) return false;
if (ReferenceEquals(this, other)) return true;
return base.Equals(other) && EqualityComparer<T>.Default.Equals(EventObject, other.EventObject);
}
public bool Equals(CancellableObjectEventArgs<T> other)
{
if (ReferenceEquals(null, other)) return false;
if (ReferenceEquals(this, other)) return true;
return base.Equals(other) && EqualityComparer<T>.Default.Equals(EventObject, other.EventObject);
}
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
if (ReferenceEquals(this, obj)) return true;
if (obj.GetType() != this.GetType()) return false;
return Equals((CancellableObjectEventArgs<T>) obj);
}
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
if (ReferenceEquals(this, obj)) return true;
if (obj.GetType() != this.GetType()) return false;
return Equals((CancellableObjectEventArgs<T>)obj);
}
public override int GetHashCode()
{
unchecked
{
return (base.GetHashCode() * 397) ^ EqualityComparer<T>.Default.GetHashCode(EventObject);
}
}
public override int GetHashCode()
{
unchecked
{
return (base.GetHashCode() * 397) ^ EqualityComparer<T>.Default.GetHashCode(EventObject);
}
}
public static bool operator ==(CancellableObjectEventArgs<T> left, CancellableObjectEventArgs<T> right)
{
return Equals(left, right);
}
public static bool operator ==(CancellableObjectEventArgs<T> left, CancellableObjectEventArgs<T> right)
{
return Equals(left, right);
}
public static bool operator !=(CancellableObjectEventArgs<T> left, CancellableObjectEventArgs<T> right)
{
return !Equals(left, right);
}
}
public static bool operator !=(CancellableObjectEventArgs<T> left, CancellableObjectEventArgs<T> right)
{
return !Equals(left, right);
}
}
[HostProtection(SecurityAction.LinkDemand, SharedState = true)]
public class CancellableEnumerableObjectEventArgs<T> : CancellableObjectEventArgs<IEnumerable<T>>, IEquatable<CancellableEnumerableObjectEventArgs<T>>
{
public CancellableEnumerableObjectEventArgs(IEnumerable<T> eventObject, bool canCancel, EventMessages messages, IDictionary<string, object> additionalData)
: base(eventObject, canCancel, messages, additionalData)
{ }
public CancellableEnumerableObjectEventArgs(IEnumerable<T> eventObject, bool canCancel, EventMessages eventMessages)
: base(eventObject, canCancel, eventMessages)
{ }
public CancellableEnumerableObjectEventArgs(IEnumerable<T> eventObject, EventMessages eventMessages)
: base(eventObject, eventMessages)
{ }
public CancellableEnumerableObjectEventArgs(IEnumerable<T> eventObject, bool canCancel)
: base(eventObject, canCancel)
{ }
public CancellableEnumerableObjectEventArgs(IEnumerable<T> eventObject)
: base(eventObject)
{ }
public bool Equals(CancellableEnumerableObjectEventArgs<T> other)
{
if (ReferenceEquals(null, other)) return false;
if (ReferenceEquals(this, other)) return true;
return EventObject.SequenceEqual(other.EventObject);
}
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
if (ReferenceEquals(this, obj)) return true;
if (obj.GetType() != this.GetType()) return false;
return Equals((CancellableEnumerableObjectEventArgs<T>)obj);
}
public override int GetHashCode()
{
return HashCodeHelper.GetHashCode(EventObject);
}
}
}
+7 -2
View File
@@ -1,9 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace Umbraco.Core.Events
{
public class DeleteEventArgs<TEntity> : CancellableObjectEventArgs<IEnumerable<TEntity>>, IEquatable<DeleteEventArgs<TEntity>>, IDeletingMediaFilesEventArgs
[SupersedeEvent(typeof(SaveEventArgs<>))]
[SupersedeEvent(typeof(PublishEventArgs<>))]
[SupersedeEvent(typeof(MoveEventArgs<>))]
[SupersedeEvent(typeof(CopyEventArgs<>))]
public class DeleteEventArgs<TEntity> : CancellableEnumerableObjectEventArgs<TEntity>, IEquatable<DeleteEventArgs<TEntity>>, IDeletingMediaFilesEventArgs
{
/// <summary>
/// Constructor accepting multiple entities that are used in the delete operation
@@ -106,7 +111,7 @@ namespace Umbraco.Core.Events
{
if (ReferenceEquals(null, other)) return false;
if (ReferenceEquals(this, other)) return true;
return base.Equals(other) && MediaFilesToDelete.Equals(other.MediaFilesToDelete);
return base.Equals(other) && MediaFilesToDelete.SequenceEqual(other.MediaFilesToDelete);
}
public override bool Equals(object obj)
+1 -1
View File
@@ -4,7 +4,7 @@ using System.Xml.Linq;
namespace Umbraco.Core.Events
{
public class ImportEventArgs<TEntity> : CancellableObjectEventArgs<IEnumerable<TEntity>>, IEquatable<ImportEventArgs<TEntity>>
public class ImportEventArgs<TEntity> : CancellableEnumerableObjectEventArgs<TEntity>, IEquatable<ImportEventArgs<TEntity>>
{
/// <summary>
/// Constructor accepting an XElement with the xml being imported
@@ -4,7 +4,7 @@ using Umbraco.Core.Packaging.Models;
namespace Umbraco.Core.Events
{
internal class ImportPackageEventArgs<TEntity> : CancellableObjectEventArgs<IEnumerable<TEntity>>, IEquatable<ImportPackageEventArgs<TEntity>>
public class ImportPackageEventArgs<TEntity> : CancellableEnumerableObjectEventArgs<TEntity>, IEquatable<ImportPackageEventArgs<TEntity>>
{
private readonly MetaData _packageMetaData;
@@ -33,6 +33,7 @@ namespace Umbraco.Core.Events
{
if (ReferenceEquals(null, other)) return false;
if (ReferenceEquals(this, other)) return true;
//TODO: MetaData for package metadata has no equality operators :/
return base.Equals(other) && _packageMetaData.Equals(other._packageMetaData);
}
+1 -1
View File
@@ -3,7 +3,7 @@ using System.Collections.Generic;
namespace Umbraco.Core.Events
{
public class PublishEventArgs<TEntity> : CancellableObjectEventArgs<IEnumerable<TEntity>>, IEquatable<PublishEventArgs<TEntity>>
public class PublishEventArgs<TEntity> : CancellableEnumerableObjectEventArgs<TEntity>, IEquatable<PublishEventArgs<TEntity>>
{
/// <summary>
/// Constructor accepting multiple entities that are used in the publish operation
+2 -3
View File
@@ -1,8 +1,9 @@
using System.Collections.Generic;
using System.Linq;
namespace Umbraco.Core.Events
{
public class SaveEventArgs<TEntity> : CancellableObjectEventArgs<IEnumerable<TEntity>>
public class SaveEventArgs<TEntity> : CancellableEnumerableObjectEventArgs<TEntity>
{
/// <summary>
/// Constructor accepting multiple entities that are used in the saving operation
@@ -116,7 +117,5 @@ namespace Umbraco.Core.Events
{
get { return EventObject; }
}
}
}
@@ -1,6 +1,8 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Umbraco.Core.Models.EntityBase;
namespace Umbraco.Core.Events
{
@@ -15,6 +17,7 @@ namespace Umbraco.Core.Events
/// </remarks>
public abstract class ScopeEventDispatcherBase : IEventDispatcher
{
//events will be enlisted in the order they are raised
private List<IEventDefinition> _events;
private readonly bool _raiseCancelable;
@@ -73,29 +76,263 @@ namespace Umbraco.Core.Events
{
if (_events == null)
return Enumerable.Empty<IEventDefinition>();
switch (filter)
{
case EventDefinitionFilter.All:
return _events;
return FilterSupersededAndUpdateToLatestEntity(_events);
case EventDefinitionFilter.FirstIn:
var l1 = new OrderedHashSet<IEventDefinition>();
foreach (var e in _events)
{
l1.Add(e);
}
return l1;
return FilterSupersededAndUpdateToLatestEntity(l1);
case EventDefinitionFilter.LastIn:
var l2 = new OrderedHashSet<IEventDefinition>(keepOldest: false);
foreach (var e in _events)
{
l2.Add(e);
}
return l2;
return FilterSupersededAndUpdateToLatestEntity(l2);
default:
throw new ArgumentOutOfRangeException("filter", filter, null);
}
}
private class EventDefinitionTypeData
{
public IEventDefinition EventDefinition { get; set; }
public Type EventArgType { get; set; }
public SupersedeEventAttribute[] SupersedeAttributes { get; set; }
}
/// <summary>
/// This will iterate over the events (latest first) and filter out any events or entities in event args that are included
/// in more recent events that Supersede previous ones. For example, If an Entity has been Saved and then Deleted, we don't want
/// to raise the Saved event (well actually we just don't want to include it in the args for that saved event)
/// </summary>
/// <param name="events"></param>
/// <returns></returns>
private static IEnumerable<IEventDefinition> FilterSupersededAndUpdateToLatestEntity(IReadOnlyList<IEventDefinition> events)
{
//used to keep the 'latest' entity and associated event definition data
var allEntities = new List<Tuple<IEntity, EventDefinitionTypeData>>();
//tracks all CancellableObjectEventArgs instances in the events which is the only type of args we can work with
var cancelableArgs = new List<CancellableObjectEventArgs>();
var result = new List<IEventDefinition>();
//This will eagerly load all of the event arg types and their attributes so we don't have to continuously look this data up
var allArgTypesWithAttributes = events.Select(x => x.Args.GetType())
.Distinct()
.ToDictionary(x => x, x => x.GetCustomAttributes<SupersedeEventAttribute>(false).ToArray());
//Iterate all events and collect the actual entities in them and relates them to their corresponding EventDefinitionTypeData
//we'll process the list in reverse because events are added in the order they are raised and we want to filter out
//any entities from event args that are not longer relevant
//(i.e. if an item is Deleted after it's Saved, we won't include the item in the Saved args)
for (var index = events.Count - 1; index >= 0; index--)
{
var eventDefinition = events[index];
var argType = eventDefinition.Args.GetType();
var attributes = allArgTypesWithAttributes[eventDefinition.Args.GetType()];
var meta = new EventDefinitionTypeData
{
EventDefinition = eventDefinition,
EventArgType = argType,
SupersedeAttributes = attributes
};
var args = eventDefinition.Args as CancellableObjectEventArgs;
if (args != null)
{
var list = TypeHelper.CreateGenericEnumerableFromObject(args.EventObject);
if (list == null)
{
//extract the event object
var obj = args.EventObject as IEntity;
if (obj != null)
{
//Now check if this entity already exists in other event args that supersede this current event arg type
if (IsFiltered(obj, meta, allEntities) == false)
{
//if it's not filtered we can adde these args to the response
cancelableArgs.Add(args);
result.Add(eventDefinition);
//track the entity
allEntities.Add(Tuple.Create(obj, meta));
}
}
else
{
//Can't retrieve the entity so cant' filter or inspect, just add to the output
result.Add(eventDefinition);
}
}
else
{
var toRemove = new List<IEntity>();
foreach (var entity in list)
{
//extract the event object
var obj = entity as IEntity;
if (obj != null)
{
//Now check if this entity already exists in other event args that supersede this current event arg type
if (IsFiltered(obj, meta, allEntities))
{
//track it to be removed
toRemove.Add(obj);
}
else
{
//track the entity, it's not filtered
allEntities.Add(Tuple.Create(obj, meta));
}
}
else
{
//we don't need to do anything here, we can't cast to IEntity so we cannot filter, so it will just remain in the list
}
}
//remove anything that has been filtered
foreach (var entity in toRemove)
{
list.Remove(entity);
}
//track the event and include in the response if there's still entities remaining in the list
if (list.Count > 0)
{
if (toRemove.Count > 0)
{
//re-assign if the items have changed
args.EventObject = list;
}
cancelableArgs.Add(args);
result.Add(eventDefinition);
}
}
}
else
{
//it's not a cancelable event arg so we just include it in the result
result.Add(eventDefinition);
}
}
//Now we'll deal with ensuring that only the latest(non stale) entities are used throughout all event args
UpdateToLatestEntities(allEntities, cancelableArgs);
//we need to reverse the result since we've been adding by latest added events first!
result.Reverse();
return result;
}
private static void UpdateToLatestEntities(IEnumerable<Tuple<IEntity, EventDefinitionTypeData>> allEntities, IEnumerable<CancellableObjectEventArgs> cancelableArgs)
{
//Now we'll deal with ensuring that only the latest(non stale) entities are used throughout all event args
var latestEntities = new OrderedHashSet<IEntity>(keepOldest: true);
foreach (var entity in allEntities.OrderByDescending(entity => entity.Item1.UpdateDate))
{
latestEntities.Add(entity.Item1);
}
foreach (var args in cancelableArgs)
{
var list = TypeHelper.CreateGenericEnumerableFromObject(args.EventObject);
if (list == null)
{
//try to find the args entity in the latest entity - based on the equality operators, this will
//match by Id since that is the default equality checker for IEntity. If one is found, than it is
//the most recent entity instance so update the args with that instance so we don't emit a stale instance.
var foundEntity = latestEntities.FirstOrDefault(x => Equals(x, args.EventObject));
if (foundEntity != null)
{
args.EventObject = foundEntity;
}
}
else
{
var updated = false;
for (int i = 0; i < list.Count; i++)
{
//try to find the args entity in the latest entity - based on the equality operators, this will
//match by Id since that is the default equality checker for IEntity. If one is found, than it is
//the most recent entity instance so update the args with that instance so we don't emit a stale instance.
var foundEntity = latestEntities.FirstOrDefault(x => Equals(x, list[i]));
if (foundEntity != null)
{
list[i] = foundEntity;
updated = true;
}
}
if (updated)
{
args.EventObject = list;
}
}
}
}
/// <summary>
/// This will check against all of the processed entity/events (allEntities) to see if this entity already exists in
/// event args that supersede the event args being passed in and if so returns true.
/// </summary>
/// <param name="entity"></param>
/// <param name="eventDef"></param>
/// <param name="allEntities"></param>
/// <returns></returns>
private static bool IsFiltered(
IEntity entity,
EventDefinitionTypeData eventDef,
List<Tuple<IEntity, EventDefinitionTypeData>> allEntities)
{
var argType = eventDef.EventDefinition.Args.GetType();
//check if the entity is found in any processed event data that could possible supersede this one
var foundByEntity = allEntities
.Where(x => x.Item2.SupersedeAttributes.Length > 0
//if it's the same arg type than it cannot supersede
&& x.Item2.EventArgType != argType
&& Equals(x.Item1, entity))
.ToArray();
//no args have been processed with this entity so it should not be filtered
if (foundByEntity.Length == 0)
return false;
if (argType.IsGenericType)
{
var supercededBy = foundByEntity
.FirstOrDefault(x =>
x.Item2.SupersedeAttributes.Any(y =>
//if the attribute type is a generic type def then compare with the generic type def of the event arg
(y.SupersededEventArgsType.IsGenericTypeDefinition && y.SupersededEventArgsType == argType.GetGenericTypeDefinition())
//if the attribute type is not a generic type def then compare with the normal type of the event arg
|| (y.SupersededEventArgsType.IsGenericTypeDefinition == false && y.SupersededEventArgsType == argType)));
return supercededBy != null;
}
else
{
var supercededBy = foundByEntity
.FirstOrDefault(x =>
x.Item2.SupersedeAttributes.Any(y =>
//since the event arg type is not a generic type, then we just compare type 1:1
y.SupersededEventArgsType == argType));
return supercededBy != null;
}
}
public void ScopeExit(bool completed)
{
@@ -0,0 +1,20 @@
using System;
namespace Umbraco.Core.Events
{
/// <summary>
/// This is used to know if the event arg attributed should supersede another event arg type when
/// tracking events for the same entity. If one event args supercedes another then the event args that have been superseded
/// will mean that the event will not be dispatched or the args will be filtered to exclude the entity.
/// </summary>
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
internal class SupersedeEventAttribute : Attribute
{
public Type SupersededEventArgsType { get; private set; }
public SupersedeEventAttribute(Type supersededEventArgsType)
{
SupersededEventArgsType = supersededEventArgsType;
}
}
}
@@ -3,7 +3,7 @@ using Umbraco.Core.Packaging.Models;
namespace Umbraco.Core.Events
{
internal class UninstallPackageEventArgs<TEntity> : CancellableObjectEventArgs<IEnumerable<TEntity>>
public class UninstallPackageEventArgs<TEntity> : CancellableObjectEventArgs<IEnumerable<TEntity>>
{
private readonly MetaData _packageMetaData;
+74 -75
View File
@@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
@@ -7,32 +6,32 @@ using System.Text;
namespace Umbraco.Core
{
/// <summary>
/// Used to create a hash code from multiple objects.
/// </summary>
/// <remarks>
/// .Net has a class the same as this: System.Web.Util.HashCodeCombiner and of course it works for all sorts of things
/// which we've not included here as we just need a quick easy class for this in order to create a unique
/// hash of directories/files to see if they have changed.
/// </remarks>
internal class HashCodeCombiner
{
private long _combinedHash = 5381L;
/// <summary>
/// Used to create a hash code from multiple objects.
/// </summary>
/// <remarks>
/// .Net has a class the same as this: System.Web.Util.HashCodeCombiner and of course it works for all sorts of things
/// which we've not included here as we just need a quick easy class for this in order to create a unique
/// hash of directories/files to see if they have changed.
/// </remarks>
internal class HashCodeCombiner
{
private long _combinedHash = 5381L;
internal void AddInt(int i)
{
_combinedHash = ((_combinedHash << 5) + _combinedHash) ^ i;
}
internal void AddInt(int i)
{
_combinedHash = ((_combinedHash << 5) + _combinedHash) ^ i;
}
internal void AddObject(object o)
{
AddInt(o.GetHashCode());
}
internal void AddObject(object o)
{
AddInt(o.GetHashCode());
}
internal void AddDateTime(DateTime d)
{
AddInt(d.GetHashCode());
}
internal void AddDateTime(DateTime d)
{
AddInt(d.GetHashCode());
}
internal void AddString(string s)
{
@@ -40,61 +39,61 @@ namespace Umbraco.Core
AddInt((StringComparer.InvariantCulture).GetHashCode(s));
}
internal void AddCaseInsensitiveString(string s)
{
if (s != null)
AddInt((StringComparer.InvariantCultureIgnoreCase).GetHashCode(s));
}
internal void AddCaseInsensitiveString(string s)
{
if (s != null)
AddInt((StringComparer.InvariantCultureIgnoreCase).GetHashCode(s));
}
internal void AddFileSystemItem(FileSystemInfo f)
{
//if it doesn't exist, don't proceed.
if (!f.Exists)
return;
internal void AddFileSystemItem(FileSystemInfo f)
{
//if it doesn't exist, don't proceed.
if (!f.Exists)
return;
AddCaseInsensitiveString(f.FullName);
AddDateTime(f.CreationTimeUtc);
AddDateTime(f.LastWriteTimeUtc);
//check if it is a file or folder
var fileInfo = f as FileInfo;
if (fileInfo != null)
{
AddInt(fileInfo.Length.GetHashCode());
}
var dirInfo = f as DirectoryInfo;
if (dirInfo != null)
{
foreach (var d in dirInfo.GetFiles())
{
AddFile(d);
}
foreach (var s in dirInfo.GetDirectories())
{
AddFolder(s);
}
}
}
AddCaseInsensitiveString(f.FullName);
AddDateTime(f.CreationTimeUtc);
AddDateTime(f.LastWriteTimeUtc);
internal void AddFile(FileInfo f)
{
AddFileSystemItem(f);
}
//check if it is a file or folder
var fileInfo = f as FileInfo;
if (fileInfo != null)
{
AddInt(fileInfo.Length.GetHashCode());
}
internal void AddFolder(DirectoryInfo d)
{
AddFileSystemItem(d);
}
var dirInfo = f as DirectoryInfo;
if (dirInfo != null)
{
foreach (var d in dirInfo.GetFiles())
{
AddFile(d);
}
foreach (var s in dirInfo.GetDirectories())
{
AddFolder(s);
}
}
}
/// <summary>
/// Returns the hex code of the combined hash code
/// </summary>
/// <returns></returns>
internal string GetCombinedHashCode()
{
return _combinedHash.ToString("x", CultureInfo.InvariantCulture);
}
internal void AddFile(FileInfo f)
{
AddFileSystemItem(f);
}
}
internal void AddFolder(DirectoryInfo d)
{
AddFileSystemItem(d);
}
/// <summary>
/// Returns the hex code of the combined hash code
/// </summary>
/// <returns></returns>
internal string GetCombinedHashCode()
{
return _combinedHash.ToString("x", CultureInfo.InvariantCulture);
}
}
}
+104
View File
@@ -0,0 +1,104 @@
using System.Collections.Generic;
namespace Umbraco.Core
{
/// <summary>
/// Borrowed from http://stackoverflow.com/a/2575444/694494
/// </summary>
internal static class HashCodeHelper
{
public static int GetHashCode<T1, T2>(T1 arg1, T2 arg2)
{
unchecked
{
return 31 * arg1.GetHashCode() + arg2.GetHashCode();
}
}
public static int GetHashCode<T1, T2, T3>(T1 arg1, T2 arg2, T3 arg3)
{
unchecked
{
int hash = arg1.GetHashCode();
hash = 31 * hash + arg2.GetHashCode();
return 31 * hash + arg3.GetHashCode();
}
}
public static int GetHashCode<T1, T2, T3, T4>(T1 arg1, T2 arg2, T3 arg3,
T4 arg4)
{
unchecked
{
int hash = arg1.GetHashCode();
hash = 31 * hash + arg2.GetHashCode();
hash = 31 * hash + arg3.GetHashCode();
return 31 * hash + arg4.GetHashCode();
}
}
public static int GetHashCode<T>(T[] list)
{
unchecked
{
int hash = 0;
foreach (var item in list)
{
if (item == null) continue;
hash = 31 * hash + item.GetHashCode();
}
return hash;
}
}
public static int GetHashCode<T>(IEnumerable<T> list)
{
unchecked
{
int hash = 0;
foreach (var item in list)
{
if (item == null) continue;
hash = 31 * hash + item.GetHashCode();
}
return hash;
}
}
/// <summary>
/// Gets a hashcode for a collection for that the order of items
/// does not matter.
/// So {1, 2, 3} and {3, 2, 1} will get same hash code.
/// </summary>
public static int GetHashCodeForOrderNoMatterCollection<T>(
IEnumerable<T> list)
{
unchecked
{
int hash = 0;
int count = 0;
foreach (var item in list)
{
if (item == null) continue;
hash += item.GetHashCode();
count++;
}
return 31 * hash + count.GetHashCode();
}
}
/// <summary>
/// Alternative way to get a hashcode is to use a fluent
/// interface like this:<br />
/// return 0.CombineHashCode(field1).CombineHashCode(field2).
/// CombineHashCode(field3);
/// </summary>
public static int CombineHashCode<T>(this int hashCode, T arg)
{
unchecked
{
return 31 * hashCode + arg.GetHashCode();
}
}
}
}
@@ -19,6 +19,8 @@ namespace Umbraco.Core.IO
private ShadowWrapper _macroPartialFileSystem;
private ShadowWrapper _partialViewsFileSystem;
private ShadowWrapper _macroScriptsFileSystem;
private ShadowWrapper _userControlsFileSystem;
private ShadowWrapper _stylesheetsFileSystem;
private ShadowWrapper _scriptsFileSystem;
private ShadowWrapper _xsltFileSystem;
@@ -61,6 +63,8 @@ namespace Umbraco.Core.IO
{
var macroPartialFileSystem = new PhysicalFileSystem(SystemDirectories.MacroPartials);
var partialViewsFileSystem = new PhysicalFileSystem(SystemDirectories.PartialViews);
var macroScriptsFileSystem = new PhysicalFileSystem(SystemDirectories.MacroScripts);
var userControlsFileSystem = new PhysicalFileSystem(SystemDirectories.UserControls);
var stylesheetsFileSystem = new PhysicalFileSystem(SystemDirectories.Css);
var scriptsFileSystem = new PhysicalFileSystem(SystemDirectories.Scripts);
var xsltFileSystem = new PhysicalFileSystem(SystemDirectories.Xslt);
@@ -69,6 +73,8 @@ namespace Umbraco.Core.IO
_macroPartialFileSystem = new ShadowWrapper(macroPartialFileSystem, "Views/MacroPartials", ScopeProvider);
_partialViewsFileSystem = new ShadowWrapper(partialViewsFileSystem, "Views/Partials", ScopeProvider);
_macroScriptsFileSystem = new ShadowWrapper(macroScriptsFileSystem, "macroScripts", ScopeProvider);
_userControlsFileSystem = new ShadowWrapper(userControlsFileSystem, "usercontrols", ScopeProvider);
_stylesheetsFileSystem = new ShadowWrapper(stylesheetsFileSystem, "css", ScopeProvider);
_scriptsFileSystem = new ShadowWrapper(scriptsFileSystem, "scripts", ScopeProvider);
_xsltFileSystem = new ShadowWrapper(xsltFileSystem, "xslt", ScopeProvider);
@@ -85,6 +91,10 @@ namespace Umbraco.Core.IO
public IFileSystem2 MacroPartialsFileSystem { get { return _macroPartialFileSystem; } }
public IFileSystem2 PartialViewsFileSystem { get { return _partialViewsFileSystem; } }
// Legacy /macroScripts folder
public IFileSystem2 MacroScriptsFileSystem { get { return _macroScriptsFileSystem; } }
// Legacy /usercontrols folder
public IFileSystem2 UserControlsFileSystem { get { return _userControlsFileSystem; } }
public IFileSystem2 StylesheetsFileSystem { get { return _stylesheetsFileSystem; } }
public IFileSystem2 ScriptsFileSystem { get { return _scriptsFileSystem; } }
public IFileSystem2 XsltFileSystem { get { return _xsltFileSystem; } }
@@ -252,13 +262,15 @@ namespace Umbraco.Core.IO
internal ICompletable Shadow(Guid id)
{
var typed = _wrappers.ToArray();
var wrappers = new ShadowWrapper[typed.Length + 7];
var wrappers = new ShadowWrapper[typed.Length + 9];
var i = 0;
while (i < typed.Length) wrappers[i] = typed[i++];
wrappers[i++] = _macroPartialFileSystem;
wrappers[i++] = _macroScriptsFileSystem;
wrappers[i++] = _partialViewsFileSystem;
wrappers[i++] = _stylesheetsFileSystem;
wrappers[i++] = _scriptsFileSystem;
wrappers[i++] = _userControlsFileSystem;
wrappers[i++] = _xsltFileSystem;
wrappers[i++] = _masterPagesFileSystem;
wrappers[i] = _mvcViewsFileSystem;
+2
View File
@@ -97,6 +97,8 @@ namespace Umbraco.Core.IO
public static string MapPath(string path, bool useHttpContext)
{
if (path == null) throw new ArgumentNullException("path");
// Check if the path is already mapped
if ((path.Length >= 2 && path[1] == Path.VolumeSeparatorChar)
|| path.StartsWith(@"\\")) //UNC Paths start with "\\". If the site is running off a network drive mapped paths will look like "\\Whatever\Boo\Bar"
+1 -1
View File
@@ -159,7 +159,7 @@ namespace Umbraco.Core.IO
// ReSharper disable once AssignNullToNotNullAttribute
var filepath = UmbracoConfig.For.UmbracoSettings().Content.UploadAllowDirectories
? Path.Combine(folder, filename)
? Path.Combine(folder, filename).Replace('\\', '/')
: folder + "-" + filename;
return filepath;
@@ -42,6 +42,7 @@ namespace Umbraco.Core.Models
public Guid Key { get; set; }
public DateTime CreateDate { get; set; }
public DateTime UpdateDate { get; set; }
public DateTime? DeletedDate { get; set; }
/// <summary>
/// Special case, always return false, this will cause the repositories managing
@@ -60,5 +61,7 @@ namespace Umbraco.Core.Models
DeepCloneHelper.DeepCloneRefProperties(this, clone);
return clone;
}
}
}
@@ -101,6 +101,9 @@ namespace Umbraco.Core.Models.EntityBase
set { SetPropertyValueAndDetectChanges(value, ref _updateDate, Ps.Value.UpdateDateSelector); }
}
[IgnoreDataMember]
public DateTime? DeletedDate { get; set; }
internal virtual void ResetIdentity()
{
_hasIdentity = false;
@@ -3,7 +3,7 @@
/// <summary>
/// Marker interface for aggregate roots
/// </summary>
public interface IAggregateRoot : IEntity
public interface IAggregateRoot : IDeletableEntity
{
}
@@ -0,0 +1,11 @@
using System;
using System.Runtime.Serialization;
namespace Umbraco.Core.Models.EntityBase
{
public interface IDeletableEntity : IEntity
{
[DataMember]
DateTime? DeletedDate { get; set; }
}
}
@@ -20,7 +20,7 @@ namespace Umbraco.Core.Models.EntityBase
/// <summary>
/// Guid based Id
/// </summary>
/// <remarks>The key is currectly used to store the Unique Id from the
/// <remarks>The key is currectly used to store the Unique Id from the
/// umbracoNode table, which many of the entities are based on.</remarks>
[DataMember]
Guid Key { get; set; }
+1 -1
View File
@@ -2,6 +2,6 @@
{
public interface IPartialView : IFile
{
PartialViewType ViewType { get; }
}
}
+7
View File
@@ -0,0 +1,7 @@
namespace Umbraco.Core.Models
{
public interface IUserControl : IFile
{
}
}
+24
View File
@@ -109,6 +109,30 @@ namespace Umbraco.Core.Models
IsApproved = true;
}
/// <summary>
/// Constructor for creating a Member object
/// </summary>
/// <param name="name"></param>
/// <param name="email"></param>
/// <param name="username"></param>
/// <param name="rawPasswordValue">
/// The password value passed in to this parameter should be the encoded/encrypted/hashed format of the member's password
/// </param>
/// <param name="contentType"></param>
/// <param name="isApproved"></param>
public Member(string name, string email, string username, string rawPasswordValue, IMemberType contentType, bool isApproved)
: base(name, -1, contentType, new PropertyCollection())
{
Mandate.ParameterNotNull(contentType, "contentType");
_contentTypeAlias = contentType.Alias;
_contentType = contentType;
_email = email;
_username = username;
_rawPasswordValue = rawPasswordValue;
IsApproved = isApproved;
}
private static readonly Lazy<PropertySelectors> Ps = new Lazy<PropertySelectors>();
private class PropertySelectors
+11 -6
View File
@@ -1,10 +1,8 @@
using System;
using System.Runtime.Serialization;
using Umbraco.Core.Services;
namespace Umbraco.Core.Models
{
/// <summary>
/// Represents a Partial View file
/// </summary>
@@ -12,14 +10,21 @@ namespace Umbraco.Core.Models
[DataContract(IsReference = true)]
public class PartialView : File, IPartialView
{
[Obsolete("Use the ctor that explicitely sets the view type.")]
public PartialView(string path)
: this(path, null)
: this(PartialViewType.PartialView, path, null)
{ }
internal PartialView(string path, Func<File, string> getFileContent)
public PartialView(PartialViewType viewType, string path)
: this(viewType, path, null)
{ }
internal PartialView(PartialViewType viewType, string path, Func<File, string> getFileContent)
: base(path, getFileContent)
{ }
{
ViewType = viewType;
}
internal PartialViewType ViewType { get; set; }
public PartialViewType ViewType { get; set; }
}
}
+3 -2
View File
@@ -1,9 +1,10 @@
namespace Umbraco.Core.Models
{
internal enum PartialViewType : byte
public enum PartialViewType : byte
{
Unknown = 0, // default
PartialView = 1,
PartialViewMacro = 2
PartialViewMacro = 2,
MacroScript = 3
}
}
@@ -178,6 +178,13 @@ namespace Umbraco.Core.Models
/// </summary>
[UmbracoObjectType(Constants.ObjectTypes.FormsDataSource)]
[FriendlyName("DataSource")]
FormsDataSource
FormsDataSource,
/// <summary>
/// Language
/// </summary>
[UmbracoObjectType(Constants.ObjectTypes.Language)]
[FriendlyName("Language")]
Language
}
}
+32
View File
@@ -0,0 +1,32 @@
using System;
using System.Runtime.Serialization;
namespace Umbraco.Core.Models
{
/// <summary>
/// Represents a UserControl file
/// </summary>
[Serializable]
[DataContract(IsReference = true)]
public class UserControl : File, IUserControl
{
public UserControl(string path)
: this(path, (Func<File, string>)null)
{ }
internal UserControl(string path, Func<File, string> getFileContent)
: base(path, getFileContent)
{ }
/// <summary>
/// Indicates whether the current entity has an identity, which in this case is a path/name.
/// </summary>
/// <remarks>
/// Overrides the default Entity identity check.
/// </remarks>
public override bool HasIdentity
{
get { return string.IsNullOrEmpty(Path) == false; }
}
}
}
+1 -1
View File
@@ -11,7 +11,7 @@ namespace Umbraco.Core
{
private readonly bool _keepOldest;
public OrderedHashSet(bool keepOldest = true)
public OrderedHashSet(bool keepOldest = true)
{
_keepOldest = keepOldest;
}
@@ -7,7 +7,7 @@ namespace Umbraco.Core.Packaging.Models
{
[Serializable]
[DataContract(IsReference = true)]
internal class InstallationSummary
public class InstallationSummary
{
public MetaData MetaData { get; set; }
public IEnumerable<IDataTypeDefinition> DataTypesInstalled { get; set; }
@@ -5,7 +5,7 @@ namespace Umbraco.Core.Packaging.Models
{
[Serializable]
[DataContract(IsReference = true)]
internal class MetaData
public class MetaData
{
public string Name { get; set; }
public string Version { get; set; }
@@ -4,7 +4,7 @@ using System.Xml.Linq;
namespace Umbraco.Core.Packaging.Models
{
internal enum ActionRunAt
public enum ActionRunAt
{
Undefined = 0,
Install,
@@ -13,7 +13,7 @@ namespace Umbraco.Core.Packaging.Models
[Serializable]
[DataContract(IsReference = true)]
internal class PackageAction
public class PackageAction
{
private ActionRunAt _runAt;
private bool? _undo;
@@ -7,7 +7,7 @@ namespace Umbraco.Core.Packaging.Models
{
[Serializable]
[DataContract(IsReference = true)]
internal class UninstallationSummary
public class UninstallationSummary
{
public MetaData MetaData { get; set; }
public IEnumerable<IDataTypeDefinition> DataTypesUninstalled { get; set; }
@@ -23,7 +23,7 @@ namespace Umbraco.Core.Persistence.Migrations
Logger = logger;
}
public IMigrationContext Context { get; internal set; }
public IMigrationContext Context;
public abstract void Up();
public abstract void Down();
@@ -2,6 +2,7 @@
using Umbraco.Core.Configuration;
using Umbraco.Core.Logging;
using Umbraco.Core.Models.Rdbms;
using Umbraco.Core.Persistence.DatabaseAnnotations;
using Umbraco.Core.Persistence.SqlSyntax;
namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenThreeZero
@@ -16,7 +17,7 @@ namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenThreeZe
public override void Up()
{
var exists = Context.Database.FirstOrDefault<RelationTypeDto>("WHERE alias=@alias", new {alias = Constants.Conventions.RelationTypes.RelateParentDocumentOnDeleteAlias});
var exists = Context.Database.FirstOrDefault<RelationTypeDtoCapture>("WHERE alias=@alias", new {alias = Constants.Conventions.RelationTypes.RelateParentDocumentOnDeleteAlias});
if (exists == null)
{
Insert.IntoTable("umbracoRelationType").Row(new
@@ -28,13 +29,42 @@ namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenThreeZe
alias = Constants.Conventions.RelationTypes.RelateParentDocumentOnDeleteAlias
});
}
}
public override void Down()
{ }
// need to capture the DTO as it is modified in later migrations
[TableName("umbracoRelationType")]
[PrimaryKey("id")]
[ExplicitColumns]
internal class RelationTypeDtoCapture
{
public const int NodeIdSeed = 3;
[Column("id")]
[PrimaryKeyColumn(IdentitySeed = NodeIdSeed)]
public int Id { get; set; }
[Column("dual")]
public bool Dual { get; set; }
[Column("parentObjectType")]
public Guid ParentObjectType { get; set; }
[Column("childObjectType")]
public Guid ChildObjectType { get; set; }
[Column("name")]
[Index(IndexTypes.UniqueNonClustered, Name = "IX_umbracoRelationType_name")]
public string Name { get; set; }
[Column("alias")]
[NullSetting(NullSetting = NullSettings.Null)]
[Length(100)]
[Index(IndexTypes.UniqueNonClustered, Name = "IX_umbracoRelationType_alias")]
public string Alias { get; set; }
}
}
}
@@ -81,7 +81,7 @@ namespace Umbraco.Core.Persistence.Repositories
s.Where<DocumentDto>(x => x.Newest, SqlSyntax);
return s;
};
var sqlBaseFull = GetBaseQuery(BaseQueryType.FullMultiple);
var sqlBaseIds = GetBaseQuery(BaseQueryType.Ids);
@@ -107,7 +107,7 @@ namespace Umbraco.Core.Persistence.Repositories
return ProcessQuery(translate(translatorFull), new PagingSqlQuery(translate(translatorIds)));
}
#endregion
#endregion
#region Overrides of PetaPocoRepositoryBase<IContent>
@@ -142,8 +142,8 @@ namespace Umbraco.Core.Persistence.Repositories
{
//The only reason we apply this left outer join is to be able to pull back the DocumentPublishedReadOnlyDto
//information with the entire data set, so basically this will get both the latest document and also it's published
//version if it has one. When performing a count or when retrieving Ids like in paging, this is unecessary
//and causes huge performance overhead for the SQL server, especially when sorting the result.
//version if it has one. When performing a count or when retrieving Ids like in paging, this is unecessary
//and causes huge performance overhead for the SQL server, especially when sorting the result.
//We also don't include this outer join when querying for multiple entities since it is much faster to fetch this information
//in a separate query. For a single entity this is ok.
@@ -234,7 +234,7 @@ namespace Umbraco.Core.Persistence.Repositories
};
var baseId = 0;
while (true)
{
// get the next group of nodes
@@ -284,7 +284,7 @@ namespace Umbraco.Core.Persistence.Repositories
}
xmlIdsQuery.Where<NodeDto>(dto => dto.NodeObjectType == docObjectType, SqlSyntax);
var allXmlIds = Database.Fetch<int>(xmlIdsQuery);
var toRemove = allXmlIds.Except(allContentIds).ToArray();
@@ -293,9 +293,9 @@ namespace Umbraco.Core.Persistence.Repositories
foreach (var idGroup in toRemove.InGroupsOf(2000))
{
Database.Execute("DELETE FROM cmsContentXml WHERE nodeId IN (@ids)", new { ids = idGroup });
}
}
}
}
public override IEnumerable<IContent> GetAllVersions(int id)
@@ -308,7 +308,7 @@ namespace Umbraco.Core.Persistence.Repositories
var sqlFull = translate(GetBaseQuery(BaseQueryType.FullMultiple));
var sqlIds = translate(GetBaseQuery(BaseQueryType.Ids));
return ProcessQuery(sqlFull, new PagingSqlQuery(sqlIds), true, includeAllVersions:true);
}
@@ -388,7 +388,7 @@ namespace Umbraco.Core.Persistence.Repositories
protected override void PersistDeletedItem(IContent entity)
{
//We need to clear out all access rules but we need to do this in a manual way since
//We need to clear out all access rules but we need to do this in a manual way since
// nothing in that table is joined to a content id
var subQuery = new Sql()
.Select("umbracoAccessRule.accessId")
@@ -449,7 +449,7 @@ namespace Umbraco.Core.Persistence.Repositories
entity.Level = level;
//Assign the same permissions to it as the parent node
// http://issues.umbraco.org/issue/U4-2161
// http://issues.umbraco.org/issue/U4-2161
var permissionsRepo = new PermissionRepository<IContent>(UnitOfWork, _cacheHelper, SqlSyntax);
var parentPermissions = permissionsRepo.GetPermissionsForEntity(entity.ParentId).ToArray();
//if there are parent permissions then assign them, otherwise leave null and permissions will become the
@@ -516,7 +516,7 @@ namespace Umbraco.Core.Persistence.Repositories
VersionDate = dto.UpdateDate,
Newest = true,
NodeId = dto.NodeId,
Published = true
Published = true
};
((Content) entity).PublishedVersionGuid = dto.VersionId;
((Content) entity).PublishedDate = dto.UpdateDate;
@@ -636,9 +636,12 @@ namespace Umbraco.Core.Persistence.Repositories
{
//In order to update the ContentVersion we need to retrieve its primary key id
var contentVerDto = Database.SingleOrDefault<ContentVersionDto>("WHERE VersionId = @Version", new { Version = entity.Version });
contentVersionDto.Id = contentVerDto.Id;
Database.Update(contentVersionDto);
if (contentVerDto != null)
{
contentVersionDto.Id = contentVerDto.Id;
Database.Update(contentVersionDto);
}
Database.Update(dto);
}
@@ -742,7 +745,7 @@ namespace Umbraco.Core.Persistence.Repositories
return ProcessQuery(translate(translatorFull), new PagingSqlQuery(translate(translatorIds)), true);
}
/// <summary>
/// This builds the Xml document used for the XML cache
/// </summary>
@@ -841,7 +844,7 @@ order by umbracoNode.{2}, umbracoNode.parentID, umbracoNode.sortOrder",
/// </summary>
/// <param name="entity"></param>
/// <param name="permission"></param>
/// <param name="userIds"></param>
/// <param name="userIds"></param>
public void AssignEntityPermission(IContent entity, char permission, IEnumerable<int> userIds)
{
var repo = new PermissionRepository<IContent>(UnitOfWork, _cacheHelper, SqlSyntax);
@@ -899,9 +902,9 @@ order by umbracoNode.{2}, umbracoNode.parentID, umbracoNode.sortOrder",
string orderBy, Direction orderDirection, bool orderBySystemField, IQuery<IContent> filter = null)
{
//NOTE: This uses the GetBaseQuery method but that does not take into account the required 'newest' field which is
//NOTE: This uses the GetBaseQuery method but that does not take into account the required 'newest' field which is
// what we always require for a paged result, so we'll ensure it's included in the filter
var filterSql = new Sql().Append("AND (cmsDocument.newest = 1)");
if (filter != null)
{
@@ -910,7 +913,7 @@ order by umbracoNode.{2}, umbracoNode.parentID, umbracoNode.sortOrder",
filterSql.Append(string.Format("AND ({0})", filterClaus.Item1), filterClaus.Item2);
}
}
Func<Tuple<string, object[]>> filterCallback = () => new Tuple<string, object[]>(filterSql.SQL, filterSql.Arguments);
return GetPagedResultsByQuery<DocumentDto>(query, pageIndex, pageSize, out totalRecords,
@@ -957,7 +960,7 @@ order by umbracoNode.{2}, umbracoNode.parentID, umbracoNode.sortOrder",
/// </param>
/// <param name="withCache"></param>
/// <param name="includeAllVersions">
/// Generally when querying for content we only want to return the most recent version of the content item, however in some cases like when
/// Generally when querying for content we only want to return the most recent version of the content item, however in some cases like when
/// we want to return all versions of a content item, we can't simply return the latest
/// </param>
/// <returns></returns>
@@ -966,7 +969,7 @@ order by umbracoNode.{2}, umbracoNode.parentID, umbracoNode.sortOrder",
// fetch returns a list so it's ok to iterate it in this method
var dtos = Database.Fetch<DocumentDto, ContentVersionDto, ContentDto, NodeDto>(sqlFull);
if (dtos.Count == 0) return Enumerable.Empty<IContent>();
//Go and get all of the published version data separately for this data, this is because when we are querying
//for multiple content items we don't include the outer join to fetch this data in the same query because
//it is insanely slow. Instead we just fetch the published version data separately in one query.
@@ -978,7 +981,7 @@ order by umbracoNode.{2}, umbracoNode.parentID, umbracoNode.sortOrder",
if (parsedOriginalSql.InvariantContains("ORDER BY "))
{
parsedOriginalSql = parsedOriginalSql.Substring(0, parsedOriginalSql.LastIndexOf("ORDER BY ", StringComparison.Ordinal));
}
}
//order by update date DESC, if there is corrupted published flags we only want the latest!
var publishedSql = new Sql(@"SELECT cmsDocument.nodeId, cmsDocument.published, cmsDocument.versionId, cmsDocument.updateDate, cmsDocument.newest
@@ -1004,12 +1007,12 @@ ORDER BY cmsContentVersion.id DESC
var content = new List<Tuple<IContent, bool>>();
var defs = new DocumentDefinitionCollection(includeAllVersions);
var templateIds = new List<int>();
//track the looked up content types, even though the content types are cached
// they still need to be deep cloned out of the cache and we don't want to add
// the overhead of deep cloning them on every item in this loop
var contentTypes = new Dictionary<int, IContentType>();
foreach (var dto in dtos)
{
DocumentPublishedReadOnlyDto publishedDto;
@@ -1145,7 +1148,7 @@ ORDER BY cmsContentVersion.id DESC
return currentName;
}
/// <summary>
/// Dispose disposable properties
/// </summary>
@@ -70,6 +70,8 @@ namespace Umbraco.Core.Persistence.Repositories
{
//Remove 'published' xml from the cmsContentXml table for the unpublished content
Database.Delete<ContentXmlDto>("WHERE nodeId = @Id", new { Id = entity.Id });
entity.DeletedDate = DateTime.Now;
}
protected override void PersistNewItem(ContentXmlEntity<TContent> entity)
@@ -270,6 +270,8 @@ AND umbracoNode.id <> @id",
//Delete (base) node data
Database.Delete<NodeDto>("WHERE uniqueID = @Id", new { Id = entity.Key });
entity.DeletedDate = DateTime.Now;
}
#endregion
@@ -539,6 +541,8 @@ AND umbracoNode.id <> @id",
Database.Execute(
"DELETE FROM cmsDataTypePreValues WHERE id=@Id",
new { Id = entity.Id });
entity.DeletedDate = DateTime.Now;
}
protected override void PersistNewItem(PreValueEntity entity)
@@ -195,6 +195,8 @@ namespace Umbraco.Core.Persistence.Repositories
//Clear the cache entries that exist by uniqueid/item key
IsolatedCache.ClearCacheItem(GetCacheIdKey<IDictionaryItem>(entity.ItemKey));
IsolatedCache.ClearCacheItem(GetCacheIdKey<IDictionaryItem>(entity.Key));
entity.DeletedDate = DateTime.Now;
}
private void RecursiveDelete(Guid parentId)
@@ -167,6 +167,8 @@ namespace Umbraco.Core.Persistence.Repositories
// delete
Database.Delete(nodeDto);
entity.DeletedDate = DateTime.Now;
}
protected override void PersistNewItem(EntityContainer entity)
@@ -0,0 +1,13 @@
using System.IO;
using Umbraco.Core.Models;
namespace Umbraco.Core.Persistence.Repositories
{
public interface IUserControlRepository : IRepository<string, UserControl>
{
bool ValidateUserControl(UserControl userControl);
Stream GetFileContentStream(string filepath);
void SetFileContent(string filepath, Stream content);
long GetFileSize(string filepath);
}
}
@@ -0,0 +1,15 @@
using Umbraco.Core.IO;
using Umbraco.Core.Models;
using Umbraco.Core.Persistence.UnitOfWork;
namespace Umbraco.Core.Persistence.Repositories
{
internal class MacroScriptRepository : PartialViewRepository
{
public MacroScriptRepository(IUnitOfWork work, IFileSystem fileSystem)
: base(work, fileSystem)
{ }
protected override PartialViewType ViewType { get { return PartialViewType.MacroScript; } }
}
}
@@ -30,7 +30,7 @@ namespace Umbraco.Core.Persistence.Repositories
var updated = FileSystem.GetLastModified(path).UtcDateTime;
//var content = GetFileContent(path);
var view = new PartialView(path, file => GetFileContent(file.OriginalPath))
var view = new PartialView(ViewType, path, file => GetFileContent(file.OriginalPath))
{
//id can be the hash
Id = path.GetHashCode(),
@@ -38,8 +38,7 @@ namespace Umbraco.Core.Persistence.Repositories
//Content = content,
CreateDate = created,
UpdateDate = updated,
VirtualPath = FileSystem.GetUrl(id),
ViewType = ViewType
VirtualPath = FileSystem.GetUrl(id)
};
//on initial construction we don't want to have dirty properties tracked
@@ -74,6 +74,7 @@ namespace Umbraco.Core.Persistence.Repositories
{
Database.Execute(delete, new { Id = GetEntityId(entity) });
}
entity.DeletedDate = DateTime.Now;
}
}
}
@@ -42,6 +42,7 @@ namespace Umbraco.Core.Persistence.Repositories
//Construct and execute delete statements for all trashed items by 'nodeObjectType'
var deletes = new List<string>
{
FormatDeleteStatement("cmsTask", "nodeId"),
FormatDeleteStatement("umbracoUser2NodeNotify", "nodeId"),
FormatDeleteStatement("umbracoUser2NodePermission", "nodeId"),
@"DELETE FROM umbracoAccessRule WHERE umbracoAccessRule.accessId IN (
@@ -311,6 +311,8 @@ namespace Umbraco.Core.Persistence.Repositories
var masterpageName = string.Concat(entity.Alias, ".master");
_masterpagesFileSystem.DeleteFile(masterpageName);
}
entity.DeletedDate = DateTime.Now;
}
#endregion
@@ -0,0 +1,135 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Umbraco.Core.IO;
using Umbraco.Core.Models;
using Umbraco.Core.Persistence.UnitOfWork;
namespace Umbraco.Core.Persistence.Repositories
{
/// <summary>
/// Represents the UserControl Repository
/// </summary>
internal class UserControlRepository : FileRepository<string, UserControl>, IUserControlRepository
{
public UserControlRepository(IUnitOfWork work, IFileSystem fileSystem)
: base(work, fileSystem)
{
}
public override UserControl Get(string id)
{
var path = FileSystem.GetRelativePath(id);
path = path.EnsureEndsWith(".ascx");
if (FileSystem.FileExists(path) == false)
return null;
var created = FileSystem.GetCreated(path).UtcDateTime;
var updated = FileSystem.GetLastModified(path).UtcDateTime;
var userControl = new UserControl(path, file => GetFileContent(file.OriginalPath))
{
Key = path.EncodeAsGuid(),
CreateDate = created,
UpdateDate = updated,
Id = path.GetHashCode(),
VirtualPath = FileSystem.GetUrl(path)
};
//on initial construction we don't want to have dirty properties tracked
// http://issues.umbraco.org/issue/U4-1946
userControl.ResetDirtyProperties(false);
return userControl;
}
public override void AddOrUpdate(UserControl entity)
{
base.AddOrUpdate(entity);
// ensure that from now on, content is lazy-loaded
if (entity.GetFileContent == null)
entity.GetFileContent = file => GetFileContent(file.OriginalPath);
}
public override IEnumerable<UserControl> GetAll(params string[] ids)
{
ids = ids
.Select(x => StringExtensions.EnsureEndsWith(x, ".ascx"))
.Distinct()
.ToArray();
if (ids.Any())
{
foreach (var id in ids)
{
yield return Get(id);
}
}
else
{
var files = FindAllFiles("", "*.ascx");
foreach (var file in files)
{
yield return Get(file);
}
}
}
/// <summary>
/// Gets a list of all <see cref="UserControl"/> that exist at the relative path specified.
/// </summary>
/// <param name="rootPath">
/// If null or not specified, will return the UserControl files at the root path relative to the IFileSystem
/// </param>
/// <returns></returns>
public IEnumerable<UserControl> GetUserControlsAtPath(string rootPath = null)
{
return FileSystem.GetFiles(rootPath ?? string.Empty, "*.ascx").Select(Get);
}
private static readonly List<string> ValidExtensions = new List<string> { "ascx" };
public bool ValidateUserControl(UserControl userControl)
{
// get full path
string fullPath;
try
{
// may throw for security reasons
fullPath = FileSystem.GetFullPath(userControl.Path);
}
catch
{
return false;
}
// validate path and extension
var validDir = SystemDirectories.UserControls;
var isValidPath = IOHelper.VerifyEditPath(fullPath, validDir);
var isValidExtension = IOHelper.VerifyFileExtension(userControl.Path, ValidExtensions);
return isValidPath && isValidExtension;
}
public Stream GetFileContentStream(string filepath)
{
if (FileSystem.FileExists(filepath) == false) return null;
try
{
return FileSystem.OpenFile(filepath);
}
catch
{
return null; // deal with race conds
}
}
public void SetFileContent(string filepath, Stream content)
{
FileSystem.AddFile(filepath, content, true);
}
}
}
@@ -231,6 +231,18 @@ namespace Umbraco.Core.Persistence
return new PartialViewMacroRepository(uow, FileSystemProviderManager.Current.MacroPartialsFileSystem);
}
[Obsolete("MacroScripts are obsolete - this is for backwards compatibility with upgraded sites.")]
internal virtual IPartialViewRepository CreateMacroScriptRepository(IUnitOfWork uow)
{
return new MacroScriptRepository(uow, FileSystemProviderManager.Current.MacroScriptsFileSystem);
}
[Obsolete("UserControls are obsolete - this is for backwards compatibility with upgraded sites.")]
internal virtual IUserControlRepository CreateUserControlRepository(IUnitOfWork uow)
{
return new UserControlRepository(uow, FileSystemProviderManager.Current.UserControlsFileSystem);
}
public virtual IStylesheetRepository CreateStylesheetRepository(IUnitOfWork uow)
{
return new StylesheetRepository(uow, FileSystemProviderManager.Current.StylesheetsFileSystem);
+5 -2
View File
@@ -39,7 +39,6 @@ using System.Security.Permissions;
[assembly: InternalsVisibleTo("UmbracoExamine")]
[assembly: InternalsVisibleTo("Concorde.Sync")]
[assembly: InternalsVisibleTo("Umbraco.VisualStudio")]
[assembly: InternalsVisibleTo("Umbraco.Courier.Core")]
[assembly: InternalsVisibleTo("Umbraco.Courier.Persistence")]
@@ -52,4 +51,8 @@ using System.Security.Permissions;
[assembly: InternalsVisibleTo("Umbraco.Forms.Web")]
//allow this to be mocked in our unit tests
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")]
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")]
//allow custom unit-testing code to access internals through custom adapters
[assembly: InternalsVisibleTo("Umbraco.VisualStudio")] // backwards compat.
[assembly: InternalsVisibleTo("Umbraco.UnitTesting.Adapter")] // new, more imperative name
@@ -22,7 +22,7 @@ namespace Umbraco.Core.PropertyEditors.ValueConverters
if (sourceString != null)
{
decimal d;
return (decimal.TryParse(sourceString, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out d)) ? d : 0M;
return (decimal.TryParse(sourceString, NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingSign, CultureInfo.InvariantCulture, out d)) ? d : 0M;
}
// in the database an a decimal is an a decimal
@@ -20,6 +20,11 @@ namespace Umbraco.Core.PropertyEditors.ValueConverters
public override object ConvertSourceToObject(PublishedPropertyType propertyType, object source, bool preview)
{
if(source == null)
{
return string.Empty;
}
return source.ToString();
}
@@ -191,6 +191,7 @@ namespace Umbraco.Core.Security
//track the last login date
user.LastLoginDateUtc = DateTime.UtcNow;
user.AccessFailedCount = 0;
await UserManager.UpdateAsync(user);
_logger.WriteCore(TraceEventType.Information, 0,
@@ -231,4 +232,4 @@ namespace Umbraco.Core.Security
return null;
}
}
}
}
@@ -494,7 +494,7 @@ namespace Umbraco.Core.Security
//the stamp cannot be null, so if it is currently null then we'll just return a hash of the password
return Task.FromResult(user.SecurityStamp.IsNullOrWhiteSpace()
? user.PasswordHash.ToMd5()
? user.PasswordHash.GenerateHash()
: user.SecurityStamp);
}
+11 -8
View File
@@ -32,6 +32,7 @@ namespace Umbraco.Core.Services
private readonly EntityXmlSerializer _entitySerializer = new EntityXmlSerializer();
private readonly IDataTypeService _dataTypeService;
private readonly IUserService _userService;
private readonly IdkMap _idkMap;
//Support recursive locks because some of the methods that require locking call other methods that require locking.
//for example, the Move method needs to be locked but this calls the Save method which also needs to be locked.
@@ -43,7 +44,8 @@ namespace Umbraco.Core.Services
ILogger logger,
IEventMessagesFactory eventMessagesFactory,
IDataTypeService dataTypeService,
IUserService userService)
IUserService userService,
IdkMap idkMap)
: base(provider, repositoryFactory, logger, eventMessagesFactory)
{
if (dataTypeService == null) throw new ArgumentNullException("dataTypeService");
@@ -51,6 +53,7 @@ namespace Umbraco.Core.Services
_publishingStrategy = new PublishingStrategy(UowProvider.ScopeProvider, eventMessagesFactory, logger);
_dataTypeService = dataTypeService;
_userService = userService;
_idkMap = idkMap;
}
#region Static Queries
@@ -382,13 +385,13 @@ namespace Umbraco.Core.Services
/// <returns><see cref="IContent"/></returns>
public IContent GetById(Guid key)
{
using (var uow = UowProvider.GetUnitOfWork(readOnly: true))
{
var repository = RepositoryFactory.CreateContentRepository(uow);
var query = Query<IContent>.Builder.Where(x => x.Key == key);
var contents = repository.GetByQuery(query);
return contents.SingleOrDefault();
}
// the repository implements a cache policy on int identifiers, not guids,
// and we are not changing it now, but we still would like to rely on caching
// instead of running a full query against the database, so relying on the
// id-key map, which is fast.
var a = _idkMap.GetIdForKey(key, UmbracoObjectTypes.Document);
return a.Success ? GetById(a.Result) : null;
}
/// <summary>
@@ -83,7 +83,7 @@ namespace Umbraco.Core.Services
/// <returns></returns>
public bool HasContainerInPath(string contentPath)
{
using (var uow = UowProvider.GetUnitOfWork())
using (var uow = UowProvider.GetUnitOfWork(readOnly: true))
{
// can use same repo for both content and media
var repository = RepositoryFactory.CreateContentTypeRepository(uow);
+15 -73
View File
@@ -16,50 +16,26 @@ namespace Umbraco.Core.Services
{
public class EntityService : ScopeRepositoryService, IEntityService
{
private readonly IRuntimeCacheProvider _runtimeCache;
private readonly Dictionary<string, Tuple<UmbracoObjectTypes, Func<int, IUmbracoEntity>>> _supportedObjectTypes;
private readonly IdkMap _idkMap;
public EntityService(IDatabaseUnitOfWorkProvider provider, RepositoryFactory repositoryFactory, ILogger logger, IEventMessagesFactory eventMessagesFactory,
IContentService contentService, IContentTypeService contentTypeService, IMediaService mediaService, IDataTypeService dataTypeService,
IMemberService memberService, IMemberTypeService memberTypeService, IRuntimeCacheProvider runtimeCache)
IMemberService memberService, IMemberTypeService memberTypeService, IdkMap idkMap)
: base(provider, repositoryFactory, logger, eventMessagesFactory)
{
_runtimeCache = runtimeCache;
IContentTypeService contentTypeService1 = contentTypeService;
_idkMap = idkMap;
_supportedObjectTypes = new Dictionary<string, Tuple<UmbracoObjectTypes, Func<int, IUmbracoEntity>>>
{
{typeof (IDataTypeDefinition).FullName, new Tuple<UmbracoObjectTypes, Func<int, IUmbracoEntity>>(UmbracoObjectTypes.DataType, dataTypeService.GetDataTypeDefinitionById)},
{typeof (IContent).FullName, new Tuple<UmbracoObjectTypes, Func<int, IUmbracoEntity>>(UmbracoObjectTypes.Document, contentService.GetById)},
{typeof (IContentType).FullName, new Tuple<UmbracoObjectTypes, Func<int, IUmbracoEntity>>(UmbracoObjectTypes.DocumentType, contentTypeService1.GetContentType)},
{typeof (IContentType).FullName, new Tuple<UmbracoObjectTypes, Func<int, IUmbracoEntity>>(UmbracoObjectTypes.DocumentType, contentTypeService.GetContentType)},
{typeof (IMedia).FullName, new Tuple<UmbracoObjectTypes, Func<int, IUmbracoEntity>>(UmbracoObjectTypes.Media, mediaService.GetById)},
{typeof (IMediaType).FullName, new Tuple<UmbracoObjectTypes, Func<int, IUmbracoEntity>>(UmbracoObjectTypes.MediaType, contentTypeService1.GetMediaType)},
{typeof (IMediaType).FullName, new Tuple<UmbracoObjectTypes, Func<int, IUmbracoEntity>>(UmbracoObjectTypes.MediaType, contentTypeService.GetMediaType)},
{typeof (IMember).FullName, new Tuple<UmbracoObjectTypes, Func<int, IUmbracoEntity>>(UmbracoObjectTypes.Member, memberService.GetById)},
{typeof (IMemberType).FullName, new Tuple<UmbracoObjectTypes, Func<int, IUmbracoEntity>>(UmbracoObjectTypes.MemberType, memberTypeService.Get)},
//{typeof (IUmbracoEntity).FullName, new Tuple<UmbracoObjectTypes, Func<int, IUmbracoEntity>>(UmbracoObjectTypes.EntityContainer, id =>
//{
// using (var uow = UowProvider.GetUnitOfWork())
// {
// var found = uow.Database.FirstOrDefault<NodeDto>("SELECT * FROM umbracoNode WHERE id=@id", new { id = id });
// return found == null ? null : new UmbracoEntity(found.Trashed)
// {
// Id = found.NodeId,
// Name = found.Text,
// Key = found.UniqueId,
// SortOrder = found.SortOrder,
// Path = found.Path,
// NodeObjectTypeId = found.NodeObjectType.Value,
// CreateDate = found.CreateDate,
// CreatorId = found.UserId.Value,
// Level = found.Level,
// ParentId = found.ParentId
// };
// }
//})}
};
}
#region Static Queries
@@ -68,6 +44,8 @@ namespace Umbraco.Core.Services
#endregion
internal IdkMap IdkMap { get { return _idkMap; } }
/// <summary>
/// Returns the integer id for a given GUID
/// </summary>
@@ -76,23 +54,12 @@ namespace Umbraco.Core.Services
/// <returns></returns>
public Attempt<int> GetIdForKey(Guid key, UmbracoObjectTypes umbracoObjectType)
{
var result = _runtimeCache.GetCacheItem<int?>(CacheKeys.IdToKeyCacheKey + key, () =>
{
using (var uow = UowProvider.GetUnitOfWork(readOnly:true))
{
var nodeObjectType = GetNodeObjectTypeGuid(umbracoObjectType);
return _idkMap.GetIdForKey(key, umbracoObjectType);
}
var sql = new Sql()
.Select("id")
.From<NodeDto>()
.Where<NodeDto>(
dto =>
dto.UniqueId == key &&
dto.NodeObjectType == nodeObjectType);
return uow.Database.ExecuteScalar<int?>(sql);
}
});
return result.HasValue ? Attempt.Succeed(result.Value) : Attempt<int>.Fail();
public Attempt<int> GetIdForUdi(Udi udi)
{
return _idkMap.GetIdForUdi(udi);
}
/// <summary>
@@ -103,32 +70,7 @@ namespace Umbraco.Core.Services
/// <returns></returns>
public Attempt<Guid> GetKeyForId(int id, UmbracoObjectTypes umbracoObjectType)
{
var result = _runtimeCache.GetCacheItem<Guid?>(CacheKeys.KeyToIdCacheKey + id, () =>
{
using (var uow = UowProvider.GetUnitOfWork(readOnly:true))
{
var nodeObjectType = GetNodeObjectTypeGuid(umbracoObjectType);
var sql = new Sql()
.Select("uniqueID")
.From<NodeDto>()
.Where<NodeDto>(
dto =>
dto.NodeId == id &&
dto.NodeObjectType == nodeObjectType);
return uow.Database.ExecuteScalar<Guid?>(sql);
}
});
return result.HasValue ? Attempt.Succeed(result.Value) : Attempt<Guid>.Fail();
}
private static Guid GetNodeObjectTypeGuid(UmbracoObjectTypes umbracoObjectType)
{
var guid = umbracoObjectType.GetGuid();
if (guid == Guid.Empty)
throw new NotSupportedException("Unsupported object type (" + umbracoObjectType + ").");
return guid;
return _idkMap.GetKeyForId(id, umbracoObjectType);
}
public IUmbracoEntity GetByKey(Guid key, bool loadBaseType = true)
@@ -394,7 +336,7 @@ namespace Umbraco.Core.Services
/// <param name="totalRecords"></param>
/// <param name="orderBy"></param>
/// <param name="orderDirection"></param>
/// <param name="filter"></param>
/// <param name="filter"></param>
/// <returns></returns>
public IEnumerable<IUmbracoEntity> GetPagedDescendants(int id, UmbracoObjectTypes umbracoObjectType, long pageIndex, int pageSize, out long totalRecords,
string orderBy = "path", Direction orderDirection = Direction.Ascending, string filter = "")
@@ -407,7 +349,7 @@ namespace Umbraco.Core.Services
var query = Query<IUmbracoEntity>.Builder;
//if the id is System Root, then just get all
if (id != Constants.System.Root)
query.Where(x => x.Path.SqlContains(string.Format(",{0},", id), TextColumnType.NVarchar));
query.Where(x => x.Path.SqlContains(string.Format(",{0},", id), TextColumnType.NVarchar));
IQuery<IUmbracoEntity> filterQuery = null;
if (filter.IsNullOrWhiteSpace() == false)
@@ -14,8 +14,7 @@ namespace Umbraco.Core.Services
{
public ExternalLoginService(IDatabaseUnitOfWorkProvider provider, RepositoryFactory repositoryFactory, ILogger logger, IEventMessagesFactory eventMessagesFactory)
: base(provider, repositoryFactory, logger, eventMessagesFactory)
{
}
{ }
/// <summary>
/// Returns all user logins assigned
@@ -23,30 +22,32 @@ namespace Umbraco.Core.Services
/// <param name="userId"></param>
/// <returns></returns>
public IEnumerable<IIdentityUserLogin> GetAll(int userId)
{
using (var uow = UowProvider.GetUnitOfWork())
{
using (var uow = UowProvider.GetUnitOfWork(readOnly: true))
{
// ToList is important here, must evaluate within uow!
var repo = RepositoryFactory.CreateExternalLoginRepository(uow);
var ret = repo.GetByQuery(new Query<IIdentityUserLogin>().Where(x => x.UserId == userId));
uow.Commit();
return ret;
return repo.GetByQuery(new Query<IIdentityUserLogin>()
.Where(x => x.UserId == userId))
.ToList();
}
}
/// <summary>
/// Returns all logins matching the login info - generally there should only be one but in some cases
/// Returns all logins matching the login info - generally there should only be one but in some cases
/// there might be more than one depending on if an adminstrator has been editing/removing members
/// </summary>
/// <param name="login"></param>
/// <returns></returns>
public IEnumerable<IIdentityUserLogin> Find(UserLoginInfo login)
{
using (var uow = UowProvider.GetUnitOfWork())
using (var uow = UowProvider.GetUnitOfWork(readOnly: true))
{
// ToList is important here, must evaluate within uow!
var repo = RepositoryFactory.CreateExternalLoginRepository(uow);
var ret = repo.GetByQuery(new Query<IIdentityUserLogin>().Where(x => x.ProviderKey == login.ProviderKey && x.LoginProvider == login.LoginProvider));
uow.Commit();
return ret;
return repo.GetByQuery(new Query<IIdentityUserLogin>()
.Where(x => x.ProviderKey == login.ProviderKey && x.LoginProvider == login.LoginProvider))
.ToList();
}
}
@@ -78,7 +79,5 @@ namespace Umbraco.Core.Services
uow.Commit();
}
}
}
}
+76
View File
@@ -621,6 +621,34 @@ namespace Umbraco.Core.Services
}
}
public Stream GetMacroScriptFileContentStream(string filepath)
{
using (var uow = UowProvider.GetUnitOfWork(readOnly: true))
{
var repository = RepositoryFactory.CreateMacroScriptRepository(uow);
return repository.GetFileContentStream(filepath);
}
}
public void SetMacroScriptFileContent(string filepath, Stream content)
{
using (var uow = UowProvider.GetUnitOfWork())
{
var repository = RepositoryFactory.CreateMacroScriptRepository(uow);
repository.SetFileContent(filepath, content);
uow.Commit();
}
}
public long GetMacroScriptFileSize(string filepath)
{
using (var uow = UowProvider.GetUnitOfWork(readOnly: true))
{
var repository = RepositoryFactory.CreateMacroScriptRepository(uow);
return repository.GetFileSize(filepath);
}
}
#endregion
public Stream GetStylesheetFileContentStream(string filepath)
@@ -679,6 +707,34 @@ namespace Umbraco.Core.Services
}
}
public Stream GetUserControlFileContentStream(string filepath)
{
using (var uow = UowProvider.GetUnitOfWork(readOnly: true))
{
var repository = RepositoryFactory.CreateUserControlRepository(uow);
return repository.GetFileContentStream(filepath);
}
}
public void SetUserControlFileContent(string filepath, Stream content)
{
using (var uow = UowProvider.GetUnitOfWork())
{
var repository = RepositoryFactory.CreateUserControlRepository(uow);
repository.SetFileContent(filepath, content);
uow.Commit();
}
}
public long GetUserControlFileSize(string filepath)
{
using (var uow = UowProvider.GetUnitOfWork(readOnly: true))
{
var repository = RepositoryFactory.CreateUserControlRepository(uow);
return repository.GetFileSize(filepath);
}
}
public Stream GetXsltFileContentStream(string filepath)
{
using (var uow = UowProvider.GetUnitOfWork(readOnly: true))
@@ -783,6 +839,26 @@ namespace Umbraco.Core.Services
}
}
[Obsolete("MacroScripts are obsolete - this is for backwards compatibility with upgraded sites.")]
public IPartialView GetMacroScript(string path)
{
using (var uow = UowProvider.GetUnitOfWork(readOnly: true))
{
var repository = RepositoryFactory.CreateMacroScriptRepository(uow);
return repository.Get(path);
}
}
[Obsolete("UserControls are obsolete - this is for backwards compatibility with upgraded sites.")]
public IUserControl GetUserControl(string path)
{
using (var uow = UowProvider.GetUnitOfWork(readOnly: true))
{
var repository = RepositoryFactory.CreateUserControlRepository(uow);
return repository.Get(path);
}
}
public IEnumerable<IPartialView> GetPartialViewMacros(params string[] names)
{
using (var uow = UowProvider.GetUnitOfWork(readOnly: true))
+8 -1
View File
@@ -28,7 +28,14 @@ namespace Umbraco.Core.Services
/// <param name="key"></param>
/// <param name="umbracoObjectType"></param>
/// <returns></returns>
Attempt<int> GetIdForKey(Guid key, UmbracoObjectTypes umbracoObjectType);
Attempt<int> GetIdForKey(Guid key, UmbracoObjectTypes umbracoObjectType);
/// <summary>
/// Returns the integer id for a given Udi
/// </summary>
/// <param name="udi"></param>
/// <returns></returns>
Attempt<int> GetIdForUdi(Udi udi);
/// <summary>
/// Returns the GUID for a given integer id
+46
View File
@@ -17,6 +17,10 @@ namespace Umbraco.Core.Services
void DeletePartialViewMacroFolder(string folderPath);
IPartialView GetPartialView(string path);
IPartialView GetPartialViewMacro(string path);
[Obsolete("MacroScripts are obsolete - this is for backwards compatibility with upgraded sites.")]
IPartialView GetMacroScript(string path);
[Obsolete("UserControls are obsolete - this is for backwards compatibility with upgraded sites.")]
IUserControl GetUserControl(string path);
IEnumerable<IPartialView> GetPartialViewMacros(params string[] names);
IXsltFile GetXsltFile(string path);
IEnumerable<IXsltFile> GetXsltFiles(params string[] names);
@@ -263,6 +267,27 @@ namespace Umbraco.Core.Services
/// <returns>The size of the template.</returns>
long GetTemplateFileSize(string filepath);
/// <summary>
/// Gets the content of a macroscript as a stream.
/// </summary>
/// <param name="filepath">The filesystem path to the macroscript.</param>
/// <returns>The content of the macroscript.</returns>
Stream GetMacroScriptFileContentStream(string filepath);
/// <summary>
/// Sets the content of a macroscript.
/// </summary>
/// <param name="filepath">The filesystem path to the macroscript.</param>
/// <param name="content">The content of the macroscript.</param>
void SetMacroScriptFileContent(string filepath, Stream content);
/// <summary>
/// Gets the size of a macroscript.
/// </summary>
/// <param name="filepath">The filesystem path to the macroscript.</param>
/// <returns>The size of the macroscript.</returns>
long GetMacroScriptFileSize(string filepath);
/// <summary>
/// Gets the content of a stylesheet as a stream.
/// </summary>
@@ -305,6 +330,27 @@ namespace Umbraco.Core.Services
/// <returns>The size of the script file.</returns>
long GetScriptFileSize(string filepath);
/// <summary>
/// Gets the content of a usercontrol as a stream.
/// </summary>
/// <param name="filepath">The filesystem path to the usercontrol.</param>
/// <returns>The content of the usercontrol.</returns>
Stream GetUserControlFileContentStream(string filepath);
/// <summary>
/// Sets the content of a usercontrol.
/// </summary>
/// <param name="filepath">The filesystem path to the usercontrol.</param>
/// <param name="content">The content of the usercontrol.</param>
void SetUserControlFileContent(string filepath, Stream content);
/// <summary>
/// Gets the size of a usercontrol.
/// </summary>
/// <param name="filepath">The filesystem path to the usercontrol.</param>
/// <returns>The size of the usercontrol.</returns>
long GetUserControlFileSize(string filepath);
/// <summary>
/// Gets the content of a XSLT file as a stream.
/// </summary>
@@ -72,6 +72,18 @@ namespace Umbraco.Core.Services
/// <returns><see cref="IMembershipUser"/></returns>
T CreateWithIdentity(string username, string email, string passwordValue, string memberTypeAlias);
/// <summary>
/// Creates and persists a new <see cref="IMembershipUser"/>
/// </summary>
/// <remarks>An <see cref="IMembershipUser"/> can be of type <see cref="IMember"/> or <see cref="IUser"/></remarks>
/// <param name="username">Username of the <see cref="IMembershipUser"/> to create</param>
/// <param name="email">Email of the <see cref="IMembershipUser"/> to create</param>
/// <param name="passwordValue">This value should be the encoded/encrypted/hashed value for the password that will be stored in the database</param>
/// <param name="memberTypeAlias">Alias of the Type</param>
/// <param name="isApproved">IsApproved of the <see cref="IMembershipUser"/> to create</param>
/// <returns><see cref="IMembershipUser"/></returns>
T CreateWithIdentity(string username, string email, string passwordValue, string memberTypeAlias, bool isApproved);
/// <summary>
/// Gets an <see cref="IMembershipUser"/> by its provider key
/// </summary>
+171
View File
@@ -0,0 +1,171 @@
using System;
using System.Collections.Generic;
using System.Threading;
using Umbraco.Core.Models;
using Umbraco.Core.Persistence.UnitOfWork;
namespace Umbraco.Core.Services
{
public class IdkMap
{
private readonly IDatabaseUnitOfWorkProvider _uowProvider;
private readonly ReaderWriterLockSlim _locker = new ReaderWriterLockSlim();
private readonly Dictionary<int, Guid> _id2Key = new Dictionary<int, Guid>();
private readonly Dictionary<Guid, int> _key2Id = new Dictionary<Guid, int>();
public IdkMap(IDatabaseUnitOfWorkProvider uowProvider)
{
_uowProvider = uowProvider;
}
// note - no need for uow, scope would be enough, but a pain to wire
// note - for pure read-only we might want to *not* enforce a transaction?
public Attempt<int> GetIdForKey(Guid key, UmbracoObjectTypes umbracoObjectType)
{
int id;
try
{
_locker.EnterReadLock();
if (_key2Id.TryGetValue(key, out id)) return Attempt.Succeed(id);
}
finally
{
if (_locker.IsReadLockHeld)
_locker.ExitReadLock();
}
int? val;
using (var uow = _uowProvider.GetUnitOfWork())
{
val = uow.Database.ExecuteScalar<int?>("SELECT id FROM umbracoNode WHERE uniqueId=@id AND nodeObjectType=@nodeObjectType",
new { id = key, nodeObjectType = GetNodeObjectTypeGuid(umbracoObjectType) });
uow.Commit();
}
if (val == null) return Attempt<int>.Fail();
id = val.Value;
try
{
_locker.EnterWriteLock();
_id2Key[id] = key;
_key2Id[key] = id;
}
finally
{
if (_locker.IsWriteLockHeld)
_locker.ExitWriteLock();
}
return Attempt.Succeed(id);
}
public Attempt<int> GetIdForUdi(Udi udi)
{
var guidUdi = udi as GuidUdi;
if (guidUdi == null)
return Attempt<int>.Fail();
var umbracoType = Constants.UdiEntityType.ToUmbracoObjectType(guidUdi.EntityType);
return GetIdForKey(guidUdi.Guid, umbracoType);
}
public Attempt<Guid> GetKeyForId(int id, UmbracoObjectTypes umbracoObjectType)
{
Guid key;
try
{
_locker.EnterReadLock();
if (_id2Key.TryGetValue(id, out key)) return Attempt.Succeed(key);
}
finally
{
if (_locker.IsReadLockHeld)
_locker.ExitReadLock();
}
Guid? val;
using (var uow = _uowProvider.GetUnitOfWork())
{
val = uow.Database.ExecuteScalar<Guid?>("SELECT uniqueId FROM umbracoNode WHERE id=@id AND nodeObjectType=@nodeObjectType",
new { id, nodeObjectType = GetNodeObjectTypeGuid(umbracoObjectType) });
uow.Commit();
}
if (val == null) return Attempt<Guid>.Fail();
key = val.Value;
try
{
_locker.EnterWriteLock();
_id2Key[id] = key;
_key2Id[key] = id;
}
finally
{
if (_locker.IsWriteLockHeld)
_locker.ExitWriteLock();
}
return Attempt.Succeed(key);
}
private static Guid GetNodeObjectTypeGuid(UmbracoObjectTypes umbracoObjectType)
{
var guid = umbracoObjectType.GetGuid();
if (guid == Guid.Empty)
throw new NotSupportedException("Unsupported object type (" + umbracoObjectType + ").");
return guid;
}
public void ClearCache()
{
try
{
_locker.EnterWriteLock();
_id2Key.Clear();
_key2Id.Clear();
}
finally
{
if (_locker.IsWriteLockHeld)
_locker.ExitWriteLock();
}
}
public void ClearCache(int id)
{
try
{
_locker.EnterWriteLock();
Guid key;
if (_id2Key.TryGetValue(id, out key) == false) return;
_id2Key.Remove(id);
_key2Id.Remove(key);
}
finally
{
if (_locker.IsWriteLockHeld)
_locker.ExitWriteLock();
}
}
public void ClearCache(Guid key)
{
try
{
_locker.EnterWriteLock();
int id;
if (_key2Id.TryGetValue(key, out id) == false) return;
_id2Key.Remove(id);
_key2Id.Remove(key);
}
finally
{
if (_locker.IsWriteLockHeld)
_locker.ExitWriteLock();
}
}
}
}
+25 -14
View File
@@ -35,14 +35,16 @@ namespace Umbraco.Core.Services
private readonly IDataTypeService _dataTypeService;
private readonly IUserService _userService;
private readonly MediaFileSystem _mediaFileSystem = FileSystemProviderManager.Current.MediaFileSystem;
private readonly IdkMap _idkMap;
public MediaService(IDatabaseUnitOfWorkProvider provider, RepositoryFactory repositoryFactory, ILogger logger, IEventMessagesFactory eventMessagesFactory, IDataTypeService dataTypeService, IUserService userService)
public MediaService(IDatabaseUnitOfWorkProvider provider, RepositoryFactory repositoryFactory, ILogger logger, IEventMessagesFactory eventMessagesFactory, IDataTypeService dataTypeService, IUserService userService, IdkMap idkMap)
: base(provider, repositoryFactory, logger, eventMessagesFactory)
{
if (dataTypeService == null) throw new ArgumentNullException("dataTypeService");
if (userService == null) throw new ArgumentNullException("userService");
_dataTypeService = dataTypeService;
_userService = userService;
_idkMap = idkMap;
}
/// <summary>
@@ -327,12 +329,15 @@ namespace Umbraco.Core.Services
/// <returns><see cref="IMedia"/></returns>
public IMedia GetById(Guid key)
{
using (var uow = UowProvider.GetUnitOfWork(readOnly: true))
{
var repository = RepositoryFactory.CreateMediaRepository(uow);
var query = Query<IMedia>.Builder.Where(x => x.Key == key);
return repository.GetByQuery(query).SingleOrDefault();
}
// the repository implements a cache policy on int identifiers, not guids,
// and we are not changing it now, but we still would like to rely on caching
// instead of running a full query against the database, so relying on the
// id-key map, which is fast.
//
// we should inject the id-key map but ... breaking changes ... yada
var a = _idkMap.GetIdForKey(key, UmbracoObjectTypes.Media);
return a.Success ? GetById(a.Result) : null;
}
/// <summary>
@@ -692,11 +697,11 @@ namespace Umbraco.Core.Services
}
Func<string, Sql> createSql = url => new Sql().Select("*")
.From<PropertyDataDto>()
.InnerJoin<PropertyTypeDto>()
.On<PropertyDataDto, PropertyTypeDto>(left => left.PropertyTypeId, right => right.Id)
.Where<PropertyTypeDto>(x => x.Alias == "umbracoFile")
.Where<PropertyDataDto>(x => x.VarChar == url);
.From<PropertyDataDto>()
.InnerJoin<PropertyTypeDto>()
.On<PropertyDataDto, PropertyTypeDto>(left => left.PropertyTypeId, right => right.Id)
.Where<PropertyTypeDto>(x => x.Alias == "umbracoFile")
.Where<PropertyDataDto>(x => x.VarChar == url);
var sql = createSql(umbracoFileValue);
@@ -900,7 +905,13 @@ namespace Umbraco.Core.Services
}
var repository = RepositoryFactory.CreateMediaRepository(uow);
media.CreatorId = userId;
//set the creator id if it's new
if (media.HasIdentity == false)
{
media.CreatorId = userId;
}
repository.AddOrUpdate(media);
repository.AddOrUpdateContentXml(media, m => _entitySerializer.Serialize(this, _dataTypeService, _userService, m));
// generate preview for blame history?
@@ -1048,7 +1059,7 @@ namespace Umbraco.Core.Services
/// <param name="userId">Optional id of the user deleting the media</param>
public void DeleteMediaOfType(int mediaTypeId, int userId = 0)
{
DeleteMediaOfTypes(new[] {mediaTypeId}, userId);
DeleteMediaOfTypes(new[] { mediaTypeId }, userId);
}
/// <summary>
+19 -2
View File
@@ -826,6 +826,22 @@ namespace Umbraco.Core.Services
return CreateMemberWithIdentity(username, email, username, passwordValue, memberType);
}
/// <summary>
/// Creates and persists a new <see cref="IMember"/>
/// </summary>
/// <remarks>An <see cref="IMembershipUser"/> can be of type <see cref="IMember"/> or <see cref="IUser"/></remarks>
/// <param name="username">Username of the <see cref="IMembershipUser"/> to create</param>
/// <param name="email">Email of the <see cref="IMembershipUser"/> to create</param>
/// <param name="passwordValue">This value should be the encoded/encrypted/hashed value for the password that will be stored in the database</param>
/// <param name="memberTypeAlias">Alias of the Type</param>
/// <param name="isApproved">Is the member approved</param>
/// <returns><see cref="IMember"/></returns>
IMember IMembershipMemberService<IMember>.CreateWithIdentity(string username, string email, string passwordValue, string memberTypeAlias, bool isApproved)
{
var memberType = FindMemberTypeByAlias(memberTypeAlias);
return CreateMemberWithIdentity(username, email, username, passwordValue, memberType, isApproved);
}
/// <summary>
/// Creates and persists a Member
/// </summary>
@@ -836,12 +852,13 @@ namespace Umbraco.Core.Services
/// <param name="name">Name of the Member to create</param>
/// <param name="passwordValue">This value should be the encoded/encrypted/hashed value for the password that will be stored in the database</param>
/// <param name="memberType">MemberType the Member should be based on</param>
/// <param name="isApproved">Optional IsApproved of the Member to create</param>
/// <returns><see cref="IMember"/></returns>
private IMember CreateMemberWithIdentity(string username, string email, string name, string passwordValue, IMemberType memberType)
private IMember CreateMemberWithIdentity(string username, string email, string name, string passwordValue, IMemberType memberType, bool isApproved = true)
{
if (memberType == null) throw new ArgumentNullException("memberType");
var member = new Member(name, email.ToLower().Trim(), username, passwordValue, memberType);
var member = new Member(name, email.ToLower().Trim(), username, passwordValue, memberType, isApproved);
using (var uow = UowProvider.GetUnitOfWork())
{
+25 -18
View File
@@ -89,18 +89,18 @@ namespace Umbraco.Core.Services
/// <returns></returns>
public string FetchPackageFile(Guid packageId, Version umbracoVersion, int userId)
{
var packageRepo = UmbracoConfig.For.UmbracoSettings().PackageRepositories.GetDefault();
var packageRepo = UmbracoConfig.For.UmbracoSettings().PackageRepositories.GetDefault();
using (var httpClient = new HttpClient())
using (var uow = _uowProvider.GetUnitOfWork())
{
{
//includeHidden = true because we don't care if it's hidden we want to get the file regardless
var url = string.Format("{0}/{1}?version={2}&includeHidden=true&asFile=true", packageRepo.RestApiUrl, packageId, umbracoVersion.ToString(3));
byte[] bytes;
try
{
bytes = httpClient.GetByteArrayAsync(url).GetAwaiter().GetResult();
}
try
{
bytes = httpClient.GetByteArrayAsync(url).GetAwaiter().GetResult();
}
catch (HttpRequestException ex)
{
throw new ConnectionException("An error occuring downloading the package from " + url, ex);
@@ -109,20 +109,20 @@ namespace Umbraco.Core.Services
//successfull
if (bytes.Length > 0)
{
var packagePath = IOHelper.MapPath(SystemDirectories.Packages);
var packagePath = IOHelper.MapPath(SystemDirectories.Packages);
// Check for package directory
if (Directory.Exists(packagePath) == false)
Directory.CreateDirectory(packagePath);
var packageFilePath = Path.Combine(packagePath, packageId + ".umb");
var packageFilePath = Path.Combine(packagePath, packageId + ".umb");
using (var fs1 = new FileStream(packageFilePath, FileMode.Create))
{
fs1.Write(bytes, 0, bytes.Length);
return "packages\\" + packageId + ".umb";
}
}
}
Audit(uow, AuditType.PackagerInstall, string.Format("Package {0} fetched from {1}", packageId, packageRepo.Id), userId, -1);
return null;
@@ -133,7 +133,7 @@ namespace Umbraco.Core.Services
{
var auditRepo = _repositoryFactory.CreateAuditRepository(uow);
auditRepo.AddOrUpdate(new AuditItem(objectId, message, type, userId));
}
}
#region Content
@@ -285,6 +285,7 @@ namespace Umbraco.Core.Services
var nodeName = element.Attribute("nodeName").Value;
var path = element.Attribute("path").Value;
var template = element.Attribute("template").Value;
var key = Guid.Empty;
var properties = from property in element.Elements()
where property.Attribute("isDoc") == null
@@ -302,6 +303,12 @@ namespace Umbraco.Core.Services
SortOrder = int.Parse(sortOrder)
};
if (element.Attribute("key") != null && Guid.TryParse(element.Attribute("key").Value, out key))
{
// update the Guid (for UDI support)
content.Key = key;
}
foreach (var property in properties)
{
string propertyTypeAlias = isLegacySchema ? property.Attribute("alias").Value : property.Name.LocalName;
@@ -520,7 +527,7 @@ namespace Umbraco.Core.Services
{
var foldersAttribute = documentType.Attribute("Folders");
var infoElement = documentType.Element("Info");
if (foldersAttribute != null && infoElement != null
if (foldersAttribute != null && infoElement != null
//don't import any folder if this is a child doc type - the parent doc type will need to
//exist which contains it's folders
&& ((string)infoElement.Element("Master")).IsNullOrWhiteSpace())
@@ -1041,7 +1048,7 @@ namespace Umbraco.Core.Services
{
_logger.Error<PackagingService>("Could not create folder: " + rootFolder, tryCreateFolder.Exception);
throw tryCreateFolder.Exception;
}
}
current = _dataTypeService.GetContainer(tryCreateFolder.Result.Entity.Id);
}
@@ -1091,14 +1098,14 @@ namespace Umbraco.Core.Services
if (dataTypeDefinition != null)
{
var valuesWithoutKeys = prevaluesElement.Elements("PreValue")
.Where(x => ((string) x.Attribute("Alias")).IsNullOrWhiteSpace())
.Where(x => ((string)x.Attribute("Alias")).IsNullOrWhiteSpace())
.Select(x => x.Attribute("Value").Value);
var valuesWithKeys = prevaluesElement.Elements("PreValue")
.Where(x => ((string) x.Attribute("Alias")).IsNullOrWhiteSpace() == false)
.Where(x => ((string)x.Attribute("Alias")).IsNullOrWhiteSpace() == false)
.ToDictionary(
key => (string) key.Attribute("Alias"),
val => new PreValue((string) val.Attribute("Value")));
key => (string)key.Attribute("Alias"),
val => new PreValue((string)val.Attribute("Value")));
//save the values with keys
_dataTypeService.SavePreValues(dataTypeDefinition, valuesWithKeys);
@@ -1956,12 +1963,12 @@ namespace Umbraco.Core.Services
/// <summary>
/// Occurs after a package is imported
/// </summary>
internal static event TypedEventHandler<IPackagingService, ImportPackageEventArgs<InstallationSummary>> ImportedPackage;
public static event TypedEventHandler<IPackagingService, ImportPackageEventArgs<InstallationSummary>> ImportedPackage;
/// <summary>
/// Occurs after a package is uninstalled
/// </summary>
internal static event TypedEventHandler<IPackagingService, UninstallPackageEventArgs<UninstallationSummary>> UninstalledPackage;
public static event TypedEventHandler<IPackagingService, UninstallPackageEventArgs<UninstallationSummary>> UninstalledPackage;
#endregion
}
+10 -6
View File
@@ -63,6 +63,8 @@ namespace Umbraco.Core.Services
private Lazy<IExternalLoginService> _externalLoginService;
private Lazy<IRedirectUrlService> _redirectUrlService;
internal IdkMap IdkMap { get; private set; }
/// <summary>
/// public ctor - will generally just be used for unit testing all items are optional and if not specified, the defaults will be used
/// </summary>
@@ -171,9 +173,11 @@ namespace Umbraco.Core.Services
EventMessagesFactory = eventMessagesFactory;
IdkMap = new IdkMap(provider);
BuildServiceCache(provider, cache,
repositoryFactory,
logger, eventMessagesFactory);
logger, eventMessagesFactory, IdkMap);
}
/// <summary>
@@ -184,7 +188,8 @@ namespace Umbraco.Core.Services
CacheHelper cache,
RepositoryFactory repositoryFactory,
ILogger logger,
IEventMessagesFactory eventMessagesFactory)
IEventMessagesFactory eventMessagesFactory,
IdkMap idkMap)
{
EventMessagesFactory = eventMessagesFactory;
@@ -256,10 +261,10 @@ namespace Umbraco.Core.Services
_memberService = new Lazy<IMemberService>(() => new MemberService(provider, repositoryFactory, logger, eventMessagesFactory, _memberGroupService.Value, _dataTypeService.Value));
if (_contentService == null)
_contentService = new Lazy<IContentService>(() => new ContentService(provider, repositoryFactory, logger, eventMessagesFactory, _dataTypeService.Value, _userService.Value));
_contentService = new Lazy<IContentService>(() => new ContentService(provider, repositoryFactory, logger, eventMessagesFactory, _dataTypeService.Value, _userService.Value, idkMap));
if (_mediaService == null)
_mediaService = new Lazy<IMediaService>(() => new MediaService(provider, repositoryFactory, logger, eventMessagesFactory, _dataTypeService.Value, _userService.Value));
_mediaService = new Lazy<IMediaService>(() => new MediaService(provider, repositoryFactory, logger, eventMessagesFactory, _dataTypeService.Value, _userService.Value, idkMap));
if (_contentTypeService == null)
_contentTypeService = new Lazy<IContentTypeService>(() => new ContentTypeService(provider, repositoryFactory, logger, eventMessagesFactory, _contentService.Value, _mediaService.Value));
@@ -277,8 +282,7 @@ namespace Umbraco.Core.Services
_entityService = new Lazy<IEntityService>(() => new EntityService(
provider, repositoryFactory, logger, eventMessagesFactory,
_contentService.Value, _contentTypeService.Value, _mediaService.Value, _dataTypeService.Value, _memberService.Value, _memberTypeService.Value,
//TODO: Consider making this an isolated cache instead of using the global one
cache.RuntimeCache));
idkMap));
if (_packagingService == null)
_packagingService = new Lazy<IPackagingService>(() => new PackagingService(logger, _contentService.Value, _contentTypeService.Value, _mediaService.Value, _macroService.Value, _dataTypeService.Value, _fileService.Value, _localizationService.Value, _entityService.Value, _userService.Value, repositoryFactory, provider));
+23 -3
View File
@@ -19,7 +19,6 @@ namespace Umbraco.Core.Services
/// </summary>
public class UserService : ScopeRepositoryService, IUserService
{
//TODO: We need to change the isUpgrading flag to use an app state enum as described here: http://issues.umbraco.org/issue/U4-6816
// in the meantime, we will use a boolean which we are currently using during upgrades to ensure that a user object is not persisted during this phase, otherwise
// exceptions can occur if the db is not in it's correct state.
@@ -113,6 +112,26 @@ namespace Umbraco.Core.Services
return CreateUserWithIdentity(username, email, passwordValue, userType);
}
/// <summary>
/// Creates and persists a new <see cref="IUser"/>
/// </summary>
/// <param name="username">Username of the <see cref="IUser"/> to create</param>
/// <param name="email">Email of the <see cref="IUser"/> to create</param>
/// <param name="passwordValue">This value should be the encoded/encrypted/hashed value for the password that will be stored in the database</param>
/// <param name="memberTypeAlias">Alias of the Type</param>
/// <param name="isApproved">Is the member approved</param>
/// <returns><see cref="IUser"/></returns>
IUser IMembershipMemberService<IUser>.CreateWithIdentity(string username, string email, string passwordValue, string memberTypeAlias, bool isApproved)
{
var userType = GetUserTypeByAlias(memberTypeAlias);
if (userType == null)
{
throw new EntityNotFoundException("The user type " + memberTypeAlias + " could not be resolved");
}
return CreateUserWithIdentity(username, email, passwordValue, userType, isApproved);
}
/// <summary>
/// Creates and persists a Member
/// </summary>
@@ -122,8 +141,9 @@ namespace Umbraco.Core.Services
/// <param name="email">Email of the Member to create</param>
/// <param name="passwordValue">This value should be the encoded/encrypted/hashed value for the password that will be stored in the database</param>
/// <param name="userType">MemberType the Member should be based on</param>
/// <param name="isApproved">Is the user approved</param>
/// <returns><see cref="IUser"/></returns>
private IUser CreateUserWithIdentity(string username, string email, string passwordValue, IUserType userType)
private IUser CreateUserWithIdentity(string username, string email, string passwordValue, IUserType userType, bool isApproved = true)
{
if (userType == null) throw new ArgumentNullException("userType");
@@ -152,7 +172,7 @@ namespace Umbraco.Core.Services
StartContentId = -1,
StartMediaId = -1,
IsLockedOut = false,
IsApproved = true
IsApproved = isApproved
};
//adding default sections content and media
user.AddAllowedSection("content");
+128 -49
View File
@@ -701,67 +701,72 @@ namespace Umbraco.Core
return val;
}
/// <summary>
/// Generates a hash of a string based on the FIPS compliance setting.
/// </summary>
/// <param name="str">Referrs to itself</param>
/// <returns>The hashed string</returns>
public static string GenerateHash(this string str)
{
return CryptoConfig.AllowOnlyFipsAlgorithms
? str.ToSHA1()
: str.ToMd5();
}
/// <summary>
/// Converts the string to MD5
/// </summary>
/// <param name="stringToConvert">referrs to itself</param>
/// <returns>the md5 hashed string</returns>
/// <param name="stringToConvert">Referrs to itself</param>
/// <returns>The MD5 hashed string</returns>
public static string ToMd5(this string stringToConvert)
{
//create an instance of the MD5CryptoServiceProvider
var md5Provider = new MD5CryptoServiceProvider();
//convert our string into byte array
var byteArray = Encoding.UTF8.GetBytes(stringToConvert);
//get the hashed values created by our MD5CryptoServiceProvider
var hashedByteArray = md5Provider.ComputeHash(byteArray);
//create a StringBuilder object
var stringBuilder = new StringBuilder();
//loop to each each byte
foreach (var b in hashedByteArray)
{
//append it to our StringBuilder
stringBuilder.Append(b.ToString("x2").ToLower());
}
//return the hashed value
return stringBuilder.ToString();
return stringToConvert.GenerateHash("MD5");
}
/// <summary>
/// Converts the string to SHA1
/// </summary>
/// <param name="stringToConvert">referrs to itself</param>
/// <returns>the md5 hashed string</returns>
/// <returns>The SHA1 hashed string</returns>
public static string ToSHA1(this string stringToConvert)
{
//create an instance of the SHA1CryptoServiceProvider
var md5Provider = new SHA1CryptoServiceProvider();
//convert our string into byte array
var byteArray = Encoding.UTF8.GetBytes(stringToConvert);
//get the hashed values created by our SHA1CryptoServiceProvider
var hashedByteArray = md5Provider.ComputeHash(byteArray);
//create a StringBuilder object
var stringBuilder = new StringBuilder();
//loop to each each byte
foreach (var b in hashedByteArray)
{
//append it to our StringBuilder
stringBuilder.Append(b.ToString("x2").ToLower());
}
//return the hashed value
return stringBuilder.ToString();
return stringToConvert.GenerateHash("SHA1");
}
/// <summary>Generate a hash of a string based on the hashType passed in
/// </summary>
/// <param name="str">Referrs to itself</param>
/// <param name="hashType">String with the hash type. See remarks section of the CryptoConfig Class in MSDN docs for a list of possible values.</param>
/// <returns>The hashed string</returns>
private static string GenerateHash(this string str, string hashType)
{
//create an instance of the correct hashing provider based on the type passed in
var hasher = HashAlgorithm.Create(hashType);
if (hasher == null) throw new InvalidOperationException("No hashing type found by name " + hashType);
using (hasher)
{
//convert our string into byte array
var byteArray = Encoding.UTF8.GetBytes(str);
//get the hashed values created by our selected provider
var hashedByteArray = hasher.ComputeHash(byteArray);
//create a StringBuilder object
var stringBuilder = new StringBuilder();
//loop to each each byte
foreach (var b in hashedByteArray)
{
//append it to our StringBuilder
stringBuilder.Append(b.ToString("x2").ToLower());
}
//return the hashed value
return stringBuilder.ToString();
}
}
/// <summary>
/// Decodes a string that was encoded with UrlTokenEncode
/// </summary>
@@ -1465,10 +1470,84 @@ namespace Umbraco.Core
/// <returns></returns>
internal static Guid ToGuid(this string text)
{
var md5 = MD5.Create();
byte[] myStringBytes = Encoding.ASCII.GetBytes(text);
byte[] hash = md5.ComputeHash(myStringBytes);
return new Guid(hash);
return CreateGuidFromHash(UrlNamespace,
text,
CryptoConfig.AllowOnlyFipsAlgorithms
? 5 // SHA1
: 3); // MD5
}
/// <summary>
/// The namespace for URLs (from RFC 4122, Appendix C).
///
/// See <a href="http://www.ietf.org/rfc/rfc4122.txt">RFC 4122</a>
/// </summary>
internal static readonly Guid UrlNamespace = new Guid("6ba7b811-9dad-11d1-80b4-00c04fd430c8");
/// <summary>
/// Creates a name-based UUID using the algorithm from RFC 4122 §4.3.
///
/// See <a href="https://github.com/LogosBible/Logos.Utility/blob/master/src/Logos.Utility/GuidUtility.cs#L34">GuidUtility.cs</a> for original implementation.
/// </summary>
/// <param name="namespaceId">The ID of the namespace.</param>
/// <param name="name">The name (within that namespace).</param>
/// <param name="version">The version number of the UUID to create; this value must be either
/// 3 (for MD5 hashing) or 5 (for SHA-1 hashing).</param>
/// <returns>A UUID derived from the namespace and name.</returns>
/// <remarks>See <a href="http://code.logos.com/blog/2011/04/generating_a_deterministic_guid.html">Generating a deterministic GUID</a>.</remarks>
internal static Guid CreateGuidFromHash(Guid namespaceId, string name, int version)
{
if (name == null)
throw new ArgumentNullException("name");
if (version != 3 && version != 5)
throw new ArgumentOutOfRangeException("version", "version must be either 3 or 5.");
// convert the name to a sequence of octets (as defined by the standard or conventions of its namespace) (step 3)
// ASSUME: UTF-8 encoding is always appropriate
byte[] nameBytes = Encoding.UTF8.GetBytes(name);
// convert the namespace UUID to network order (step 3)
byte[] namespaceBytes = namespaceId.ToByteArray();
SwapByteOrder(namespaceBytes);
// comput the hash of the name space ID concatenated with the name (step 4)
byte[] hash;
using (HashAlgorithm algorithm = version == 3 ? (HashAlgorithm)MD5.Create() : SHA1.Create())
{
algorithm.TransformBlock(namespaceBytes, 0, namespaceBytes.Length, null, 0);
algorithm.TransformFinalBlock(nameBytes, 0, nameBytes.Length);
hash = algorithm.Hash;
}
// most bytes from the hash are copied straight to the bytes of the new GUID (steps 5-7, 9, 11-12)
byte[] newGuid = new byte[16];
Array.Copy(hash, 0, newGuid, 0, 16);
// set the four most significant bits (bits 12 through 15) of the time_hi_and_version field to the appropriate 4-bit version number from Section 4.1.3 (step 8)
newGuid[6] = (byte)((newGuid[6] & 0x0F) | (version << 4));
// set the two most significant bits (bits 6 and 7) of the clock_seq_hi_and_reserved to zero and one, respectively (step 10)
newGuid[8] = (byte)((newGuid[8] & 0x3F) | 0x80);
// convert the resulting UUID to local byte order (step 13)
SwapByteOrder(newGuid);
return new Guid(newGuid);
}
// Converts a GUID (expressed as a byte array) to/from network order (MSB-first).
internal static void SwapByteOrder(byte[] guid)
{
SwapBytes(guid, 0, 3);
SwapBytes(guid, 1, 2);
SwapBytes(guid, 4, 5);
SwapBytes(guid, 6, 7);
}
private static void SwapBytes(byte[] guid, int left, int right)
{
byte temp = guid[left];
guid[left] = guid[right];
guid[right] = temp;
}
}
}
+16 -2
View File
@@ -1,5 +1,6 @@
using System;
using System.ComponentModel;
using System.Linq;
namespace Umbraco.Core
{
@@ -20,7 +21,7 @@ namespace Umbraco.Core
/// <param name="entityType">The entity type part of the udi.</param>
/// <param name="id">The string id part of the udi.</param>
public StringUdi(string entityType, string id)
: base(entityType, "umb://" + entityType + "/" + id)
: base(entityType, "umb://" + entityType + "/" + EscapeUriString(id))
{
Id = id;
}
@@ -32,7 +33,20 @@ namespace Umbraco.Core
public StringUdi(Uri uriValue)
: base(uriValue)
{
Id = uriValue.AbsolutePath.TrimStart('/');
Id = Uri.UnescapeDataString(uriValue.AbsolutePath.TrimStart('/'));
}
private static string EscapeUriString(string s)
{
// Uri.EscapeUriString preserves / but also [ and ] which is bad
// Uri.EscapeDataString does not preserve / which is bad
// reserved = : / ? # [ ] @ ! $ & ' ( ) * + , ; =
// unreserved = alpha digit - . _ ~
// we want to preserve the / and the unreserved
// so...
return string.Join("/", s.Split('/').Select(Uri.EscapeDataString));
}
/// <summary>
+5 -1
View File
@@ -68,7 +68,7 @@ namespace Umbraco.Core.Strings
/// <summary>
/// Flag mask for encoding.
/// </summary>
CodeMask = Unicode | Utf8 | Ascii,
CodeMask = Unicode | Utf8 | Ascii | TryAscii,
/// <summary>
/// Unicode encoding.
@@ -86,6 +86,10 @@ namespace Umbraco.Core.Strings
/// </summary>
Ascii = 0x0400,
/// <summary>
/// Ascii encoding, if possible.
/// </summary>
TryAscii = 0x0800,
// role values
@@ -152,12 +152,18 @@ namespace Umbraco.Core.Strings
/// <returns>The short string helper.</returns>
public DefaultShortStringHelper WithDefaultConfig()
{
var urlSegmentConvertTo = CleanStringType.Utf8;
if (_umbracoSettings.RequestHandler.ConvertUrlsToAscii)
urlSegmentConvertTo = CleanStringType.Ascii;
if (_umbracoSettings.RequestHandler.TryConvertUrlsToAscii)
urlSegmentConvertTo = CleanStringType.TryAscii;
return WithConfig(CleanStringType.UrlSegment, new Config
{
PreFilter = ApplyUrlReplaceCharacters,
PostFilter = x => CutMaxLength(x, 240),
IsTerm = (c, leading) => char.IsLetterOrDigit(c) || c == '_', // letter, digit or underscore
StringType = (_umbracoSettings.RequestHandler.ConvertUrlsToAscii ? CleanStringType.Ascii : CleanStringType.Utf8) | CleanStringType.LowerCase,
StringType = urlSegmentConvertTo | CleanStringType.LowerCase,
BreakTermsOnUpper = false,
Separator = '-'
}).WithConfig(CleanStringType.FileName, new Config
@@ -542,9 +548,20 @@ function validateSafeAlias(input, value, immediate, callback) {{
// recode
var codeType = stringType & CleanStringType.CodeMask;
text = codeType == CleanStringType.Ascii
? Utf8ToAsciiConverter.ToAsciiString(text)
: RemoveSurrogatePairs(text);
switch (codeType)
{
case CleanStringType.Ascii:
text = Utf8ToAsciiConverter.ToAsciiString(text);
break;
case CleanStringType.TryAscii:
const char ESC = (char) 27;
var ctext = Utf8ToAsciiConverter.ToAsciiString(text, ESC);
if (ctext.Contains(ESC) == false) text = ctext;
break;
default:
text = RemoveSurrogatePairs(text);
break;
}
// clean
text = CleanCodeString(text, stringType, separator.Value, culture, config);
@@ -17,8 +17,9 @@ namespace Umbraco.Core.Strings
/// Converts an Utf8 string into an Ascii string.
/// </summary>
/// <param name="text">The text to convert.</param>
/// <param name="fail">The character to used to replace characters that cannot properly be converted.</param>
/// <returns>The converted text.</returns>
public static string ToAsciiString(string text)
public static string ToAsciiString(string text, char fail = '?')
{
var input = text.ToCharArray();
@@ -26,7 +27,7 @@ namespace Umbraco.Core.Strings
// but... we should be filtering short strings only...
var output = new char[input.Length * 3]; // *3 because of things such as OE
var len = ToAscii(input, output);
var len = ToAscii(input, output, fail);
return new string(output, 0, len);
//var output = new StringBuilder(input.Length + 16); // default is 16, start with at least input length + little extra
@@ -38,8 +39,9 @@ namespace Umbraco.Core.Strings
/// Converts an Utf8 string into an array of Ascii characters.
/// </summary>
/// <param name="text">The text to convert.</param>
/// <param name="fail">The character to used to replace characters that cannot properly be converted.</param>
/// <returns>The converted text.</returns>
public static char[] ToAsciiCharArray(string text)
public static char[] ToAsciiCharArray(string text, char fail = '?')
{
var input = text.ToCharArray();
@@ -47,7 +49,7 @@ namespace Umbraco.Core.Strings
// but... we should be filtering short strings only...
var output = new char[input.Length * 3]; // *3 because of things such as OE
var len = ToAscii(input, output);
var len = ToAscii(input, output, fail);
var array = new char[len];
Array.Copy(output, array, len);
return array;
@@ -64,10 +66,11 @@ namespace Umbraco.Core.Strings
/// </summary>
/// <param name="input">The input array.</param>
/// <param name="output">The output array.</param>
/// <param name="fail">The character to used to replace characters that cannot properly be converted.</param>
/// <returns>The number of characters in the output array.</returns>
/// <remarks>The caller must ensure that the output array is big enough.</remarks>
/// <exception cref="OverflowException">The output array is not big enough.</exception>
private static int ToAscii(char[] input, char[] output)
private static int ToAscii(char[] input, char[] output, char fail = '?')
{
var opos = 0;
@@ -75,10 +78,10 @@ namespace Umbraco.Core.Strings
if (char.IsSurrogate(input[ipos])) // ignore high surrogate
{
ipos++; // and skip low surrogate
output[opos++] = '?';
output[opos++] = fail;
}
else
ToAscii(input, ipos, output, ref opos);
ToAscii(input, ipos, output, ref opos, fail);
return opos;
}
@@ -109,12 +112,13 @@ namespace Umbraco.Core.Strings
/// <param name="ipos">The input position.</param>
/// <param name="output">The output array.</param>
/// <param name="opos">The output position.</param>
/// <param name="fail">The character to used to replace characters that cannot properly be converted.</param>
/// <remarks>
/// <para>Adapted from various sources on the 'net including <c>Lucene.Net.Analysis.ASCIIFoldingFilter</c>.</para>
/// <para>Input should contain Utf8 characters exclusively and NOT Unicode.</para>
/// <para>Removes controls, normalizes whitespaces, replaces symbols by '?'.</para>
/// </remarks>
private static void ToAscii(char[] input, int ipos, char[] output, ref int opos)
private static void ToAscii(char[] input, int ipos, char[] output, ref int opos, char fail = '?')
{
var c = input[ipos];
@@ -3583,7 +3587,7 @@ namespace Umbraco.Core.Strings
// output[opos++] = c;
// strict ASCII
output[opos++] = '?';
output[opos++] = fail;
break;
}
@@ -4,6 +4,7 @@ using System.Web;
using Umbraco.Core.Configuration;
using Umbraco.Core.Configuration.UmbracoSettings;
using Umbraco.Core.IO;
using Umbraco.Core.Logging;
namespace Umbraco.Core.Sync
{
@@ -40,8 +41,9 @@ namespace Umbraco.Core.Sync
.ToList();
if (serversA.Length == 0)
{
{
_serverRole = ServerRole.Unknown; // config error, actually
LogHelper.Debug<ConfigServerRegistrar>(string.Format("Server Role Unknown: DistributedCalls are enabled but no servers are listed"));
}
else
{
@@ -50,7 +52,10 @@ namespace Umbraco.Core.Sync
var serverName = master.ServerName;
if (appId.IsNullOrWhiteSpace() && serverName.IsNullOrWhiteSpace())
{
_serverRole = ServerRole.Unknown; // config error, actually
LogHelper.Debug<ConfigServerRegistrar>(string.Format("Server Role Unknown: Server Name or AppId missing from Server configuration in DistributedCalls settings"));
}
else
_serverRole = IsCurrentServer(appId, serverName)
? ServerRole.Master
+2 -2
View File
@@ -166,8 +166,8 @@ namespace Umbraco.Core
return true;
}
return false;
}
}
/// <summary>
/// Determines whether [is of generic type] [the specified type].
/// </summary>
+45 -4
View File
@@ -2,6 +2,7 @@ using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Reflection;
@@ -15,11 +16,51 @@ namespace Umbraco.Core
{
private static readonly ConcurrentDictionary<Tuple<Type, bool, bool, bool>, PropertyInfo[]> GetPropertiesCache
= new ConcurrentDictionary<Tuple<Type, bool, bool, bool>, PropertyInfo[]>();
private static readonly ConcurrentDictionary<Type, FieldInfo[]> GetFieldsCache
private static readonly ConcurrentDictionary<Type, FieldInfo[]> GetFieldsCache
= new ConcurrentDictionary<Type, FieldInfo[]>();
private static readonly Assembly[] EmptyAssemblies = new Assembly[0];
/// <summary>
/// Based on a type we'll check if it is IEnumerable{T} (or similar) and if so we'll return a List{T}, this will also deal with array types and return List{T} for those too.
/// If it cannot be done, null is returned.
/// </summary>
/// <param name="obj"></param>
/// <returns></returns>
internal static IList CreateGenericEnumerableFromObject(object obj)
{
var type = obj.GetType();
if (type.IsGenericType)
{
var genericTypeDef = type.GetGenericTypeDefinition();
if (genericTypeDef == typeof(IEnumerable<>)
|| genericTypeDef == typeof(ICollection<>)
|| genericTypeDef == typeof(Collection<>)
|| genericTypeDef == typeof(IList<>)
|| genericTypeDef == typeof(List<>)
//this will occur when Linq is used and we get the odd WhereIterator or DistinctIterators since those are special iterator types
|| obj is IEnumerable)
{
//if it is a IEnumerable<>, IList<T> or ICollection<> we'll use a List<>
var genericType = typeof(List<>).MakeGenericType(type.GetGenericArguments());
//pass in obj to fill the list
return (IList)Activator.CreateInstance(genericType, obj);
}
}
if (type.IsArray)
{
//if its an array, we'll use a List<>
var genericType = typeof(List<>).MakeGenericType(type.GetElementType());
//pass in obj to fill the list
return (IList)Activator.CreateInstance(genericType, obj);
}
return null;
}
/// <summary>
/// Checks if the method is actually overriding a base method
/// </summary>
@@ -45,8 +86,8 @@ namespace Umbraco.Core
if (assembly.IsAppCodeAssembly() || assembly.IsGlobalAsaxAssembly())
return EmptyAssemblies;
// find all assembly references that are referencing the current type's assembly since we
// find all assembly references that are referencing the current type's assembly since we
// should only be scanning those assemblies because any other assembly will definitely not
// contain sub type's of the one we're currently looking for
var name = assembly.GetName().Name;
+3 -2
View File
@@ -101,7 +101,8 @@ namespace Umbraco.Core
public override string ToString()
{
// UriValue is created in the ctor and is never null
return UriValue.ToString();
// use AbsoluteUri here and not ToString else it's not encoded!
return UriValue.AbsoluteUri;
}
/// <summary>
@@ -159,7 +160,7 @@ namespace Umbraco.Core
}
if (udiType == UdiType.StringUdi)
{
udi = path == string.Empty ? GetRootUdi(uri.Host) : new StringUdi(uri.Host, path);
udi = path == string.Empty ? GetRootUdi(uri.Host) : new StringUdi(uri.Host, Uri.UnescapeDataString(path));
return true;
}
if (tryParse) return false;
+10 -1
View File
@@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using Umbraco.Core.Models;
namespace Umbraco.Core
@@ -70,6 +69,10 @@ namespace Umbraco.Core
[UdiType(UdiType.StringUdi)]
public const string AnyString = "any-string"; // that one is for tests
[UdiType(UdiType.StringUdi)]
public const string Language = "language";
[UdiType(UdiType.StringUdi)]
public const string MacroScript = "macroscript";
[UdiType(UdiType.StringUdi)]
public const string MediaFile = "media-file";
[UdiType(UdiType.StringUdi)]
@@ -83,6 +86,8 @@ namespace Umbraco.Core
[UdiType(UdiType.StringUdi)]
public const string PartialViewMacro = "partial-view-macro";
[UdiType(UdiType.StringUdi)]
public const string UserControl = "usercontrol";
[UdiType(UdiType.StringUdi)]
public const string Xslt = "xslt";
public static string FromUmbracoObjectType(UmbracoObjectTypes umbracoObjectType)
@@ -123,6 +128,8 @@ namespace Umbraco.Core
return FormsPreValue;
case UmbracoObjectTypes.FormsDataSource:
return FormsDataSource;
case UmbracoObjectTypes.Language:
return Language;
}
throw new NotSupportedException(string.Format("UmbracoObjectType \"{0}\" does not have a matching EntityType.", umbracoObjectType));
}
@@ -165,6 +172,8 @@ namespace Umbraco.Core
return UmbracoObjectTypes.FormsPreValue;
case FormsDataSource:
return UmbracoObjectTypes.FormsDataSource;
case Language:
return UmbracoObjectTypes.Language;
}
throw new NotSupportedException(
string.Format("EntityType \"{0}\" does not have a matching UmbracoObjectType.", entityType));
+34 -3
View File
@@ -97,7 +97,7 @@ namespace Umbraco.Core
/// </summary>
/// <param name="entity">The entity.</param>
/// <returns>The entity identifier of the entity.</returns>
public static GuidUdi GetUdi(this Umbraco.Core.Models.EntityContainer entity)
public static GuidUdi GetUdi(this EntityContainer entity)
{
if (entity == null) throw new ArgumentNullException("entity");
@@ -190,6 +190,17 @@ namespace Umbraco.Core
return new GuidUdi(Constants.UdiEntityType.Macro, entity.Key).EnsureClosed();
}
/// <summary>
/// Gets the entity identifier of the entity.
/// </summary>
/// <param name="entity">The entity.</param>
/// <returns>The entity identifier of the entity.</returns>
public static StringUdi GetUdi(this IUserControl entity)
{
if (entity == null) throw new ArgumentNullException("entity");
return new StringUdi(Constants.UdiEntityType.UserControl, entity.Path.TrimStart('/')).EnsureClosed();
}
/// <summary>
/// Gets the entity identifier of the entity.
/// </summary>
@@ -198,7 +209,13 @@ namespace Umbraco.Core
public static StringUdi GetUdi(this IPartialView entity)
{
if (entity == null) throw new ArgumentNullException("entity");
return new StringUdi(Constants.UdiEntityType.PartialView, entity.Path.TrimStart('/')).EnsureClosed();
// we should throw on Unknown but for the time being, assume it means PartialView
var entityType = entity.ViewType == PartialViewType.PartialViewMacro
? Constants.UdiEntityType.PartialViewMacro
: Constants.UdiEntityType.PartialView;
return new StringUdi(entityType, entity.Path.TrimStart('/')).EnsureClosed();
}
/// <summary>
@@ -240,6 +257,17 @@ namespace Umbraco.Core
return new GuidUdi(Constants.UdiEntityType.RelationType, entity.Key).EnsureClosed();
}
/// <summary>
/// Gets the entity identifier of the entity.
/// </summary>
/// <param name="entity">The entity.</param>
/// <returns>The entity identifier of the entity.</returns>
public static StringUdi GetUdi(this ILanguage entity)
{
if (entity == null) throw new ArgumentNullException("entity");
return new StringUdi(Constants.UdiEntityType.Language, entity.IsoCode).EnsureClosed();
}
/// <summary>
/// Gets the entity identifier of the entity.
/// </summary>
@@ -273,7 +301,7 @@ namespace Umbraco.Core
var dataTypeComposition = entity as IDataTypeDefinition;
if (dataTypeComposition != null) return dataTypeComposition.GetUdi();
var container = entity as Umbraco.Core.Models.EntityContainer;
var container = entity as EntityContainer;
if (container != null) return container.GetUdi();
var media = entity as IMedia;
@@ -309,6 +337,9 @@ namespace Umbraco.Core
var relationType = entity as IRelationType;
if (relationType != null) return relationType.GetUdi();
var language = entity as ILanguage;
if (language != null) return language.GetUdi();
throw new NotSupportedException(string.Format("Entity type {0} is not supported.", entity.GetType().FullName));
}
}
+12 -3
View File
@@ -100,9 +100,8 @@
<HintPath>..\packages\Owin.1.0\lib\net40\Owin.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Semver, Version=2.0.4.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Semver.2.0.4\lib\netstandard1.1\Semver.dll</HintPath>
<Private>True</Private>
<Reference Include="Semver, Version=1.1.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\semver.1.1.2\lib\net45\Semver.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.Composition" />
@@ -238,6 +237,7 @@
<Compile Include="Configuration\UmbracoSettings\ContentError404Collection.cs" />
<Compile Include="Configuration\UmbracoSettings\ContentErrorPageElement.cs" />
<Compile Include="Configuration\UmbracoSettings\ContentErrorsElement.cs" />
<Compile Include="Configuration\UmbracoSettings\ContentSectionExtensions.cs" />
<Compile Include="Configuration\UmbracoSettings\ImagingAutoFillPropertiesCollection.cs" />
<Compile Include="Configuration\UmbracoSettings\ImagingAutoFillUploadFieldElement.cs" />
<Compile Include="Configuration\UmbracoSettings\ContentImagingElement.cs" />
@@ -339,9 +339,14 @@
<Compile Include="Events\IDeletingMediaFilesEventArgs.cs" />
<Compile Include="Events\ScopeEventDispatcherBase.cs" />
<Compile Include="Events\ScopeLifespanMessagesFactory.cs" />
<Compile Include="Events\SupersedeEventAttribute.cs" />
<Compile Include="Exceptions\ConnectionException.cs" />
<Compile Include="HashCodeHelper.cs" />
<Compile Include="IHttpContextAccessor.cs" />
<Compile Include="Models\EntityBase\IDeletableEntity.cs" />
<Compile Include="Models\IUserControl.cs" />
<Compile Include="Models\PublishedContent\PublishedContentTypeConverter.cs" />
<Compile Include="Models\UserControl.cs" />
<Compile Include="OrderedHashSet.cs" />
<Compile Include="Events\UninstallPackageEventArgs.cs" />
<Compile Include="Models\GridValue.cs" />
@@ -573,12 +578,15 @@
<Compile Include="Persistence\Repositories\Interfaces\IRedirectUrlRepository.cs" />
<Compile Include="Persistence\Repositories\Interfaces\IServerRegistrationRepository.cs" />
<Compile Include="Persistence\Repositories\Interfaces\IDeleteMediaFilesRepository.cs" />
<Compile Include="Persistence\Repositories\Interfaces\IUserControlRepository.cs" />
<Compile Include="Persistence\Repositories\Interfaces\IXsltFileRepository.cs" />
<Compile Include="Persistence\Repositories\Interfaces\ITaskRepository.cs" />
<Compile Include="Persistence\Repositories\Interfaces\ITaskTypeRepository.cs" />
<Compile Include="Persistence\Repositories\MacroScriptRepository.cs" />
<Compile Include="Persistence\Repositories\MigrationEntryRepository.cs" />
<Compile Include="Persistence\Repositories\PublicAccessRepository.cs" />
<Compile Include="Persistence\Repositories\RedirectUrlRepository.cs" />
<Compile Include="Persistence\Repositories\UserControlRepository.cs" />
<Compile Include="Persistence\Repositories\XsltFileRepository.cs" />
<Compile Include="Persistence\Repositories\TaskRepository.cs" />
<Compile Include="Persistence\Repositories\TaskTypeRepository.cs" />
@@ -647,6 +655,7 @@
<Compile Include="Services\ContentTypeServiceExtensions.cs" />
<Compile Include="Models\RedirectUrl.cs" />
<Compile Include="Services\IContentServiceBase.cs" />
<Compile Include="Services\IdkMap.cs" />
<Compile Include="Services\RedirectUrlService.cs" />
<Compile Include="Services\DomainService.cs" />
<Compile Include="Services\ExternalLoginService.cs" />
+1 -5
View File
@@ -15,11 +15,7 @@
<package id="MySql.Data" version="6.9.9" targetFramework="net45" />
<package id="Newtonsoft.Json" version="10.0.2" targetFramework="net45" />
<package id="Owin" version="1.0" targetFramework="net45" />
<package id="Semver" version="2.0.4" targetFramework="net45" />
<package id="semver" version="1.1.2" targetFramework="net45" />
<package id="SharpZipLib" version="0.86.0" targetFramework="net45" />
<package id="SqlServerCE" version="4.0.0.1" targetFramework="net45" />
<package id="System.Runtime" version="4.3.0" targetFramework="net45" />
<package id="System.Runtime.Extensions" version="4.3.0" targetFramework="net45" />
<package id="System.Runtime.InteropServices" version="4.3.0" targetFramework="net45" />
<package id="System.Text.RegularExpressions" version="4.3.0" targetFramework="net45" />
</packages>
+1
View File
@@ -79,6 +79,7 @@
</system.data>
<system.web>
<httpRuntime targetFramework="4.5" />
<compilation defaultLanguage="c#" debug="true" batch="false" targetFramework="4.0"></compilation>
<machineKey validationKey="5E7B955FCE36F5F2A867C2A0D85DC61E7FEA9E15F1561E8386F78BFE9EE23FF18B21E6A44AA17300B3B9D5DBEB37AA61A2C73884A5BBEDA6D3B14BA408A7A8CD" decryptionKey="116B853D031219E404E088FCA0986D6CF2DFA77E1957B59FCC9404B8CA3909A1" validation="SHA1" decryption="AES" />
<!--<trust level="Medium" originUrl=".*"/>-->

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