Compare commits

...

365 Commits

Author SHA1 Message Date
Shannon Deminick 48786fcae1 Merge pull request #1464 from umbraco/temp-U4-8939
Temp u4 8939
2016-09-05 15:11:23 +02:00
Sebastiaan Janssen 28b4945d36 No longer need this now that it's part of JsJQueryCore 2016-09-05 14:59:22 +02:00
Sebastiaan Janssen 4a5314d8b9 No longer need this now that it's part of JsJQueryCore 2016-09-05 14:56:06 +02:00
Shannon Deminick c67adcc43f Merge pull request #1463 from umbraco/temp-U4-8939
U4-8939 Old openContentPicker() method is failing
2016-09-05 14:51:29 +02:00
Sebastiaan Janssen 0a43fea1c0 U4-8939 Old openContentPicker() method is failing
Adding jquery-migrate to make sure legacy applications keep working
2016-09-05 14:42:45 +02:00
Sebastiaan Janssen a20b7f9303 Merge pull request #1457 from umbraco/temp-u4-8917
U4-8719 - bugfix the redirect dashboard
2016-09-05 12:48:30 +02:00
Stephan 5b9b6be383 Merge pull request #1455 from abjerner/patch-12
Added support for progress bar/list for when uploading a single file
2016-09-05 12:22:54 +02:00
Stephan 40f6de950c Merge pull request #1460 from umbraco/temp-U4-8938
U4-8938 [OutputCache] headers changed from Cache-Control: public to p…
2016-09-05 11:35:58 +02:00
Stephan 916c350352 Merge pull request #1461 from umbraco/temp-U4-8898
U4-8898 Blank login screen after upgrade to 7.5.x
2016-09-05 11:30:48 +02:00
Sebastiaan Janssen 4186791d9a Removing this reference for now, doesn't seem like the best way to reference a dll and the sln build fine without this 2016-09-04 13:13:45 +02:00
Sebastiaan Janssen 02cef43815 Localizing the URL tracker dashboard 2016-09-04 13:09:37 +02:00
Sebastiaan Janssen 8d291efedd In the spirit of DRY: centralized IsAdmin() check in an extension method
Made sure that non-admins can't trigger the enable/disable URL tracker endpoint
Renamed "admin" in GetEnableState to "isUserAdmin" for clarity
2016-09-04 11:44:16 +02:00
Sebastiaan Janssen a5c8052439 Better error message when package install fails 2016-09-03 13:55:54 +02:00
Sebastiaan Janssen 704169abab Merge branch 'refs/heads/dev-v7' into temp-U4-8889 2016-09-03 13:27:31 +02:00
Sebastiaan Janssen 8ee8b52832 Bumps version 2016-09-03 13:26:40 +02:00
Sebastiaan Janssen 81819aa3b7 Merge branch 'refs/heads/master-v7' into dev-v7 2016-09-03 13:25:02 +02:00
Sebastiaan Janssen 90ffae5526 Adds back some try-catches that were previously removed so we can actually log the errors 2016-09-03 13:23:32 +02:00
Sebastiaan Janssen a3c99531bf U4-8898 Blank login screen after upgrade to 7.5.x
Moves the updating of the CDF version to the very beginning before we even redirect to the login screen so it is nicely cachebusted
2016-09-03 10:23:17 +02:00
Sebastiaan Janssen 1b6bf2f331 U4-8938 [OutputCache] headers changed from Cache-Control: public to private 2016-09-03 10:16:34 +02:00
Stephan fee217e8d7 U4-8719 - minor fix 2016-09-02 15:01:58 +02:00
Stephan c05a28a901 U4-8719 - bugfix the redirect dashboard, move to content section 2016-09-02 14:54:18 +02:00
Stephan fa45cd1a88 tmp 2016-09-02 14:44:16 +02:00
Simon Busborg 6cb5331918 Fixed mistake where :not was applied to every umb-table-cell 2016-09-02 14:37:31 +02:00
Simon Busborg fca865a743 Fixed Redirects UI.. Added flex-box basis utility, removed date and edit button 2016-09-02 14:33:07 +02:00
Anders Bjerner 1f313b9487 Added support for progress bar/list for when uploading a single file 2016-09-02 11:39:16 +02:00
Stephan 85d243508c Merge pull request #1453 from umbraco/temp-U4-8923
U4-8923 Adding new property to media breaks ability to save
2016-09-01 15:55:48 +02:00
Sebastiaan Janssen a74feab9eb U4-8923 Adding new property to media breaks ability to save
If you add a new property to a member or media type and then try to update an
existing media item/member ContentRepository didn't have this problem because
it was already using the additional if statement that has now also been added to
MemberRepository and MediaRepository
2016-09-01 15:15:47 +02:00
Sebastiaan Janssen ae591d4883 U4-8889 Package install fails
Fixes one of the problems with installing packages (when 1 file needs to be copied to multiple places) and adds better logging for other potential problems
2016-09-01 14:19:12 +02:00
Claus 71482f0fc9 U4-8584 Starterkit thumbnails are not really thumbnails
updating url for thumbnails in the "new" starterkit code - seems we forgot those and only updated the legacy installer.
2016-08-29 08:54:01 +02:00
Sebastiaan Janssen af5455a500 Bumps version 2016-08-23 10:52:29 +02:00
Sebastiaan Janssen be57692a62 Change some event handlers back to .live instead of .on
#U4-8884 Fixed
2016-08-23 10:48:15 +02:00
Sebastiaan Janssen 460d884109 Update the companion PermissionEditor.aspx file too 2016-08-23 10:48:15 +02:00
Sebastiaan Janssen 1a1a3c43ca Merge pull request #1446 from or321/or321-patch-1
Update UmbracoCms.nuspec
2016-08-23 10:40:10 +02:00
or321 6df6b87c4c Update UmbracoCms.nuspec
Update Newtonsoft.Json dependency to allow version 9.0.1 . This will match the same change in UmbracoCms.Core.nuspec file
2016-08-23 11:01:21 +03:00
Sebastiaan Janssen 172895f17f U4-8884 Users editor doesn't work any more in 7.5.0
#U4-8884 Fixed
2016-08-22 15:18:04 +02:00
Simon Busborg 8d3add8834 Fixes: U4-8878 Text in grid items in reorder-mode is now right aligned 2016-08-22 09:10:05 +02:00
Sebastiaan Janssen ae257550da Update README.md 2016-08-21 15:33:08 +02:00
Sebastiaan Janssen 4653746117 Correct notation of path/name combo 2016-08-21 11:06:25 +02:00
Sebastiaan Janssen 84bd22190b Use names artifacts 2016-08-21 10:58:57 +02:00
Sebastiaan Janssen 5e58e0d0a5 Wrong artifact filter 2016-08-20 16:05:46 +02:00
Sebastiaan Janssen 8b2fa22b90 Attempt to have dev-v7 builds deploy to nightlies 2016-08-20 15:49:21 +02:00
Sebastiaan Janssen f76fd360f1 Bumps version 2016-08-20 10:29:49 +02:00
Sebastiaan Janssen 39ebb9545d Merge pull request #1442 from umbraco/temp-U4-8868
U4-8868 Ensuring all usages of .live() is updated
2016-08-18 15:32:03 +02:00
Sebastiaan Janssen 6572eea915 Merge pull request #1443 from jannikanker/jannikanker-U4-8867
U4-8867 (IFRAME casing typos)
2016-08-18 13:05:14 +02:00
Jannik Anker 99ad5d6826 Update en_us.xml 2016-08-18 12:57:17 +02:00
Jannik Anker 2a1697b0a3 Update en.xml 2016-08-18 12:55:37 +02:00
Jannik Anker 583a09260e Update ClickJackingCheck.cs 2016-08-18 12:52:34 +02:00
Claus 344dab65d4 U4-8868 Ensuring all usages of .live() is updated
changed .on bind handlers to use .live instead.
removed an old jquery.1.4.4 which seems unreferenced and unused in the whole project.
2016-08-18 12:45:15 +02:00
Sebastiaan Janssen f658613fad Update README.md 2016-08-18 10:14:12 +02:00
Claus 1216f4a49e Merge pull request #1436 from umbraco/temp-u4-8856
U4-8856 - don't flood log with media errors
2016-08-17 10:52:02 +02:00
Sebastiaan Janssen 460e72fc1f Dealing with quirky trees.configs 2016-08-16 16:03:50 +02:00
Stephan 908c8837e9 U4-8856 - don't flood log with media errors 2016-08-16 15:41:52 +02:00
Sebastiaan Janssen 11c720cc2a Fixes trees config transform to work with versions older than 7.4 too 2016-08-16 14:39:52 +02:00
Sebastiaan Janssen c93b4fa1fe Reverts: Makes sure the build uses a predictable version of npm 2016-08-16 14:39:52 +02:00
Stephan d409d17189 U4-8813 - bugfix 2016-08-16 14:36:18 +02:00
Stephan 38c876bb53 Revert "U4-8813 - bugfix"
This reverts commit 95fb7f97d0.
2016-08-16 14:35:31 +02:00
Stephan 95fb7f97d0 U4-8813 - bugfix 2016-08-16 14:30:19 +02:00
Sebastiaan Janssen 9dfa9e2fb6 Bump the version 2016-08-16 13:37:05 +02:00
Sebastiaan Janssen 6ee8382ff3 Makes sure the build uses a predictable version of npm 2016-08-16 13:35:40 +02:00
Claus 69fb5e9932 Merge branch 'abjerner-patch-10' into dev-v7 2016-08-16 13:28:27 +02:00
Claus ca9f3bbd5a updating various references to use examine constants. 2016-08-16 13:27:46 +02:00
Claus fe7efa4fba Merge branch 'patch-10' of git://github.com/abjerner/Umbraco-CMS into abjerner-patch-10 2016-08-16 13:11:34 +02:00
Sebastiaan Janssen 1ec2cc430b Merge pull request #1429 from bjarnef/dev-v7-U4-8844
Set border radius for modal to zero.
2016-08-16 13:10:51 +02:00
Sebastiaan Janssen c1a8ea9df3 Merge pull request #1433 from umbraco/temp-U4-8850
U4-8850 Configuring a custom BackOfficeUserManager type will not work if the type is not specifically BackOfficeUserManager
2016-08-16 13:09:50 +02:00
Stephan cd2c79e7d5 U4-8813 - cleanup 2016-08-16 12:45:10 +02:00
Claus d5d0a958d3 removed console.logs 2016-08-16 11:45:42 +02:00
Mads Rasmussen 9e9e51cf29 Merge pull request #1432 from theotron/U4-8845
U4-8845 - Prevents double-click on confirm delete from deleting from bin
2016-08-16 09:50:47 +02:00
Sebastiaan Janssen 808793edd8 Updating to latest ImageProcessor 2016-08-16 09:35:05 +02:00
Sebastiaan Janssen 3895a93b61 Replaces the old packages tree item with the new one and puts it at the top 2016-08-16 09:35:05 +02:00
Shannon eadb9ba276 Merge branch 'refs/heads/dev-v7' into temp-U4-8850 2016-08-12 17:08:05 +02:00
Shannon fc582b0516 adds db schema check to validate if 7.4 has been installed, changes the versions detected to only be minor versions (they shouldn't have indicated build versions), updates code to not use deprecated methods 2016-08-12 16:54:24 +02:00
Shannon Deminick 432fac7dc9 Merge pull request #1430 from umbraco/temp-U4-8849
Fixes: U4-8849 301 Url tracker - When deleting last item on a page th…
2016-08-12 16:40:49 +02:00
Sebastiaan Janssen fad69046df Don't ship with the test-baseUrl 2016-08-12 16:38:48 +02:00
Shannon 6bcadfea44 Removes the explicit castings to (BackOfficeUserManager) since that isn't actually the base class! The base class is BackOfficeUserManager<BackOfficeIdentityUser>, all of this identity stuff is a bit of a generics nightmare but that also do to the generic nightmare that is OWIN. Moves more logic to the base class so it can be used by sub classes, fixes the base class to use a generic user type 2016-08-12 16:17:14 +02:00
theotron a3c457e50b Fixes U4-8845 - Double-click on confirm delete, deletes from bin as well
http://issues.umbraco.org/issue/U4-8845
2016-08-12 14:39:12 +01:00
Sebastiaan Janssen b2a56fa58f Merge branch 'ugurcelenk-dev-v7' into dev-v7 2016-08-12 14:19:09 +02:00
Sebastiaan Janssen f97c20253a Turkish Language file updated #1431 2016-08-12 14:18:50 +02:00
Ugur Celenk 51f57eb5ce Turkish Language file updated 2016-08-12 14:58:10 +03:00
Sebastiaan Janssen 54e82f9ed1 Fix nasty typo 2016-08-12 12:25:58 +02:00
Shannon 2ff3ce933b U4-8850 Configuring a custom BackOfficeUserManager type will not work if the type is not specifically BackOfficeUserManager 2016-08-12 12:20:00 +02:00
Mads Rasmussen 1c15daca52 Fixes: U4-8849 301 Url tracker - When deleting last item on a page the url tracker should check for new results. 2016-08-12 10:49:20 +02:00
Shannon de2d4bef13 Ensure the current umbraco version is passed up to Our for the new packaging section 2016-08-12 10:19:08 +02:00
bjarnef 8c6f56d3f5 Set border radius for modal to zero. 2016-08-11 18:46:01 +02:00
Sebastiaan Janssen 2f0b26db47 Merge pull request #1428 from umbraco/temp-U4-8841
U4-8841 Scheduled publishing in 7.5.0-latest has some problems
2016-08-11 17:37:16 +02:00
Shannon 1fd020a0f2 adds better debug logging to scheduled publishing 2016-08-11 14:33:10 +02:00
Shannon e12c294150 Merge branch 'dev-v7' of https://github.com/umbraco/Umbraco-CMS into dev-v7 2016-08-11 14:06:49 +02:00
Shannon 8d1d394ded Adds latest stable Examine version 2016-08-11 14:06:38 +02:00
Claus 3274965c34 typo 2016-08-11 12:43:12 +02:00
Claus 54fb1c6231 fixes the offsetting not being applied when loading the datepicker. 2016-08-11 11:22:50 +02:00
Morten Christensen d3ff1cbba9 Merge pull request #1426 from umbraco/temp-U4-8671
U4-8671 Media Types Missing in 7.4
2016-08-11 11:03:08 +02:00
Claus f4072bc975 Merge branch 'update-site-count-installer' into dev-v7 2016-08-11 08:13:46 +02:00
paulsterling 31e0913488 Updating number for current sites to 360 000 2016-08-10 14:49:30 -07:00
Claus f55e673632 adding a few tests for U4-8567. 2016-08-10 14:58:55 +02:00
Shannon f1087fce3c Merge branch 'dev-v7' of https://github.com/umbraco/Umbraco-CMS into dev-v7 2016-08-10 14:41:09 +02:00
Shannon 5620074790 U4-8718 Latest ClientDependency release 2016-08-10 14:40:54 +02:00
Claus 600d7be2ac U4-8567 UmbracoHelper.CreateEncryptedRouteString fails to parse additionalRouteVals when it is of type Dictionary<string, object> 2016-08-10 13:45:06 +02:00
Claus 596888a8f6 Revert "Revert "U4-8833 The default sorting field for the member list view should be LoginName not Name""
This reverts commit d355d2609a.
2016-08-10 12:58:41 +02:00
Claus 0f0a0a186c U4-8838 Media type list has issues 2016-08-10 12:13:03 +02:00
Sebastiaan Janssen 200f0bb67e Don't add the Get Started panel back on upgrades 2016-08-10 11:59:35 +02:00
Sebastiaan Janssen af1be7f32f Insert <areas> if they're missing 2016-08-10 11:59:35 +02:00
Shannon d355d2609a Revert "U4-8833 The default sorting field for the member list view should be LoginName not Name" 2016-08-10 11:42:58 +02:00
Shannon 06da9f4f7d Merge branch 'dev-v7' of https://github.com/umbraco/Umbraco-CMS into dev-v7 2016-08-10 11:42:12 +02:00
Shannon 5bd5bf87ad Fixes the search sorting for the packages section against our 2016-08-10 11:41:58 +02:00
Claus db78e26647 U4-8833 The default sorting field for the member list view should be LoginName not Name
correcting LoginName to username.
2016-08-10 11:23:46 +02:00
Claus a2adfe4798 Merge pull request #1425 from umbraco/temp-U4-8830
Fixes: U4-8830 Redirect url dashboard - add confirm dialog when remov…
2016-08-10 10:58:25 +02:00
Claus a7b19e1acf Merge pull request #1424 from umbraco/temp-U4-8825
Fixes: U4-8825 Show SVG preview in media picker
2016-08-10 10:47:35 +02:00
Claus a92aa6ad9a fixed up a comment and some cleanup. 2016-08-10 10:04:47 +02:00
Claus 154e4a19a5 cleaning and formatting. 2016-08-10 10:01:04 +02:00
Claus 0142bc61bc U4-8671 Media Types Missing in 7.4
renders child nodes in media type tree.
fixed up the context menus returned on nodes so you can create children if not disabled in config.
2016-08-10 09:56:28 +02:00
Shannon d99a691bdc Changes magic strings to constants for database provider types. 2016-08-09 15:36:02 +02:00
Shannon 10422079b6 Merge branch 'dev-v7' of https://github.com/umbraco/Umbraco-CMS into dev-v7 2016-08-09 15:33:49 +02:00
Shannon c1da28dd47 U4-8837 Change paging query for SQL server 2012+ to be more efficient 2016-08-09 15:33:35 +02:00
Sebastiaan Janssen 2018dab869 Fixed deprecation warning with moment.js 2016-08-09 15:32:17 +02:00
Shannon 5b88f35471 Merge branch 'dev-v7' of https://github.com/umbraco/Umbraco-CMS into dev-v7 2016-08-09 15:30:54 +02:00
Shannon 2ee71ecb96 U4-8833 The default sorting field for the member list view should be LoginName not Name 2016-08-09 15:30:43 +02:00
Mads Rasmussen 213a25e3fe fixes: U4-8836 Add empty state to content and member list view 2016-08-09 14:27:48 +02:00
Sebastiaan Janssen 14b527a9fa Makes sure the redirect dashboard is added in zip and for NuGet upgrades
Also adds healthcheck for NuGet upgrades
2016-08-09 14:12:28 +02:00
Shannon 2d25c4dad5 deletes tests to attempt to test the sorting issue: U4-8831 which didn't work because it's on sql ce 2016-08-09 14:01:18 +02:00
Shannon 8bdf0924de Merge remote-tracking branch 'refs/remotes/origin/dev-v7' into dev-v7 2016-08-09 13:59:00 +02:00
Shannon 1b85163a7f U4-8831 Paging logic is flawed when ordering by a potentially non-unique value 2016-08-09 13:58:53 +02:00
Shannon 634dfaaf75 U4-8833 The default sorting field for the member list view should be LoginName not Name 2016-08-09 13:55:41 +02:00
Claus 2279e6cc53 U4-8834 Removing code assigning PropertyData IDs for new properties even though it isn't used 2016-08-09 13:39:40 +02:00
Mads Rasmussen 82c5b91deb Fixes: U4-8832 Remove custom styling of pagination on list views 2016-08-09 13:30:19 +02:00
Shannon 9d2efdfb37 Adds test to confirm bug U4-8831 2016-08-09 12:47:14 +02:00
Mads Rasmussen 952cfc6d5f Fixes: U4-8830 Redirect url dashboard - add confirm dialog when removing redirect 2016-08-09 12:13:56 +02:00
Mads Rasmussen ff2311d19c bring back the checkered background for white images 2016-08-09 12:02:30 +02:00
Mads Rasmussen ef64098f4e remove checkered background from picked media 2016-08-09 10:34:47 +02:00
Mads Rasmussen 611acf8cea Show SVG preview in picked media 2016-08-09 10:34:27 +02:00
Shannon 910e6b7a64 U4-8766 v7.5.0-beta2 exception from Examine Grid Indexer 2016-08-09 09:40:29 +02:00
Sebastiaan Janssen bffd9c340d Wrong parameter name being sent to the RedirectUrlManagementController 2016-08-09 09:21:22 +02:00
Simon Busborg df116555ad fix search 2016-08-09 09:11:19 +02:00
Mads Rasmussen ca7e9c90b9 fixes: U4-8827 Add empty state for no search result and no added redirects to url redirects dashboard 2016-08-09 08:47:01 +02:00
Mads Rasmussen 65fc23dadc Fixes: U4-8828 Redirect urls dashboard - when search field has focus and enter is pressed the first redirect gets deleted 2016-08-09 08:44:45 +02:00
Sebastiaan Janssen 3ac7512a98 Merge pull request #1116 from rpjengaard/patch-1
Update da.xml
2016-08-08 17:23:20 +02:00
Sebastiaan Janssen a553fabce4 Merge pull request #1262 from umbraco/UmbracoCMS-Settings-Dashboard
Fixed issue: U4-8435 so the link is correct in settingsdashboardintro…
2016-08-08 17:07:55 +02:00
Sebastiaan Janssen 2a2453a969 Merge pull request #1283 from jbreuer/patch-1
Fix for U4-8510
2016-08-08 17:06:21 +02:00
Sebastiaan Janssen f4711a4473 Merge pull request #1340 from bjarnef/dev-v7-U4-8608
Document getByQuery
2016-08-08 17:02:53 +02:00
Sebastiaan Janssen 2069c585fb Merge branch 'temp-U4-8802' into dev-v7
# Conflicts:
#	src/Umbraco.Web/Routing/RedirectTrackingEventHandler.cs
#	src/Umbraco.Web/Umbraco.Web.csproj
2016-08-08 16:49:10 +02:00
Mads Rasmussen 045374993f Fixes: U4-8821 Prevent random form submits from healthcheck dashboard 2016-08-08 15:12:42 +02:00
Sebastiaan Janssen 57923866ed Merge pull request #1419 from umbraco/temp-U4-8813
U4-8813 RedirectTrackingEventhandler always iterates over all descend…
2016-08-08 14:59:58 +02:00
Shannon bf61956b7f oops fixes build 2016-08-08 14:48:05 +02:00
Shannon 9ad84a7eab fixes repository mapping the GUID id for redirect urls and removes unused properties 2016-08-08 14:47:48 +02:00
Shannon 4301af108f Merge branch 'temp-U4-8802' of https://github.com/umbraco/Umbraco-CMS into temp-U4-8802
# Conflicts:
#	src/Umbraco.Web.UI.Client/src/views/dashboard/developer/redirecturls.html
#	src/Umbraco.Web/Editors/RedirectUrlManagementController.cs
2016-08-08 14:42:07 +02:00
Shannon c331ba134a Fixes 301 redirect js naming conventions, fixes URL handling, moves c# classes to the correct/constistent namespaces, fixes up models and N+1 requests, adds model mapping to not return the business logic model, adds controller method to check if it's enabled instead of returning the result as part of the search. 2016-08-08 14:40:53 +02:00
Mads Rasmussen 7d4e547b8d Fixes: U4-8820 Healthcheck dashboard should validate input for notification email 2016-08-08 14:30:59 +02:00
Mads Rasmussen cbd20cb9b3 Merge pull request #1406 from arknu/U4-8749
U4-8749: Allow default sort order to be custom properties
2016-08-08 14:01:53 +02:00
Claus 3170d6829a browser object null check in jquery.ba-bbq.min. 2016-08-08 13:26:21 +02:00
Claus 55752abdcf fixing InsertMacroSplitButton typo in jquery selector causing javascript errors.
fixing modal $.browser checks to not cause console errors due to deprecated browser object in jquery 1.9+.
2016-08-08 13:23:46 +02:00
Sebastiaan Janssen 69c952ddda Don't use HttpContext 2016-08-08 13:10:32 +02:00
Simon Busborg 4ff728b62a added target blank so it opens in another tab 2016-08-08 12:55:52 +02:00
Shannon Deminick 1b9a3e8ebc Merge pull request #1423 from abryukhov/patch-3
Update UI language ru.xml * dev-v7-U4-8597 - Social login form key added
2016-08-08 12:22:11 +02:00
Shannon fee4a84c66 Revert temp commit, adds logic to check if the segment value has changed + lots of notes 2016-08-08 12:19:03 +02:00
Shannon ad2a644bdf temp save to track history since i need to roll this back 2016-08-08 12:07:43 +02:00
Sebastiaan Janssen f4b0700528 Merge branch 'temp-U4-8802' of https://github.com/umbraco/Umbraco-CMS into temp-U4-8802 2016-08-08 12:00:14 +02:00
Sebastiaan Janssen 126c358546 Fixes build and use Guid where necessary 2016-08-08 11:57:48 +02:00
Alexander Bryukhov f316393955 Update UI language ru.xml 2016-08-08 16:41:19 +07:00
Simon Busborg 80d579891b Removes search when disabled 2016-08-08 11:33:56 +02:00
Claus bfc2e6f666 Merge branch 'bjarnef-dev-v7-U4-8597' into dev-v7 2016-08-08 11:32:02 +02:00
Claus c3035f26a7 Merge branch 'dev-v7-U4-8597' of git://github.com/bjarnef/Umbraco-CMS into bjarnef-dev-v7-U4-8597
Conflicts:
	src/Umbraco.Web.UI/umbraco/config/lang/da.xml
2016-08-08 11:31:29 +02:00
Sebastiaan Janssen b2e03dcc1b Merge branch 'refs/heads/dev-v7' into temp-U4-8802 2016-08-08 11:31:16 +02:00
Mads Rasmussen 97a765d6af Merge branch 'bjarnef-dev-v7-U4-8580' into dev-v7 2016-08-08 11:28:07 +02:00
Mads Rasmussen 67430392e3 Change object to img to make it render in Edge 2016-08-08 11:22:16 +02:00
Sebastiaan Janssen 6560f752d6 Merge branch 'refs/heads/dev-v7' into temp-U4-8802 2016-08-08 11:21:19 +02:00
Claus e02575830f Merge pull request #1420 from umbraco/temp-U4-8816
U4-8816 Update to jQuery  2.2.4
2016-08-08 11:00:47 +02:00
Shannon Deminick a838d20c3e Merge pull request #1422 from abryukhov/patch-9
Update UI language ru.xml
2016-08-08 10:57:22 +02:00
Alexander Bryukhov 081284bc62 Update UI language ru.xml
1. Duplicated 'prompt' area removed
2. Several typos corrected
2016-08-08 15:48:14 +07:00
Claus 9e9c1ad030 Merge pull request #1418 from drpeck/dev-v7
U4-8814 - HTml.Wrap adds children twice
2016-08-08 10:45:35 +02:00
Simon Busborg 32d48b12d1 Changed button when inactive, added class to toggle when table in inactive 2016-08-08 10:36:10 +02:00
Claus b4b91f0fef Merge branch 'pynej-sql-repalce' into dev-v7 2016-08-08 10:19:35 +02:00
Claus cbf67a4399 changing to Debug.Print. 2016-08-08 10:18:44 +02:00
Claus f58e0dc08e Merge branch 'sql-repalce' of git://github.com/pynej/Umbraco-CMS into pynej-sql-repalce 2016-08-08 09:58:39 +02:00
Shannon Deminick e449c237be Merge pull request #1421 from abryukhov/patch-8
Update UI language ru-RU.xml
2016-08-08 09:40:51 +02:00
Shannon Deminick 1dae6724cc Merge pull request #1227 from abryukhov/patch-6
Update UI language ru.xml
2016-08-08 09:40:20 +02:00
Simon Busborg a28c52aa16 Added styling to url list 2016-08-08 09:36:10 +02:00
Mads Rasmussen 26708ae82b Merge branch 'dev-v7-U4-8580' of git://github.com/bjarnef/Umbraco-CMS into bjarnef-dev-v7-U4-8580 2016-08-08 09:20:32 +02:00
Alexander Bryukhov 809970bc2e Update UI language ru-RU.xml
New 'bulk' area and few more corrections
2016-08-07 14:06:16 +07:00
Mads Rasmussen 27d041c055 Merge pull request #1416 from bjarnef/dev-v7-U4-8765-fix
Open documentation link in new browser window/tab
2016-08-05 21:36:27 +02:00
Shannon 7bf3d04a25 Merge branch 'dev-v7' of https://github.com/umbraco/Umbraco-CMS into dev-v7 2016-08-05 19:29:10 +02:00
Shannon 87934e52dc obsoletes strange IsGuid and changes logic to use what .Net does instead of regex in case others are using this. 2016-08-05 19:28:46 +02:00
Shannon 4022c3cec9 U4-8816 Update to jQuery 2.2.4 2016-08-05 19:15:11 +02:00
Shannon 816107a348 U4-8813 RedirectTrackingEventhandler always iterates over all descendants
fixes SHA1 hashing (moves to a ext method), fixes col length for new db for the redirect table, updates migration len to 40 to store the correct hash format, don't iterate descendents if there's nothing changed, fixes issue with RedirectTrackingEventHandler with regards to operating outside of a web request (i.e. console app)
2016-08-05 18:55:48 +02:00
Sebastiaan Janssen aedba40b54 Updates language file to specify which integrity check we're looking at. Quotes all table names correctly. Updates description for the check. 2016-08-05 18:03:05 +02:00
Shannon 31b17e3048 Merge branch 'dev-v7' of https://github.com/umbraco/Umbraco-CMS into dev-v7 2016-08-05 17:41:13 +02:00
Shannon 42666403a6 Fixes regression issue with building the xml cache file, moves the logic to query and build the xml document for the cache to the repository level. 2016-08-05 17:41:00 +02:00
Mads Rasmussen aa66fd6e33 rewrite controller as vm + refactor controller to follow angular style guide 2016-08-05 16:59:03 +02:00
Sebastiaan Janssen 19325ac522 Fixes the build 2016-08-05 14:44:37 +02:00
Mads Rasmussen b8b30bdc6e make resource for all redirect url end points 2016-08-05 14:35:58 +02:00
Claus 69b6044bc6 fixing null check on UmbracoContext.Current in RedirectTrackingEventHandler's PageCacheRefresher_CacheUpdated. 2016-08-05 14:01:25 +02:00
Sebastiaan Janssen 18a1aa2f6f Merge pull request #1413 from umbraco/temp-U4-8530
U4-8530 Make it possbile to hide preview button by DocumentType or ContentItem
2016-08-05 13:18:29 +02:00
Shannon 92f7782ab9 Merge branch 'dev-v7' of https://github.com/umbraco/Umbraco-CMS into dev-v7 2016-08-05 13:06:49 +02:00
Shannon 3e932ecf3f fixes icon and author urls for local package install 2016-08-05 13:06:35 +02:00
Sebastiaan Janssen dd62a917fd Merge pull request #1411 from umbraco/temp-U4-8808
U4-8808 Fixing up 301 redirects
2016-08-05 13:06:18 +02:00
Sebastiaan Janssen 958e20356c Merge pull request #1412 from umbraco/temp-U4-8786
U4-8786 Member search in listview returns error (7.5-beta2)
2016-08-05 13:04:42 +02:00
Mads Rasmussen 1f8dc9a424 move dashboard from App_Plugins to dashboards folder 2016-08-05 12:36:10 +02:00
Shannon 539637720f Merge branch 'dev-v7' of https://github.com/umbraco/Umbraco-CMS into dev-v7 2016-08-05 12:31:00 +02:00
Shannon 6a3f146da1 Fixes health check index & throbber while fixing, fixes xml data integrity check to check for invalid XML that doesn't contain a GUID 2016-08-05 12:29:05 +02:00
David Peck 7fe7f88c98 Merge pull request #1 from drpeck/U4-8814
Children added to HtmlTagWrapper twice
2016-08-05 11:14:53 +01:00
David Peck 774f00d4f5 Children added to HtmlTagWrapper twice
By calling the overload on line 884 the children are added. To do it again results in the children being added twice.
2016-08-05 11:14:01 +01:00
Sebastiaan Janssen aab2c65aaa Merge pull request #1417 from umbraco/temp-U4-8156
U4-8156 Support minimum versions for Umbraco packages
2016-08-05 11:58:38 +02:00
Sebastiaan Janssen 3dcba7a6b0 urlHash column has to be 20 chars because SHA1 uses more bytes than MD5 2016-08-05 11:51:08 +02:00
Sebastiaan Janssen 3ece30bd8b Don't let the event handlers kick in if Redirect Tracking is turned off in the config 2016-08-05 11:41:08 +02:00
Shannon 36a191464d ensures table name is quoted properly 2016-08-05 11:26:20 +02:00
Simon Busborg 9131b73cbb Merge pull request #1415 from bjarnef/dev-v7-U4-8809
Show only empty recycle bin text, when filter doesn't has a value
2016-08-05 11:14:44 +02:00
Simon Busborg 68b3ea349e Merge pull request #1414 from bjarnef/dev-v7-U4-8805
Ensure editing area use full height when it only has a little...
2016-08-05 10:53:13 +02:00
Mads Rasmussen 2f0ba3ac07 First part of html + js cleanup - use angular components in dashboard view + make js fit. 2016-08-05 10:51:32 +02:00
Claus 6c271d92f9 migration should only delete table if it is using a integer id, otherwise leave it alone. 2016-08-05 08:25:58 +02:00
bjarnef e1daa79bab Open documentation link in new browser window/tab 2016-08-04 22:35:55 +02:00
bjarnef a136235c72 Show only empty recycle bin text, when filter doesn't has a value 2016-08-04 21:10:31 +02:00
bjarnef e8e440516f Ensure editing area use full height when it only has a little or no content 2016-08-04 20:30:54 +02:00
Sebastiaan Janssen b2e7c7a8d4 More specific exception when a conversion fails 2016-08-04 19:18:52 +02:00
Shannon 2c15db5950 U4-8530 Make it possbile to hide preview button by DocumentType or ContentItem 2016-08-04 18:34:20 +02:00
Shannon 7ed240d510 Merge branch 'Phosworks-U4-8530' into temp-U4-8530 2016-08-04 18:09:00 +02:00
Shannon a91b8e0acf Merge branch 'U4-8530' of https://github.com/Phosworks/Umbraco-CMS into Phosworks-U4-8530 2016-08-04 18:08:27 +02:00
Shannon 0be81aa4e5 U4-8786 Member search in listview returns error (7.5-beta2) 2016-08-04 18:01:57 +02:00
Sebastiaan Janssen 221edc76cf Merge remote-tracking branch 'refs/remotes/origin/dev-v7' into temp-U4-8802 2016-08-04 17:49:42 +02:00
Sebastiaan Janssen 0280d832b5 Some fixing based on code review 2016-08-04 17:48:50 +02:00
Sebastiaan Janssen 875070fed8 File should not have been committed 2016-08-04 17:02:46 +02:00
Shannon 9d62b2f5f9 nuspec and nuget refs updated to latest Models Builder 2016-08-04 16:59:26 +02:00
Shannon Deminick 548c7845cb Merge pull request #1409 from umbraco/temp-U4-8779
U4-8779 Sorting not working in Members List View in 7.5 Beta2
2016-08-04 16:46:54 +02:00
Shannon 9c7052f0fd Fixed the property join for sorting on custom columns, this would have only worked if there were actual values in those columns, we fix this now with an outer join instead of an inner join 2016-08-04 16:46:46 +02:00
Sebastiaan Janssen 177b61bbf5 Merge pull request #1292 from darrenferguson/dev-v7
Fix U4-8532 - No built in Active Directory authentication in Umbraco
2016-08-04 16:25:22 +02:00
Sebastiaan Janssen 8038016b55 U4-8778 The "Link your xx account" button doesn't work because it's a form wrapped in a form 2016-08-04 15:58:19 +02:00
Claus ae0ad2becf switching to sha1 instead of md5. 2016-08-04 15:46:02 +02:00
Claus ba11de51e3 deleting through the recycle bin also deletes redirect urls. 2016-08-04 15:46:01 +02:00
Claus ccaa198e25 changing integer IDs to guid for RedirectUrls. 2016-08-04 15:46:01 +02:00
Claus 66c0d9dc12 removing migrations from solution 2016-08-04 15:45:58 +02:00
Claus 59c3d6a206 cleaning up migrations. we're deleting the table so no need to do a bunch of migration stuff instead of just compiling it into one migration deleting and creating the table again. 2016-08-04 15:45:58 +02:00
Shannon 0ab145e4ac Ensures that type="strict" is added to the package creation, does some null checking on the stylesheets packaging so ysod doesn't occur, some code formatting. 2016-08-04 15:33:26 +02:00
Shannon 423588d018 code formatting 2016-08-04 15:20:57 +02:00
Shannon Deminick 16afab86f3 Merge pull request #1407 from umbraco/temp-U4-8754
U4-8754 Single content queries like Get(int id) for content, media an…
2016-08-04 15:05:58 +02:00
Sebastiaan Janssen 43737e78fb Sorry about that! 2016-08-04 15:05:49 +02:00
Shannon Deminick f6943ceab4 Merge pull request #1408 from umbraco/temp-U4-8361-2
U4-8361 301 Url Tracking
2016-08-04 14:51:50 +02:00
Sebastiaan Janssen 6495077568 Whoops 2016-08-04 14:50:55 +02:00
Sebastiaan Janssen c61a9ee433 AppendCacheExtension needs to be AppendHeader 2016-08-04 14:46:07 +02:00
Sebastiaan Janssen b7264b58f9 Fixed the mapping for HasPublishedVersion 2016-08-04 12:19:24 +02:00
Sebastiaan Janssen ba5be0e22a Adds search function 2016-08-04 11:21:42 +02:00
Mads Rasmussen d8f68f5f9b Merge branch 'spacebetween-U4-7475-grid-tinymce-styles' into dev-v7 2016-08-04 10:32:30 +02:00
Mads Rasmussen b365a9944f Fix js errors for grunt to build 2016-08-04 10:29:36 +02:00
Simon Busborg 5b2bcdbfac Merge pull request #1399 from marcemarc/temp-u4-8772
Fixes  U4-8772, adds icon to published but changed listview items
2016-08-04 10:08:04 +02:00
Mads Rasmussen abb994cf30 Merge branch 'U4-7475-grid-tinymce-styles' of git://github.com/spacebetween/Umbraco-CMS into spacebetween-U4-7475-grid-tinymce-styles 2016-08-04 10:02:11 +02:00
Sebastiaan Janssen 6e480058b9 Adds R# rule to give a little hint when newing up a disposable 2016-08-04 09:46:48 +02:00
Simon Busborg 912a460bd8 Merge pull request #1353 from abjerner/patch-7
Added a tooltip with icon alias on mouseover
2016-08-04 09:35:38 +02:00
Sebastiaan Janssen 52d366bb6f MD5CryptoServiceProvider is disposable 2016-08-04 08:58:30 +02:00
Asbjørn Riis-Knudsen 2ddbca8861 U4-8749: Add a service to allow acces to prevalues from inline listview editor 2016-08-03 22:07:06 +02:00
Sebastiaan Janssen e66eefbbd7 Fixes unit test 2016-08-03 21:42:40 +02:00
Sebastiaan Janssen f1d9775a0f Fix the build 2016-08-03 21:15:27 +02:00
Sebastiaan Janssen 1aa2845b4a Merge pull request #1360 from marcemarc/dev-u4-8657
Closes Issue U4-8657 - Add an overload to GetDictionaryValue to provide fallback text
2016-08-03 21:08:16 +02:00
Sebastiaan Janssen 1c88117498 U4-8803 Add "Create package" back as a right-click item on the "Created Packages" node
#U4-8803 Fixed
2016-08-03 20:17:43 +02:00
Sebastiaan Janssen 6237d4a3e5 Adds a toggle to disable/enable the URL tracker
Adds paging, adapted from https://github.com/robertjf/umbMemberListView/blob/master/MemberListView/App_Plugins/MemberManager/backoffice/dashboard/memberListView.controller.js
2016-08-03 20:01:43 +02:00
Sebastiaan Janssen 77cbdcf38f js files are ignored by default, need to force add them if we really want them 2016-08-03 19:05:04 +02:00
Sebastiaan Janssen 85a3abf643 Adds a setting to be able to disable redirect URL tracking 2016-08-03 17:57:41 +02:00
Sebastiaan Janssen c53a04d658 Needed to be fixed, just like for the ascending OrderBy - see U4-4474 2016-08-03 17:57:41 +02:00
Sebastiaan Janssen b4d5140d07 WIP Starting with taking Marc's code to get a rudimentary dashboard for the 301 URL tracker 2016-08-03 17:57:01 +02:00
Sebastiaan Janssen 11cafa2c4c Adds a setting to be able to disable redirect URL tracking 2016-08-03 17:54:21 +02:00
Sebastiaan Janssen a5f3b50699 Needed to be fixed, just like for the ascending OrderBy - see U4-4474 2016-08-03 17:52:27 +02:00
Shannon 00bc454080 Merge branch 'dev-v7' of https://github.com/umbraco/Umbraco-CMS into dev-v7 2016-08-03 14:04:33 +02:00
Shannon 67cd4aeb59 fixes user mgr logic 2016-08-03 14:04:25 +02:00
Claus b4ea03cdf3 U4-8779 Sorting not working in Members List View in 7.5 Beta2 2016-08-03 12:43:46 +02:00
Mads Rasmussen c8d7a62a47 Fixes: U4-8747 Actions menu button not aligned with heading input 2016-08-03 09:53:55 +02:00
Sebastiaan Janssen b9fcda8f39 U4-8361 301 Url Tracking
Adds the ability to add certain headers to a PublishedContentRequest - these are internal for now until we're sure we want to expose them
Adds response headers to tell browsers not to cache the 301 redirects so people can easily change their mind later
2016-08-02 17:01:32 +02:00
Sebastiaan Janssen e020779a14 U4-8751 GetCropUrl method should have a parameter for specifying the image format
Additional fix asking for InvariantContains instead of just Contains
2016-08-02 15:07:25 +02:00
Sebastiaan Janssen d611ae85e1 Merge pull request #1398 from arknu/U4-8751_2
U4-8751: Put format parameter at the end when format is specified in furtherOptions
2016-08-02 14:57:38 +02:00
Sebastiaan Janssen 2df8f55032 U4-8794 Allow Newtosoft JSON 9.0.1 to be installed
#U4-8794 Fixed
2016-08-02 14:45:57 +02:00
Sebastiaan Janssen 6788e8954e U4-8509 woff2 mime type 2016-08-02 14:37:08 +02:00
Sebastiaan Janssen 080da771ff U4-8457 Ensure <MacroErrors> default is updated from legacy inline setting to newer throw setting
#U4-8457 Fixed
2016-08-02 14:37:08 +02:00
Sebastiaan Janssen 08b3b635b4 Merge pull request #1305 from electricsheep/U4-8336
U4-8509 - Added woff2 mime type
2016-08-02 14:36:58 +02:00
Mads Rasmussen 8e411069f4 Merge pull request #1318 from umbraco/temp-U4-8584
Temp u4 8584
2016-08-02 13:26:34 +02:00
Claus 7d0c92937a U4-8754 Single content queries like Get(int id) for content, media and members needs to execute a TOP 1 (or LIMIT 1)
updated a bunch of the remaining repositories to also use this pattern where applicable (repos using mappers aren't compatible without more work).
2016-08-02 12:11:35 +02:00
Simon Busborg 1ca6674095 Fixes http://issues.umbraco.org/issue/U4-8770 2016-08-02 09:41:01 +02:00
Shannon 3ebb3dc544 U4-7813 Enable MiniProfiler to profiler during startup 2016-08-01 12:04:02 +02:00
Asbjørn Riis-Knudsen 1f6caa0164 U4-8749: add back some acceidentally deleted code to deal with existing values 2016-07-30 00:35:06 +02:00
Asbjørn Riis-Knudsen 6adccb66dd U4-8749: Use watch do dynamically refresh sort column list 2016-07-30 00:30:50 +02:00
Asbjørn Riis-Knudsen 6837dd2ce8 U4-8749: One more fix by @AndyButland 2016-07-29 23:55:20 +02:00
Asbjørn Riis-Knudsen b686fa74c9 U4-8749: Fixes by @AndyButland 2016-07-29 23:42:59 +02:00
Claus 22d12f3abc Merge branch 'bjarnef-dev-v7-U4-8488' into dev-v7 2016-07-29 11:23:36 +02:00
Claus bb4671faf1 Merge branch 'dev-v7-U4-8488' of git://github.com/bjarnef/Umbraco-CMS into bjarnef-dev-v7-U4-8488
Conflicts:
	src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/listview.controller.js
2016-07-29 11:22:13 +02:00
Claus 57d2901c2e Merge pull request #1405 from umbraco/temp-U4-8367
U4-8367 Breadcrumb and save button breaks layout.
2016-07-29 10:48:31 +02:00
Claus 9914ab6c59 Merge branch 'bjarnef-dev-v7-U4-8748' into dev-v7 2016-07-29 10:38:33 +02:00
Claus ccd03cb1f2 fixes overlay width on small screens (mads). 2016-07-29 10:38:00 +02:00
Claus 89fd31085c Merge branch 'dev-v7-U4-8748' of git://github.com/bjarnef/Umbraco-CMS into bjarnef-dev-v7-U4-8748 2016-07-29 10:30:18 +02:00
Asbjørn Riis-Knudsen e53b81b627 U4-8749: Remove commented out code 2016-07-28 22:21:21 +02:00
Asbjørn Riis-Knudsen 385c53936e U4-8749: Initial implementation of the default sort order using the columns added instead of a fixed list 2016-07-28 22:18:17 +02:00
Mads Rasmussen be8a52e7b6 fix positioning of sub header when scrolling 2016-07-28 12:34:04 +02:00
Mads Rasmussen 3cdf80a82b change main editor from absolute positioning to flex box. Sets auto height on editor footer so it can expand 2016-07-28 12:33:32 +02:00
Mads Rasmussen b631db14c3 show full breadcrumb item on hover 2016-07-28 12:26:52 +02:00
Mads Rasmussen 5f7859a8c1 truncate breadcrumb items 2016-07-28 12:25:58 +02:00
Claus 1a2f7b8788 Merge branch 'dev-v7' of github.com:umbraco/Umbraco-CMS into dev-v7 2016-07-27 14:18:39 +02:00
Claus 39aca137a4 Merge branch 'temp-U4-8601' into dev-v7
Conflicts:
	src/Umbraco.Web.UI.Client/src/views/dashboard/developer/healthcheck.controller.js
	src/Umbraco.Web.UI.Client/src/views/dashboard/developer/healthcheck.html
2016-07-27 14:18:21 +02:00
Warren Buckley 88c6b0450e Merge pull request #1401 from umbraco/temp-U4-8733
U4-8733 Trying to include a stylesheet in a package results in a YSOD
2016-07-27 13:18:07 +01:00
Claus 9ae339f17b removing a console.log.
whitespace and some formatting.
2016-07-27 13:59:10 +02:00
Mads Rasmussen b1f13cdbb2 health check overview - hide status when group is loading 2016-07-27 13:15:22 +02:00
Mads Rasmussen 1636c16954 move loading indicator one level up in detail view, so it's visible first time the checks are run. 2016-07-27 12:40:45 +02:00
Claus f7f736fe63 Merge pull request #1403 from umbraco/temp-U4-8780
U4-8780 Error migrating from 7.2.2 -> 7.5 beta 2 - cmsStylesheetProperty invalid object name
2016-07-27 11:04:10 +02:00
bjarnef ba6736dbb3 Fix correct syntax of calc function in less 2016-07-27 10:31:18 +02:00
Mads Rasmussen 29be571afd Add button to check all groups + a bit of style polish 2016-07-27 09:31:01 +02:00
bjarnef c5b9e6a194 Load svg in <object> to have access to events and be able to manipulate svg 2016-07-27 01:36:17 +02:00
Jeremy Pyne 2cad3838f4 Update ExpressionTests.cs
Fixes for SQL replace test.
2016-07-26 10:27:19 -04:00
Sebastiaan Janssen c955cce28d Because the cmsStylesheetProperty table was already deleted by an earlier migration, it can't be deleted again
However because all of this runs in one transaction, it will try anyway, we need to do this in a "local" context instead
2016-07-26 16:20:22 +02:00
Sebastiaan Janssen bb376367d6 If the umbracoMigration table does not yet exist, then get the configured version from the web.config and parse it 2016-07-26 16:19:17 +02:00
Sebastiaan Janssen a83b524130 DetermineInstalledVersionByMigrations needs to check if the table exists, not the code asking for a version 2016-07-26 16:18:00 +02:00
Claus dcdd47dff4 adding a few unit tests to MemberService. 2016-07-26 16:05:30 +02:00
Jeremy Pyne c6a2d41888 Added test. 2016-07-26 09:45:45 -04:00
bjarnef d37b65adcf Extend model with extension property, display svg in <img> and font icon for other files 2016-07-26 14:45:03 +02:00
Claus 379a0d68f7 U4-8733 Trying to include a stylesheet in a package results in a YSOD 2016-07-26 13:38:06 +02:00
Sebastiaan Janssen c206965f88 U4-8777 ImageProcessor fails to generate thumbnail for animated gif
#U4-8777 Fixed

Updates to the latest ImageProcessor to ship in the zip release
2016-07-26 12:09:05 +02:00
Mads Rasmussen 8fd1743bce only render actions div if there are any actions 2016-07-26 12:01:24 +02:00
Claus 4acfd1dcca better error message for errors when embedding media. 2016-07-26 11:31:39 +02:00
Mads Rasmussen 67234ef115 Fixes: U4-8713 New packager - avoid horizontal scrollbar for narrow screens 2016-07-26 10:34:29 +02:00
Jeremy Pyne de89f555d4 Added missing Sql mapping for standard Replace function:
.Where<MyModel>(s => s.Name.Replace(" ", "-") == userName)

Should generate valid SQL:
REPLACE([dbo].[MyModel].[Name], ' ', '-')
2016-07-25 16:46:49 -04:00
Shannon Deminick 9f36d2b7c6 Update README.md 2016-07-25 11:13:06 +02:00
Simon Busborg 2aa27dcf8c Merge pull request #1395 from bjarnef/dev-v7-U4-8746
Open link in new browser window/tab
2016-07-25 10:45:56 +02:00
Simon Busborg 43da97332c Merge pull request #1396 from bjarnef/dev-v7-U4-8765
Open documentation link in new browser window/tab
2016-07-25 10:44:48 +02:00
Marc Goodson 379661e302 Fixes U4-8772, adds HasPublishedVersion property to mapping of IContent to ContentItemBasic, then adds existing 'has-unpublished-version' css class to list view row if item is published but has unpublished changes 2016-07-25 09:17:27 +01:00
Asbjørn Riis-Knudsen 5f3f698ffd U4-8751: Put format parameter at the end when format is specified in furtherOptions 2016-07-24 18:09:06 +02:00
Sebastiaan Janssen 4ab200d538 Request elevated command promt to install git (necessary for the install to succeed) 2016-07-23 11:52:47 +02:00
bjarnef 55fad36bad Open documentation link in new browser window/tab 2016-07-22 15:13:00 +02:00
Warren Buckley 99a7aa53a1 Merge pull request #1393 from umbraco/temp-U4-8755
U4-8755 - more explicit errors when xml cache is corrupt
2016-07-22 11:47:17 +01:00
Warren Buckley d783554476 Merge pull request #1392 from umbraco/temp-u4-8756
U4-8756 - fix 7.5 beta2 upgrade
2016-07-22 10:50:28 +01:00
bjarnef 5444b65eaf Open link in new browser window/tab 2016-07-21 19:56:57 +02:00
Warren Buckley c4400a20d6 Merge pull request #1388 from umbraco/temp-u4-8720
temp-u4-8720
2016-07-21 15:48:47 +01:00
Stephan 32d59bb2bc U4-8755 - more explicit errors when xml cache is corrupt 2016-07-21 16:46:46 +02:00
Stephan 6c6c56645d U4-8720 - add documentation 2016-07-21 15:20:45 +02:00
Warren Buckley be16e84dbb Merge pull request #1386 from umbraco/temp-u4-8663
U4-8663 - fix deleting properties in doctype editor
2016-07-21 11:39:29 +01:00
Stephan a4fec9dd0f U4-8756 - fix 7.5 beta2 upgrade 2016-07-21 11:49:25 +02:00
Sebastiaan Janssen 3f2ebbda59 U4-8757 DB error installing 7.5.0 beta2 with SQL server - first escape characters, THEN wrap the password in single quotes
#U4-8757 Fixed
2016-07-21 11:24:08 +02:00
bjarnef ed392cd252 Fix issue where subsequent submit of reset password form cleared error message 2016-07-21 02:31:40 +02:00
bjarnef 0fe24a45ff Fix position of user and help dialog position and optimization in mobile layout. 2016-07-21 00:47:28 +02:00
Sebastiaan Janssen b290e6af8a Merge pull request #1385 from umbraco/temp-u4-6247
U4-6247 - fix PublicAccess repo
2016-07-20 14:02:46 +02:00
Warren Buckley 6e440f0f69 Merge pull request #1375 from bjarnef/dev-v7-U4-8696
Only add class "-light" to grid items in content.
2016-07-20 11:12:24 +01:00
Lukas Vorlicek 2eaa2b3166 U4-7475 Feature UA-1736 (element+class styles) for TinyMCE in grid
credits to @SorenA https://github.com/umbraco/Umbraco-CMS/pull/630
2016-07-19 20:38:46 +02:00
Stephan a0caab410e U4-8720 - add dynamic support, UmbracoHelper methods 2016-07-19 16:13:46 +02:00
Warren Buckley 05ebc9dfa7 Merge branch 'abjerner-patch-9' into dev-v7 2016-07-19 14:41:08 +01:00
Warren Buckley f4a2990819 Replace inline style with CSS class that achieves same result 2016-07-19 14:38:44 +01:00
Stephan dc476dcb02 U4-8720 - get typed content by guid 2016-07-19 15:38:42 +02:00
Stephan 0603cb3ab1 U4-8720 - add IPublishedContent Site, Children ext. methods 2016-07-19 15:38:42 +02:00
Warren Buckley d81a95dbdc Merge branch 'patch-9' of https://github.com/abjerner/Umbraco-CMS into abjerner-patch-9 2016-07-19 14:06:51 +01:00
Stephan 576539c774 U4-8663 - fix deleting properties in doctype editor 2016-07-19 10:46:18 +02:00
Stephan 4786a8037c U4-6247 - fix PublicAccess repo 2016-07-18 19:26:49 +02:00
Anders Bjerner e7f0eda504 Might as well have constants for the external searcher (and indexers) 2016-07-08 12:45:17 +02:00
bjarnef b9b3de0b01 Only add class "-light" to grid items in content. 2016-07-07 23:08:58 +02:00
Anders Bjerner 826b9e9cc3 Added editor alias to the list of available editors 2016-07-04 13:09:07 +02:00
bjarnef 4b08442652 Fix localization 2016-07-01 00:04:09 +02:00
Simon Busborg fdd1a89fb3 Added utilities font weight 2016-06-28 13:11:19 +02:00
Marc Goodson 29e45534c5 Add an overload to GetDictionaryValue to provide a fallback - U4-8657 2016-06-27 16:46:52 +01:00
bjarnef 889ef47fd2 Update localization of listview bulk actions 2016-06-24 00:44:45 +02:00
Anders Bjerner 8d55a55a80 Added a tooltip with icon alias on mouseover 2016-06-23 17:45:01 +02:00
Wincent 944898d6e5 http://issues.umbraco.org/issue/U4-8530
Adds Preview property to ContentItemDisplay
2016-06-21 14:18:55 +02:00
bjarnef f247e1b66f Document getByQuery 2016-06-20 19:54:46 +02:00
Claus 2e9e8f23e9 adjustments for paddings. 2016-06-12 20:40:39 +02:00
Claus a099c40d93 U4-8584 Starterkit thumbnails are not really thumbnails
adding a parameter to the image url to avoid loading a massive image when its only rendered in a thumbnail size.
2016-06-12 20:39:53 +02:00
Oliver Philpott 952ff74899 Fixed formatting for woff2 mimetype 2016-06-09 10:26:03 +01:00
Oliver Philpott 3f5729767d U4-8509 - Added woff2 mime type 2016-06-09 10:08:05 +01:00
Darren Ferguson def690b8c3 Fix U4-8532 - No built in Active Directory authentication in Umbraco 7.3+ 2016-05-30 11:15:03 +01:00
Darren Ferguson b168923d5f http://issues.umbraco.org/issue/U4-7032 : Include a password checker for Active Directory - as ability to authenticate via AD was removed in 7.3 2016-05-29 15:46:42 +01:00
Jeroen Breuer 1fc17e6f46 Fix for U4-8510 2016-05-24 17:04:39 +02:00
bjarnef 695c69af7f Updated indent 2016-05-22 21:11:51 +02:00
bjarnef 0607782028 Added localization for the new password reset stuff. 2016-05-22 21:08:21 +02:00
bjarnef 45ff11b884 Change "siten" to "sitet" 2016-05-22 14:26:37 +02:00
bjarnef e39f818389 Fix indent 2016-05-22 13:53:43 +02:00
bjarnef e2aee08959 Change back to original timeout value. 2016-05-22 13:52:02 +02:00
bjarnef 5fab1ca207 Localize move and copy overlay titles opened from listview actions. Prepare localization of bulk messages. 2016-05-22 13:46:48 +02:00
Dennis Aaen 02ffaa9ee8 Fixed issue: U4-8435 so the link is correct in settingsdashboardintro dashboard 2016-05-10 20:33:03 +02:00
Alexander Bryukhov 89cd2f50d7 Update UI language ru.xml
New area and keys for unsaved changes dialog localization (PR #1234)
New keys for list view localization PR #1235
2016-04-24 23:09:46 +06:00
Alexander Bryukhov c10534a064 Update UI language ru.xml
Missing keys & some typos found
2016-04-14 23:31:24 +06:00
René Pjengaard f5ceab82f1 Update da.xml
Added translation for contentPublishedFailedAwaitingRelease
2016-02-12 14:00:45 +01:00
295 changed files with 6747 additions and 3839 deletions
+4 -2
View File
@@ -3,9 +3,11 @@ Umbraco CMS
Umbraco is a free open source Content Management System built on the ASP.NET platform.
## Building Umbraco from source ##
The easiest way to get started is to run `build/build.bat` which will build both the backoffice (also known as "Belle") and the Umbraco core. You can then easily start debugging from Visual Studio, or if you need to debug Belle you can run `grunt dev` in `src\Umbraco.Web.UI.Client`.
The easiest way to get started is to run `build/build.bat` which will build both the backoffice (also known as "Belle") and the Umbraco core. You can then easily start debugging from Visual Studio, or if you need to debug Belle you can run `grunt vs` in `src\Umbraco.Web.UI.Client`.
If you're interested in making changes to Belle make sure to read the [Belle ReadMe file](src/Umbraco.Web.UI.Client/README.md). Note that you can always [download a nightly build](http://nightly.umbraco.org/umbraco%207.0.0/) so you don't have to build the code yourself.
If you're interested in making changes to Belle without running Visual Studio make sure to read the [Belle ReadMe file](src/Umbraco.Web.UI.Client/README.md).
Note that you can always [download a nightly build](http://nightly.umbraco.org/?container=umbraco-750) so you don't have to build the code yourself.
## Watch a introduction video ##
+11
View File
@@ -35,7 +35,18 @@ test:
assemblies: src\Umbraco.Tests\bin\Debug\Umbraco.Tests.dll
artifacts:
- path: build\UmbracoCms.*
name: UmbracoFiles
- path: build\msbuild.log
name: BuildLog
deploy:
- provider: AzureBlob
storage_account_name: umbraconightlies
storage_access_key:
secure: bmEMml2SF7QLHULiePa/a01XOeIa2SxJeXuaZ+1R27b+Vb2nNUQVYiPlUyF2cZAFSHI/zO/LekRsVU1rTescGhJjF7SSjKybymI3p+F/OWpwqiu2WfFee1ofXBFx8QHw
container: umbraco-750
artifact: UmbracoFiles
on:
branch: dev-v7
notifications:
- provider: Slack
auth_token:
+42 -11
View File
@@ -1,23 +1,33 @@
@ECHO OFF
SETLOCAL
REM SETLOCAL is on, so changes to the path not persist to the actual user's path
:: SETLOCAL is on, so changes to the path not persist to the actual user's path
git.exe --version
if %ERRORLEVEL%==9009 GOTO :trydefaultpath
IF %ERRORLEVEL%==9009 GOTO :trydefaultpath
GOTO :EOF
:: Git is installed, no need to to anything else
:trydefaultpath
path=C:\Program Files (x86)\Git\cmd;C:\Program Files\Git\cmd;%PATH%
PATH=C:\Program Files (x86)\Git\cmd;C:\Program Files\Git\cmd;%PATH%
git.exe --version
if %ERRORLEVEL%==9009 GOTO :showerror
IF %ERRORLEVEL%==9009 GOTO :showerror
GOTO :EOF
:: Git is installed, no need to to anything else
:showerror
ECHO Git is not in your path and could not be found in C:\Program Files (x86)\Git\cmd nor in C:\Program Files\Git\cmd
set /p install=" Do you want to install Git through Chocolatey [y/n]? " %=%
if %install%==y (
SET /p install=" Do you want to install Git through Chocolatey [y/n]? " %=%
IF %install%==y (
:: Create a temporary batch file to execute either after elevating to admin or as-is when the user is already admin
ECHO @ECHO OFF > "%temp%\ChocoInstallGit.cmd"
ECHO SETLOCAL >> "%temp%\ChocoInstallGit.cmd"
ECHO ECHO Installing Chocolatey first >> "%temp%\ChocoInstallGit.cmd"
ECHO @powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" >> "%temp%\ChocoInstallGit.cmd"
ECHO SET PATH=%%PATH%%;%%ALLUSERSPROFILE%%\chocolatey\bin >> "%temp%\ChocoInstallGit.cmd"
ECHO choco install git -y >> "%temp%\ChocoInstallGit.cmd"
GOTO :installgit
) else (
) ELSE (
GOTO :cantcontinue
)
@@ -26,7 +36,28 @@ ECHO Can't complete the build without Git being in the path. Please add it to be
GOTO :EOF
:installgit
ECHO Installing Chocolatey first
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin
ECHO Installing Git through Chocolatey
choco install git
pushd %~dp0
:: Running prompt elevated
:: --> Check for permissions
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
:: --> If error flag set, we do not have admin.
IF '%errorlevel%' NEQ '0' (
GOTO UACPrompt
) ELSE ( GOTO gotAdmin )
:UACPrompt
ECHO You're not currently running this with admin privileges, we'll now try to execute the install of Git through Chocolatey after elevating to admin privileges
ECHO Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
ECHO UAC.ShellExecute "%temp%\ChocoInstallGit.cmd", "", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
EXIT /B
:gotAdmin
IF EXIST "%temp%\getadmin.vbs" ( DEL "%temp%\getadmin.vbs" )
pushd "%CD%"
CD /D "%~dp0"
CALL "%temp%\ChocoInstallGit.cmd"
+5 -5
View File
@@ -27,14 +27,14 @@
<dependency id="SharpZipLib" version="[0.86.0, 1.0.0)" />
<dependency id="MySql.Data" version="[6.9.8, 7.0.0)" />
<dependency id="xmlrpcnet" version="[2.5.0, 3.0.0)" />
<dependency id="ClientDependency" version="[1.9.0-beta4, 2.0.0)" />
<dependency id="ClientDependency" version="[1.9.1, 2.0.0)" />
<dependency id="ClientDependency-Mvc5" version="[1.8.0, 2.0.0)" />
<!-- AutoMapper can not be updated due to: https://github.com/AutoMapper/AutoMapper/issues/373#issuecomment-127644405 -->
<dependency id="AutoMapper" version="[3.0.0, 3.1.0)" />
<dependency id="Newtonsoft.Json" version="[6.0.8, 9.0.0)" />
<dependency id="Examine" version="[0.1.69-beta, 1.0.0)" />
<dependency id="ImageProcessor" version="[2.4.3, 3.0.0)" />
<dependency id="ImageProcessor.Web" version="[4.6.3, 5.0.0)" />
<dependency id="Newtonsoft.Json" version="[6.0.8, 10.0.0)" />
<dependency id="Examine" version="[0.1.69, 1.0.0)" />
<dependency id="ImageProcessor" version="[2.4.4, 3.0.0)" />
<dependency id="ImageProcessor.Web" version="[4.6.4, 5.0.0)" />
<dependency id="semver" version="[1.1.2, 2.0.0)" />
<dependency id="UrlRewritingNet" version="[2.0.7, 3.0.0)" />
<!-- Markdown can not be updated due to: https://github.com/hey-red/markdownsharp/issues/71#issuecomment-233585487 -->
+3 -3
View File
@@ -16,8 +16,8 @@
<tags>umbraco</tags>
<dependencies>
<dependency id="UmbracoCms.Core" version="[$version$]" />
<dependency id="Newtonsoft.Json" version="[6.0.8, 9.0.0)" />
<dependency id="Umbraco.ModelsBuilder" version="[3.0.3, 4.0.0)" />
<dependency id="Newtonsoft.Json" version="[6.0.8, 10.0.0)" />
<dependency id="Umbraco.ModelsBuilder" version="[3.0.4, 4.0.0)" />
</dependencies>
</metadata>
<files>
@@ -45,4 +45,4 @@
<file src="tools\Views.Web.config.install.xdt" target="Views\Web.config.install.xdt" />
<file src="build\**" target="build" />
</files>
</package>
</package>
@@ -21,6 +21,12 @@
</section>
<section alias="StartupDeveloperDashboardSection" xdt:Locator="Match(alias)" xdt:Transform="InsertIfMissing">
<areas xdt:Transform="InsertIfMissing">
<area xdt:Transform="InsertIfMissing">developer</area>
</areas>
</section>
<section alias="StartupDeveloperDashboardSection">
<tab caption="Get Started" xdt:Locator="Match(caption)" xdt:Transform="Replace">
<control showOnce="true" addPanel="true" panelCaption="">
views/dashboard/developer/developerdashboardvideos.html
@@ -30,16 +36,21 @@
</section>
<section alias="StartupDeveloperDashboardSection" xdt:Locator="Match(alias)" xdt:Transform="InsertIfMissing">
<tab caption="Examine Management" xdt:Locator="Match(caption)" xdt:Transform="InsertIfMissing">
<tab caption="Examine Management" xdt:Locator="Match(caption)" xdt:Transform="InsertIfMissing">
<control>
views/dashboard/developer/examinemanagement.html
</control>
</tab>
<tab caption="Xml Data Integrity Report" xdt:Transform="InsertIfMissing">
</tab>
<tab caption="Health Check" xdt:Transform="InsertIfMissing" xdt:Locator="Match(caption)">
<control>
views/dashboard/developer/xmldataintegrityreport.html
views/dashboard/developer/healthcheck.html
</control>
</tab>
</tab>
<tab caption="Redirect URL Management" xdt:Transform="InsertIfMissing" xdt:Locator="Match(caption)">
<control>
views/dashboard/developer/redirecturls.html
</control>
</tab>
</section>
<section alias="StartupMediaDashboardSection" xdt:Locator="Match(alias)" xdt:Transform="InsertIfMissing">
@@ -52,19 +63,6 @@
</tab>
</section>
<section alias="StartupDashboardSection" xdt:Locator="Match(alias)" xdt:Transform="InsertIfMissing">
<tab caption="Get Started" xdt:Locator="Match(caption)" xdt:Transform="Remove" />
<tab caption="Get Started" xdt:Transform="Insert">
<access>
<grant>admin</grant>
</access>
<control showOnce="true" addPanel="true" panelCaption="">
views/dashboard/default/startupdashboardintro.html
</control>
</tab>
<tab caption="Last Edits" xdt:Locator="Match(caption)" xdt:Transform="Remove" />
</section>
<section alias="StartupMemberDashboardSection" xdt:Locator="Match(alias)" xdt:Transform="InsertIfMissing">
<tab caption="Get Started" xdt:Locator="Match(caption)" xdt:Transform="Remove" />
<tab caption="Get Started" xdt:Transform="Insert">
@@ -80,5 +78,6 @@
<section alias="StartupDashboardSection">
<tab caption="Change Password" xdt:Locator="Match(caption)" xdt:Transform="Remove" />
<tab caption="Last Edits" xdt:Locator="Match(caption)" xdt:Transform="Remove" />
</section>
</dashBoard>
@@ -292,6 +292,8 @@
<mimeMap fileExtension=".svg" mimeType="image/svg+xml" xdt:Locator="Match(fileExtension)" xdt:Transform="InsertIfMissing" />
<remove fileExtension=".woff" xdt:Locator="Match(fileExtension)" xdt:Transform="InsertIfMissing" />
<mimeMap fileExtension=".woff" mimeType="application/x-font-woff" xdt:Locator="Match(fileExtension)" xdt:Transform="InsertIfMissing" />
<remove fileExtension=".woff2" xdt:Locator="Match(fileExtension)" xdt:Transform="InsertIfMissing" />
<mimeMap fileExtension=".woff2" mimeType="application/x-font-woff2" xdt:Locator="Match(fileExtension)" xdt:Transform="InsertIfMissing" />
<remove fileExtension=".less" xdt:Locator="Match(fileExtension)" xdt:Transform="InsertIfMissing" />
<mimeMap fileExtension=".less" mimeType="text/css" xdt:Locator="Match(fileExtension)" xdt:Transform="InsertIfMissing" />
</staticContent>
+17 -9
View File
@@ -55,21 +55,29 @@
xdt:Transform="SetAttributes()" />
<!--Developer-->
<add alias="datatype" application="developer"
<add alias="packager" application="developer"
xdt:Locator="Match(application,alias)"
xdt:Transform="Remove" />
<add initialize="true" sortOrder="0" alias="datatypes" application="developer" title="Data Types" iconClosed="icon-folder" iconOpen="icon-folder" type="Umbraco.Web.Trees.DataTypeTreeController, umbraco"
<add alias="packagerPackages" application="developer"
xdt:Locator="Match(application,alias)"
xdt:Transform="InsertIfMissing" />
xdt:Transform="Remove" />
<add initialize="true" sortOrder="0" alias="packager" application="developer" iconClosed="icon-folder" iconOpen="icon-folder-open" type="Umbraco.Web.Trees.PackagesTreeController, umbraco"
xdt:Locator="Match(application,alias)"
xdt:Transform="InsertIfMissing" />
<!-- Before 7.4 this tree had the alias 'dataType', without the 's' on the end, this is here to rename it -->
<add sortOrder="1" alias="dataTypes" application="developer" type="Umbraco.Web.Trees.DataTypeTreeController, umbraco"
xdt:Locator="Match(application,type)"
xdt:Transform="SetAttributes(alias,sortOrder)" />
<!-- Yes, set the sortOrder again, like above because.. sometimes apparently we already have a dataTypes node and we can't remove more than one.. if they're equal though (same alias,application and sortOrder) it doesn't throw an error -->
<add sortOrder="1" alias="dataTypes" application="developer"
xdt:Locator="Match(application,alias)"
xdt:Transform="SetAttributes(sortOrder)" />
<add application="developer" alias="macros" title="Macros" type="umbraco.loadMacros, umbraco" iconClosed="icon-folder" iconOpen="icon-folder" sortOrder="2"
xdt:Locator="Match(application,alias)"
xdt:Transform="SetAttributes()" />
<add application="developer" alias="packager" title="Packages" type="umbraco.loadPackager, umbraco" iconClosed="icon-folder" iconOpen="icon-folder" sortOrder="3"
xdt:Locator="Match(application,alias)"
xdt:Transform="SetAttributes()" />
<add application="developer" alias="packagerPackages" title="Packager Packages" type="umbraco.loadPackages, umbraco" iconClosed="icon-folder" iconOpen="icon-folder" initialize="false" sortOrder="3"
xdt:Locator="Match(application,alias)"
xdt:Transform="SetAttributes()" />
<add application="developer" alias="relationTypes" title="Relation Types" type="umbraco.loadRelationTypes, umbraco" iconClosed="icon-folder" iconOpen="icon-folder" sortOrder="4"
xdt:Locator="Match(application,alias)"
xdt:Transform="SetAttributes()" />
+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.5.0
beta2
7.5.3
+2 -2
View File
@@ -11,5 +11,5 @@ using System.Resources;
[assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyFileVersion("7.5.0")]
[assembly: AssemblyInformationalVersion("7.5.0-beta2")]
[assembly: AssemblyFileVersion("7.5.3")]
[assembly: AssemblyInformationalVersion("7.5.3")]
@@ -291,7 +291,19 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
true);
}
}
[ConfigurationProperty("EnableInheritedMediaTypes")]
internal InnerTextConfigurationElement<bool> EnableInheritedMediaTypes
{
get
{
return new OptionalInnerTextConfigurationElement<bool>(
(InnerTextConfigurationElement<bool>)this["EnableInheritedMediaTypes"],
//set the default
true);
}
}
string IContentSection.NotificationEmailAddress
{
get { return Notifications.NotificationEmailAddress; }
@@ -431,5 +443,10 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
{
get { return EnableInheritedDocumentTypes; }
}
bool IContentSection.EnableInheritedMediaTypes
{
get { return EnableInheritedMediaTypes; }
}
}
}
@@ -61,5 +61,7 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
string DefaultDocumentTypeProperty { get; }
bool EnableInheritedDocumentTypes { get; }
bool EnableInheritedMediaTypes { get; }
}
}
@@ -9,6 +9,8 @@
bool DisableAlternativeTemplates { get; }
bool DisableFindContentByIdPath { get; }
bool DisableRedirectUrlTracking { get; }
string UrlProviderMode { get; }
@@ -27,6 +27,12 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
get { return (bool) base["disableFindContentByIdPath"]; }
}
[ConfigurationProperty("disableRedirectUrlTracking", DefaultValue = "false")]
public bool DisableRedirectUrlTracking
{
get { return (bool) base["disableRedirectUrlTracking"]; }
}
[ConfigurationProperty("urlProviderMode", DefaultValue = "AutoLegacy")]
public string UrlProviderMode
{
@@ -6,7 +6,7 @@ namespace Umbraco.Core.Configuration
{
public class UmbracoVersion
{
private static readonly Version Version = new Version("7.5.0");
private static readonly Version Version = new Version("7.5.3");
/// <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 "beta2"; } }
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
+20 -7
View File
@@ -1,15 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Umbraco.Core
namespace Umbraco.Core
{
public static partial class Constants
{
public static class Examine
{
/// <summary>
/// The alias of the internal member indexer
/// </summary>
public const string InternalMemberIndexer = "InternalMemberIndexer";
/// <summary>
/// The alias of the internal content indexer
/// </summary>
public const string InternalIndexer = "InternalIndexer";
/// <summary>
/// The alias of the external content indexer
/// </summary>
public const string ExternalIndexer = "ExternalIndexer";
/// <summary>
/// The alias of the internal member searcher
/// </summary>
@@ -19,6 +27,11 @@ namespace Umbraco.Core
/// The alias of the internal content searcher
/// </summary>
public const string InternalSearcher = "InternalSearcher";
/// <summary>
/// The alias of the external content searcher
/// </summary>
public const string ExternalSearcher = "ExternalSearcher";
}
}
}
+30 -23
View File
@@ -1,33 +1,40 @@
namespace Umbraco.Core
{
public static partial class Constants
{
/// <summary>
/// Defines the identifiers for Umbraco system nodes.
/// </summary>
public static class System
{
/// <summary>
/// The integer identifier for global system root node.
/// </summary>
public const int Root = -1;
public static partial class Constants
{
/// <summary>
/// Defines the identifiers for Umbraco system nodes.
/// </summary>
public static class System
{
/// <summary>
/// The integer identifier for global system root node.
/// </summary>
public const int Root = -1;
/// <summary>
/// The integer identifier for content's recycle bin.
/// </summary>
public const int RecycleBinContent = -20;
/// <summary>
/// The integer identifier for content's recycle bin.
/// </summary>
public const int RecycleBinContent = -20;
/// <summary>
/// The integer identifier for media's recycle bin.
/// </summary>
public const int RecycleBinMedia = -21;
/// <summary>
/// The integer identifier for media's recycle bin.
/// </summary>
public const int RecycleBinMedia = -21;
public const int DefaultContentListViewDataTypeId = -95;
public const int DefaultContentListViewDataTypeId = -95;
public const int DefaultMediaListViewDataTypeId = -96;
public const int DefaultMembersListViewDataTypeId = -97;
// identifiers for lock objects
public const int ServersLock = -331;
}
}
public const int ServersLock = -331;
}
public static class DatabaseProviders
{
public const string SqlCe = "System.Data.SqlServerCe.4.0";
public const string SqlServer = "System.Data.SqlClient";
public const string MySql = "MySql.Data.MySqlClient";
}
}
}
+20 -70
View File
@@ -135,7 +135,7 @@ namespace Umbraco.Core
if (string.IsNullOrEmpty(_providerName) == false)
return _providerName;
_providerName = "System.Data.SqlClient";
_providerName = Constants.DatabaseProviders.SqlServer;
if (ConfigurationManager.ConnectionStrings[GlobalSettings.UmbracoConnectionName] != null)
{
if (string.IsNullOrEmpty(ConfigurationManager.ConnectionStrings[GlobalSettings.UmbracoConnectionName].ProviderName) == false)
@@ -212,10 +212,10 @@ namespace Umbraco.Core
{
var provider = DbConnectionExtensions.DetectProviderFromConnectionString(connectionString);
var databaseProvider = provider.ToString();
var providerName = "System.Data.SqlClient";
var providerName = Constants.DatabaseProviders.SqlServer;
if (databaseProvider.ToLower().Contains("mysql"))
{
providerName = "MySql.Data.MySqlClient";
providerName = Constants.DatabaseProviders.MySql;
}
SaveConnectionString(connectionString, providerName);
Initialize(string.Empty);
@@ -240,10 +240,10 @@ namespace Umbraco.Core
public string GetDatabaseConnectionString(string server, string databaseName, string user, string password, string databaseProvider, out string providerName)
{
providerName = "System.Data.SqlClient";
providerName = Constants.DatabaseProviders.SqlServer;
if (databaseProvider.ToLower().Contains("mysql"))
{
providerName = "MySql.Data.MySqlClient";
providerName = Constants.DatabaseProviders.MySql;
return string.Format("Server={0}; Database={1};Uid={2};Pwd={3}", server, databaseName, user, password);
}
if (databaseProvider.ToLower().Contains("azure"))
@@ -260,7 +260,7 @@ namespace Umbraco.Core
/// <param name="databaseName">Name of the database</param>
public void ConfigureIntegratedSecurityDatabaseConnection(string server, string databaseName)
{
const string providerName = "System.Data.SqlClient";
const string providerName = Constants.DatabaseProviders.SqlServer;
var connectionString = GetIntegratedSecurityDatabaseConnectionString(server, databaseName);
SaveConnectionString(connectionString, providerName);
Initialize(providerName);
@@ -373,7 +373,7 @@ namespace Umbraco.Core
var databaseSettings = ConfigurationManager.ConnectionStrings[GlobalSettings.UmbracoConnectionName];
if (databaseSettings != null && string.IsNullOrWhiteSpace(databaseSettings.ConnectionString) == false && string.IsNullOrWhiteSpace(databaseSettings.ProviderName) == false)
{
var providerName = "System.Data.SqlClient";
var providerName = Constants.DatabaseProviders.SqlServer;
string connString = null;
if (!string.IsNullOrEmpty(ConfigurationManager.ConnectionStrings[GlobalSettings.UmbracoConnectionName].ProviderName))
{
@@ -381,8 +381,7 @@ namespace Umbraco.Core
connString = ConfigurationManager.ConnectionStrings[GlobalSettings.UmbracoConnectionName].ConnectionString;
}
Initialize(providerName, connString);
DetermineSqlServerVersion();
}
else if (ConfigurationManager.AppSettings.ContainsKey(GlobalSettings.UmbracoConnectionName) && string.IsNullOrEmpty(ConfigurationManager.AppSettings[GlobalSettings.UmbracoConnectionName]) == false)
{
@@ -395,8 +394,8 @@ namespace Umbraco.Core
else if (legacyConnString.ToLowerInvariant().Contains("tcp:"))
{
//Must be sql azure
SaveConnectionString(legacyConnString, "System.Data.SqlClient");
Initialize("System.Data.SqlClient");
SaveConnectionString(legacyConnString, Constants.DatabaseProviders.SqlServer);
Initialize(Constants.DatabaseProviders.SqlServer);
}
else if (legacyConnString.ToLowerInvariant().Contains("datalayer=mysql"))
{
@@ -407,20 +406,19 @@ namespace Umbraco.Core
foreach (var variable in legacyConnString.Split(';').Where(x => x.ToLowerInvariant().StartsWith("datalayer") == false))
connectionStringWithoutDatalayer = string.Format("{0}{1};", connectionStringWithoutDatalayer, variable);
SaveConnectionString(connectionStringWithoutDatalayer, "MySql.Data.MySqlClient");
Initialize("MySql.Data.MySqlClient");
SaveConnectionString(connectionStringWithoutDatalayer, Constants.DatabaseProviders.MySql);
Initialize(Constants.DatabaseProviders.MySql);
}
else
{
//Must be sql
SaveConnectionString(legacyConnString, "System.Data.SqlClient");
Initialize("System.Data.SqlClient");
SaveConnectionString(legacyConnString, Constants.DatabaseProviders.SqlServer);
Initialize(Constants.DatabaseProviders.SqlServer);
}
//Remove the legacy connection string, so we don't end up in a loop if something goes wrong.
GlobalSettings.RemoveSetting(GlobalSettings.UmbracoConnectionName);
DetermineSqlServerVersion();
}
else
{
@@ -465,49 +463,6 @@ namespace Umbraco.Core
Initialize(providerName);
}
/// <summary>
/// Set the lazy resolution of determining the SQL server version if that is the db type we're using
/// </summary>
private void DetermineSqlServerVersion()
{
var sqlServerSyntax = SqlSyntax as SqlServerSyntaxProvider;
if (sqlServerSyntax != null)
{
//this will not execute now, it is lazy so will only execute when we need to actually know
// the sql server version.
sqlServerSyntax.VersionName = new Lazy<SqlServerVersionName>(() =>
{
try
{
var database = this._factory.CreateDatabase();
var version = database.ExecuteScalar<string>("SELECT SERVERPROPERTY('productversion')");
var firstPart = version.Split('.')[0];
switch (firstPart)
{
case "11":
return SqlServerVersionName.V2012;
case "10":
return SqlServerVersionName.V2008;
case "9":
return SqlServerVersionName.V2005;
case "8":
return SqlServerVersionName.V2000;
case "7":
return SqlServerVersionName.V7;
default:
return SqlServerVersionName.Other;
}
}
catch (Exception)
{
return SqlServerVersionName.Invalid;
}
});
}
}
internal DatabaseSchemaResult ValidateDatabaseSchema()
{
if (_configured == false || (string.IsNullOrEmpty(_connectionString) || string.IsNullOrEmpty(ProviderName)))
@@ -517,7 +472,7 @@ namespace Umbraco.Core
{
if (SystemUtilities.GetCurrentTrustLevel() != AspNetHostingPermissionLevel.Unrestricted
&& ProviderName == "MySql.Data.MySqlClient")
&& ProviderName == Constants.DatabaseProviders.MySql)
{
throw new InvalidOperationException("Cannot use MySql in Medium Trust configuration");
}
@@ -625,13 +580,8 @@ namespace Umbraco.Core
var installedSchemaVersion = new SemVersion(schemaResult.DetermineInstalledVersion());
var installedMigrationVersion = new SemVersion(0);
//we cannot check the migrations table if it doesn't exist, this will occur when upgrading to 7.3
if (schemaResult.ValidTables.Any(x => x.InvariantEquals("umbracoMigration")))
{
installedMigrationVersion = schemaResult.DetermineInstalledVersionByMigrations(migrationEntryService);
}
var installedMigrationVersion = schemaResult.DetermineInstalledVersionByMigrations(migrationEntryService);
var targetVersion = UmbracoVersion.Current;
//In some cases - like upgrading from 7.2.6 -> 7.3, there will be no migration information in the database and therefore it will
@@ -731,7 +681,7 @@ namespace Umbraco.Core
private Attempt<Result> CheckReadyForInstall()
{
if (SystemUtilities.GetCurrentTrustLevel() != AspNetHostingPermissionLevel.Unrestricted
&& ProviderName == "MySql.Data.MySqlClient")
&& ProviderName == Constants.DatabaseProviders.MySql)
{
throw new InvalidOperationException("Cannot use MySql in Medium Trust configuration");
}
@@ -780,7 +730,7 @@ namespace Umbraco.Core
{
var dbIsSqlCe = false;
if (databaseSettings != null && databaseSettings.ProviderName != null)
dbIsSqlCe = databaseSettings.ProviderName == "System.Data.SqlServerCe.4.0";
dbIsSqlCe = databaseSettings.ProviderName == Constants.DatabaseProviders.SqlCe;
var sqlCeDatabaseExists = false;
if (dbIsSqlCe)
{
@@ -19,7 +19,7 @@ namespace Umbraco.Core.Models.Identity
Culture = Configuration.GlobalSettings.DefaultUILanguage;
}
public virtual async Task<ClaimsIdentity> GenerateUserIdentityAsync(BackOfficeUserManager manager)
public virtual async Task<ClaimsIdentity> GenerateUserIdentityAsync(BackOfficeUserManager<BackOfficeIdentityUser> manager)
{
// NOTE the authenticationType must match the umbraco one
// defined in CookieAuthenticationOptions.AuthenticationType
+1 -1
View File
@@ -135,7 +135,7 @@ namespace Umbraco.Core.Models
private static void ThrowTypeException(object value, Type expected, string alias)
{
throw new Exception(string.Format("Value \"{0}\" of type \"{1}\" could not be converted"
throw new InvalidOperationException(string.Format("Value \"{0}\" of type \"{1}\" could not be converted"
+ " to type \"{2}\" which is expected by property type \"{3}\".",
value, value.GetType(), expected, alias));
}
@@ -5,7 +5,7 @@ using Umbraco.Core.Persistence.DatabaseAnnotations;
namespace Umbraco.Core.Models.Rdbms
{
[TableName("umbracoRedirectUrl")]
[PrimaryKey("id")]
[PrimaryKey("id", autoIncrement = false)]
[ExplicitColumns]
class RedirectUrlDto
{
@@ -22,8 +22,8 @@ namespace Umbraco.Core.Models.Rdbms
// inserts, and much faster on reads, so... we have an index on a hash.
[Column("id")]
[PrimaryKeyColumn(IdentitySeed = 1, Name = "PK_umbracoRedirectUrl")]
public int Id { get; set; }
[PrimaryKeyColumn(Name = "PK_umbracoRedirectUrl", AutoIncrement = false)]
public Guid Id { get; set; }
[ResultColumn]
public int ContentId { get; set; }
@@ -39,12 +39,12 @@ namespace Umbraco.Core.Models.Rdbms
[Column("url")]
[NullSetting(NullSetting = NullSettings.NotNull)]
//[Index(IndexTypes.UniqueNonClustered, Name = "IX_umbracoRedirectUrl", ForColumns = "url, createDateUtc")]
public string Url { get; set; }
[Column("urlHash")]
[NullSetting(NullSetting = NullSettings.NotNull)]
[Index(IndexTypes.UniqueNonClustered, Name = "IX_umbracoRedirectUrl", ForColumns = "urlHash, contentKey, createDateUtc")]
[Length(40)]
public string UrlHash { get; set; }
}
}
+14 -3
View File
@@ -1,8 +1,5 @@
using System;
using System.Globalization;
using System.Linq;
using System.Threading;
using Umbraco.Core.Models.Identity;
using Umbraco.Core.Models.Membership;
using Umbraco.Core.Services;
@@ -83,5 +80,19 @@ namespace Umbraco.Core.Models
if (media == null) throw new ArgumentNullException("media");
return HasPathAccess(media.Path, user.StartMediaId, Constants.System.RecycleBinMedia);
}
/// <summary>
/// Determines whether this user is an admin.
/// </summary>
/// <param name="user"></param>
/// <returns>
/// <c>true</c> if this user is admin; otherwise, <c>false</c>.
/// </returns>
public static bool IsAdmin(this IUser user)
{
if (user == null) throw new ArgumentNullException("user");
return user.UserType.Alias == "admin";
}
}
}
@@ -107,10 +107,10 @@ namespace Umbraco.Core.Persistence
var foreignSql = _syntaxProvider.Format(tableDefinition.ForeignKeys);
var indexSql = _syntaxProvider.Format(tableDefinition.Indexes);
var tableExist = _db.TableExist(tableName);
var tableExist = TableExist(tableName);
if (overwrite && tableExist)
{
_db.DropTable(tableName);
DropTable(tableName);
tableExist = false;
}
@@ -42,13 +42,13 @@ namespace Umbraco.Core.Persistence
{
case DatabaseProviders.SqlServer:
case DatabaseProviders.SqlAzure:
factory = DbProviderFactories.GetFactory("System.Data.SqlClient");
factory = DbProviderFactories.GetFactory(Constants.DatabaseProviders.SqlServer);
break;
case DatabaseProviders.SqlServerCE:
factory = DbProviderFactories.GetFactory("System.Data.SqlServerCe.4.0");
break;
case DatabaseProviders.MySql:
factory = DbProviderFactories.GetFactory("MySql.Data.MySqlClient");
factory = DbProviderFactories.GetFactory(Constants.DatabaseProviders.MySql);
break;
case DatabaseProviders.PostgreSQL:
case DatabaseProviders.Oracle:
@@ -266,9 +266,9 @@ namespace Umbraco.Core.Persistence.Migrations.Initial
//defaults for the member list
_database.Insert("cmsDataTypePreValues", "id", false, new DataTypePreValueDto { Id = -1, Alias = "pageSize", SortOrder = 1, DataTypeNodeId = Constants.System.DefaultMembersListViewDataTypeId, Value = "10" });
_database.Insert("cmsDataTypePreValues", "id", false, new DataTypePreValueDto { Id = -2, Alias = "orderBy", SortOrder = 2, DataTypeNodeId = Constants.System.DefaultMembersListViewDataTypeId, Value = "Name" });
_database.Insert("cmsDataTypePreValues", "id", false, new DataTypePreValueDto { Id = -2, Alias = "orderBy", SortOrder = 2, DataTypeNodeId = Constants.System.DefaultMembersListViewDataTypeId, Value = "username" });
_database.Insert("cmsDataTypePreValues", "id", false, new DataTypePreValueDto { Id = -3, Alias = "orderDirection", SortOrder = 3, DataTypeNodeId = Constants.System.DefaultMembersListViewDataTypeId, Value = "asc" });
_database.Insert("cmsDataTypePreValues", "id", false, new DataTypePreValueDto { Id = -4, Alias = "includeProperties", SortOrder = 4, DataTypeNodeId = Constants.System.DefaultMembersListViewDataTypeId, Value = "[{\"alias\":\"email\",\"isSystem\":1},{\"alias\":\"username\",\"isSystem\":1},{\"alias\":\"updateDate\",\"header\":\"Last edited\",\"isSystem\":1}]" });
_database.Insert("cmsDataTypePreValues", "id", false, new DataTypePreValueDto { Id = -4, Alias = "includeProperties", SortOrder = 4, DataTypeNodeId = Constants.System.DefaultMembersListViewDataTypeId, Value = "[{\"alias\":\"username\",\"isSystem\":1},{\"alias\":\"email\",\"isSystem\":1},{\"alias\":\"updateDate\",\"header\":\"Last edited\",\"isSystem\":1}]" });
//layouts for the list view
var cardLayout = "{\"name\": \"Grid\",\"path\": \"views/propertyeditors/listview/layouts/grid/grid.html\", \"icon\": \"icon-thumbnails-small\", \"isSystem\": 1, \"selected\": true}";
@@ -276,10 +276,10 @@ namespace Umbraco.Core.Persistence.Migrations.Initial
//defaults for the media list
_database.Insert("cmsDataTypePreValues", "id", false, new DataTypePreValueDto { Id = -5, Alias = "pageSize", SortOrder = 1, DataTypeNodeId = Constants.System.DefaultMediaListViewDataTypeId, Value = "100" });
_database.Insert("cmsDataTypePreValues", "id", false, new DataTypePreValueDto { Id = -6, Alias = "orderBy", SortOrder = 2, DataTypeNodeId = Constants.System.DefaultMediaListViewDataTypeId, Value = "VersionDate" });
_database.Insert("cmsDataTypePreValues", "id", false, new DataTypePreValueDto { Id = -6, Alias = "orderBy", SortOrder = 2, DataTypeNodeId = Constants.System.DefaultMediaListViewDataTypeId, Value = "updateDate" });
_database.Insert("cmsDataTypePreValues", "id", false, new DataTypePreValueDto { Id = -7, Alias = "orderDirection", SortOrder = 3, DataTypeNodeId = Constants.System.DefaultMediaListViewDataTypeId, Value = "desc" });
_database.Insert("cmsDataTypePreValues", "id", false, new DataTypePreValueDto { Id = -8, Alias = "layouts", SortOrder = 4, DataTypeNodeId = Constants.System.DefaultMediaListViewDataTypeId, Value = "[" + cardLayout + "," + listLayout + "]" });
_database.Insert("cmsDataTypePreValues", "id", false, new DataTypePreValueDto { Id = -9, Alias = "includeProperties", SortOrder = 5, DataTypeNodeId = Constants.System.DefaultMediaListViewDataTypeId, Value = "[{\"alias\":\"sortOrder\",\"isSystem\":1, \"header\": \"Sort order\"},{\"alias\":\"updateDate\",\"header\":\"Last edited\",\"isSystem\":1},{\"alias\":\"owner\",\"header\":\"Updated by\",\"isSystem\":1}]" });
_database.Insert("cmsDataTypePreValues", "id", false, new DataTypePreValueDto { Id = -9, Alias = "includeProperties", SortOrder = 5, DataTypeNodeId = Constants.System.DefaultMediaListViewDataTypeId, Value = "[{\"alias\":\"updateDate\",\"header\":\"Last edited\",\"isSystem\":1},{\"alias\":\"owner\",\"header\":\"Updated by\",\"isSystem\":1}]" });
}
private void CreateUmbracoRelationTypeData()
@@ -43,8 +43,13 @@ namespace Umbraco.Core.Persistence.Migrations.Initial
/// <returns></returns>
public SemVersion DetermineInstalledVersionByMigrations(IMigrationEntryService migrationEntryService)
{
var allMigrations = migrationEntryService.GetAll(GlobalSettings.UmbracoMigrationName);
var mostrecent = allMigrations.OrderByDescending(x => x.Version).Select(x => x.Version).FirstOrDefault();
SemVersion mostrecent = null;
if (ValidTables.Any(x => x.InvariantEquals("umbracoMigration")))
{
var allMigrations = migrationEntryService.GetAll(GlobalSettings.UmbracoMigrationName);
mostrecent = allMigrations.OrderByDescending(x => x.Version).Select(x => x.Version).FirstOrDefault();
}
return mostrecent ?? new SemVersion(new Version(0, 0, 0));
}
@@ -116,13 +121,19 @@ namespace Umbraco.Core.Persistence.Migrations.Initial
//if the error is for umbracoAccess it must be the previous version to 7.3 since that is when it is added
if (Errors.Any(x => x.Item1.Equals("Table") && (x.Item2.InvariantEquals("umbracoAccess"))))
{
return new Version(7, 2, 5);
return new Version(7, 2, 0);
}
//if the error is for umbracoDeployChecksum it must be the previous version to 7.4 since that is when it is added
if (Errors.Any(x => x.Item1.Equals("Table") && (x.Item2.InvariantEquals("umbracoDeployChecksum"))))
{
return new Version(7, 3, 4);
return new Version(7, 3, 0);
}
//if the error is for umbracoRedirectUrl it must be the previous version to 7.5 since that is when it is added
if (Errors.Any(x => x.Item1.Equals("Table") && (x.Item2.InvariantEquals("umbracoRedirectUrl"))))
{
return new Version(7, 4, 0);
}
return UmbracoVersion.Current;
@@ -1,7 +1,6 @@
using System.Linq;
using Umbraco.Core.Configuration;
using Umbraco.Core.Logging;
using Umbraco.Core.Persistence.Migrations.Syntax.Create;
using Umbraco.Core.Persistence.SqlSyntax;
namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenFiveZero
@@ -21,24 +20,40 @@ namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenFiveZer
private string MigrationCode(Database database)
{
// don't execute if the table is already there
var tables = SqlSyntax.GetTablesInSchema(database).ToArray();
if (tables.InvariantContains("umbracoRedirectUrl")) return null;
var umbracoRedirectUrlTableName = "umbracoRedirectUrl";
var localContext = new LocalMigrationContext(Context.CurrentDatabaseProvider, database, SqlSyntax, Logger);
localContext.Create.Table("umbracoRedirectUrl")
.WithColumn("id").AsInt32().Identity().PrimaryKey("PK_umbracoRedirectUrl")
.WithColumn("contentId").AsInt32().NotNullable()
.WithColumn("createDateUtc").AsDateTime().NotNullable()
.WithColumn("url").AsString(2048).NotNullable();
var tables = SqlSyntax.GetTablesInSchema(database).ToArray();
if (tables.InvariantContains(umbracoRedirectUrlTableName))
{
var columns = SqlSyntax.GetColumnsInSchema(database).ToArray();
if (columns.Any(x => x.TableName.InvariantEquals(umbracoRedirectUrlTableName) && x.ColumnName.InvariantEquals("id") && x.DataType == "uniqueidentifier"))
return null;
localContext.Delete.Table(umbracoRedirectUrlTableName);
}
localContext.Create.Index("IX_umbracoRedirectUrl")
.OnTable("umbracoRedirectUrl")
.OnColumn("url").Ascending()
.OnColumn("createDateUtc").Ascending()
localContext.Create.Table(umbracoRedirectUrlTableName)
.WithColumn("id").AsGuid().NotNullable().PrimaryKey("PK_" + umbracoRedirectUrlTableName)
.WithColumn("createDateUtc").AsDateTime().NotNullable()
.WithColumn("url").AsString(2048).NotNullable()
.WithColumn("contentKey").AsGuid().NotNullable()
.WithColumn("urlHash").AsString(40).NotNullable();
localContext.Create.Index("IX_" + umbracoRedirectUrlTableName).OnTable(umbracoRedirectUrlTableName)
.OnColumn("urlHash")
.Ascending()
.OnColumn("contentKey")
.Ascending()
.OnColumn("createDateUtc")
.Descending()
.WithOptions().NonClustered();
localContext.Create.ForeignKey("FK_" + umbracoRedirectUrlTableName)
.FromTable(umbracoRedirectUrlTableName).ForeignColumn("contentKey")
.ToTable("umbracoNode").PrimaryColumn("uniqueID");
return localContext.GetSql();
}
@@ -1,57 +0,0 @@
using System.Linq;
using Umbraco.Core.Configuration;
using Umbraco.Core.Logging;
using Umbraco.Core.Persistence.Migrations.Syntax.Alter;
using Umbraco.Core.Persistence.Migrations.Syntax.Create;
using Umbraco.Core.Persistence.Migrations.Syntax.Delete;
using Umbraco.Core.Persistence.Migrations.Syntax.Execute;
using Umbraco.Core.Persistence.SqlSyntax;
namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenFiveZero
{
[Migration("7.5.0", 101, GlobalSettings.UmbracoMigrationName)]
public class AddRedirectUrlTable2 : MigrationBase
{
public AddRedirectUrlTable2(ISqlSyntaxProvider sqlSyntax, ILogger logger)
: base(sqlSyntax, logger)
{ }
public override void Up()
{
// defer, because we are making decisions based upon what's in the database
Execute.Code(MigrationCode);
}
private string MigrationCode(Database database)
{
var columns = SqlSyntax.GetColumnsInSchema(database).ToArray();
if (columns.Any(x => x.TableName.InvariantEquals("umbracoRedirectUrl") && x.ColumnName.InvariantEquals("contentKey")))
return null;
var localContext = new LocalMigrationContext(Context.CurrentDatabaseProvider, database, SqlSyntax, Logger);
localContext.Execute.Sql("DELETE FROM umbracoRedirectUrl"); // else cannot add non-nullable field
localContext.Delete.Column("contentId").FromTable("umbracoRedirectUrl");
// SQL CE does not want to alter-add non-nullable columns ;-(
// but it's OK to create as nullable then alter, go figure
//localContext.Alter.Table("umbracoRedirectUrl")
// .AddColumn("contentKey").AsGuid().NotNullable();
localContext.Alter.Table("umbracoRedirectUrl")
.AddColumn("contentKey").AsGuid().Nullable();
localContext.Alter.Table("umbracoRedirectUrl")
.AlterColumn("contentKey").AsGuid().NotNullable();
localContext.Create.ForeignKey("FK_umbracoRedirectUrl")
.FromTable("umbracoRedirectUrl").ForeignColumn("contentKey")
.ToTable("umbracoNode").PrimaryColumn("uniqueID");
return localContext.GetSql();
}
public override void Down()
{ }
}
}
@@ -1,57 +0,0 @@
using System.Linq;
using Umbraco.Core.Configuration;
using Umbraco.Core.Logging;
using Umbraco.Core.Persistence.SqlSyntax;
namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenFiveZero
{
[Migration("7.5.0", 102, GlobalSettings.UmbracoMigrationName)]
public class AddRedirectUrlTable3 : MigrationBase
{
public AddRedirectUrlTable3(ISqlSyntaxProvider sqlSyntax, ILogger logger)
: base(sqlSyntax, logger)
{ }
public override void Up()
{
// defer, because we are making decisions based upon what's in the database
Execute.Code(MigrationCode);
}
private string MigrationCode(Database database)
{
var columns = SqlSyntax.GetColumnsInSchema(database).ToArray();
if (columns.Any(x => x.TableName.InvariantEquals("umbracoRedirectUrl") && x.ColumnName.InvariantEquals("hurl")))
return null;
var localContext = new LocalMigrationContext(Context.CurrentDatabaseProvider, database, SqlSyntax, Logger);
localContext.Execute.Sql("DELETE FROM umbracoRedirectUrl"); // else cannot add non-nullable field
localContext.Delete.Index("IX_umbracoRedirectUrl").OnTable("umbracoRedirectUrl");
// SQL CE does not want to alter-add non-nullable columns ;-(
// but it's OK to create as nullable then alter, go figure
//localContext.Alter.Table("umbracoRedirectUrl")
// .AddColumn("urlHash").AsString(16).NotNullable();
localContext.Alter.Table("umbracoRedirectUrl")
.AddColumn("hurl").AsString(16).Nullable();
localContext.Alter.Table("umbracoRedirectUrl")
.AlterColumn("hurl").AsString(16).NotNullable();
localContext.Create.Index("IX_umbracoRedirectUrl").OnTable("umbracoRedirectUrl")
.OnColumn("hurl")
.Ascending()
.OnColumn("contentKey")
.Ascending()
.OnColumn("createDateUtc")
.Descending()
.WithOptions().NonClustered();
return localContext.GetSql();
}
public override void Down()
{ }
}
}
@@ -1,59 +0,0 @@
using System.Linq;
using Umbraco.Core.Configuration;
using Umbraco.Core.Logging;
using Umbraco.Core.Persistence.SqlSyntax;
namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenFiveZero
{
[Migration("7.5.0", 103, GlobalSettings.UmbracoMigrationName)]
public class AddRedirectUrlTable4 : MigrationBase
{
public AddRedirectUrlTable4(ISqlSyntaxProvider sqlSyntax, ILogger logger)
: base(sqlSyntax, logger)
{ }
public override void Up()
{
// defer, because we are making decisions based upon what's in the database
Execute.Code(MigrationCode);
}
private string MigrationCode(Database database)
{
var columns = SqlSyntax.GetColumnsInSchema(database).ToArray();
if (columns.Any(x => x.TableName.InvariantEquals("umbracoRedirectUrl") && x.ColumnName.InvariantEquals("urlHash")))
return null;
var localContext = new LocalMigrationContext(Context.CurrentDatabaseProvider, database, SqlSyntax, Logger);
localContext.Execute.Sql("DELETE FROM umbracoRedirectUrl"); // else cannot add non-nullable field
localContext.Delete.Index("IX_umbracoRedirectUrl").OnTable("umbracoRedirectUrl");
localContext.Delete.Column("hurl").FromTable("umbracoRedirectUrl");
// SQL CE does not want to alter-add non-nullable columns ;-(
// but it's OK to create as nullable then alter, go figure
//localContext.Alter.Table("umbracoRedirectUrl")
// .AddColumn("urlHash").AsString(16).NotNullable();
localContext.Alter.Table("umbracoRedirectUrl")
.AddColumn("urlHash").AsString(16).Nullable();
localContext.Alter.Table("umbracoRedirectUrl")
.AlterColumn("urlHash").AsString(16).NotNullable();
localContext.Create.Index("IX_umbracoRedirectUrl").OnTable("umbracoRedirectUrl")
.OnColumn("urlHash")
.Ascending()
.OnColumn("contentKey")
.Ascending()
.OnColumn("createDateUtc")
.Descending()
.WithOptions().NonClustered();
return localContext.GetSql();
}
public override void Down()
{ }
}
}
@@ -19,22 +19,32 @@ namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenFiveZer
public override void Up()
{
// defer, because we are making decisions based upon what's in the database
Execute.Code(MigrationCode);
}
private string MigrationCode(Database database)
{
var localContext = new LocalMigrationContext(Context.CurrentDatabaseProvider, database, SqlSyntax, Logger);
//Clear all stylesheet data if the tables exist
var tables = SqlSyntax.GetTablesInSchema(Context.Database).ToArray();
if (tables.InvariantContains("cmsStylesheetProperty"))
{
Delete.FromTable("cmsStylesheetProperty").AllRows();
Delete.FromTable("umbracoNode").Row(new { nodeObjectType = new Guid(Constants.ObjectTypes.StylesheetProperty) });
localContext.Delete.FromTable("cmsStylesheetProperty").AllRows();
localContext.Delete.FromTable("umbracoNode").Row(new { nodeObjectType = new Guid(Constants.ObjectTypes.StylesheetProperty) });
Delete.Table("cmsStylesheetProperty");
localContext.Delete.Table("cmsStylesheetProperty");
}
if (tables.InvariantContains("cmsStylesheet"))
{
Delete.FromTable("cmsStylesheet").AllRows();
Delete.FromTable("umbracoNode").Row(new { nodeObjectType = new Guid(Constants.ObjectTypes.Stylesheet) });
localContext.Delete.FromTable("cmsStylesheet").AllRows();
localContext.Delete.FromTable("umbracoNode").Row(new { nodeObjectType = new Guid(Constants.ObjectTypes.Stylesheet) });
Delete.Table("cmsStylesheet");
localContext.Delete.Table("cmsStylesheet");
}
return localContext.GetSql();
}
public override void Down()
+43 -29
View File
@@ -164,7 +164,7 @@ namespace Umbraco.Core.Persistence
connectionStringName = ConfigurationManager.ConnectionStrings[0].Name;
// Work out connection string and provider name
var providerName = "System.Data.SqlClient";
var providerName = Constants.DatabaseProviders.SqlServer;
if (ConfigurationManager.ConnectionStrings[connectionStringName] != null)
{
if (!string.IsNullOrEmpty(ConfigurationManager.ConnectionStrings[connectionStringName].ProviderName))
@@ -181,7 +181,7 @@ namespace Umbraco.Core.Persistence
CommonConstruct();
}
enum DBType
internal enum DBType
{
SqlServer,
SqlServerCE,
@@ -726,6 +726,42 @@ namespace Umbraco.Core.Persistence
return true;
}
/// <summary>
/// NOTE: This is a custom mod of PetaPoco!! This builds the paging sql for different db providers
/// </summary>
/// <param name="sql"></param>
/// <param name="sqlSelectRemoved"></param>
/// <param name="sqlOrderBy"></param>
/// <param name="args"></param>
/// <param name="sqlPage"></param>
/// <param name="databaseType"></param>
/// <param name="skip"></param>
/// <param name="take"></param>
internal virtual void BuildSqlDbSpecificPagingQuery(DBType databaseType, long skip, long take, string sql, string sqlSelectRemoved, string sqlOrderBy, ref object[] args, out string sqlPage)
{
if (databaseType == DBType.SqlServer || databaseType == DBType.Oracle)
{
sqlSelectRemoved = rxOrderBy.Replace(sqlSelectRemoved, "");
if (rxDistinct.IsMatch(sqlSelectRemoved))
{
sqlSelectRemoved = "peta_inner.* FROM (SELECT " + sqlSelectRemoved + ") peta_inner";
}
sqlPage = string.Format("SELECT * FROM (SELECT ROW_NUMBER() OVER ({0}) peta_rn, {1}) peta_paged WHERE peta_rn>@{2} AND peta_rn<=@{3}",
sqlOrderBy == null ? "ORDER BY (SELECT NULL)" : sqlOrderBy, sqlSelectRemoved, args.Length, args.Length + 1);
args = args.Concat(new object[] { skip, skip + take }).ToArray();
}
else if (databaseType == DBType.SqlServerCE)
{
sqlPage = string.Format("{0}\nOFFSET @{1} ROWS FETCH NEXT @{2} ROWS ONLY", sql, args.Length, args.Length + 1);
args = args.Concat(new object[] { skip, take }).ToArray();
}
else
{
sqlPage = string.Format("{0}\nLIMIT @{1} OFFSET @{2}", sql, args.Length, args.Length + 1);
args = args.Concat(new object[] { take, skip }).ToArray();
}
}
public void BuildPageQueries<T>(long skip, long take, string sql, ref object[] args, out string sqlCount, out string sqlPage)
{
// Add auto select clause
@@ -734,34 +770,12 @@ namespace Umbraco.Core.Persistence
// Split the SQL into the bits we need
string sqlSelectRemoved, sqlOrderBy;
if (!SplitSqlForPaging(sql, out sqlCount, out sqlSelectRemoved, out sqlOrderBy))
if (SplitSqlForPaging(sql, out sqlCount, out sqlSelectRemoved, out sqlOrderBy) == false)
throw new Exception("Unable to parse SQL statement for paged query");
if (_dbType == DBType.Oracle && sqlSelectRemoved.StartsWith("*"))
throw new Exception("Query must alias '*' when performing a paged query.\neg. select t.* from table t order by t.id");
// Build the SQL for the actual final result
if (_dbType == DBType.SqlServer || _dbType == DBType.Oracle)
{
sqlSelectRemoved = rxOrderBy.Replace(sqlSelectRemoved, "");
if (rxDistinct.IsMatch(sqlSelectRemoved))
{
sqlSelectRemoved = "peta_inner.* FROM (SELECT " + sqlSelectRemoved + ") peta_inner";
}
sqlPage = string.Format("SELECT * FROM (SELECT ROW_NUMBER() OVER ({0}) peta_rn, {1}) peta_paged WHERE peta_rn>@{2} AND peta_rn<=@{3}",
sqlOrderBy==null ? "ORDER BY (SELECT NULL)" : sqlOrderBy, sqlSelectRemoved, args.Length, args.Length + 1);
args = args.Concat(new object[] { skip, skip+take }).ToArray();
}
else if (_dbType == DBType.SqlServerCE)
{
sqlPage = string.Format("{0}\nOFFSET @{1} ROWS FETCH NEXT @{2} ROWS ONLY", sql, args.Length, args.Length + 1);
args = args.Concat(new object[] { skip, take }).ToArray();
}
else
{
sqlPage = string.Format("{0}\nLIMIT @{1} OFFSET @{2}", sql, args.Length, args.Length + 1);
args = args.Concat(new object[] { take, skip }).ToArray();
}
BuildSqlDbSpecificPagingQuery(_dbType, skip, take, sql, sqlSelectRemoved, sqlOrderBy, ref args, out sqlPage);
}
// Fetch a page
@@ -2315,8 +2329,8 @@ namespace Umbraco.Core.Persistence
// Member variables
string _connectionString;
string _providerName;
readonly string _connectionString;
readonly string _providerName;
DbProviderFactory _factory;
IDbConnection _sharedConnection;
IDbTransaction _transaction;
@@ -203,7 +203,8 @@ namespace Umbraco.Core.Persistence
{
//if it is sql ce or it is a sql server version less than 2008, we need to do individual inserts.
var sqlServerSyntax = SqlSyntaxContext.SqlSyntaxProvider as SqlServerSyntaxProvider;
if ((sqlServerSyntax != null && (int)sqlServerSyntax.VersionName.Value < (int)SqlServerVersionName.V2008)
if ((sqlServerSyntax != null && (int)sqlServerSyntax.GetVersionName(db) < (int)SqlServerVersionName.V2008)
|| SqlSyntaxContext.SqlSyntaxProvider is SqlCeSyntaxProvider)
{
//SqlCe doesn't support bulk insert statements!
@@ -77,7 +77,8 @@ namespace Umbraco.Core.Persistence
var type = typeof(TColumn);
var tableName = type.GetTableName();
var syntax = string.Format("{0}.{1} DESC",
//need to ensure the order by is in brackets, see: https://github.com/toptensoftware/PetaPoco/issues/177
var syntax = string.Format("({0}.{1}) DESC",
sqlSyntax.GetQuotedTableName(tableName),
sqlSyntax.GetQuotedColumnName(columnName));
@@ -440,6 +440,55 @@ namespace Umbraco.Core.Persistence.Querying
}
return HandleStringComparison(visitedObjectForMethod, compareValue, m.Method.Name, colType);
case "Replace":
string searchValue;
if (methodArgs[0].NodeType != ExpressionType.Constant)
{
//This occurs when we are getting a value from a non constant such as: x => x.Path.StartsWith(content.Path)
// So we'll go get the value:
var member = Expression.Convert(methodArgs[0], typeof(object));
var lambda = Expression.Lambda<Func<object>>(member);
var getter = lambda.Compile();
searchValue = getter().ToString();
}
else
{
searchValue = methodArgs[0].ToString();
}
if (methodArgs[0].Type != typeof(string) && TypeHelper.IsTypeAssignableFrom<IEnumerable>(methodArgs[0].Type))
{
throw new NotSupportedException("An array Contains method is not supported");
}
string replaceValue;
if (methodArgs[1].NodeType != ExpressionType.Constant)
{
//This occurs when we are getting a value from a non constant such as: x => x.Path.StartsWith(content.Path)
// So we'll go get the value:
var member = Expression.Convert(methodArgs[1], typeof(object));
var lambda = Expression.Lambda<Func<object>>(member);
var getter = lambda.Compile();
replaceValue = getter().ToString();
}
else
{
replaceValue = methodArgs[1].ToString();
}
if (methodArgs[1].Type != typeof(string) && TypeHelper.IsTypeAssignableFrom<IEnumerable>(methodArgs[1].Type))
{
throw new NotSupportedException("An array Contains method is not supported");
}
SqlParameters.Add(RemoveQuote(searchValue));
SqlParameters.Add(RemoveQuote(replaceValue));
return string.Format("replace({0}, @{1}, @{2})", visitedObjectForMethod, SqlParameters.Count - 2, SqlParameters.Count - 1);
//case "Substring":
// var startIndex = Int32.Parse(args[0].ToString()) + 1;
// if (args.Count == 2)
@@ -501,7 +550,7 @@ namespace Umbraco.Core.Persistence.Querying
//case "As":
// return string.Format("{0} As {1}", r,
// GetQuotedColumnName(RemoveQuoteFromAlias(RemoveQuote(args[0].ToString()))));
default:
throw new ArgumentOutOfRangeException("No logic supported for " + m.Method.Name);
@@ -6,6 +6,7 @@ using System.Linq;
using System.Linq.Expressions;
using System.Net.Http.Headers;
using System.Text;
using System.Xml;
using System.Xml.Linq;
using Umbraco.Core.Configuration;
using Umbraco.Core.Dynamics;
@@ -63,9 +64,9 @@ namespace Umbraco.Core.Persistence.Repositories
var sql = GetBaseQuery(false)
.Where(GetBaseWhereClause(), new { Id = id })
.Where<DocumentDto>(x => x.Newest)
.OrderByDescending<ContentVersionDto>(x => x.VersionDate);
.OrderByDescending<ContentVersionDto>(x => x.VersionDate, SqlSyntax);
var dto = Database.Fetch<DocumentDto, ContentVersionDto, ContentDto, NodeDto, DocumentPublishedReadOnlyDto>(sql).FirstOrDefault();
var dto = Database.Fetch<DocumentDto, ContentVersionDto, ContentDto, NodeDto, DocumentPublishedReadOnlyDto>(SqlSyntax.SelectTop(sql, 1)).FirstOrDefault();
if (dto == null)
return null;
@@ -688,6 +689,77 @@ namespace Umbraco.Core.Persistence.Repositories
}
}
/// <summary>
/// This builds the Xml document used for the XML cache
/// </summary>
/// <returns></returns>
public XmlDocument BuildXmlCache()
{
//TODO: This is what we should do , but converting to use XDocument would be breaking unless we convert
// to XmlDocument at the end of this, but again, this would be bad for memory... though still not nearly as
// bad as what is happening before!
// We'll keep using XmlDocument for now though, but XDocument xml generation is much faster:
// https://blogs.msdn.microsoft.com/codejunkie/2008/10/08/xmldocument-vs-xelement-performance/
// I think we already have code in here to convert XDocument to XmlDocument but in case we don't here
// it is: https://blogs.msdn.microsoft.com/marcelolr/2009/03/13/fast-way-to-convert-xmldocument-into-xdocument/
//// Prepare an XmlDocument with an appropriate inline DTD to match
//// the expected content
//var parent = new XElement("root", new XAttribute("id", "-1"));
//var xmlDoc = new XDocument(
// new XDocumentType("root", null, null, DocumentType.GenerateDtd()),
// parent);
var xmlDoc = new XmlDocument();
var doctype = xmlDoc.CreateDocumentType("root", null, null,
ApplicationContext.Current.Services.ContentTypeService.GetContentTypesDtd());
xmlDoc.AppendChild(doctype);
var parent = xmlDoc.CreateElement("root");
var pIdAtt = xmlDoc.CreateAttribute("id");
pIdAtt.Value = "-1";
parent.Attributes.Append(pIdAtt);
xmlDoc.AppendChild(parent);
const string sql = @"select umbracoNode.id, umbracoNode.parentID, umbracoNode.sortOrder, cmsContentXml.xml, umbracoNode.level from umbracoNode
inner join cmsContentXml on cmsContentXml.nodeId = umbracoNode.id and umbracoNode.nodeObjectType = @type
where umbracoNode.id in (select cmsDocument.nodeId from cmsDocument where cmsDocument.published = 1)
order by umbracoNode.level, umbracoNode.parentID, umbracoNode.sortOrder";
XmlElement last = null;
//NOTE: Query creates a reader - does not load all into memory
foreach (var row in Database.Query<dynamic>(sql, new { type = new Guid(Constants.ObjectTypes.Document) }))
{
string parentId = ((int)row.parentID).ToInvariantString();
string xml = row.xml;
int sortOrder = row.sortOrder;
//if the parentid is changing
if (last != null && last.GetAttribute("parentID") != parentId)
{
parent = xmlDoc.GetElementById(parentId);
if (parent == null)
{
//Need to short circuit here, if the parent is not there it means that the parent is unpublished
// and therefore the child is not published either so cannot be included in the xml cache
continue;
}
}
var xmlDocFragment = xmlDoc.CreateDocumentFragment();
xmlDocFragment.InnerXml = xml;
last = (XmlElement)parent.AppendChild(xmlDocFragment);
// fix sortOrder - see notes in UpdateSortOrder
last.Attributes["sortOrder"].Value = sortOrder.ToInvariantString();
}
return xmlDoc;
}
public int CountPublished()
{
var sql = GetBaseQuery(true).Where<NodeDto>(x => x.Trashed == false)
@@ -251,8 +251,8 @@ AND umbracoNode.id <> @id",
var nodeDto = dto.NodeDto;
Database.Update(nodeDto);
// look up ContentType entry to get PrimaryKey for updating the DTO
// fixme - why? we are UPDATING so we should ALREADY have a PK!
//Look up ContentType entry to get PrimaryKey for updating the DTO
var dtoPk = Database.First<ContentTypeDto>("WHERE nodeId = @Id", new { Id = entity.Id });
dto.PrimaryKey = dtoPk.PrimaryKey;
Database.Update(dto);
@@ -262,31 +262,30 @@ AND umbracoNode.id <> @id",
foreach (var composition in entity.ContentTypeComposition)
Database.Insert(new ContentType2ContentTypeDto { ParentId = composition.Id, ChildId = entity.Id });
//Removing a ContentType from a composition (U4-1690)
//1. Find content based on the current ContentType: entity.Id
//2. Find all PropertyTypes on the ContentType that was removed - tracked id (key)
//3. Remove properties based on property types from the removed content type where the content ids correspond to those found in step one
// removing a ContentType from a composition (U4-1690)
// 1. Find content based on the current ContentType: entity.Id
// 2. Find all PropertyTypes on the ContentType that was removed - tracked id (key)
// 3. Remove properties based on property types from the removed content type where the content ids correspond to those found in step one
var compositionBase = entity as ContentTypeCompositionBase;
if (compositionBase != null && compositionBase.RemovedContentTypeKeyTracker != null &&
compositionBase.RemovedContentTypeKeyTracker.Any())
{
//Find Content based on the current ContentType
// find Content based on the current ContentType
var sql = new Sql();
sql.Select("*")
.From<ContentDto>()
.InnerJoin<NodeDto>()
.On<ContentDto, NodeDto>(left => left.NodeId, right => right.NodeId)
.From<ContentDto>(SqlSyntax)
.InnerJoin<NodeDto>(SqlSyntax).On<ContentDto, NodeDto>(SqlSyntax, left => left.NodeId, right => right.NodeId)
.Where<NodeDto>(x => x.NodeObjectType == new Guid(Constants.ObjectTypes.Document))
.Where<ContentDto>(x => x.ContentTypeId == entity.Id);
var contentDtos = Database.Fetch<ContentDto, NodeDto>(sql);
//Loop through all tracked keys, which corresponds to the ContentTypes that has been removed from the composition
// loop through all tracked keys, which corresponds to the ContentTypes that has been removed from the composition
foreach (var key in compositionBase.RemovedContentTypeKeyTracker)
{
//Find PropertyTypes for the removed ContentType
// find PropertyTypes for the removed ContentType
var propertyTypes = Database.Fetch<PropertyTypeDto>("WHERE contentTypeId = @Id", new { Id = key });
//Loop through the Content that is based on the current ContentType in order to remove the Properties that are
//based on the PropertyTypes that belong to the removed ContentType.
// loop through the Content that is based on the current ContentType in order to remove the Properties that are
// based on the PropertyTypes that belong to the removed ContentType.
foreach (var contentDto in contentDtos)
{
foreach (var propertyType in propertyTypes)
@@ -294,51 +293,47 @@ AND umbracoNode.id <> @id",
var nodeId = contentDto.NodeId;
var propertyTypeId = propertyType.Id;
var propertySql = new Sql().Select("cmsPropertyData.id")
.From<PropertyDataDto>()
.InnerJoin<PropertyTypeDto>()
.On<PropertyDataDto, PropertyTypeDto>(
left => left.PropertyTypeId, right => right.Id)
.Where<PropertyDataDto>(x => x.NodeId == nodeId)
.Where<PropertyTypeDto>(x => x.Id == propertyTypeId);
.From<PropertyDataDto>(SqlSyntax)
.InnerJoin<PropertyTypeDto>(SqlSyntax).On<PropertyDataDto, PropertyTypeDto>(SqlSyntax, left => left.PropertyTypeId, right => right.Id)
.Where<PropertyDataDto>(x => x.NodeId == nodeId)
.Where<PropertyTypeDto>(x => x.Id == propertyTypeId);
//Finally delete the properties that match our criteria for removing a ContentType from the composition
// finally delete the properties that match our criteria for removing a ContentType from the composition
Database.Delete<PropertyDataDto>(new Sql("WHERE id IN (" + propertySql.SQL + ")", propertySql.Arguments));
}
}
}
}
//Delete the allowed content type entries before adding the updated collection
Database.Delete<ContentTypeAllowedContentTypeDto>("WHERE Id = @Id", new { Id = entity.Id });
//Insert collection of allowed content types
// delete the allowed content type entries before re-inserting the collectino of allowed content types
Database.Delete<ContentTypeAllowedContentTypeDto>("WHERE Id = @Id", new { entity.Id });
foreach (var allowedContentType in entity.AllowedContentTypes)
{
Database.Insert(new ContentTypeAllowedContentTypeDto
{
Id = entity.Id,
AllowedId = allowedContentType.Id.Value,
SortOrder = allowedContentType.SortOrder
});
{
Id = entity.Id,
AllowedId = allowedContentType.Id.Value,
SortOrder = allowedContentType.SortOrder
});
}
// FIXME below, manage the property types
if (((ICanBeDirty)entity).IsPropertyDirty("PropertyTypes") || entity.PropertyTypes.Any(x => x.IsDirty()))
// delete ??? fixme wtf is this?!
// by excepting entries from db with entries from collections
if (entity.IsPropertyDirty("PropertyTypes") || entity.PropertyTypes.Any(x => x.IsDirty()))
{
//Delete PropertyTypes by excepting entries from db with entries from collections
var dbPropertyTypes = Database.Fetch<PropertyTypeDto>("WHERE contentTypeId = @Id", new { Id = entity.Id });
var dbPropertyTypeAlias = dbPropertyTypes.Select(x => x.Id);
var entityPropertyTypes = entity.PropertyTypes.Where(x => x.HasIdentity).Select(x => x.Id);
var items = dbPropertyTypeAlias.Except(entityPropertyTypes);
foreach (var item in items)
{
//Before a PropertyType can be deleted, all Properties based on that PropertyType should be deleted.
Database.Delete<TagRelationshipDto>("WHERE propertyTypeId = @Id", new { Id = item });
Database.Delete<PropertyDataDto>("WHERE propertytypeid = @Id", new { Id = item });
Database.Delete<PropertyTypeDto>("WHERE contentTypeId = @Id AND id = @PropertyTypeId",
new { Id = entity.Id, PropertyTypeId = item });
}
DeletePropertyType(entity.Id, item);
}
// delete tabs
// by excepting entries from db with entries from collections
List<int> orphanPropertyTypeIds = null;
if (entity.IsPropertyDirty("PropertyGroups") || entity.PropertyGroups.Any(x => x.IsDirty()))
{
// todo
@@ -357,68 +352,97 @@ AND umbracoNode.id <> @id",
// (all gone)
// delete tabs that do not exist anymore
// get the tabs that are currently existing (in the db)
// get the tabs that we want, now
// and derive the tabs that we want to delete
// get the tabs that are currently existing (in the db), get the tabs that we want,
// now, and derive the tabs that we want to delete
var existingPropertyGroups = Database.Fetch<PropertyTypeGroupDto>("WHERE contentTypeNodeId = @id", new { id = entity.Id })
.Select(x => x.Id)
.ToList();
var newPropertyGroups = entity.PropertyGroups.Select(x => x.Id).ToList();
var tabsToDelete = existingPropertyGroups
var groupsToDelete = existingPropertyGroups
.Except(newPropertyGroups)
.ToArray();
// move properties to generic properties, and delete the tabs
if (tabsToDelete.Length > 0)
// delete the tabs
if (groupsToDelete.Length > 0)
{
Database.Update<PropertyTypeDto>("SET propertyTypeGroupId=NULL WHERE propertyTypeGroupId IN (@ids)", new { ids = tabsToDelete });
Database.Delete<PropertyTypeGroupDto>("WHERE id IN (@ids)", new { ids = tabsToDelete });
// if the tab contains properties, take care of them
// - move them to 'generic properties' so they remain consistent
// - keep track of them, later on we'll figure out what to do with them
// see http://issues.umbraco.org/issue/U4-8663
orphanPropertyTypeIds = Database.Fetch<PropertyTypeDto>("WHERE propertyTypeGroupId IN (@ids)", new { ids = groupsToDelete })
.Select(x => x.Id).ToList();
Database.Update<PropertyTypeDto>("SET propertyTypeGroupId=NULL WHERE propertyTypeGroupId IN (@ids)", new { ids = groupsToDelete });
// now we can delete the tabs
Database.Delete<PropertyTypeGroupDto>("WHERE id IN (@ids)", new { ids = groupsToDelete });
}
}
var propertyGroupFactory = new PropertyGroupFactory(entity.Id);
//Run through all groups to insert or update entries
// insert or update groups, assign properties
foreach (var propertyGroup in entity.PropertyGroups)
{
var tabDto = propertyGroupFactory.BuildGroupDto(propertyGroup);
int groupPrimaryKey = propertyGroup.HasIdentity
? Database.Update(tabDto)
: Convert.ToInt32(Database.Insert(tabDto));
// insert or update group
var groupDto = propertyGroupFactory.BuildGroupDto(propertyGroup);
var groupId = propertyGroup.HasIdentity
? Database.Update(groupDto)
: Convert.ToInt32(Database.Insert(groupDto));
if (propertyGroup.HasIdentity == false)
propertyGroup.Id = groupPrimaryKey; //Set Id on new PropertyGroup
propertyGroup.Id = groupId;
else
groupId = propertyGroup.Id;
//Ensure that the PropertyGroup's Id is set on the PropertyTypes within a group
//unless the PropertyGroupId has already been changed.
// assign properties to the group
// (all of them, even those that have .IsPropertyDirty("PropertyGroupId") == true,
// because it should have been set to this group anyways and better be safe)
foreach (var propertyType in propertyGroup.PropertyTypes)
{
if (propertyType.IsPropertyDirty("PropertyGroupId") == false)
{
var tempGroup = propertyGroup;
propertyType.PropertyGroupId = new Lazy<int>(() => tempGroup.Id);
}
}
propertyType.PropertyGroupId = new Lazy<int>(() => groupId);
}
//Run through all PropertyTypes to insert or update entries
// insert or update properties
// all of them, no-group and in groups
foreach (var propertyType in entity.PropertyTypes)
{
var tabId = propertyType.PropertyGroupId != null ? propertyType.PropertyGroupId.Value : default(int);
//If the Id of the DataType is not set, we resolve it from the db by its PropertyEditorAlias
if (propertyType.DataTypeDefinitionId == 0 || propertyType.DataTypeDefinitionId == default(int))
{
AssignDataTypeFromPropertyEditor(propertyType);
}
var groupId = propertyType.PropertyGroupId != null ? propertyType.PropertyGroupId.Value : default(int);
//validate the alias!
// if the Id of the DataType is not set, we resolve it from the db by its PropertyEditorAlias
if (propertyType.DataTypeDefinitionId == 0 || propertyType.DataTypeDefinitionId == default(int))
AssignDataTypeFromPropertyEditor(propertyType);
// validate the alias
ValidateAlias(propertyType);
var propertyTypeDto = propertyGroupFactory.BuildPropertyTypeDto(tabId, propertyType);
int typePrimaryKey = propertyType.HasIdentity
? Database.Update(propertyTypeDto)
: Convert.ToInt32(Database.Insert(propertyTypeDto));
// insert or update property
var propertyTypeDto = propertyGroupFactory.BuildPropertyTypeDto(groupId, propertyType);
var typeId = propertyType.HasIdentity
? Database.Update(propertyTypeDto)
: Convert.ToInt32(Database.Insert(propertyTypeDto));
if (propertyType.HasIdentity == false)
propertyType.Id = typePrimaryKey; //Set Id on new PropertyType
propertyType.Id = typeId;
else
typeId = propertyType.Id;
// not an orphan anymore
if (orphanPropertyTypeIds != null)
orphanPropertyTypeIds.Remove(typeId);
}
// deal with orphan properties: those that were in a deleted tab,
// and have not been re-mapped to another tab or to 'generic properties'
if (orphanPropertyTypeIds != null)
foreach (var id in orphanPropertyTypeIds)
DeletePropertyType(entity.Id, id);
}
private void DeletePropertyType(int contentTypeId, int propertyTypeId)
{
// first clear dependencies
Database.Delete<TagRelationshipDto>("WHERE propertyTypeId = @Id", new { Id = propertyTypeId });
Database.Delete<PropertyDataDto>("WHERE propertytypeid = @Id", new { Id = propertyTypeId });
// then delete the property type
Database.Delete<PropertyTypeDto>("WHERE contentTypeId = @Id AND id = @PropertyTypeId", new { Id = contentTypeId, PropertyTypeId = propertyTypeId });
}
protected IEnumerable<ContentTypeSort> GetAllowedContentTypeIds(int id)
@@ -649,7 +673,7 @@ AND umbracoNode.id <> @id",
var allParentContentTypes = contentTypes.Where(x => allParentIdsAsArray.Contains(x.Id)).ToArray();
foreach (var contentType in contentTypes)
{
{
var entityId = contentType.Id;
var parentContentTypes = allParentContentTypes.Where(x =>
@@ -714,10 +738,10 @@ AND umbracoNode.id <> @id",
out IDictionary<int, List<int>> parentMediaTypeIds)
{
Mandate.ParameterNotNull(db, "db");
var sql = @"SELECT cmsContentType.pk as ctPk, cmsContentType.alias as ctAlias, cmsContentType.allowAtRoot as ctAllowAtRoot, cmsContentType.description as ctDesc,
cmsContentType.icon as ctIcon, cmsContentType.isContainer as ctIsContainer, cmsContentType.nodeId as ctId, cmsContentType.thumbnail as ctThumb,
AllowedTypes.AllowedId as ctaAllowedId, AllowedTypes.SortOrder as ctaSortOrder, AllowedTypes.alias as ctaAlias,
AllowedTypes.AllowedId as ctaAllowedId, AllowedTypes.SortOrder as ctaSortOrder, AllowedTypes.alias as ctaAlias,
ParentTypes.parentContentTypeId as chtParentId, ParentTypes.parentContentTypeKey as chtParentKey,
umbracoNode.createDate as nCreateDate, umbracoNode." + sqlSyntax.GetQuotedColumnName("level") + @" as nLevel, umbracoNode.nodeObjectType as nObjectType, umbracoNode.nodeUser as nUser,
umbracoNode.parentID as nParentId, umbracoNode." + sqlSyntax.GetQuotedColumnName("path") + @" as nPath, umbracoNode.sortOrder as nSortOrder, umbracoNode." + sqlSyntax.GetQuotedColumnName("text") + @" as nName, umbracoNode.trashed as nTrashed,
@@ -741,7 +765,7 @@ AND umbracoNode.id <> @id",
ON ParentTypes.childContentTypeId = cmsContentType.nodeId
WHERE (umbracoNode.nodeObjectType = @nodeObjectType)
ORDER BY ctId";
var result = db.Fetch<dynamic>(sql, new { nodeObjectType = new Guid(Constants.ObjectTypes.MediaType) });
if (result.Any() == false)
@@ -848,16 +872,16 @@ AND umbracoNode.id <> @id",
return mediaType;
}
internal static IEnumerable<IContentType> MapContentTypes(Database db, ISqlSyntaxProvider sqlSyntax,
internal static IEnumerable<IContentType> MapContentTypes(Database db, ISqlSyntaxProvider sqlSyntax,
out IDictionary<int, List<AssociatedTemplate>> associatedTemplates,
out IDictionary<int, List<int>> parentContentTypeIds)
{
Mandate.ParameterNotNull(db, "db");
var sql = @"SELECT cmsDocumentType.IsDefault as dtIsDefault, cmsDocumentType.templateNodeId as dtTemplateId,
cmsContentType.pk as ctPk, cmsContentType.alias as ctAlias, cmsContentType.allowAtRoot as ctAllowAtRoot, cmsContentType.description as ctDesc,
cmsContentType.icon as ctIcon, cmsContentType.isContainer as ctIsContainer, cmsContentType.nodeId as ctId, cmsContentType.thumbnail as ctThumb,
AllowedTypes.AllowedId as ctaAllowedId, AllowedTypes.SortOrder as ctaSortOrder, AllowedTypes.alias as ctaAlias,
AllowedTypes.AllowedId as ctaAllowedId, AllowedTypes.SortOrder as ctaSortOrder, AllowedTypes.alias as ctaAlias,
ParentTypes.parentContentTypeId as chtParentId,ParentTypes.parentContentTypeKey as chtParentKey,
umbracoNode.createDate as nCreateDate, umbracoNode." + sqlSyntax.GetQuotedColumnName("level") + @" as nLevel, umbracoNode.nodeObjectType as nObjectType, umbracoNode.nodeUser as nUser,
umbracoNode.parentID as nParentId, umbracoNode." + sqlSyntax.GetQuotedColumnName("path") + @" as nPath, umbracoNode.sortOrder as nSortOrder, umbracoNode." + sqlSyntax.GetQuotedColumnName("text") + @" as nName, umbracoNode.trashed as nTrashed,
@@ -890,7 +914,7 @@ AND umbracoNode.id <> @id",
ON ParentTypes.childContentTypeId = cmsContentType.nodeId
WHERE (umbracoNode.nodeObjectType = @nodeObjectType)
ORDER BY ctId";
var result = db.Fetch<dynamic>(sql, new { nodeObjectType = new Guid(Constants.ObjectTypes.DocumentType)});
if (result.Any() == false)
@@ -911,7 +935,7 @@ AND umbracoNode.id <> @id",
{
var ct = queue.Dequeue();
//check for default templates
//check for default templates
bool? isDefaultTemplate = Convert.ToBoolean(ct.dtIsDefault);
int? templateId = ct.dtTemplateId;
if (currDefaultTemplate == -1 && isDefaultTemplate.HasValue && isDefaultTemplate.Value && templateId.HasValue)
@@ -41,7 +41,7 @@ namespace Umbraco.Core.Persistence.Repositories
{
var sql = GetBaseQuery(false).Where(GetBaseWhereClause(), new { id = id, NodeObjectType = NodeObjectTypeId });
var nodeDto = Database.Fetch<NodeDto>(sql).FirstOrDefault();
var nodeDto = Database.Fetch<NodeDto>(SqlSyntax.SelectTop(sql, 1)).FirstOrDefault();
return nodeDto == null ? null : CreateEntity(nodeDto);
}
@@ -58,12 +58,12 @@ namespace Umbraco.Core.Persistence.Repositories
var sql = GetBaseQuery(false);
sql.Where(GetBaseWhereClause(), new { Id = id });
var macroDto = Database.Fetch<ExternalLoginDto>(sql).FirstOrDefault();
if (macroDto == null)
var dto = Database.Fetch<ExternalLoginDto>(SqlSyntax.SelectTop(sql, 1)).FirstOrDefault();
if (dto == null)
return null;
var factory = new ExternalLoginFactory();
var entity = factory.BuildEntity(macroDto);
var entity = factory.BuildEntity(dto);
//on initial construction we don't want to have dirty properties tracked
// http://issues.umbraco.org/issue/U4-1946
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Xml;
using System.Xml.Linq;
using Umbraco.Core.Models;
using Umbraco.Core.Models.Membership;
@@ -11,6 +12,12 @@ namespace Umbraco.Core.Persistence.Repositories
{
public interface IContentRepository : IRepositoryVersionable<int, IContent>, IRecycleBinRepository<IContent>, IDeleteMediaFilesRepository
{
/// <summary>
/// This builds the Xml document used for the XML cache
/// </summary>
/// <returns></returns>
XmlDocument BuildXmlCache();
/// <summary>
/// Get the count of published items
/// </summary>
@@ -7,7 +7,7 @@ namespace Umbraco.Core.Persistence.Repositories
/// <summary>
/// Defines the <see cref="IRedirectUrl"/> repository.
/// </summary>
public interface IRedirectUrlRepository : IRepositoryQueryable<int, IRedirectUrl>
public interface IRedirectUrlRepository : IRepositoryQueryable<Guid, IRedirectUrl>
{
/// <summary>
/// Gets a redirect url.
@@ -21,7 +21,7 @@ namespace Umbraco.Core.Persistence.Repositories
/// Deletes a redirect url.
/// </summary>
/// <param name="id">The redirect url identifier.</param>
void Delete(int id);
void Delete(Guid id);
/// <summary>
/// Deletes all redirect urls.
@@ -66,5 +66,15 @@ namespace Umbraco.Core.Persistence.Repositories
/// <param name="total">The total count of redirect urls.</param>
/// <returns>The redirect urls.</returns>
IEnumerable<IRedirectUrl> GetAllUrls(int rootContentId, long pageIndex, int pageSize, out long total);
/// <summary>
/// Searches for all redirect urls that contain a given search term in their URL property.
/// </summary>
/// <param name="searchTerm">The term to search for.</param>
/// <param name="pageIndex">The page index.</param>
/// <param name="pageSize">The page size.</param>
/// <param name="total">The total count of redirect urls.</param>
/// <returns>The redirect urls.</returns>
IEnumerable<IRedirectUrl> SearchUrls(string searchTerm, long pageIndex, int pageSize, out long total);
}
}
@@ -52,9 +52,9 @@ namespace Umbraco.Core.Persistence.Repositories
{
var sql = GetBaseQuery(false);
sql.Where(GetBaseWhereClause(), new { Id = id });
sql.OrderByDescending<ContentVersionDto>(x => x.VersionDate);
sql.OrderByDescending<ContentVersionDto>(x => x.VersionDate, SqlSyntax);
var dto = Database.Fetch<ContentVersionDto, ContentDto, NodeDto>(sql).FirstOrDefault();
var dto = Database.Fetch<ContentVersionDto, ContentDto, NodeDto>(SqlSyntax.SelectTop(sql, 1)).FirstOrDefault();
if (dto == null)
return null;
@@ -413,6 +413,8 @@ namespace Umbraco.Core.Persistence.Repositories
{
foreach (var property in entity.Properties)
{
if (keyDictionary.ContainsKey(property.PropertyTypeId) == false) continue;
property.Id = keyDictionary[property.PropertyTypeId];
}
}
@@ -453,8 +455,16 @@ namespace Umbraco.Core.Persistence.Repositories
Func<Tuple<string, object[]>> filterCallback = null;
if (filter.IsNullOrWhiteSpace() == false)
{
sbWhere.Append("AND (umbracoNode." + SqlSyntax.GetQuotedColumnName("text") + " LIKE @" + args.Count + ")");
sbWhere
.Append("AND (")
.Append(SqlSyntax.GetQuotedTableName("umbracoNode"))
.Append(".")
.Append(SqlSyntax.GetQuotedColumnName("text"))
.Append(" LIKE @")
.Append(args.Count)
.Append(")");
args.Add("%" + filter + "%");
filterCallback = () => new Tuple<string, object[]>(sbWhere.ToString().Trim(), args.ToArray());
}
@@ -32,7 +32,7 @@ namespace Umbraco.Core.Persistence.Repositories
var sql = GetBaseQuery(false);
sql.Where(GetBaseWhereClause(), new { Id = id });
var dto = Database.Fetch<NodeDto>(sql).FirstOrDefault();
var dto = Database.Fetch<NodeDto>(SqlSyntax.SelectTop(sql, 1)).FirstOrDefault();
return dto == null ? null : _modelFactory.BuildEntity(dto);
}
@@ -52,9 +52,9 @@ namespace Umbraco.Core.Persistence.Repositories
{
var sql = GetBaseQuery(false);
sql.Where(GetBaseWhereClause(), new { Id = id });
sql.OrderByDescending<ContentVersionDto>(x => x.VersionDate);
sql.OrderByDescending<ContentVersionDto>(x => x.VersionDate, SqlSyntax);
var dto = Database.Fetch<MemberDto, ContentVersionDto, ContentDto, NodeDto>(sql).FirstOrDefault();
var dto = Database.Fetch<MemberDto, ContentVersionDto, ContentDto, NodeDto>(SqlSyntax.SelectTop(sql, 1)).FirstOrDefault();
if (dto == null)
return null;
@@ -365,6 +365,8 @@ namespace Umbraco.Core.Persistence.Repositories
{
foreach (var property in ((Member)entity).Properties)
{
if (keyDictionary.ContainsKey(property.PropertyTypeId) == false) continue;
property.Id = keyDictionary[property.PropertyTypeId];
}
}
@@ -622,9 +624,32 @@ namespace Umbraco.Core.Persistence.Repositories
Func<Tuple<string, object[]>> filterCallback = null;
if (filter.IsNullOrWhiteSpace() == false)
{
sbWhere.Append("AND ((umbracoNode. " + SqlSyntax.GetQuotedColumnName("text") + " LIKE @" + args.Count + ") " +
"OR (cmsMember.LoginName LIKE @0" + args.Count + "))");
args.Add("%" + filter + "%");
//This will build up the where clause - even though the same 'filter' is being
//applied to both columns, the parameters values passed to PetaPoco need to be
//duplicated, otherwise it gets confused :/
var columnFilters = new List<Tuple<string, string>>
{
new Tuple<string, string>("umbracoNode", "text"),
new Tuple<string, string>("cmsMember", "LoginName")
};
sbWhere.Append("AND (");
for (int i = 0; i < columnFilters.Count; i++)
{
sbWhere
.Append("(")
.Append(SqlSyntax.GetQuotedTableName(columnFilters[i].Item1))
.Append(".")
.Append(SqlSyntax.GetQuotedColumnName(columnFilters[i].Item2))
.Append(" LIKE @")
.Append(args.Count)
.Append(") ");
args.Add(string.Format("%{0}%", filter));
if (i < (columnFilters.Count - 1))
{
sbWhere.Append("OR ");
}
}
sbWhere.Append(")");
filterCallback = () => new Tuple<string, object[]>(sbWhere.ToString().Trim(), args.ToArray());
}
@@ -24,7 +24,7 @@ namespace Umbraco.Core.Persistence.Repositories
var sql = GetBaseQuery(false);
sql.Where(GetBaseWhereClause(), new { Id = id });
var dto = Database.First<MigrationDto>(sql);
var dto = Database.Fetch<MigrationDto>(SqlSyntax.SelectTop(sql, 1)).FirstOrDefault();
if (dto == null)
return null;
@@ -17,8 +17,7 @@ namespace Umbraco.Core.Persistence.Repositories
{
public PublicAccessRepository(IDatabaseUnitOfWork work, CacheHelper cache, ILogger logger, ISqlSyntaxProvider sqlSyntax)
: base(work, cache, logger, sqlSyntax)
{
}
{ }
private FullDataSetRepositoryCachePolicyFactory<PublicAccessEntry, Guid> _cachePolicyFactory;
protected override IRepositoryCachePolicyFactory<PublicAccessEntry, Guid> CachePolicyFactory
@@ -46,6 +45,8 @@ namespace Umbraco.Core.Persistence.Repositories
sql.Where("umbracoAccess.id IN (@ids)", new { ids = ids });
}
sql.OrderBy<AccessDto>(x => x.NodeId, SqlSyntax);
var factory = new PublicAccessEntryFactory();
var dtos = Database.Fetch<AccessDto, AccessRuleDto, AccessDto>(new AccessRulesRelator().Map, sql);
return dtos.Select(factory.BuildEntity);
@@ -69,7 +70,7 @@ namespace Umbraco.Core.Persistence.Repositories
.From<AccessDto>(SqlSyntax)
.LeftJoin<AccessRuleDto>(SqlSyntax)
.On<AccessDto, AccessRuleDto>(SqlSyntax, left => left.Id, right => right.AccessId);
return sql;
}
@@ -162,7 +163,5 @@ namespace Umbraco.Core.Persistence.Repositories
{
return entity.Key;
}
}
}
@@ -49,6 +49,10 @@ namespace Umbraco.Core.Persistence.Repositories
INNER JOIN umbracoNode as TB2 ON TB1.nodeId = TB2.id
WHERE TB2.trashed = '1' AND TB2.nodeObjectType = @NodeObjectType)",
FormatDeleteStatement("umbracoAccess", "nodeId"),
@"DELETE FROM umbracoRedirectUrl WHERE umbracoRedirectUrl.id IN(
SELECT TB1.id FROM umbracoRedirectUrl as TB1
INNER JOIN umbracoNode as TB2 ON TB1.contentKey = TB2.uniqueId
WHERE TB2.trashed = '1' AND TB2.nodeObjectType = @NodeObjectType)",
FormatDeleteStatement("umbracoRelation", "parentId"),
FormatDeleteStatement("umbracoRelation", "childId"),
FormatDeleteStatement("cmsTagRelationship", "nodeId"),
@@ -12,9 +12,9 @@ using Umbraco.Core.Persistence.UnitOfWork;
namespace Umbraco.Core.Persistence.Repositories
{
internal class RedirectUrlRepository : PetaPocoRepositoryBase<int, IRedirectUrl>, IRedirectUrlRepository
internal class RedirectUrlRepository : PetaPocoRepositoryBase<Guid, IRedirectUrl>, IRedirectUrlRepository
{
public RedirectUrlRepository(IDatabaseUnitOfWork work, CacheHelper cache, ILogger logger, ISqlSyntaxProvider sqlSyntax)
public RedirectUrlRepository(IDatabaseUnitOfWork work, CacheHelper cache, ILogger logger, ISqlSyntaxProvider sqlSyntax)
: base(work, cache, logger, sqlSyntax)
{ }
@@ -23,19 +23,19 @@ namespace Umbraco.Core.Persistence.Repositories
throw new NotSupportedException("This repository does not support this method.");
}
protected override bool PerformExists(int id)
protected override bool PerformExists(Guid id)
{
return PerformGet(id) != null;
}
protected override IRedirectUrl PerformGet(int id)
protected override IRedirectUrl PerformGet(Guid id)
{
var sql = GetBaseQuery(false).Where<RedirectUrlDto>(x => x.Id == id);
var dto = Database.Fetch<RedirectUrlDto>(sql).FirstOrDefault();
var dto = Database.Fetch<RedirectUrlDto>(SqlSyntax.SelectTop(sql, 1)).FirstOrDefault();
return dto == null ? null : Map(dto);
}
protected override IEnumerable<IRedirectUrl> PerformGetAll(params int[] ids)
protected override IEnumerable<IRedirectUrl> PerformGetAll(params Guid[] ids)
{
if (ids.Length > 2000)
throw new NotSupportedException("This repository does not support more than 2000 ids.");
@@ -86,7 +86,7 @@ JOIN umbracoNode ON umbracoRedirectUrl.contentKey=umbracoNode.uniqueID");
{
var dto = Map(entity);
Database.Insert(dto);
entity.Id = dto.Id;
entity.Id = entity.Key.GetHashCode();
}
protected override void PersistUpdatedItem(IRedirectUrl entity)
@@ -101,11 +101,11 @@ JOIN umbracoNode ON umbracoRedirectUrl.contentKey=umbracoNode.uniqueID");
return new RedirectUrlDto
{
Id = redirectUrl.Id,
Id = redirectUrl.Key,
ContentKey = redirectUrl.ContentKey,
CreateDateUtc = redirectUrl.CreateDateUtc,
Url = redirectUrl.Url,
UrlHash = HashUrl(redirectUrl.Url)
UrlHash = redirectUrl.Url.ToSHA1()
};
}
@@ -117,7 +117,8 @@ JOIN umbracoNode ON umbracoRedirectUrl.contentKey=umbracoNode.uniqueID");
try
{
url.DisableChangeTracking();
url.Id = dto.Id;
url.Key = dto.Id;
url.Id = dto.Id.GetHashCode();
url.ContentId = dto.ContentId;
url.ContentKey = dto.ContentKey;
url.CreateDateUtc = dto.CreateDateUtc;
@@ -132,7 +133,7 @@ JOIN umbracoNode ON umbracoRedirectUrl.contentKey=umbracoNode.uniqueID");
public IRedirectUrl Get(string url, Guid contentKey)
{
var urlHash = HashUrl(url);
var urlHash = url.ToSHA1();
var sql = GetBaseQuery(false).Where<RedirectUrlDto>(x => x.Url == url && x.UrlHash == urlHash && x.ContentKey == contentKey);
var dto = Database.Fetch<RedirectUrlDto>(sql).FirstOrDefault();
return dto == null ? null : Map(dto);
@@ -148,14 +149,14 @@ JOIN umbracoNode ON umbracoRedirectUrl.contentKey=umbracoNode.uniqueID");
Database.Execute("DELETE FROM umbracoRedirectUrl WHERE contentKey=@contentKey", new { contentKey });
}
public void Delete(int id)
public void Delete(Guid id)
{
Database.Delete<RedirectUrlDto>(id);
}
public IRedirectUrl GetMostRecentUrl(string url)
{
var urlHash = HashUrl(url);
var urlHash = url.ToSHA1();
var sql = GetBaseQuery(false)
.Where<RedirectUrlDto>(x => x.Url == url && x.UrlHash == urlHash)
.OrderByDescending<RedirectUrlDto>(x => x.CreateDateUtc, SqlSyntax);
@@ -185,7 +186,7 @@ JOIN umbracoNode ON umbracoRedirectUrl.contentKey=umbracoNode.uniqueID");
public IEnumerable<IRedirectUrl> GetAllUrls(int rootContentId, long pageIndex, int pageSize, out long total)
{
var sql = GetBaseQuery(false)
.Where("umbracoNode.path LIKE @path", new { path = "%," + rootContentId + ",%" })
.Where(string.Format("{0}.{1} LIKE @path", SqlSyntax.GetQuotedTableName("umbracoNode"), SqlSyntax.GetQuotedColumnName("path")), new { path = "%," + rootContentId + ",%" })
.OrderByDescending<RedirectUrlDto>(x => x.CreateDateUtc, SqlSyntax);
var result = Database.Page<RedirectUrlDto>(pageIndex + 1, pageSize, sql);
total = Convert.ToInt32(result.TotalItems);
@@ -194,12 +195,16 @@ JOIN umbracoNode ON umbracoRedirectUrl.contentKey=umbracoNode.uniqueID");
return rules;
}
private static string HashUrl(string url)
public IEnumerable<IRedirectUrl> SearchUrls(string searchTerm, long pageIndex, int pageSize, out long total)
{
var crypto = new MD5CryptoServiceProvider();
var inputBytes = Encoding.UTF8.GetBytes(url);
var hashedBytes = crypto.ComputeHash(inputBytes);
return Encoding.UTF8.GetString(hashedBytes);
}
var sql = GetBaseQuery(false)
.Where(string.Format("{0}.{1} LIKE @url", SqlSyntax.GetQuotedTableName("umbracoRedirectUrl"), SqlSyntax.GetQuotedColumnName("Url")), new { url = "%" + searchTerm.Trim().ToLowerInvariant() + "%" })
.OrderByDescending<RedirectUrlDto>(x => x.CreateDateUtc, SqlSyntax);
var result = Database.Page<RedirectUrlDto>(pageIndex + 1, pageSize, sql);
total = Convert.ToInt32(result.TotalItems);
var rules = result.Items.Select(Map);
return rules;
}
}
}
@@ -33,7 +33,7 @@ namespace Umbraco.Core.Persistence.Repositories
var sql = GetBaseQuery(false);
sql.Where(GetBaseWhereClause(), new { Id = id });
var dto = Database.FirstOrDefault<RelationDto>(sql);
var dto = Database.Fetch<RelationDto>(SqlSyntax.SelectTop(sql, 1)).FirstOrDefault();
if (dto == null)
return null;
@@ -31,7 +31,7 @@ namespace Umbraco.Core.Persistence.Repositories
var sql = GetBaseQuery(false);
sql.Where(GetBaseWhereClause(), new { Id = id });
var dto = Database.FirstOrDefault<RelationTypeDto>(sql);
var dto = Database.Fetch<RelationTypeDto>(SqlSyntax.SelectTop(sql, 1)).FirstOrDefault();
if (dto == null)
return null;
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Umbraco.Core.Logging;
using Umbraco.Core.Models;
using Umbraco.Core.Models.EntityBase;
@@ -26,7 +25,7 @@ namespace Umbraco.Core.Persistence.Repositories
var sql = GetBaseQuery(false);
sql.Where(GetBaseWhereClause(), new { Id = id });
var tagDto = Database.Fetch<TagDto>(sql).FirstOrDefault();
var tagDto = Database.Fetch<TagDto>(SqlSyntax.SelectTop(sql, 1)).FirstOrDefault();
if (tagDto == null)
return null;
@@ -25,7 +25,7 @@ namespace Umbraco.Core.Persistence.Repositories
var sql = GetBaseQuery(false);
sql.Where(GetBaseWhereClause(), new { Id = id });
var taskDto = Database.Fetch<TaskDto, TaskTypeDto>(sql).FirstOrDefault();
var taskDto = Database.Fetch<TaskDto, TaskTypeDto>(SqlSyntax.SelectTop(sql, 1)).FirstOrDefault();
if (taskDto == null)
return null;
@@ -23,7 +23,7 @@ namespace Umbraco.Core.Persistence.Repositories
var sql = GetBaseQuery(false);
sql.Where(GetBaseWhereClause(), new { Id = id });
var taskDto = Database.Fetch<TaskTypeDto>(sql).FirstOrDefault();
var taskDto = Database.Fetch<TaskTypeDto>(SqlSyntax.SelectTop(sql, 1)).FirstOrDefault();
if (taskDto == null)
return null;
@@ -236,7 +236,7 @@ namespace Umbraco.Core.Persistence.Repositories
private Sql GetFilteredSqlForPagedResults(Sql sql, Func<Tuple<string, object[]>> defaultFilter = null)
{
Sql filteredSql;
// Apply filter
if (defaultFilter != null)
{
@@ -262,7 +262,7 @@ namespace Umbraco.Core.Persistence.Repositories
return filteredSql;
}
private Sql GetSortedSqlForPagedResults(Sql sql, Direction orderDirection, string orderBy, bool orderBySystemField)
private Sql GetSortedSqlForPagedResults(Sql sql, Direction orderDirection, string orderBy, bool orderBySystemField, Tuple<string, string> nodeIdSelect)
{
//copy to var so that the original isn't changed
@@ -286,44 +286,71 @@ namespace Umbraco.Core.Persistence.Repositories
}
else
{
// Sorting by a custom field, so set-up sub-query for ORDER BY clause to pull through valie
// Sorting by a custom field, so set-up sub-query for ORDER BY clause to pull through value
// from most recent content version for the given order by field
var sortedInt = string.Format(SqlSyntax.ConvertIntegerToOrderableString, "dataInt");
var sortedDate = string.Format(SqlSyntax.ConvertDateToOrderableString, "dataDate");
var sortedString = string.Format("COALESCE({0},'')", "dataNvarchar");
var sortedDecimal = string.Format(SqlSyntax.ConvertDecimalToOrderableString, "dataDecimal");
var innerJoinTempTable = string.Format(@"INNER JOIN (
SELECT CASE
WHEN dataInt Is Not Null THEN {0}
WHEN dataDecimal Is Not Null THEN {1}
WHEN dataDate Is Not Null THEN {2}
ELSE {3}
END AS CustomPropVal,
cd.nodeId AS CustomPropValContentId
FROM cmsDocument cd
INNER JOIN cmsPropertyData cpd ON cpd.contentNodeId = cd.nodeId AND cpd.versionId = cd.versionId
INNER JOIN cmsPropertyType cpt ON cpt.Id = cpd.propertytypeId
WHERE cpt.Alias = @{4} AND cd.newest = 1) AS CustomPropData
ON CustomPropData.CustomPropValContentId = umbracoNode.id
", sortedInt, sortedDecimal, sortedDate, sortedString, sortedSql.Arguments.Length);
//these are defaults that will be used in the query - they can be overridden for non-versioned entities or document entities
var versionQuery = " AND cpd.versionId = cd.versionId";
var newestQuery = string.Empty;
//cmsDocument needs to filter by the 'newest' parameter in the query
if (nodeIdSelect.Item1 == "cmsDocument")
newestQuery = " AND cd.newest = 1";
//members do not use versions so clear the versionQuery string
if (nodeIdSelect.Item1 == "cmsMember")
versionQuery = string.Empty;
//needs to be an outer join since there's no guarantee that any of the nodes have values for this property
var outerJoinTempTable = string.Format(@"LEFT OUTER JOIN (
SELECT CASE
WHEN dataInt Is Not Null THEN {0}
WHEN dataDecimal Is Not Null THEN {1}
WHEN dataDate Is Not Null THEN {2}
ELSE {3}
END AS CustomPropVal,
cd.{4} AS CustomPropValContentId
FROM {5} cd
INNER JOIN cmsPropertyData cpd ON cpd.contentNodeId = cd.{4}{6}
INNER JOIN cmsPropertyType cpt ON cpt.Id = cpd.propertytypeId
WHERE cpt.Alias = @{7}{8}) AS CustomPropData
ON CustomPropData.CustomPropValContentId = umbracoNode.id
", sortedInt, sortedDecimal, sortedDate, sortedString, nodeIdSelect.Item2, nodeIdSelect.Item1, versionQuery, sortedSql.Arguments.Length, newestQuery);
//insert this just above the first LEFT OUTER JOIN (for cmsDocument) or the last WHERE (everything else)
string newSql;
if (nodeIdSelect.Item1 == "cmsDocument")
newSql = sortedSql.SQL.Insert(sortedSql.SQL.IndexOf("LEFT OUTER JOIN"), outerJoinTempTable);
else
newSql = sortedSql.SQL.Insert(sortedSql.SQL.LastIndexOf("WHERE"), outerJoinTempTable);
//insert this just above the LEFT OUTER JOIN
var newSql = sortedSql.SQL.Insert(sortedSql.SQL.IndexOf("LEFT OUTER JOIN"), innerJoinTempTable);
var newArgs = sortedSql.Arguments.ToList();
newArgs.Add(orderBy);
sortedSql = new Sql(newSql, newArgs.ToArray());
sortedSql.OrderBy("CustomPropData.CustomPropVal");
if (orderDirection == Direction.Descending)
{
sortedSql.Append(" DESC");
}
sortedSql.OrderByDescending("CustomPropData.CustomPropVal");
}
else
{
sortedSql.OrderBy("CustomPropData.CustomPropVal");
}
}
//no matter what we always MUST order the result also by umbracoNode.id to ensure that all records being ordered by are unique.
// if we do not do this then we end up with issues where we are ordering by a field that has duplicate values (i.e. the 'text' column
// is empty for many nodes)
// see: http://issues.umbraco.org/issue/U4-8831
sortedSql.OrderBy("umbracoNode.id");
return sortedSql;
}
/// <summary>
@@ -371,7 +398,7 @@ namespace Umbraco.Core.Persistence.Repositories
//get sorted and filtered sql
var sqlNodeIdsWithSort = GetSortedSqlForPagedResults(
GetFilteredSqlForPagedResults(sqlNodeIds, defaultFilter),
orderDirection, orderBy, orderBySystemField);
orderDirection, orderBy, orderBySystemField, nodeIdSelect);
// Get page of results and total count
IEnumerable<TEntity> result;
@@ -409,7 +436,7 @@ namespace Umbraco.Core.Persistence.Repositories
//get sorted and filtered sql
var fullQuery = GetSortedSqlForPagedResults(
GetFilteredSqlForPagedResults(withInnerJoinSql, defaultFilter),
orderDirection, orderBy, orderBySystemField);
orderDirection, orderBy, orderBySystemField, nodeIdSelect);
return processQuery(fullQuery);
}
else
@@ -483,17 +510,6 @@ WHERE EXISTS(
var propertyFactory = new PropertyFactory(compositionProperties, def.Version, def.Id, def.CreateDate, def.VersionDate);
var properties = propertyFactory.BuildEntity(propertyDataDtos.ToArray()).ToArray();
var newProperties = properties.Where(x => x.HasIdentity == false && x.PropertyType.HasIdentity);
foreach (var property in newProperties)
{
var propertyDataDto = new PropertyDataDto { NodeId = def.Id, PropertyTypeId = property.PropertyTypeId, VersionId = def.Version };
int primaryKey = Convert.ToInt32(Database.Insert(propertyDataDto));
property.Version = def.Version;
property.Id = primaryKey;
}
foreach (var property in properties)
{
//NOTE: The benchmarks run with and without the following code show very little change so this is not a perf bottleneck
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using Umbraco.Core.Models.Rdbms;
using Umbraco.Core.Persistence.DatabaseAnnotations;
using Umbraco.Core.Persistence.DatabaseModelDefinitions;
using Umbraco.Core.Persistence.Querying;
@@ -66,6 +67,7 @@ namespace Umbraco.Core.Persistence.SqlSyntax
string Format(ForeignKeyDefinition foreignKey);
string FormatColumnRename(string tableName, string oldName, string newName);
string FormatTableRename(string oldName, string newName);
Sql SelectTop(Sql sql, int top);
bool SupportsClustered();
bool SupportsIdentityInsert();
bool? SupportsCaseInsensitiveQueries(Database db);
@@ -10,7 +10,7 @@ namespace Umbraco.Core.Persistence.SqlSyntax
/// <summary>
/// Represents an SqlSyntaxProvider for MySql
/// </summary>
[SqlSyntaxProviderAttribute("MySql.Data.MySqlClient")]
[SqlSyntaxProvider(Constants.DatabaseProviders.MySql)]
public class MySqlSyntaxProvider : SqlSyntaxProviderBase<MySqlSyntaxProvider>
{
private readonly ILogger _logger;
@@ -178,6 +178,11 @@ ORDER BY TABLE_NAME, INDEX_NAME",
return result > 0;
}
public override Sql SelectTop(Sql sql, int top)
{
return new Sql(string.Concat(sql.SQL, " LIMIT ", top), sql.Arguments);
}
public override bool SupportsClustered()
{
return true;
@@ -10,7 +10,7 @@ namespace Umbraco.Core.Persistence.SqlSyntax
/// <summary>
/// Represents an SqlSyntaxProvider for Sql Ce
/// </summary>
[SqlSyntaxProviderAttribute("System.Data.SqlServerCe.4.0")]
[SqlSyntaxProviderAttribute(Constants.DatabaseProviders.SqlCe)]
public class SqlCeSyntaxProvider : MicrosoftSqlSyntaxProviderBase<SqlCeSyntaxProvider>
{
public SqlCeSyntaxProvider()
@@ -18,6 +18,11 @@ namespace Umbraco.Core.Persistence.SqlSyntax
}
public override Sql SelectTop(Sql sql, int top)
{
return new Sql(sql.SQL.Insert(sql.SQL.IndexOf(' '), " TOP " + top), sql.Arguments);
}
public override bool SupportsClustered()
{
return false;
@@ -8,18 +8,63 @@ namespace Umbraco.Core.Persistence.SqlSyntax
/// <summary>
/// Represents an SqlSyntaxProvider for Sql Server
/// </summary>
[SqlSyntaxProviderAttribute("System.Data.SqlClient")]
[SqlSyntaxProviderAttribute(Constants.DatabaseProviders.SqlServer)]
public class SqlServerSyntaxProvider : MicrosoftSqlSyntaxProviderBase<SqlServerSyntaxProvider>
{
public SqlServerSyntaxProvider()
{
}
}
/// <summary>
/// Gets/sets the version of the current SQL server instance
/// </summary>
internal Lazy<SqlServerVersionName> VersionName { get; set; }
internal SqlServerVersionName GetVersionName(Database database)
{
if (_versionName.HasValue)
return _versionName.Value;
try
{
var version = database.ExecuteScalar<string>("SELECT SERVERPROPERTY('productversion')");
var firstPart = version.Split('.')[0];
switch (firstPart)
{
case "13":
_versionName = SqlServerVersionName.V2014;
break;
case "12":
_versionName = SqlServerVersionName.V2014;
break;
case "11":
_versionName = SqlServerVersionName.V2012;
break;
case "10":
_versionName = SqlServerVersionName.V2008;
break;
case "9":
_versionName = SqlServerVersionName.V2005;
break;
case "8":
_versionName = SqlServerVersionName.V2000;
break;
case "7":
_versionName = SqlServerVersionName.V7;
break;
default:
_versionName = SqlServerVersionName.Other;
break;
}
}
catch (Exception)
{
_versionName = SqlServerVersionName.Invalid;
}
return _versionName.Value;
}
private SqlServerVersionName? _versionName;
/// <summary>
/// SQL Server stores default values assigned to columns as constraints, it also stores them with named values, this is the only
@@ -104,6 +149,11 @@ order by T.name, I.name");
return column.IsIdentity ? GetIdentityString(column) : string.Empty;
}
public override Sql SelectTop(Sql sql, int top)
{
return new Sql(sql.SQL.Insert(sql.SQL.IndexOf(' '), " TOP " + top), sql.Arguments);
}
private static string GetIdentityString(ColumnDefinition column)
{
return "IDENTITY(1,1)";
@@ -3,6 +3,9 @@
/// <summary>
/// Represents the version name of SQL server (i.e. the year 2008, 2005, etc...)
/// </summary>
/// <remarks>
/// see: https://support.microsoft.com/en-us/kb/321185
/// </remarks>
internal enum SqlServerVersionName
{
Invalid = -1,
@@ -11,6 +14,8 @@
V2005 = 2,
V2008 = 3,
V2012 = 4,
Other = 5
V2014 = 5,
V2016 = 6,
Other = 100
}
}
@@ -503,6 +503,8 @@ namespace Umbraco.Core.Persistence.SqlSyntax
protected abstract string FormatIdentity(ColumnDefinition column);
public abstract Sql SelectTop(Sql sql, int top);
public virtual string DeleteDefaultConstraint
{
get
@@ -6,6 +6,7 @@ using System.Linq;
using System.Text;
using StackExchange.Profiling;
using Umbraco.Core.Logging;
using Umbraco.Core.Persistence.SqlSyntax;
namespace Umbraco.Core.Persistence
{
@@ -154,5 +155,41 @@ namespace Umbraco.Core.Persistence
}
base.OnExecutedCommand(cmd);
}
/// <summary>
/// We are overriding this in the case that we are using SQL Server 2012+ so we can make paging more efficient than the default PetaPoco paging
/// see: http://issues.umbraco.org/issue/U4-8837
/// </summary>
/// <param name="sql"></param>
/// <param name="sqlSelectRemoved"></param>
/// <param name="sqlOrderBy"></param>
/// <param name="args"></param>
/// <param name="sqlPage"></param>
/// <param name="databaseType"></param>
/// <param name="skip"></param>
/// <param name="take"></param>
internal override void BuildSqlDbSpecificPagingQuery(DBType databaseType, long skip, long take, string sql, string sqlSelectRemoved, string sqlOrderBy, ref object[] args, out string sqlPage)
{
if (databaseType == DBType.SqlServer)
{
//we need to check it's version to see what kind of paging format we can use
//TODO: This is a hack, but we don't have access to the SqlSyntaxProvider here, we can in v8 but not now otherwise
// this would be a breaking change.
var sqlServerSyntax = SqlSyntaxContext.SqlSyntaxProvider as SqlServerSyntaxProvider;
if (sqlServerSyntax != null)
{
if ((int) sqlServerSyntax.GetVersionName(this) >= (int) SqlServerVersionName.V2012)
{
//we can use the good paging! to do that we are going to change the databaseType to SQLCE since
//it also uses the good paging syntax.
base.BuildSqlDbSpecificPagingQuery(DBType.SqlServerCE, skip, take, sql, sqlSelectRemoved, sqlOrderBy, ref args, out sqlPage);
return;
}
}
}
//use the defaults
base.BuildSqlDbSpecificPagingQuery(databaseType, skip, take, sql, sqlSelectRemoved, sqlOrderBy, ref args, out sqlPage);
}
}
}
@@ -28,7 +28,7 @@ namespace Umbraco.Core.PropertyEditors.ValueConverters
// </values>
// </keyFeatureList>
var sourceString = source.ToString();
var sourceString = source != null ? source.ToString() : null;
if (string.IsNullOrWhiteSpace(sourceString)) return Enumerable.Empty<string>();
//SD: I have no idea why this logic is here, I'm pretty sure we've never saved the multiple txt string
@@ -17,8 +17,15 @@ namespace Umbraco.Core.Publishing
_contentService = contentService;
}
public void CheckPendingAndProcess()
/// <summary>
/// Processes scheduled operations
/// </summary>
/// <returns>
/// Returns the number of items successfully completed
/// </returns>
public int CheckPendingAndProcess()
{
var counter = 0;
foreach (var d in _contentService.GetContentForRelease())
{
try
@@ -32,10 +39,14 @@ namespace Umbraco.Core.Publishing
LogHelper.Error<ScheduledPublisher>("Could not published the document (" + d.Id + ") based on it's scheduled release, status result: " + result.Result.StatusType, result.Exception);
}
else
{
{
LogHelper.Warn<ScheduledPublisher>("Could not published the document (" + d.Id + ") based on it's scheduled release. Status result: " + result.Result.StatusType);
}
}
else
{
counter++;
}
}
catch (Exception ee)
{
@@ -48,7 +59,11 @@ namespace Umbraco.Core.Publishing
try
{
d.ExpireDate = null;
_contentService.UnPublish(d, (int)d.GetWriterProfile().Id);
var result = _contentService.UnPublish(d, (int)d.GetWriterProfile().Id);
if (result)
{
counter++;
}
}
catch (Exception ee)
{
@@ -56,6 +71,8 @@ namespace Umbraco.Core.Publishing
throw;
}
}
return counter;
}
}
}
@@ -0,0 +1,31 @@
using System.Configuration;
using System.DirectoryServices.AccountManagement;
using System.Threading.Tasks;
using Umbraco.Core.Models.Identity;
namespace Umbraco.Core.Security
{
public class ActiveDirectoryBackOfficeUserPasswordChecker : IBackOfficeUserPasswordChecker
{
public virtual string ActiveDirectoryDomain {
get {
return ConfigurationManager.AppSettings["ActiveDirectoryDomain"];
}
}
public Task<BackOfficeUserPasswordCheckerResult> CheckPasswordAsync(BackOfficeIdentityUser user, string password)
{
bool isValid;
using (var pc = new PrincipalContext(ContextType.Domain, ActiveDirectoryDomain))
{
isValid = pc.ValidateCredentials(user.UserName, password);
}
var result = isValid
? BackOfficeUserPasswordCheckerResult.ValidCredentials
: BackOfficeUserPasswordCheckerResult.InvalidCredentials;
return Task.FromResult(result);
}
}
}
@@ -7,7 +7,8 @@ using Umbraco.Core.Models.Identity;
namespace Umbraco.Core.Security
{
public class BackOfficeClaimsIdentityFactory : ClaimsIdentityFactory<BackOfficeIdentityUser, int>
public class BackOfficeClaimsIdentityFactory<T> : ClaimsIdentityFactory<T, int>
where T: BackOfficeIdentityUser
{
public BackOfficeClaimsIdentityFactory()
{
@@ -20,7 +21,7 @@ namespace Umbraco.Core.Security
/// </summary>
/// <param name="manager"/><param name="user"/><param name="authenticationType"/>
/// <returns/>
public override async Task<ClaimsIdentity> CreateAsync(UserManager<BackOfficeIdentityUser, int> manager, BackOfficeIdentityUser user, string authenticationType)
public override async Task<ClaimsIdentity> CreateAsync(UserManager<T, int> manager, T user, string authenticationType)
{
var baseIdentity = await base.CreateAsync(manager, user, authenticationType);
@@ -42,4 +43,9 @@ namespace Umbraco.Core.Security
return umbracoIdentity;
}
}
public class BackOfficeClaimsIdentityFactory : BackOfficeClaimsIdentityFactory<BackOfficeIdentityUser>
{
}
}
@@ -17,7 +17,7 @@ namespace Umbraco.Core.Security
private readonly ILogger _logger;
private readonly IOwinRequest _request;
public BackOfficeSignInManager(BackOfficeUserManager userManager, IAuthenticationManager authenticationManager, ILogger logger, IOwinRequest request)
public BackOfficeSignInManager(UserManager<BackOfficeIdentityUser, int> userManager, IAuthenticationManager authenticationManager, ILogger logger, IOwinRequest request)
: base(userManager, authenticationManager)
{
if (logger == null) throw new ArgumentNullException("logger");
@@ -29,13 +29,13 @@ namespace Umbraco.Core.Security
public override Task<ClaimsIdentity> CreateUserIdentityAsync(BackOfficeIdentityUser user)
{
return user.GenerateUserIdentityAsync((BackOfficeUserManager)UserManager);
return user.GenerateUserIdentityAsync((BackOfficeUserManager<BackOfficeIdentityUser>)UserManager);
}
public static BackOfficeSignInManager Create(IdentityFactoryOptions<BackOfficeSignInManager> options, IOwinContext context, ILogger logger)
{
return new BackOfficeSignInManager(
context.GetUserManager<BackOfficeUserManager>(),
context.GetBackOfficeUserManager(),
context.Authentication,
logger,
context.Request);
@@ -5,6 +5,7 @@ using System.Threading.Tasks;
using System.Web.Security;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.Owin;
using Microsoft.Owin.Security.DataProtection;
using Umbraco.Core.Models.Identity;
using Umbraco.Core.Services;
@@ -15,6 +16,8 @@ namespace Umbraco.Core.Security
/// </summary>
public class BackOfficeUserManager : BackOfficeUserManager<BackOfficeIdentityUser>
{
public const string OwinMarkerKey = "Umbraco.Web.Security.Identity.BackOfficeUserManagerMarker";
public BackOfficeUserManager(IUserStore<BackOfficeIdentityUser, int> store)
: base(store)
{
@@ -26,9 +29,8 @@ namespace Umbraco.Core.Security
MembershipProviderBase membershipProvider)
: base(store)
{
if (options == null) throw new ArgumentNullException("options");
var manager = new BackOfficeUserManager(store);
InitUserManager(manager, membershipProvider, options);
if (options == null) throw new ArgumentNullException("options");;
InitUserManager(this, membershipProvider, options);
}
#region Static Create methods
@@ -69,7 +71,7 @@ namespace Umbraco.Core.Security
{
var manager = new BackOfficeUserManager(customUserStore, options, membershipProvider);
return manager;
}
}
#endregion
/// <summary>
@@ -79,65 +81,15 @@ namespace Umbraco.Core.Security
/// <param name="membershipProvider"></param>
/// <param name="options"></param>
/// <returns></returns>
protected void InitUserManager(BackOfficeUserManager manager, MembershipProviderBase membershipProvider, IdentityFactoryOptions<BackOfficeUserManager> options)
protected void InitUserManager(
BackOfficeUserManager manager,
MembershipProviderBase membershipProvider,
IdentityFactoryOptions<BackOfficeUserManager> options)
{
// Configure validation logic for usernames
manager.UserValidator = new UserValidator<BackOfficeIdentityUser, int>(manager)
{
AllowOnlyAlphanumericUserNames = false,
RequireUniqueEmail = true
};
// Configure validation logic for passwords
manager.PasswordValidator = new PasswordValidator
{
RequiredLength = membershipProvider.MinRequiredPasswordLength,
RequireNonLetterOrDigit = membershipProvider.MinRequiredNonAlphanumericCharacters > 0,
RequireDigit = false,
RequireLowercase = false,
RequireUppercase = false
//TODO: Do we support the old regex match thing that membership providers used?
};
//use a custom hasher based on our membership provider
manager.PasswordHasher = new MembershipPasswordHasher(membershipProvider);
var dataProtectionProvider = options.DataProtectionProvider;
if (dataProtectionProvider != null)
{
manager.UserTokenProvider = new DataProtectorTokenProvider<BackOfficeIdentityUser, int>(dataProtectionProvider.Create("ASP.NET Identity"));
}
manager.UserLockoutEnabledByDefault = true;
manager.MaxFailedAccessAttemptsBeforeLockout = membershipProvider.MaxInvalidPasswordAttempts;
//NOTE: This just needs to be in the future, we currently don't support a lockout timespan, it's either they are locked
// or they are not locked, but this determines what is set on the account lockout date which corresponds to whether they are
// locked out or not.
manager.DefaultAccountLockoutTimeSpan = TimeSpan.FromDays(30);
//custom identity factory for creating the identity object for which we auth against in the back office
manager.ClaimsIdentityFactory = new BackOfficeClaimsIdentityFactory();
manager.EmailService = new EmailService();
//NOTE: Not implementing these, if people need custom 2 factor auth, they'll need to implement their own UserStore to suport it
//// Register two factor authentication providers. This application uses Phone and Emails as a step of receiving a code for verifying the user
//// You can write your own provider and plug in here.
//manager.RegisterTwoFactorProvider("PhoneCode", new PhoneNumberTokenProvider<ApplicationUser>
//{
// MessageFormat = "Your security code is: {0}"
//});
//manager.RegisterTwoFactorProvider("EmailCode", new EmailTokenProvider<ApplicationUser>
//{
// Subject = "Security Code",
// BodyFormat = "Your security code is: {0}"
//});
//manager.SmsService = new SmsService();
//NOTE: This method is mostly here for backwards compat
base.InitUserManager(manager, membershipProvider, options.DataProtectionProvider);
}
}
/// <summary>
@@ -180,6 +132,73 @@ namespace Umbraco.Core.Security
}
#endregion
/// <summary>
/// Initializes the user manager with the correct options
/// </summary>
/// <param name="manager"></param>
/// <param name="membershipProvider"></param>
/// <param name="dataProtectionProvider"></param>
/// <returns></returns>
protected void InitUserManager(
BackOfficeUserManager<T> manager,
MembershipProviderBase membershipProvider,
IDataProtectionProvider dataProtectionProvider)
{
// Configure validation logic for usernames
manager.UserValidator = new UserValidator<T, int>(manager)
{
AllowOnlyAlphanumericUserNames = false,
RequireUniqueEmail = true
};
// Configure validation logic for passwords
manager.PasswordValidator = new PasswordValidator
{
RequiredLength = membershipProvider.MinRequiredPasswordLength,
RequireNonLetterOrDigit = membershipProvider.MinRequiredNonAlphanumericCharacters > 0,
RequireDigit = false,
RequireLowercase = false,
RequireUppercase = false
//TODO: Do we support the old regex match thing that membership providers used?
};
//use a custom hasher based on our membership provider
manager.PasswordHasher = new MembershipPasswordHasher(membershipProvider);
if (dataProtectionProvider != null)
{
manager.UserTokenProvider = new DataProtectorTokenProvider<T, int>(dataProtectionProvider.Create("ASP.NET Identity"));
}
manager.UserLockoutEnabledByDefault = true;
manager.MaxFailedAccessAttemptsBeforeLockout = membershipProvider.MaxInvalidPasswordAttempts;
//NOTE: This just needs to be in the future, we currently don't support a lockout timespan, it's either they are locked
// or they are not locked, but this determines what is set on the account lockout date which corresponds to whether they are
// locked out or not.
manager.DefaultAccountLockoutTimeSpan = TimeSpan.FromDays(30);
//custom identity factory for creating the identity object for which we auth against in the back office
manager.ClaimsIdentityFactory = new BackOfficeClaimsIdentityFactory<T>();
manager.EmailService = new EmailService();
//NOTE: Not implementing these, if people need custom 2 factor auth, they'll need to implement their own UserStore to suport it
//// Register two factor authentication providers. This application uses Phone and Emails as a step of receiving a code for verifying the user
//// You can write your own provider and plug in here.
//manager.RegisterTwoFactorProvider("PhoneCode", new PhoneNumberTokenProvider<ApplicationUser>
//{
// MessageFormat = "Your security code is: {0}"
//});
//manager.RegisterTwoFactorProvider("EmailCode", new EmailTokenProvider<ApplicationUser>
//{
// Subject = "Security Code",
// BodyFormat = "Your security code is: {0}"
//});
//manager.SmsService = new SmsService();
}
/// <summary>
/// Logic used to validate a username and password
/// </summary>
@@ -0,0 +1,26 @@
using System;
using Microsoft.AspNet.Identity.Owin;
using Microsoft.Owin;
using Umbraco.Core.Models.Identity;
namespace Umbraco.Core.Security
{
/// <summary>
/// This class is only here due to the fact that IOwinContext Get / Set only work in generics, if they worked
/// with regular 'object' then we wouldn't have to use this work around but because of that we have to use this
/// class to resolve the 'real' type of the registered user manager
/// </summary>
/// <typeparam name="TManager"></typeparam>
/// <typeparam name="TUser"></typeparam>
internal class BackOfficeUserManagerMarker<TManager, TUser> : IBackOfficeUserManagerMarker
where TManager : BackOfficeUserManager<TUser>
where TUser : BackOfficeIdentityUser
{
public BackOfficeUserManager<BackOfficeIdentityUser> GetManager(IOwinContext owin)
{
var mgr = owin.Get<TManager>() as BackOfficeUserManager<BackOfficeIdentityUser>;
if (mgr == null) throw new InvalidOperationException("Could not cast the registered back office user of type " + typeof(TManager) + " to " + typeof(BackOfficeUserManager<BackOfficeIdentityUser>));
return mgr;
}
}
}
@@ -0,0 +1,15 @@
using Microsoft.Owin;
using Umbraco.Core.Models.Identity;
namespace Umbraco.Core.Security
{
/// <summary>
/// This interface is only here due to the fact that IOwinContext Get / Set only work in generics, if they worked
/// with regular 'object' then we wouldn't have to use this work around but because of that we have to use this
/// class to resolve the 'real' type of the registered user manager
/// </summary>
internal interface IBackOfficeUserManagerMarker
{
BackOfficeUserManager<BackOfficeIdentityUser> GetManager(IOwinContext owin);
}
}
@@ -0,0 +1,47 @@
using System;
using Microsoft.AspNet.Identity.Owin;
using Microsoft.Owin;
using Umbraco.Core.Models.Identity;
namespace Umbraco.Core.Security
{
public static class OwinExtensions
{
/// <summary>
/// Gets the back office sign in manager out of OWIN
/// </summary>
/// <param name="owinContext"></param>
/// <returns></returns>
public static BackOfficeSignInManager GetBackOfficeSignInManager(this IOwinContext owinContext)
{
var mgr = owinContext.Get<BackOfficeSignInManager>();
if (mgr == null)
{
throw new NullReferenceException("Could not resolve an instance of " + typeof(BackOfficeSignInManager) + " from the " + typeof(IOwinContext));
}
return mgr;
}
/// <summary>
/// Gets the back office user manager out of OWIN
/// </summary>
/// <param name="owinContext"></param>
/// <returns></returns>
/// <remarks>
/// This is required because to extract the user manager we need to user a custom service since owin only deals in generics and
/// developers could register their own user manager types
/// </remarks>
public static BackOfficeUserManager<BackOfficeIdentityUser> GetBackOfficeUserManager(this IOwinContext owinContext)
{
var marker = owinContext.Get<IBackOfficeUserManagerMarker>(BackOfficeUserManager.OwinMarkerKey);
if (marker == null) throw new NullReferenceException("No " + typeof(IBackOfficeUserManagerMarker) + " has been registered with Owin which means that no Umbraco back office user manager has been registered");
var mgr = marker.GetManager(owinContext);
if (mgr == null)
{
throw new NullReferenceException("Could not resolve an instance of " + typeof(BackOfficeUserManager<BackOfficeIdentityUser>));
}
return mgr;
}
}
}
+16 -1
View File
@@ -4,6 +4,7 @@ using System.ComponentModel;
using System.Globalization;
using System.Linq;
using System.Threading;
using System.Xml;
using System.Xml.Linq;
using Umbraco.Core.Auditing;
using Umbraco.Core.Configuration;
@@ -636,7 +637,7 @@ namespace Umbraco.Core.Services
query.Where(x => x.Path.SqlContains(string.Format(",{0},", id), TextColumnType.NVarchar));
}
var contents = repository.GetPagedResultsByQuery(query, pageIndex, pageSize, out totalChildren, orderBy, orderDirection, orderBySystemField, filter);
return contents;
}
}
@@ -1714,6 +1715,20 @@ namespace Umbraco.Core.Services
return true;
}
/// <summary>
/// This builds the Xml document used for the XML cache
/// </summary>
/// <returns></returns>
public XmlDocument BuildXmlCache()
{
var uow = UowProvider.GetUnitOfWork();
using (var repository = RepositoryFactory.CreateContentRepository(uow))
{
var result = repository.BuildXmlCache();
return result;
}
}
/// <summary>
/// Rebuilds all xml content in the cmsContentXml table for all documents
/// </summary>
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Xml;
using Umbraco.Core.Models;
using Umbraco.Core.Models.Membership;
using Umbraco.Core.Persistence.DatabaseModelDefinitions;
@@ -94,6 +95,12 @@ namespace Umbraco.Core.Services
/// </summary>
public interface IContentService : IService
{
/// <summary>
/// This builds the Xml document used for the XML cache
/// </summary>
/// <returns></returns>
XmlDocument BuildXmlCache();
/// <summary>
/// Rebuilds all xml content in the cmsContentXml table for all documents
/// </summary>
@@ -33,7 +33,7 @@ namespace Umbraco.Core.Services
/// Deletes a redirect url.
/// </summary>
/// <param name="id">The redirect url identifier.</param>
void Delete(int id);
void Delete(Guid id);
/// <summary>
/// Deletes all redirect urls.
@@ -72,5 +72,15 @@ namespace Umbraco.Core.Services
/// <param name="total">The total count of redirect urls.</param>
/// <returns>The redirect urls.</returns>
IEnumerable<IRedirectUrl> GetAllRedirectUrls(int rootContentId, long pageIndex, int pageSize, out long total);
/// <summary>
/// Searches for all redirect urls that contain a given search term in their URL property.
/// </summary>
/// <param name="searchTerm">The term to search for.</param>
/// <param name="pageIndex">The page index.</param>
/// <param name="pageSize">The page size.</param>
/// <param name="total">The total count of redirect urls.</param>
/// <returns>The redirect urls.</returns>
IEnumerable<IRedirectUrl> SearchRedirectUrls(string searchTerm, long pageIndex, int pageSize, out long total);
}
}
@@ -23,7 +23,7 @@ namespace Umbraco.Core.Services
if (redir != null)
redir.CreateDateUtc = DateTime.UtcNow;
else
redir = new RedirectUrl { Url = url, ContentKey = contentKey };
redir = new RedirectUrl { Key = Guid.NewGuid(), Url = url, ContentKey = contentKey };
repo.AddOrUpdate(redir);
uow.Commit();
}
@@ -39,7 +39,7 @@ namespace Umbraco.Core.Services
}
}
public void Delete(int id)
public void Delete(Guid id)
{
using (var uow = UowProvider.GetUnitOfWork())
using (var repo = RepositoryFactory.CreateRedirectUrlRepository(uow))
@@ -75,7 +75,6 @@ namespace Umbraco.Core.Services
using (var repo = RepositoryFactory.CreateRedirectUrlRepository(uow))
{
var rule = repo.GetMostRecentUrl(url);
uow.Commit();
return rule;
}
}
@@ -86,7 +85,6 @@ namespace Umbraco.Core.Services
using (var repo = RepositoryFactory.CreateRedirectUrlRepository(uow))
{
var rules = repo.GetContentUrls(contentKey);
uow.Commit();
return rules;
}
}
@@ -97,7 +95,6 @@ namespace Umbraco.Core.Services
using (var repo = RepositoryFactory.CreateRedirectUrlRepository(uow))
{
var rules = repo.GetAllUrls(pageIndex, pageSize, out total);
uow.Commit();
return rules;
}
}
@@ -108,7 +105,15 @@ namespace Umbraco.Core.Services
using (var repo = RepositoryFactory.CreateRedirectUrlRepository(uow))
{
var rules = repo.GetAllUrls(rootContentId, pageIndex, pageSize, out total);
uow.Commit();
return rules;
}
}
public IEnumerable<IRedirectUrl> SearchRedirectUrls(string searchTerm, long pageIndex, int pageSize, out long total)
{
using (var uow = UowProvider.GetUnitOfWork())
using (var repo = RepositoryFactory.CreateRedirectUrlRepository(uow))
{
var rules = repo.SearchUrls(searchTerm, pageIndex, pageSize, out total);
return rules;
}
}
+35 -24
View File
@@ -666,31 +666,12 @@ namespace Umbraco.Core
return compare.Contains(compareTo, StringComparer.InvariantCultureIgnoreCase);
}
/// <summary>
/// Determines if the string is a Guid
/// </summary>
/// <param name="str"></param>
/// <param name="withHyphens"></param>
/// <returns></returns>
[Obsolete("Use Guid.TryParse instead")]
[EditorBrowsable(EditorBrowsableState.Never)]
public static bool IsGuid(this string str, bool withHyphens)
{
var isGuid = false;
if (!String.IsNullOrEmpty(str))
{
Regex guidRegEx;
if (withHyphens)
{
guidRegEx = new Regex(@"^(\{{0,1}([0-9a-fA-F]){8}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){12}\}{0,1})$");
}
else
{
guidRegEx = new Regex(@"^(\{{0,1}([0-9a-fA-F]){8}([0-9a-fA-F]){4}([0-9a-fA-F]){4}([0-9a-fA-F]){4}([0-9a-fA-F]){12}\}{0,1})$");
}
isGuid = guidRegEx.IsMatch(str);
}
return isGuid;
Guid g;
return Guid.TryParse(str, out g);
}
/// <summary>
@@ -712,7 +693,7 @@ namespace Umbraco.Core
/// <returns></returns>
public static object ParseInto(this string val, Type type)
{
if (!String.IsNullOrEmpty(val))
if (string.IsNullOrEmpty(val) == false)
{
TypeConverter tc = TypeDescriptor.GetConverter(type);
return tc.ConvertFrom(val);
@@ -750,6 +731,36 @@ namespace Umbraco.Core
return stringBuilder.ToString();
}
/// <summary>
/// Converts the string to SHA1
/// </summary>
/// <param name="stringToConvert">referrs to itself</param>
/// <returns>the md5 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();
}
/// <summary>
/// Decodes a string that was encoded with UrlTokenEncode
@@ -26,5 +26,9 @@ namespace Umbraco.Core.Strings
/// per content, in 1-to-1 multilingual configurations. Then there would be one
/// url per culture.</remarks>
string GetUrlSegment(IContentBase content, CultureInfo culture);
//TODO: For the 301 tracking, we need to add another extended interface to this so that
// the RedirectTrackingEventHandler can ask the IUrlSegmentProvider if the URL is changing.
// Currently the way it works is very hacky, see notes in: RedirectTrackingEventHandler.ContentService_Publishing
}
}
+7 -6
View File
@@ -52,8 +52,8 @@
<Reference Include="ICSharpCode.SharpZipLib">
<HintPath>..\packages\SharpZipLib.0.86.0\lib\20\ICSharpCode.SharpZipLib.dll</HintPath>
</Reference>
<Reference Include="ImageProcessor, Version=2.4.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\ImageProcessor.2.4.1.0\lib\net45\ImageProcessor.dll</HintPath>
<Reference Include="ImageProcessor, Version=2.4.4.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\ImageProcessor.2.4.4.0\lib\net45\ImageProcessor.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="log4net, Version=1.2.11.0, Culture=neutral, processorArchitecture=MSIL">
@@ -114,6 +114,7 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\SqlServerCE.4.0.0.1\lib\System.Data.SqlServerCe.Entity.dll</HintPath>
</Reference>
<Reference Include="System.DirectoryServices.AccountManagement" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Net.Http.WebRequest" />
@@ -427,9 +428,6 @@
<Compile Include="Persistence\Mappers\MigrationEntryMapper.cs" />
<Compile Include="Persistence\Migrations\LocalMigrationContext.cs" />
<Compile Include="Persistence\Migrations\Upgrades\TargetVersionFourOneZero\AddPreviewXmlTable.cs" />
<Compile Include="Persistence\Migrations\Upgrades\TargetVersionSevenFiveZero\AddRedirectUrlTable4.cs" />
<Compile Include="Persistence\Migrations\Upgrades\TargetVersionSevenFiveZero\AddRedirectUrlTable3.cs" />
<Compile Include="Persistence\Migrations\Upgrades\TargetVersionSevenFiveZero\AddRedirectUrlTable2.cs" />
<Compile Include="Persistence\Migrations\Upgrades\TargetVersionSevenFiveZero\EnsureServersLockObject.cs" />
<Compile Include="Persistence\Migrations\Upgrades\TargetVersionSevenFiveZero\AddRedirectUrlTable.cs" />
<Compile Include="Persistence\Migrations\Upgrades\TargetVersionSevenFiveZero\RemoveStylesheetDataAndTablesAgain.cs" />
@@ -504,15 +502,19 @@
<Compile Include="PropertyEditors\ValueConverters\ImageCropperValueConverter.cs" />
<Compile Include="Publishing\UnPublishedStatusType.cs" />
<Compile Include="Publishing\UnPublishStatus.cs" />
<Compile Include="Security\ActiveDirectoryBackOfficeUserPasswordChecker.cs" />
<Compile Include="Security\BackOfficeClaimsIdentityFactory.cs" />
<Compile Include="Security\BackOfficeCookieAuthenticationProvider.cs" />
<Compile Include="Security\BackOfficeSignInManager.cs" />
<Compile Include="Security\BackOfficeUserManager.cs" />
<Compile Include="Security\BackOfficeUserManagerMarker.cs" />
<Compile Include="Security\BackOfficeUserPasswordCheckerResult.cs" />
<Compile Include="Security\BackOfficeUserStore.cs" />
<Compile Include="Security\IBackOfficeUserManagerMarker.cs" />
<Compile Include="Security\IBackOfficeUserPasswordChecker.cs" />
<Compile Include="Security\MembershipPasswordHasher.cs" />
<Compile Include="Security\EmailService.cs" />
<Compile Include="Security\OwinExtensions.cs" />
<Compile Include="SemVersionExtensions.cs" />
<Compile Include="Serialization\NoTypeConverterJsonConverter.cs" />
<Compile Include="ServiceProviderExtensions.cs" />
@@ -1095,7 +1097,6 @@
<Compile Include="Profiling\LogProfiler.cs" />
<Compile Include="Profiling\ProfilerExtensions.cs" />
<Compile Include="Profiling\ProfilerResolver.cs" />
<Compile Include="Profiling\WebProfiler.cs" />
<Compile Include="PropertyEditors\DelimitedManifestValueValidator.cs" />
<Compile Include="PropertyEditors\IntegerValidator.cs" />
<Compile Include="PropertyEditors\ManifestPropertyValidator.cs" />
+1 -1
View File
@@ -2,7 +2,7 @@
<packages>
<package id="AutoMapper" version="3.0.0" targetFramework="net45" />
<package id="HtmlAgilityPack" version="1.4.9" targetFramework="net45" />
<package id="ImageProcessor" version="2.4.1.0" targetFramework="net45" />
<package id="ImageProcessor" version="2.4.4.0" targetFramework="net45" />
<package id="log4net-mediumtrust" version="2.0.0" targetFramework="net4" />
<package id="Microsoft.AspNet.Identity.Core" version="2.2.1" targetFramework="net45" />
<package id="Microsoft.AspNet.Identity.Owin" version="2.2.1" targetFramework="net45" />
@@ -28,5 +28,11 @@ namespace Umbraco.Tests.Configurations.UmbracoSettings
{
Assert.IsTrue(SettingsSection.WebRouting.DisableFindContentByIdPath == false);
}
[Test]
public void DisableRedirectUrlTracking()
{
Assert.IsTrue(SettingsSection.WebRouting.DisableRedirectUrlTracking == false);
}
}
}
@@ -1,9 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.Generic;
using NUnit.Framework;
using Umbraco.Core;
using Umbraco.Web;
namespace Umbraco.Tests.FrontEnd
@@ -48,5 +45,38 @@ namespace Umbraco.Tests.FrontEnd
Assert.AreEqual("Hello world, this is some text <a href='blah'>with&hellip;</a>", result);
}
[Test]
public void Create_Encrypted_RouteString_From_Anonymous_Object()
{
var additionalRouteValues = new
{
key1 = "value1",
key2 = "value2",
Key3 = "Value3",
keY4 = "valuE4"
};
var encryptedRouteString = UmbracoHelper.CreateEncryptedRouteString("FormController", "FormAction", "", additionalRouteValues);
var result = encryptedRouteString.DecryptWithMachineKey();
var expectedResult = "c=FormController&a=FormAction&ar=&key1=value1&key2=value2&Key3=Value3&keY4=valuE4";
Assert.AreEqual(expectedResult, result);
}
[Test]
public void Create_Encrypted_RouteString_From_Dictionary()
{
var additionalRouteValues = new Dictionary<string, object>()
{
{"key1", "value1"},
{"key2", "value2"},
{"Key3", "Value3"},
{"keY4", "valuE4"}
};
var encryptedRouteString = UmbracoHelper.CreateEncryptedRouteString("FormController", "FormAction", "", additionalRouteValues);
var result = encryptedRouteString.DecryptWithMachineKey();
var expectedResult = "c=FormController&a=FormAction&ar=&key1=value1&key2=value2&Key3=Value3&keY4=valuE4";
Assert.AreEqual(expectedResult, result);
}
}
}
@@ -119,13 +119,10 @@ namespace Umbraco.Tests.Migrations
//pass in explicit migrations
new DeleteRedirectUrlTable(SqlSyntax, logger),
new AddRedirectUrlTable(SqlSyntax, logger),
new AddRedirectUrlTable2(SqlSyntax, logger),
new AddRedirectUrlTable3(SqlSyntax, logger),
new AddRedirectUrlTable4(SqlSyntax, logger)
new AddRedirectUrlTable(SqlSyntax, logger)
);
var db = new UmbracoDatabase("Datasource=|DataDirectory|UmbracoPetaPocoTests.sdf;Flush Interval=1;", "System.Data.SqlServerCe.4.0", Logger);
var db = new UmbracoDatabase("Datasource=|DataDirectory|UmbracoPetaPocoTests.sdf;Flush Interval=1;", Constants.DatabaseProviders.SqlCe, Logger);
var upgraded = migrationRunner.Execute(db, DatabaseProviders.SqlServerCE, true);
Assert.IsTrue(upgraded);
@@ -100,7 +100,7 @@ namespace Umbraco.Tests.Migrations
public UmbracoDatabase GetConfiguredDatabase()
{
return new UmbracoDatabase("Datasource=|DataDirectory|UmbracoPetaPocoTests.sdf;Flush Interval=1;", "System.Data.SqlServerCe.4.0", Mock.Of<ILogger>());
return new UmbracoDatabase("Datasource=|DataDirectory|UmbracoPetaPocoTests.sdf;Flush Interval=1;", Constants.DatabaseProviders.SqlCe, Mock.Of<ILogger>());
}
@@ -1,5 +1,6 @@
using Moq;
using NUnit.Framework;
using Umbraco.Core;
using Umbraco.Core.Logging;
using Umbraco.Core.Persistence;
using Umbraco.Core.Persistence.SqlSyntax;
@@ -26,7 +27,7 @@ namespace Umbraco.Tests.Migrations.Upgrades
public override UmbracoDatabase GetConfiguredDatabase()
{
return new UmbracoDatabase("Server = 169.254.120.3; Database = upgradetest; Uid = umbraco; Pwd = umbraco", "MySql.Data.MySqlClient", Mock.Of<ILogger>());
return new UmbracoDatabase("Server = 169.254.120.3; Database = upgradetest; Uid = umbraco; Pwd = umbraco", Constants.DatabaseProviders.MySql, Mock.Of<ILogger>());
}
public override DatabaseProviders GetDatabaseProvider()
@@ -3,6 +3,7 @@ using Moq;
using NUnit.Framework;
using Semver;
using SQLCE4Umbraco;
using Umbraco.Core;
using Umbraco.Core.Logging;
using Umbraco.Core.Persistence;
using Umbraco.Core.Persistence.Migrations;
@@ -64,7 +65,7 @@ namespace Umbraco.Tests.Migrations.Upgrades
public override UmbracoDatabase GetConfiguredDatabase()
{
return new UmbracoDatabase("Datasource=|DataDirectory|UmbracoPetaPocoTests.sdf;Flush Interval=1;", "System.Data.SqlServerCe.4.0", Mock.Of<ILogger>());
return new UmbracoDatabase("Datasource=|DataDirectory|UmbracoPetaPocoTests.sdf;Flush Interval=1;", Constants.DatabaseProviders.SqlCe, Mock.Of<ILogger>());
}
public override DatabaseProviders GetDatabaseProvider()
@@ -5,6 +5,7 @@ using System.IO;
using Moq;
using NUnit.Framework;
using SQLCE4Umbraco;
using Umbraco.Core;
using Umbraco.Core.Logging;
using Umbraco.Core.Persistence;
using Umbraco.Core.Persistence.SqlSyntax;
@@ -69,7 +70,7 @@ namespace Umbraco.Tests.Migrations.Upgrades
public override UmbracoDatabase GetConfiguredDatabase()
{
return new UmbracoDatabase("Datasource=|DataDirectory|UmbracoPetaPocoTests.sdf;Flush Interval=1;", "System.Data.SqlServerCe.4.0", Mock.Of<ILogger>());
return new UmbracoDatabase("Datasource=|DataDirectory|UmbracoPetaPocoTests.sdf;Flush Interval=1;", Constants.DatabaseProviders.SqlCe, Mock.Of<ILogger>());
}
public override DatabaseProviders GetDatabaseProvider()
@@ -1,5 +1,6 @@
using Moq;
using NUnit.Framework;
using Umbraco.Core;
using Umbraco.Core.Logging;
using Umbraco.Core.Persistence;
using Umbraco.Core.Persistence.SqlSyntax;
@@ -24,7 +25,7 @@ namespace Umbraco.Tests.Migrations.Upgrades
public override UmbracoDatabase GetConfiguredDatabase()
{
return new UmbracoDatabase(@"server=.\SQLEXPRESS;database=EmptyForTest;user id=umbraco;password=umbraco", "System.Data.SqlClient", Mock.Of<ILogger>());
return new UmbracoDatabase(@"server=.\SQLEXPRESS;database=EmptyForTest;user id=umbraco;password=umbraco", Constants.DatabaseProviders.SqlServer, Mock.Of<ILogger>());
}
public override DatabaseProviders GetDatabaseProvider()
@@ -6,6 +6,7 @@ using System.Text.RegularExpressions;
using Moq;
using NUnit.Framework;
using SQLCE4Umbraco;
using Umbraco.Core;
using Umbraco.Core.Configuration;
using Umbraco.Core.Logging;
using Umbraco.Core.ObjectResolution;
@@ -103,7 +104,7 @@ namespace Umbraco.Tests.Migrations.Upgrades
public UmbracoDatabase GetConfiguredDatabase()
{
return new UmbracoDatabase("Datasource=|DataDirectory|UmbracoPetaPocoTests.sdf;Flush Interval=1;", "System.Data.SqlServerCe.4.0", Mock.Of<ILogger>());
return new UmbracoDatabase("Datasource=|DataDirectory|UmbracoPetaPocoTests.sdf;Flush Interval=1;", Constants.DatabaseProviders.SqlCe, Mock.Of<ILogger>());
}
public string GetDatabaseSpecificSqlScript()
@@ -52,7 +52,7 @@ namespace Umbraco.Tests.Persistence
var dbContext = new DatabaseContext(
new DefaultDatabaseFactory(GlobalSettings.UmbracoConnectionName, _logger),
_logger, SqlSyntaxProvider, "System.Data.SqlServerCe.4.0");
_logger, SqlSyntaxProvider, Constants.DatabaseProviders.SqlCe);
var repositoryFactory = new RepositoryFactory(cacheHelper, _logger, SqlSyntaxProvider, SettingsForTests.GenerateMockSettings());
@@ -25,7 +25,7 @@ namespace Umbraco.Tests.Persistence
{
_dbContext = new DatabaseContext(
new DefaultDatabaseFactory(Core.Configuration.GlobalSettings.UmbracoConnectionName, Mock.Of<ILogger>()),
Mock.Of<ILogger>(), new SqlCeSyntaxProvider(), "System.Data.SqlServerCe.4.0");
Mock.Of<ILogger>(), new SqlCeSyntaxProvider(), Constants.DatabaseProviders.SqlCe);
//unfortunately we have to set this up because the PetaPocoExtensions require singleton access
ApplicationContext.Current = new ApplicationContext(
@@ -87,7 +87,7 @@ namespace Umbraco.Tests.Persistence
engine.CreateDatabase();
}
var dbFactory = new DefaultDatabaseFactory(connString, "System.Data.SqlServerCe.4.0", Mock.Of<ILogger>());
var dbFactory = new DefaultDatabaseFactory(connString, Constants.DatabaseProviders.SqlCe, Mock.Of<ILogger>());
//re-map the dbcontext to the new conn string
_dbContext = new DatabaseContext(
dbFactory,
@@ -1,6 +1,7 @@
using System.Data.SqlClient;
using Moq;
using NUnit.Framework;
using Umbraco.Core;
using Umbraco.Core.Logging;
using Umbraco.Core.Persistence;
@@ -13,7 +14,7 @@ namespace Umbraco.Tests.Persistence.FaultHandling
public void PetaPocoConnection_Cant_Connect_To_SqlDatabase_With_Invalid_User()
{
// Arrange
const string providerName = "System.Data.SqlClient";
const string providerName = Constants.DatabaseProviders.SqlServer;
const string connectionString = @"server=.\SQLEXPRESS;database=EmptyForTest;user id=x;password=umbraco";
var factory = new DefaultDatabaseFactory(connectionString, providerName, Mock.Of<ILogger>());
var database = factory.CreateDatabase();
@@ -27,7 +28,7 @@ namespace Umbraco.Tests.Persistence.FaultHandling
public void PetaPocoConnection_Cant_Connect_To_SqlDatabase_Because_Of_Network()
{
// Arrange
const string providerName = "System.Data.SqlClient";
const string providerName = Constants.DatabaseProviders.SqlServer;
const string connectionString = @"server=.\SQLEXPRESS;database=EmptyForTest;user id=umbraco;password=umbraco";
var factory = new DefaultDatabaseFactory(connectionString, providerName, Mock.Of<ILogger>());
var database = factory.CreateDatabase();
@@ -32,7 +32,7 @@ namespace Umbraco.Tests.Persistence
base.Initialize();
_database = new Database("Server = 169.254.120.3; Database = testdb; Uid = umbraco; Pwd = umbraco",
"MySql.Data.MySqlClient");
Constants.DatabaseProviders.MySql);
}
[TearDown]
@@ -98,7 +98,7 @@ namespace Umbraco.Tests.Persistence.Querying
.Where("([umbracoNode].[nodeObjectType] = @0)", new Guid("c66ba18e-eaf3-4cff-8a22-41b16d66a972"))
.Where("([umbracoNode].[id] = @0)", 1050)
.Where("([cmsContentVersion].[VersionId] = @0)", new Guid("2b543516-a944-4ee6-88c6-8813da7aaa07"))
.OrderBy("[cmsContentVersion].[VersionDate] DESC");
.OrderBy("([cmsContentVersion].[VersionDate]) DESC");
var sql = new Sql();
sql.Select("*")
@@ -117,5 +117,20 @@ namespace Umbraco.Tests.Persistence.Querying
Assert.AreEqual("mydomain\\myuser%", modelToSqlExpressionHelper.GetSqlParameters()[0]);
}
[Test]
public void Sql_Replace_Mapped()
{
Expression<Func<IUser, bool>> predicate = user => user.Username.Replace("@world", "@test") == "hello@test.com";
var modelToSqlExpressionHelper = new ModelToSqlExpressionHelper<IUser>();
var result = modelToSqlExpressionHelper.Visit(predicate);
Debug.Print("Model to Sql ExpressionHelper: \n" + result);
Assert.AreEqual("(replace([umbracoUser].[userLogin], @1, @2) = @0)", result);
Assert.AreEqual("hello@test.com", modelToSqlExpressionHelper.GetSqlParameters()[0]);
Assert.AreEqual("@world", modelToSqlExpressionHelper.GetSqlParameters()[1]);
Assert.AreEqual("@test", modelToSqlExpressionHelper.GetSqlParameters()[2]);
}
}
}
}
@@ -46,7 +46,7 @@ namespace Umbraco.Tests.Persistence
}
_database = new Database("Datasource=|DataDirectory|test.sdf;Flush Interval=1;",
"System.Data.SqlServerCe.4.0");
Constants.DatabaseProviders.SqlCe);
}
[TearDown]
@@ -30,7 +30,7 @@ namespace Umbraco.Tests.Persistence
base.Initialize();
_database = new Database(@"server=.\SQLEXPRESS;database=EmptyForTest;user id=umbraco;password=umbraco",
"System.Data.SqlClient");
Constants.DatabaseProviders.SqlServer);
}
[TearDown]
@@ -7,6 +7,7 @@ using Moq;
using NUnit.Framework;
using Umbraco.Core;
using Umbraco.Core.Configuration.UmbracoSettings;
using Umbraco.Core.Events;
using Umbraco.Core.IO;
using Umbraco.Core.Logging;
using Umbraco.Core.Models;
@@ -15,6 +16,7 @@ using Umbraco.Core.Models.Rdbms;
using Umbraco.Core.Persistence;
using Umbraco.Core.Persistence.Repositories;
using Umbraco.Core.Persistence.UnitOfWork;
using Umbraco.Core.Publishing;
using Umbraco.Core.Services;
using Umbraco.Tests.TestHelpers;
using Umbraco.Tests.TestHelpers.Entities;
@@ -877,6 +879,46 @@ namespace Umbraco.Tests.Services
Assert.That(content.Published, Is.True);
}
[Test]
public void Can_Publish_Content_WithEvents()
{
ContentService.Publishing += ContentServiceOnPublishing;
// tests that during 'publishing' event, what we get from the repo is the 'old' content,
// because 'publishing' fires before the 'saved' event ie before the content is actually
// saved
try
{
var contentService = ServiceContext.ContentService;
var content = contentService.GetById(NodeDto.NodeIdSeed + 1);
Assert.AreEqual("Home", content.Name);
content.Name = "foo";
var published = contentService.Publish(content, 0);
Assert.That(published, Is.True);
Assert.That(content.Published, Is.True);
var e = ServiceContext.ContentService.GetById(content.Id);
Assert.AreEqual("foo", e.Name);
}
finally
{
ContentService.Publishing -= ContentServiceOnPublishing;
}
}
private void ContentServiceOnPublishing(IPublishingStrategy sender, PublishEventArgs<IContent> args)
{
Assert.AreEqual(1, args.PublishedEntities.Count());
var entity = args.PublishedEntities.First();
Assert.AreEqual("foo", entity.Name);
var e = ServiceContext.ContentService.GetById(entity.Id);
Assert.AreEqual("Home", e.Name);
}
[Test]
public void Can_Publish_Only_Valid_Content()
{
@@ -8,6 +8,7 @@ using Umbraco.Core.Models.EntityBase;
using Umbraco.Core.Models.Membership;
using Umbraco.Core.Models.Rdbms;
using Umbraco.Core.Persistence;
using Umbraco.Core.Persistence.DatabaseModelDefinitions;
using Umbraco.Core.Persistence.Querying;
using Umbraco.Core.Persistence.Repositories;
using Umbraco.Core.Persistence.UnitOfWork;
@@ -33,6 +34,34 @@ namespace Umbraco.Tests.Services
base.TearDown();
}
[Test]
public void Can_Create_Member()
{
IMemberType memberType = MockedContentTypes.CreateSimpleMemberType();
ServiceContext.MemberTypeService.Save(memberType);
IMember member = MockedMember.CreateSimpleMember(memberType, "test", "test@test.com", "pass", "test");
ServiceContext.MemberService.Save(member);
Assert.AreNotEqual(0, member.Id);
var foundMember = ServiceContext.MemberService.GetById(member.Id);
Assert.IsNotNull(foundMember);
Assert.AreEqual("test@test.com", foundMember.Email);
}
[Test]
public void Can_Create_Member_With_Long_TLD_In_Email()
{
IMemberType memberType = MockedContentTypes.CreateSimpleMemberType();
ServiceContext.MemberTypeService.Save(memberType);
IMember member = MockedMember.CreateSimpleMember(memberType, "test", "test@test.marketing", "pass", "test");
ServiceContext.MemberService.Save(member);
Assert.AreNotEqual(0, member.Id);
var foundMember = ServiceContext.MemberService.GetById(member.Id);
Assert.IsNotNull(foundMember);
Assert.AreEqual("test@test.marketing", foundMember.Email);
}
[Test]
public void Can_Create_Role()
{
@@ -44,7 +44,7 @@ namespace Umbraco.Tests.Services
protected override string GetDbProviderName()
{
return "System.Data.SqlClient";
return Constants.DatabaseProviders.SqlServer;
}
@@ -40,7 +40,7 @@ namespace Umbraco.Tests.Services
//it is multi-threaded.
_dbFactory = new PerThreadDatabaseFactory(Logger);
//overwrite the local object
ApplicationContext.DatabaseContext = new DatabaseContext(_dbFactory, Logger, new SqlCeSyntaxProvider(), "System.Data.SqlServerCe.4.0");
ApplicationContext.DatabaseContext = new DatabaseContext(_dbFactory, Logger, new SqlCeSyntaxProvider(), Constants.DatabaseProviders.SqlCe);
//disable cache
var cacheHelper = CacheHelper.CreateDisabledCacheHelper();
@@ -60,7 +60,7 @@ namespace Umbraco.Tests.TestHelpers
var syntaxProvider = new SqlCeSyntaxProvider();
SqlSyntaxContext.SqlSyntaxProvider = syntaxProvider;
_database = new UmbracoDatabase(connectionString, "System.Data.SqlServerCe.4.0", Mock.Of<ILogger>());
_database = new UmbracoDatabase(connectionString, Constants.DatabaseProviders.SqlCe, Mock.Of<ILogger>());
// First remove anything in the database
var creation = new DatabaseSchemaCreation(_database, Mock.Of<ILogger>(), syntaxProvider);

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