Compare commits
601 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 220446afec | |||
| a101367292 | |||
| e90fedb835 | |||
| d5f9dfecc4 | |||
| cbb84f79d1 | |||
| a7377d0686 | |||
| 68a4749917 | |||
| 81763bf4d8 | |||
| 0e0bc9fbef | |||
| 964d9a9328 | |||
| 64dac39bae | |||
| 6040d149ec | |||
| bfbc6595fb | |||
| 25d8fc7a13 | |||
| e11b5c3fdb | |||
| 87100feb3d | |||
| eae74b0e20 | |||
| 610efe552d | |||
| c4860a490f | |||
| 8e6bbc3df9 | |||
| c16d0b77c2 | |||
| 2c4403f892 | |||
| fd66f08520 | |||
| 8e50f4968f | |||
| 9acbe09449 | |||
| 4baaafd006 | |||
| 3f7293304d | |||
| f62581bd38 | |||
| 9782e3711e | |||
| 1f4ba9cfdc | |||
| ba4f0cc6a4 | |||
| fc84821e8b | |||
| 0fcf0b505a | |||
| d300146cf6 | |||
| c8482b9f59 | |||
| b7795e19ef | |||
| c97617f5b5 | |||
| 14265fc964 | |||
| 18c3345e47 | |||
| 924a016ffe | |||
| a02b41e9d2 | |||
| 068c4a0b16 | |||
| f7d28d769a | |||
| 9a07e206d8 | |||
| 0edb71f4aa | |||
| b376207ef6 | |||
| 6d0aa824ad | |||
| 89afacf161 | |||
| 0fa6940bb6 | |||
| 1353b0a592 | |||
| 617fec171f | |||
| 2c63866cb3 | |||
| 18d3aa9ee2 | |||
| f83c966e55 | |||
| de41a1f1ca | |||
| c9f57c6ce3 | |||
| 54ab26e2ed | |||
| 31dc1b2cdb | |||
| d4b9a711c6 | |||
| 9521742254 | |||
| 9fee3f5873 | |||
| cb10578e19 | |||
| cdc4435f2d | |||
| a885840b9f | |||
| 62173cef58 | |||
| e5b0a4d98c | |||
| 9479d63cba | |||
| 4c544acb42 | |||
| c7c5f481f1 | |||
| 5e8e62cbf7 | |||
| 555b520a0c | |||
| 8053db32b6 | |||
| 3e2d59e526 | |||
| 9d3e967c2a | |||
| 71ec09486d | |||
| 8dadc92aa8 | |||
| f472f5d950 | |||
| 775a6f80ea | |||
| 5bf8b8ecba | |||
| 397ef32665 | |||
| 2634e33f51 | |||
| 6e27caa547 | |||
| 9c027dcdbc | |||
| f3876b86dc | |||
| 58c3dfac1c | |||
| dcf59d2b17 | |||
| 71099514cb | |||
| 887111318f | |||
| bf9755b27c | |||
| aca181b32e | |||
| 886347e763 | |||
| 9fa606e065 | |||
| e40ac44afd | |||
| 48603fb840 | |||
| f824439180 | |||
| b3616c9f8c | |||
| 48383f2e7a | |||
| cb98385242 | |||
| 916bad82df | |||
| 29ec8cb2d3 | |||
| 04900337c7 | |||
| 1433685160 | |||
| c5994ed54a | |||
| 9fd80d791a | |||
| f5f9cb676c | |||
| 04e2d2370a | |||
| 8d00d931b0 | |||
| 2998ad8cea | |||
| 46c15ef28f | |||
| 2b369a57d8 | |||
| c37a6bb928 | |||
| 6e53291877 | |||
| bb78f756c7 | |||
| ffb0de4050 | |||
| 0fecad9867 | |||
| 3045068d68 | |||
| 37a6668313 | |||
| 36814d746f | |||
| a72f6edb6b | |||
| e01cbcd405 | |||
| 012ed6cf16 | |||
| eb3ff12916 | |||
| 1ebff69358 | |||
| 5435c44ea9 | |||
| 76fa477c35 | |||
| 1f6f36d8c8 | |||
| c46ac11125 | |||
| 73d5a3f993 | |||
| 5a99a6903d | |||
| 775639da41 | |||
| 2375ede161 | |||
| fcd00599da | |||
| d3f5090150 | |||
| 6a7faf457b | |||
| ec247d2b27 | |||
| f32479bb10 | |||
| 371269436f | |||
| ef13e4112f | |||
| ce5b6861bb | |||
| eaf64d1814 | |||
| 6bf1ecdb11 | |||
| fdd0ff2c23 | |||
| bade8e42ba | |||
| cfdf2768e6 | |||
| c3ca006f14 | |||
| 6c47c8f792 | |||
| 63160e2e2d | |||
| edc58fe8a5 | |||
| 23632dc0c3 | |||
| d739b9fb31 | |||
| 2ae4ede258 | |||
| cacd08b57c | |||
| 4eddfb4cf5 | |||
| f2b3d7c041 | |||
| 5d97a94dcb | |||
| de6e7dd28d | |||
| 420c029bf7 | |||
| 61441dd436 | |||
| 5c24867925 | |||
| 0409cbe613 | |||
| bbbea99ced | |||
| 3d213342bf | |||
| 48fdb75d96 | |||
| a97094458d | |||
| f81353af0b | |||
| f0e1460550 | |||
| d15c09ad2a | |||
| 5813202892 | |||
| 82f6b6a66d | |||
| eec6ee79aa | |||
| 5ed4f262cd | |||
| e5d7f6fd04 | |||
| a9ad0ae8eb | |||
| 9cd64a9061 | |||
| 839c0d011b | |||
| 15c9aadcdc | |||
| 36a1c0a9e0 | |||
| 30f0c96052 | |||
| cfab30a1ef | |||
| 1dd0086eb5 | |||
| a7f06ebc56 | |||
| 9498bc4bfd | |||
| 38b13bf6ce | |||
| c8cb5b26b0 | |||
| 5749f80a7f | |||
| 5d9a935621 | |||
| 1ff4fe26dd | |||
| bd69820028 | |||
| 3c9953979a | |||
| 2f6189ae24 | |||
| 5ff329778d | |||
| befb2b4d2f | |||
| f4ae45d8f2 | |||
| 7b73ed1796 | |||
| 0eacbcb7cb | |||
| f871de61d5 | |||
| e02693e46b | |||
| db62d14b1a | |||
| c096ab9e54 | |||
| ada5a031b4 | |||
| 9c8b9f8bb4 | |||
| a4bd3abfbe | |||
| a8a768a50f | |||
| 62b99ffc59 | |||
| 6b0c94948e | |||
| 25f049e167 | |||
| f7979fa19d | |||
| 6fd1784337 | |||
| a7bb8e0d00 | |||
| ed4a9f84f0 | |||
| bbe4a87784 | |||
| cbd5c295bd | |||
| 0d29e1438c | |||
| 4796827f02 | |||
| c6f7ece764 | |||
| e86aaefaaf | |||
| 97e9cd4be0 | |||
| 63af822bad | |||
| b65f653c91 | |||
| 3b404a2f76 | |||
| e9567e7adc | |||
| 697daab4d7 | |||
| 6c29ad854c | |||
| 93d89535aa | |||
| eb093ca4a6 | |||
| 1040f234dc | |||
| 5a1ace9362 | |||
| 3f835fe19c | |||
| bf43ce3281 | |||
| c37ba0dc8a | |||
| 7b5ad9a5c6 | |||
| f0afa701bc | |||
| 71dc1110d8 | |||
| 4de4eb9cc8 | |||
| 308d5ba344 | |||
| 74dac71e8a | |||
| 64518774c6 | |||
| f65b0df3e2 | |||
| 5cfe9e85f8 | |||
| 61044b6018 | |||
| 00fc5a5bb2 | |||
| da85e4eb28 | |||
| 3f23865e0a | |||
| fbc08d66f1 | |||
| 79f04bf939 | |||
| 9ab90595e2 | |||
| aac208c0e8 | |||
| f8e101ec13 | |||
| 23fcc1ac55 | |||
| 6356531207 | |||
| 51b618826c | |||
| 04c28e5006 | |||
| e9ef9b9d75 | |||
| c160ce98c1 | |||
| c3a60ea0e0 | |||
| 3408efdee4 | |||
| 1f0dc7e65d | |||
| f89083c772 | |||
| 752065e540 | |||
| 82e4e50584 | |||
| 775e63148d | |||
| 4259b02b8d | |||
| 0c402310d9 | |||
| 8d92330ad6 | |||
| 44e76f741f | |||
| ecbced5c62 | |||
| e6773dafc1 | |||
| 7b8b7ed170 | |||
| c0997e1b9f | |||
| d4f862a44f | |||
| 64c983eb07 | |||
| e25222162c | |||
| e022687457 | |||
| 84db2f4d85 | |||
| ef64409a9a | |||
| f0b68ac31e | |||
| dba7bcf60a | |||
| 6c80bd9eb9 | |||
| c7b7bf1510 | |||
| d1805b1448 | |||
| 780937dae9 | |||
| 9b054eaa47 | |||
| 1584530615 | |||
| 100ca5caa6 | |||
| badd9ae289 | |||
| db6755a5bb | |||
| 738815170c | |||
| ef091e8c3a | |||
| 71b3810e9c | |||
| a1e62dae5e | |||
| 96c087d00f | |||
| 0568bf51f0 | |||
| e3bade4d1a | |||
| 633b0b0003 | |||
| 82adf48699 | |||
| 63be12b9fe | |||
| 33f7ed5129 | |||
| 79583c571c | |||
| a7e2c0b4dc | |||
| da48e1b392 | |||
| f535ece685 | |||
| 04e46c7cd1 | |||
| 1089aef00a | |||
| 0288d6ec89 | |||
| 8950d94b25 | |||
| bb6299cc01 | |||
| 2176f2a1c9 | |||
| 6a351bede1 | |||
| efc1aae0ae | |||
| df39e027fd | |||
| 64f05e4c97 | |||
| 30bc89ba93 | |||
| 841c8d69fc | |||
| aa780d2b8a | |||
| 59f15f1618 | |||
| b2f0a9f23d | |||
| 40cd07f3f4 | |||
| 99e7f84f79 | |||
| 3a5a32c65f | |||
| c2627f3a2a | |||
| 22b8d41aee | |||
| ee47ea2026 | |||
| 57622cef9a | |||
| 30ad3f5aa6 | |||
| 2c11f0be0f | |||
| c514ce8da3 | |||
| 65d421b619 | |||
| 62897f7064 | |||
| e0619edabb | |||
| 4142f47861 | |||
| 7135f9a268 | |||
| a75a58b719 | |||
| 7b969fc167 | |||
| 78475b0686 | |||
| 4925d55e8f | |||
| 52d2306e17 | |||
| 5e5207d4f3 | |||
| 96d46c82fe | |||
| 86bf50db12 | |||
| 14778422e6 | |||
| 6a931273a6 | |||
| 5fab1ea436 | |||
| d50e49ad37 | |||
| c8dc10f2e3 | |||
| 0504663814 | |||
| 62611a7255 | |||
| 5310ce38fd | |||
| 9a99ed655a | |||
| 407cd0ca60 | |||
| b384f1b0c3 | |||
| 14c4e9dda7 | |||
| 12fb549469 | |||
| 2599fdb1d2 | |||
| d05395075d | |||
| 664ecd6bb7 | |||
| 6b639e940c | |||
| 5b688d42ba | |||
| 3124ea4e67 | |||
| e9afa78444 | |||
| ef6fd54af3 | |||
| 03f68cefb7 | |||
| f8fa7df3f3 | |||
| 25cfe0193c | |||
| 3612780d15 | |||
| 7d8247047b | |||
| 7abbfbcfcc | |||
| 91a1955454 | |||
| 1f3c396c5b | |||
| b9dd0ab1a9 | |||
| 779dd26527 | |||
| 65969e22a0 | |||
| 23f7a4e53f | |||
| 5b1ed8bef5 | |||
| 583ae2df11 | |||
| 14cd1e7a76 | |||
| 4572b55f98 | |||
| a22b97643a | |||
| af2dbc7cd9 | |||
| 5d7ba5c842 | |||
| bee59e39a0 | |||
| 80be614731 | |||
| 8d24ac3651 | |||
| 7beb21ad66 | |||
| ed51dbaf85 | |||
| 488ba05eda | |||
| 5dac5ed88b | |||
| 4bb89c1827 | |||
| 647c7a6ce0 | |||
| 6d5a8c0db7 | |||
| 3314ab026b | |||
| 8b612a1047 | |||
| 28ecf79643 | |||
| 8f78ba8b97 | |||
| 94b0870a53 | |||
| b9ff056b61 | |||
| 7e1a11373b | |||
| 200625aa3a | |||
| f1e52c5ad8 | |||
| 1217e64532 | |||
| c454d022dc | |||
| c4b8dcd88b | |||
| 3a62fb5900 | |||
| d127856726 | |||
| 02e9866398 | |||
| ed8c9daa8a | |||
| 59ec709c69 | |||
| 68fa22ba9b | |||
| e25886180a | |||
| e8b2f3cd0b | |||
| 74eb69534d | |||
| 710bc7ed7c | |||
| be17a6e186 | |||
| b7eb6303ec | |||
| 4d012ee1e1 | |||
| e3a73465f7 | |||
| 6b5057b870 | |||
| e577648efd | |||
| b3664d2391 | |||
| 3dc4059036 | |||
| 6d6b2f72b6 | |||
| a542cf56d4 | |||
| 1fdb813d1d | |||
| 6c3b63cf55 | |||
| 6b195587c1 | |||
| d323b3c5c9 | |||
| b03d7884bb | |||
| 37e6e61eff | |||
| 42e5b4e867 | |||
| fc8c92e922 | |||
| 5d7cbd3477 | |||
| 42b689867e | |||
| d4fb28607d | |||
| dfbdf99bbc | |||
| 7848ea5ec0 | |||
| 62afc06f56 | |||
| dbe2257b47 | |||
| 2029bef6eb | |||
| ffddb8faa0 | |||
| 456c89a5d5 | |||
| 37986f0ed5 | |||
| b883c7cb11 | |||
| 23a7e515f8 | |||
| 05e17e1c7f | |||
| 829942dcf9 | |||
| 9ce1ea66dc | |||
| d6d611d381 | |||
| 7020e948b8 | |||
| b96511d9d4 | |||
| ed5ca49755 | |||
| c1352e2ad6 | |||
| 1a6988c2ea | |||
| 0cca63e646 | |||
| 05aa2aeb75 | |||
| e3cc107bfa | |||
| 4a59c27793 | |||
| abde63ebee | |||
| 346fb471da | |||
| d4c5a1ee1c | |||
| e3598b99a5 | |||
| ab32732f26 | |||
| 3949cfa736 | |||
| 406d172169 | |||
| b550b9f9d1 | |||
| 211268f210 | |||
| 348a3e6692 | |||
| c3c63ce0e3 | |||
| 20d8656237 | |||
| e114cbeeaf | |||
| a6a6edb9f2 | |||
| 5cfb4f5122 | |||
| eec11c8e5f | |||
| 438dedd1ab | |||
| a950acbaba | |||
| f44875d072 | |||
| d7360e7a41 | |||
| add2f57397 | |||
| cd3c17d73f | |||
| fe6d783222 | |||
| fc8b0f1822 | |||
| bd56117c80 | |||
| 6102c970c8 | |||
| 29903058a9 | |||
| b3940dea1b | |||
| 3dac630d05 | |||
| 10108d75b8 | |||
| 24cb64579b | |||
| 86239cc777 | |||
| 685aea1728 | |||
| 8ea99b9463 | |||
| bc20a48570 | |||
| a17865683c | |||
| 6f76ee384c | |||
| eb4e041682 | |||
| 477aa754b3 | |||
| 48bff0aa6c | |||
| 4ea9fec9e2 | |||
| 5167ba7aee | |||
| f3a965841b | |||
| 08ddb5f4c4 | |||
| 4ec63ffd0d | |||
| 4cb3e82972 | |||
| 0a20741f39 | |||
| 4575748f16 | |||
| 028ee831b8 | |||
| 3595dd3339 | |||
| 54981cd57c | |||
| 0aab8cacaa | |||
| 15b4d33e00 | |||
| 367ba5cddf | |||
| ff64efbcdf | |||
| 5bc0c499d8 | |||
| f667318b58 | |||
| 87c9d15ad5 | |||
| d5a41d41e9 | |||
| 127736d188 | |||
| 139ab8d4df | |||
| 4abb8035b8 | |||
| 0ca1807d64 | |||
| 5ae90d201c | |||
| 6c416009d7 | |||
| 50da9bcb50 | |||
| 9e6a2d8a7c | |||
| cfb84cae44 | |||
| 4239833713 | |||
| 4fa1a3948e | |||
| 1b78e854f0 | |||
| c62a2362d2 | |||
| eb1855fcb7 | |||
| d4863239cd | |||
| 4b7ddb9c15 | |||
| e5bb35b335 | |||
| 7eabd09b3a | |||
| 087f0c0ede | |||
| db9d6d9109 | |||
| 700e180522 | |||
| 8584997f5f | |||
| 4710b3b641 | |||
| 227e2489c1 | |||
| 91a5b19378 | |||
| 4c20441c4e | |||
| edfe1e6d54 | |||
| 7869f77704 | |||
| 34fd405bca | |||
| f03ee9f908 | |||
| b053638204 | |||
| d790194682 | |||
| 3fec2b9756 | |||
| bc7a31d791 | |||
| 05d84c6673 | |||
| f6645e3928 | |||
| 50b00b12b0 | |||
| 569371ffff | |||
| f7b72b225a | |||
| d1bed54cf1 | |||
| ba868887d4 | |||
| 3a7853dcbe | |||
| 60af7deacd | |||
| 49bc3151b0 | |||
| d6b7bae38a | |||
| 715cc22722 | |||
| 88b23e09b6 | |||
| 4697f2ecad | |||
| 612484c0b6 | |||
| 0e4974babe | |||
| 5fdd7d8bd6 | |||
| b5c87ccfb7 | |||
| 2efe6ae7a4 | |||
| 5775984730 | |||
| cbab70fd7c | |||
| cfa2a30006 | |||
| 09a3b0d155 | |||
| ca9cd77ded | |||
| 812601217a | |||
| 3a6ec5ef0c | |||
| 4197a7654f | |||
| 3133014650 | |||
| 4bce945946 | |||
| 2d15c9c01c | |||
| 58e648828b | |||
| d87b268a40 | |||
| 5174645059 | |||
| e4286bc35b | |||
| cf4d13da31 | |||
| a89b064e29 | |||
| 1e41973eb5 | |||
| b4e496fceb | |||
| bb94fc7d71 | |||
| 959378c456 | |||
| 787e128d5c | |||
| b7912a7be7 | |||
| 0bc7aa6ba7 | |||
| 367da39bbb | |||
| 6d8ffb903f | |||
| 0e992f897f | |||
| 3f19878c18 | |||
| 308f64a7e2 | |||
| 1eab92b299 | |||
| 7a8b8f138f | |||
| 926ea54c39 | |||
| 2e43a34812 | |||
| 1b9afc961b |
@@ -76,6 +76,7 @@ src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/umbraco.*
|
||||
src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/routes.js
|
||||
src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/app.dev.js
|
||||
src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/loader.js
|
||||
src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/loader.dev.js
|
||||
src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/main.js
|
||||
src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/app.js
|
||||
|
||||
@@ -130,3 +131,4 @@ src/*.boltdata/
|
||||
src/umbraco.sln.ide/*
|
||||
build/UmbracoCms.*/
|
||||
src/.vs/
|
||||
src/Umbraco.Web.UI/umbraco/js/install.loader.js
|
||||
|
||||
@@ -7,9 +7,9 @@ The easiest way to get started is to run `build/build.bat` which will build both
|
||||
|
||||
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.
|
||||
|
||||
## Watch a five minute introduction video ##
|
||||
## Watch a introduction video ##
|
||||
|
||||
[](http://umbraco.org/help-and-support/video-tutorials/getting-started/what-is-umbraco)
|
||||
[](https://umbraco.tv/videos/umbraco-v7/content-editor/basics/introduction/cms-explanation/)
|
||||
|
||||
## Umbraco - the simple, flexible and friendly ASP.NET CMS ##
|
||||
|
||||
|
||||
@@ -15,9 +15,8 @@
|
||||
<language>en-US</language>
|
||||
<tags>umbraco</tags>
|
||||
<dependencies>
|
||||
<dependency id="Microsoft.AspNet.Mvc" version="[4.0.40804.0,6.0.0)" />
|
||||
<dependency id="Microsoft.AspNet.Mvc" version="[5.2.3,6.0.0)" />
|
||||
<dependency id="Microsoft.AspNet.WebApi" version="[5.2.3,6.0.0)" />
|
||||
<dependency id="Microsoft.AspNet.Mvc.FixedDisplayModes" version="1.0.1" />
|
||||
<dependency id="Microsoft.Net.Http" version="[2.2.29, 3.0.0)" />
|
||||
<dependency id="Microsoft.AspNet.Identity.Owin" version="[2.2.1, 3.0.0)" />
|
||||
<dependency id="Microsoft.Owin.Security.Cookies" version="[3.0.1, 4.0.0)" />
|
||||
@@ -27,16 +26,18 @@
|
||||
<dependency id="HtmlAgilityPack" version="[1.4.9, 2.0.0)" />
|
||||
<dependency id="Lucene.Net" version="[2.9.4.1, 3.0.0.0)" />
|
||||
<dependency id="SharpZipLib" version="[0.86.0, 1.0.0)" />
|
||||
<dependency id="MySql.Data" version="[6.9.7, 7.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.8.4, 2.0.0)" />
|
||||
<dependency id="ClientDependency-Mvc" version="[1.8.0, 2.0.0)" />
|
||||
<dependency id="AutoMapper" version="[3.3.1, 4.0.0)" />
|
||||
<dependency id="ClientDependency-Mvc5" version="[1.8.0, 2.0.0)" />
|
||||
<dependency id="AutoMapper" version="[3.0.0, 3.1.0)" />
|
||||
<dependency id="Newtonsoft.Json" version="[6.0.8, 7.0.0)" />
|
||||
<dependency id="Examine" version="[0.1.66, 1.0.0)" />
|
||||
<dependency id="ImageProcessor" version="[1.9.5, 3.0.0)" />
|
||||
<dependency id="ImageProcessor.Web" version="[3.3.1, 5.0.0)" />
|
||||
<dependency id="Examine" version="[0.1.68, 1.0.0)" />
|
||||
<dependency id="ImageProcessor" version="[2.3.0, 3.0.0)" />
|
||||
<dependency id="ImageProcessor.Web" version="[4.4.0, 5.0.0)" />
|
||||
<dependency id="semver" version="[1.1.2, 2.0.0)" />
|
||||
<dependency id="Microsoft.AspNet.WebHelpers" version="[3.2.3, 4.0.0)" />
|
||||
<dependency id="Microsoft.AspNet.WebPages.Data" version="[3.2.3, 4.0.0)" />
|
||||
</dependencies>
|
||||
</metadata>
|
||||
<files>
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
<file src="tools\Dashboard.config.install.xdt" target="Content\config\Dashboard.config.install.xdt" />
|
||||
<file src="tools\trees.config.install.xdt" target="Content\config\trees.config.install.xdt" />
|
||||
<file src="tools\umbracoSettings.config.install.xdt" target="Content\config\umbracoSettings.config.install.xdt" />
|
||||
<file src="tools\Views.Web.config.install.xdt" target="Views\Web.config.install.xdt" />
|
||||
<file src="build\**" target="build" />
|
||||
</files>
|
||||
</package>
|
||||
@@ -1,6 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Target Name="CopyUmbracoFilesToWebRootForDeploy" AfterTargets="CopyAllFilesToSingleFolderForMsdeploy">
|
||||
<PropertyGroup>
|
||||
<UmbracoFilesFolder>$(MSBuildThisFileDirectory)..\UmbracoFiles\</UmbracoFilesFolder>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<UmbracoFiles Include="$(UmbracoFilesFolder)**\*" />
|
||||
</ItemGroup>
|
||||
<Copy SourceFiles="%(UmbracoFiles.FullPath)" DestinationFiles="$(_PackageTempDir)\%(RecursiveDir)%(Filename)%(Extension)" Condition="!Exists('%(RecursiveDir)%(Filename)%(Extension)')" />
|
||||
</Target>
|
||||
<Target Name="CopyUmbracoFilesToWebRoot" BeforeTargets="AfterBuild">
|
||||
<!-- This copies the files listed in `AddUmbracoFilesToOutput` to the webroot during NuGet install and should -->
|
||||
<!-- not be altered to support automated builds, use `CopyUmbracoFilesToWebRootForDeploy` for that instead -->
|
||||
<PropertyGroup>
|
||||
<UmbracoFilesFolder>$(MSBuildThisFileDirectory)..\UmbracoFiles\</UmbracoFilesFolder>
|
||||
</PropertyGroup>
|
||||
@@ -47,4 +58,4 @@
|
||||
</FilesForPackagingFromProject>
|
||||
</ItemGroup>
|
||||
</Target>
|
||||
</Project>
|
||||
</Project>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0"?>
|
||||
<dashBoard xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
|
||||
<section alias="StartupSettingsDashboardSection" xdt:Locator="Match(alias)">
|
||||
<section alias="StartupSettingsDashboardSection" xdt:Locator="Match(alias)" xdt:Transform="InsertIfMissing">
|
||||
<tab caption="Get Started" xdt:Locator="Match(caption)" xdt:Transform="Remove" />
|
||||
<tab caption="Welcome" xdt:Locator="Match(caption)" xdt:Transform="InsertIfMissing">
|
||||
<control showOnce="true" addPanel="true" panelCaption="" xdt:Transform="InsertIfMissing">
|
||||
@@ -20,7 +20,7 @@
|
||||
</tab>
|
||||
</section>
|
||||
|
||||
<section alias="StartupDeveloperDashboardSection" xdt:Locator="Match(alias)">
|
||||
<section alias="StartupDeveloperDashboardSection" xdt:Locator="Match(alias)" xdt:Transform="InsertIfMissing">
|
||||
<tab caption="Get Started" xdt:Locator="Match(caption)" xdt:Transform="Replace">
|
||||
<control showOnce="true" addPanel="true" panelCaption="">
|
||||
views/dashboard/developer/developerdashboardvideos.html
|
||||
@@ -29,7 +29,7 @@
|
||||
<tab caption="Examine Management" xdt:Locator="Match(caption)" xdt:Transform="Remove" />
|
||||
</section>
|
||||
|
||||
<section alias="StartupDeveloperDashboardSection" xdt:Locator="Match(alias)">
|
||||
<section alias="StartupDeveloperDashboardSection" xdt:Locator="Match(alias)" xdt:Transform="InsertIfMissing">
|
||||
<tab caption="Examine Management" xdt:Locator="Match(caption)" xdt:Transform="InsertIfMissing">
|
||||
<control>
|
||||
views/dashboard/developer/examinemanagement.html
|
||||
@@ -39,10 +39,10 @@
|
||||
<control>
|
||||
views/dashboard/developer/xmldataintegrityreport.html
|
||||
</control>
|
||||
</tab>
|
||||
</tab>
|
||||
</section>
|
||||
|
||||
<section alias="StartupMediaDashboardSection" xdt:Locator="Match(alias)">
|
||||
<section alias="StartupMediaDashboardSection" xdt:Locator="Match(alias)" xdt:Transform="InsertIfMissing">
|
||||
<tab caption="Get Started" xdt:Locator="Match(caption)" xdt:Transform="Remove" />
|
||||
<tab caption="Content" xdt:Locator="Match(caption)" xdt:Transform="InsertIfMissing" />
|
||||
<tab caption="Content" xdt:Locator="Match(caption)" xdt:Transform="Replace">
|
||||
@@ -52,7 +52,7 @@
|
||||
</tab>
|
||||
</section>
|
||||
|
||||
<section alias="StartupDashboardSection" xdt:Locator="Match(alias)">
|
||||
<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>
|
||||
@@ -62,17 +62,10 @@
|
||||
views/dashboard/default/startupdashboardintro.html
|
||||
</control>
|
||||
</tab>
|
||||
<tab caption="Change password" xdt:Locator="Match(caption)" xdt:Transform="Remove" />
|
||||
<tab caption="Change Password" xdt:Locator="Match(caption)" xdt:Transform="Remove" />
|
||||
<tab caption="Change Password" xdt:Transform="Insert">
|
||||
<control showOnce="false" addPanel="false" panelCaption="">
|
||||
views/dashboard/ChangePassword.html
|
||||
</control>
|
||||
</tab>
|
||||
<tab caption="Last Edits" xdt:Locator="Match(caption)" xdt:Transform="Remove" />
|
||||
</section>
|
||||
|
||||
<section alias="StartupMemberDashboardSection" xdt:Locator="Match(alias)">
|
||||
<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">
|
||||
<control showOnce="true" addPanel="true" panelCaption="">
|
||||
|
||||
@@ -10,9 +10,6 @@
|
||||
|
||||
Don't forget to build!
|
||||
|
||||
When upgrading your website using NuGet you should answer "No" to the questions to overwrite the Web.config
|
||||
file (and config files in the config folder).
|
||||
|
||||
We've done our best to transform your configuration files but in case something is not quite right: remember we
|
||||
backed up your files in App_Data\NuGetBackup so you can find the original files before they were transformed.
|
||||
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
<?xml version="1.0"?>
|
||||
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
|
||||
<configSections>
|
||||
<sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
|
||||
xdt:Locator="Match(name)"
|
||||
xdt:Transform="SetAttributes(type)">
|
||||
<section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
|
||||
xdt:Locator="Match(name)"
|
||||
xdt:Transform="SetAttributes(type)" />
|
||||
<section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
|
||||
xdt:Locator="Match(name)"
|
||||
xdt:Transform="SetAttributes(type)" />
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
|
||||
<system.web.webPages.razor>
|
||||
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
|
||||
xdt:Locator="Match(factoryType)"
|
||||
xdt:Transform="SetAttributes(factoryType)" />
|
||||
</system.web.webPages.razor>
|
||||
|
||||
<system.web>
|
||||
<pages
|
||||
pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
|
||||
pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
|
||||
userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
|
||||
xdt:Locator="Match(pageParserFilterType,pageBaseType,userControlBaseType)"
|
||||
xdt:Transform="SetAttributes(pageParserFilterType,pageBaseType,userControlBaseType)">
|
||||
<controls>
|
||||
<add assembly="System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc"
|
||||
xdt:Locator="Match(namespace)"
|
||||
xdt:Transform="SetAttributes(assembly)" />
|
||||
</controls>
|
||||
</pages>
|
||||
</system.web>
|
||||
|
||||
</configuration>
|
||||
@@ -22,10 +22,7 @@
|
||||
<appSettings>
|
||||
<add key="owin:appStartup" value="UmbracoDefaultOwinStartup" xdt:Locator="Match(key)" xdt:Transform="InsertIfMissing" />
|
||||
</appSettings>
|
||||
<appSettings>
|
||||
<add key="owin:appStartup" value="UmbracoDefaultOwinStartup" xdt:Locator="Match(key)" xdt:Transform="SetAttributes" />
|
||||
</appSettings>
|
||||
|
||||
|
||||
<umbracoConfiguration xdt:Transform="InsertIfMissing">
|
||||
<settings configSource="config\umbracoSettings.config" xdt:Locator="Match(configSource)" xdt:Transform="InsertIfMissing" />
|
||||
<BaseRestExtensions configSource="config\BaseRestExtensions.config" xdt:Locator="Match(configSource)" xdt:Transform="InsertIfMissing" />
|
||||
@@ -51,6 +48,13 @@
|
||||
<system.web xdt:Transform="InsertIfMissing" />
|
||||
<system.web>
|
||||
<siteMap xdt:Transform="Remove" />
|
||||
<siteMap xdt:Transform="InsertIfMissing">
|
||||
<providers xdt:Transform="InsertIfMissing">
|
||||
<remove name="MySqlSiteMapProvider" xdt:Transform="InsertIfMissing" />
|
||||
</providers>
|
||||
</siteMap>
|
||||
<httpRuntime xdt:Transform="InsertIfMissing" />
|
||||
<httpRuntime targetFramework="4.5" xdt:Transform="SetAttributes(targetFramework)" />
|
||||
<membership defaultProvider="DefaultMembershipProvider" xdt:Locator="Match(defaultProvider)" xdt:Transform="Remove" />
|
||||
<roleManager defaultProvider="DefaultRoleProvider" xdt:Locator="Match(defaultProvider)" xdt:Transform="Remove"/>
|
||||
<profile defaultProvider="DefaultProfileProvider" xdt:Locator="Match(defaultProvider)" xdt:Transform="Remove"/>>
|
||||
@@ -77,6 +81,10 @@
|
||||
</compilation>
|
||||
|
||||
<compilation>
|
||||
<assemblies>
|
||||
<remove assembly="System.Web.Http" xdt:Locator="Match(assembly)" xdt:Transform="Remove" />
|
||||
<remove assembly="System.Net.Http" xdt:Locator="Match(assembly)" xdt:Transform="Remove" />
|
||||
</assemblies>
|
||||
<assemblies>
|
||||
<remove assembly="System.Web.Http" xdt:Locator="Match(assembly)" xdt:Transform="InsertBefore(/configuration/system.web/compilation/assemblies/add)" />
|
||||
<remove assembly="System.Net.Http" xdt:Locator="Match(assembly)" xdt:Transform="InsertBefore(/configuration/system.web/compilation/assemblies/add)" />
|
||||
@@ -173,23 +181,23 @@
|
||||
<assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<dependentAssembly xdt:Transform="Insert">
|
||||
<assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<dependentAssembly xdt:Transform="Insert">
|
||||
<assemblyIdentity name="Microsoft.Owin.Security.OAuth" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<dependentAssembly xdt:Transform="Insert">
|
||||
<assemblyIdentity name="Microsoft.Owin.Security" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<dependentAssembly xdt:Transform="Insert">
|
||||
<assemblyIdentity name="Microsoft.Owin.Security.Cookies" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<dependentAssembly xdt:Transform="Insert">
|
||||
<assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
|
||||
</dependentAssembly>
|
||||
|
||||
@@ -57,12 +57,25 @@ if ($project) {
|
||||
if(Test-Path $umbracoBinFolder\ImageProcessor.dll) { Remove-Item $umbracoBinFolder\ImageProcessor.dll -Force -Confirm:$false }
|
||||
if(Test-Path $umbracoBinFolder\ImageProcessor.Web.dll) { Remove-Item $umbracoBinFolder\ImageProcessor.Web.dll -Force -Confirm:$false }
|
||||
if(Test-Path $umbracoBinFolder\Lucene.Net.dll) { Remove-Item $umbracoBinFolder\Lucene.Net.dll -Force -Confirm:$false }
|
||||
if(Test-Path $umbracoBinFolder\Microsoft.AspNet.Identity.Core.dll) { Remove-Item $umbracoBinFolder\Microsoft.AspNet.Identity.Core.dll -Force -Confirm:$false }
|
||||
if(Test-Path $umbracoBinFolder\Microsoft.AspNet.Identity.Owin.dll) { Remove-Item $umbracoBinFolder\Microsoft.AspNet.Identity.Owin.dll -Force -Confirm:$false }
|
||||
if(Test-Path $umbracoBinFolder\Microsoft.Owin.dll) { Remove-Item $umbracoBinFolder\Microsoft.Owin.dll -Force -Confirm:$false }
|
||||
if(Test-Path $umbracoBinFolder\Microsoft.Owin.Host.SystemWeb.dll) { Remove-Item $umbracoBinFolder\Microsoft.Owin.Host.SystemWeb.dll -Force -Confirm:$false }
|
||||
if(Test-Path $umbracoBinFolder\Microsoft.Owin.Security.dll) { Remove-Item $umbracoBinFolder\Microsoft.Owin.Security.dll -Force -Confirm:$false }
|
||||
if(Test-Path $umbracoBinFolder\Microsoft.Owin.Security.Cookies.dll) { Remove-Item $umbracoBinFolder\Microsoft.Owin.Security.Cookies.dll -Force -Confirm:$false }
|
||||
if(Test-Path $umbracoBinFolder\Microsoft.Owin.Security.OAuth.dll) { Remove-Item $umbracoBinFolder\Microsoft.Owin.Security.OAuth.dll -Force -Confirm:$false }
|
||||
if(Test-Path $umbracoBinFolder\Microsoft.Web.Infrastructure.dll) { Remove-Item $umbracoBinFolder\Microsoft.Web.Infrastructure.dll -Force -Confirm:$false }
|
||||
if(Test-Path $umbracoBinFolder\Microsoft.Web.Helpers.dll) { Remove-Item $umbracoBinFolder\Microsoft.Web.Helpers.dll -Force -Confirm:$false }
|
||||
if(Test-Path $umbracoBinFolder\Microsoft.Web.Mvc.FixedDisplayModes.dll) { Remove-Item $umbracoBinFolder\Microsoft.Web.Mvc.FixedDisplayModes.dll -Force -Confirm:$false }
|
||||
if(Test-Path $umbracoBinFolder\MiniProfiler.dll) { Remove-Item $umbracoBinFolder\MiniProfiler.dll -Force -Confirm:$false }
|
||||
if(Test-Path $umbracoBinFolder\MySql.Data.dll) { Remove-Item $umbracoBinFolder\MySql.Data.dll -Force -Confirm:$false }
|
||||
if(Test-Path $umbracoBinFolder\Newtonsoft.Json.dll) { Remove-Item $umbracoBinFolder\Newtonsoft.Json.dll -Force -Confirm:$false }
|
||||
if(Test-Path $umbracoBinFolder\Owin.dll) { Remove-Item $umbracoBinFolder\Owin.dll -Force -Confirm:$false }
|
||||
if(Test-Path $umbracoBinFolder\Semver.dll) { Remove-Item $umbracoBinFolder\Semver.dll -Force -Confirm:$false }
|
||||
if(Test-Path $umbracoBinFolder\System.Net.Http.Extensions.dll) { Remove-Item $umbracoBinFolder\System.Net.Http.Extensions.dll -Force -Confirm:$false }
|
||||
if(Test-Path $umbracoBinFolder\System.Net.Http.Formatting.dll) { Remove-Item $umbracoBinFolder\System.Net.Http.Formatting.dll -Force -Confirm:$false }
|
||||
if(Test-Path $umbracoBinFolder\System.Net.Http.Primitives.dll) { Remove-Item $umbracoBinFolder\System.Net.Http.Primitives.dll -Force -Confirm:$false }
|
||||
if(Test-Path $umbracoBinFolder\System.Web.Helpers.dll) { Remove-Item $umbracoBinFolder\System.Web.Helpers.dll -Force -Confirm:$false }
|
||||
if(Test-Path $umbracoBinFolder\System.Web.Http.dll) { Remove-Item $umbracoBinFolder\System.Web.Http.dll -Force -Confirm:$false }
|
||||
if(Test-Path $umbracoBinFolder\System.Web.Http.WebHost.dll) { Remove-Item $umbracoBinFolder\System.Web.Http.WebHost.dll -Force -Confirm:$false }
|
||||
if(Test-Path $umbracoBinFolder\System.Web.Mvc.dll) { Remove-Item $umbracoBinFolder\System.Web.Mvc.dll -Force -Confirm:$false }
|
||||
|
||||
@@ -45,9 +45,6 @@ del ..\src\Umbraco.Web.UI\UserControls\*.*
|
||||
echo Removing masterpage files
|
||||
del ..\src\Umbraco.Web.UI\masterpages\*.*
|
||||
|
||||
echo Removing view files
|
||||
del ..\src\Umbraco.Web.UI\Views\*.*
|
||||
|
||||
echo Removing razor files
|
||||
del ..\src\Umbraco.Web.UI\macroScripts\*.*
|
||||
|
||||
@@ -104,7 +101,9 @@ echo Removing user control files
|
||||
FOR %%A IN (..\src\Umbraco.Web.UI\usercontrols\*.*) DO DEL %%A
|
||||
|
||||
echo Removing view files
|
||||
FOR %%A IN (..\src\Umbraco.Web.UI\Views\*.*) DO DEL %%A
|
||||
ATTRIB +H ..\src\Umbraco.Web.UI\Views\Partials\Grid\*.cshtml /S
|
||||
FOR %%A IN (..\src\Umbraco.Web.UI\Views\) DO DEL /Q /S *.cshtml -H
|
||||
ATTRIB -H ..\src\Umbraco.Web.UI\Views\Partials\Grid\*.cshtml /S
|
||||
|
||||
echo Removing razor files
|
||||
FOR %%A IN (..\src\Umbraco.Web.UI\macroScripts\*.*) DO DEL %%A
|
||||
|
||||
@@ -54,9 +54,6 @@ del ..\src\Umbraco.Web.UI\UserControls\*.*
|
||||
echo Removing masterpage files
|
||||
del ..\src\Umbraco.Web.UI\masterpages\*.*
|
||||
|
||||
echo Removing view files
|
||||
del ..\src\Umbraco.Web.UI\Views\*.*
|
||||
|
||||
echo Removing razor files
|
||||
del ..\src\Umbraco.Web.UI\macroScripts\*.*
|
||||
|
||||
@@ -122,7 +119,9 @@ echo Removing user control files
|
||||
FOR %%A IN (..\src\Umbraco.Web.UI\usercontrols\*.*) DO DEL %%A
|
||||
|
||||
echo Removing view files
|
||||
FOR %%A IN (..\src\Umbraco.Web.UI\Views\*.*) DO DEL %%A
|
||||
ATTRIB +H ..\src\Umbraco.Web.UI\Views\Partials\Grid\*.cshtml /S
|
||||
FOR %%A IN (..\src\Umbraco.Web.UI\Views\) DO DEL /Q /S *.cshtml -H
|
||||
ATTRIB -H ..\src\Umbraco.Web.UI\Views\Partials\Grid\*.cshtml /S
|
||||
|
||||
echo Removing razor files
|
||||
FOR %%A IN (..\src\Umbraco.Web.UI\macroScripts\*.*) DO DEL %%A
|
||||
@@ -151,6 +150,9 @@ rmdir "..\src\Umbraco.Web.UI\usercontrols\umbracoContour\" /S /Q
|
||||
echo Start with a clean web.config
|
||||
copy ..\src\Umbraco.Web.UI\web.Template.config ..\src\Umbraco.Web.UI\web.config /Y
|
||||
|
||||
echo Start with a clean web.config
|
||||
copy ..\src\Umbraco.Web.UI\web.Template.config ..\src\Umbraco.Web.UI\web.config /Y
|
||||
|
||||
echo "Umbraco install reverted to clean install"
|
||||
pause
|
||||
exit
|
||||
|
||||
@@ -1,3 +1,2 @@
|
||||
# Usage: on line 2 put the release version, on line 3 put the version comment (example: beta)
|
||||
7.3.0
|
||||
beta2
|
||||
7.3.4
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<packageSources>
|
||||
<add key="nuget.org" value="https://www.nuget.org/api/v2/" />
|
||||
<add key="umbracocore" value="http://www.myget.org/f/umbracocore/" />
|
||||
</packageSources>
|
||||
</configuration>
|
||||
+2
-2
@@ -11,5 +11,5 @@ using System.Resources;
|
||||
|
||||
[assembly: AssemblyVersion("1.0.*")]
|
||||
|
||||
[assembly: AssemblyFileVersion("7.3.0")]
|
||||
[assembly: AssemblyInformationalVersion("7.3.0-beta2")]
|
||||
[assembly: AssemblyFileVersion("7.3.4")]
|
||||
[assembly: AssemblyInformationalVersion("7.3.4")]
|
||||
@@ -11,7 +11,7 @@ namespace Umbraco.Core
|
||||
/// <summary>
|
||||
/// A resolver to return all IAction objects
|
||||
/// </summary>
|
||||
internal sealed class ActionsResolver : LazyManyObjectsResolverBase<ActionsResolver, IAction>
|
||||
public sealed class ActionsResolver : LazyManyObjectsResolverBase<ActionsResolver, IAction>
|
||||
{
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.Configuration;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.ObjectResolution;
|
||||
@@ -259,22 +260,13 @@ namespace Umbraco.Core
|
||||
{
|
||||
get
|
||||
{
|
||||
// if initialized, return
|
||||
if (_umbracoApplicationUrl != null) return _umbracoApplicationUrl;
|
||||
|
||||
// try settings
|
||||
ServerEnvironmentHelper.TrySetApplicationUrlFromSettings(this, ProfilingLogger.Logger, UmbracoConfig.For.UmbracoSettings());
|
||||
|
||||
// and return what we have, may be null
|
||||
ApplicationUrlHelper.EnsureApplicationUrl(this);
|
||||
return _umbracoApplicationUrl;
|
||||
}
|
||||
set
|
||||
{
|
||||
_umbracoApplicationUrl = value;
|
||||
}
|
||||
}
|
||||
|
||||
internal string _umbracoApplicationUrl; // internal for tests
|
||||
// ReSharper disable once InconsistentNaming
|
||||
internal string _umbracoApplicationUrl;
|
||||
|
||||
private Lazy<bool> _configured;
|
||||
internal MainDom MainDom { get; private set; }
|
||||
@@ -291,7 +283,12 @@ namespace Umbraco.Core
|
||||
{
|
||||
var configStatus = ConfigurationStatus;
|
||||
var currentVersion = UmbracoVersion.GetSemanticVersion();
|
||||
var ok = configStatus == currentVersion;
|
||||
|
||||
var ok =
|
||||
//we are not configured if this is null
|
||||
string.IsNullOrWhiteSpace(configStatus) == false
|
||||
//they must match
|
||||
&& configStatus == currentVersion;
|
||||
|
||||
if (ok)
|
||||
{
|
||||
@@ -316,8 +313,9 @@ namespace Umbraco.Core
|
||||
|
||||
return ok;
|
||||
}
|
||||
catch
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Error<ApplicationContext>("Error determining if application is configured, returning false", ex);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -379,6 +377,11 @@ namespace Umbraco.Core
|
||||
internal set { _services = value; }
|
||||
}
|
||||
|
||||
internal ServerRole GetCurrentServerRole()
|
||||
{
|
||||
var registrar = ServerRegistrarResolver.Current.Registrar as IServerRegistrar2;
|
||||
return registrar == null ? ServerRole.Unknown : registrar.GetCurrentServerRole();
|
||||
}
|
||||
|
||||
private volatile bool _disposed;
|
||||
private readonly ReaderWriterLockSlim _disposalLocker = new ReaderWriterLockSlim();
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Runtime.ConstrainedExecution;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@@ -117,38 +118,55 @@ namespace Umbraco.Core
|
||||
private class NamedSemaphoreReleaser : CriticalFinalizerObject, IDisposable
|
||||
{
|
||||
private readonly Semaphore _semaphore;
|
||||
private GCHandle _handle;
|
||||
|
||||
internal NamedSemaphoreReleaser(Semaphore semaphore)
|
||||
{
|
||||
_semaphore = semaphore;
|
||||
_handle = GCHandle.Alloc(_semaphore);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
GC.SuppressFinalize(this); // finalize will not run
|
||||
}
|
||||
|
||||
private void Dispose(bool disposing)
|
||||
{
|
||||
// critical
|
||||
_handle.Free();
|
||||
_semaphore.Release();
|
||||
_semaphore.Dispose();
|
||||
}
|
||||
|
||||
// we WANT to release the semaphore because it's a system object
|
||||
// ie a critical non-managed resource - so we inherit from CriticalFinalizerObject
|
||||
// which means that the finalizer "should" run in all situations
|
||||
// we WANT to release the semaphore because it's a system object, ie a critical
|
||||
// non-managed resource - and if it is not released then noone else can acquire
|
||||
// the lock - so we inherit from CriticalFinalizerObject which means that the
|
||||
// finalizer "should" run in all situations - there is always a chance that it
|
||||
// does not run and the semaphore remains "acquired" but then chances are the
|
||||
// whole process (w3wp.exe...) is going down, at which point the semaphore will
|
||||
// be destroyed by Windows.
|
||||
|
||||
// however... that can fail with System.ObjectDisposedException because the
|
||||
// underlying handle was closed... because we cannot guarantee that the semaphore
|
||||
// is not gone already... unless we get a GCHandle = GCHandle.Alloc(_semaphore);
|
||||
// which should keep it around and then we free the handle?
|
||||
// however, the semaphore is a managed object, and so when the finalizer runs it
|
||||
// might have been finalized already, and then we get a, ObjectDisposedException
|
||||
// in the finalizer - which is bad.
|
||||
|
||||
// so... I'm not sure this is safe really...
|
||||
// in order to prevent this we do two things
|
||||
// - use a GCHandler to ensure the semaphore is still there when the finalizer
|
||||
// runs, so we can actually release it
|
||||
// - wrap the finalizer code in a try...catch to make sure it never throws
|
||||
|
||||
~NamedSemaphoreReleaser()
|
||||
{
|
||||
Dispose(false);
|
||||
try
|
||||
{
|
||||
Dispose(false);
|
||||
}
|
||||
catch
|
||||
{
|
||||
// we do NOT want the finalizer to throw - never ever
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace Umbraco.Core.Configuration
|
||||
//make this volatile so that we can ensure thread safety with a double check lock
|
||||
private static volatile string _reservedUrlsCache;
|
||||
private static string _reservedPathsCache;
|
||||
private static StartsWithContainer _reservedList = new StartsWithContainer();
|
||||
private static HashSet<string> _reservedList = new HashSet<string>();
|
||||
private static string _reservedPaths;
|
||||
private static string _reservedUrls;
|
||||
//ensure the built on (non-changeable) reserved paths are there at all times
|
||||
@@ -767,38 +767,31 @@ namespace Umbraco.Core.Configuration
|
||||
// store references to strings to determine changes
|
||||
_reservedPathsCache = GlobalSettings.ReservedPaths;
|
||||
_reservedUrlsCache = GlobalSettings.ReservedUrls;
|
||||
|
||||
string _root = SystemDirectories.Root.Trim().ToLower();
|
||||
|
||||
|
||||
// add URLs and paths to a new list
|
||||
StartsWithContainer _newReservedList = new StartsWithContainer();
|
||||
foreach (string reservedUrl in _reservedUrlsCache.Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries))
|
||||
var newReservedList = new HashSet<string>();
|
||||
foreach (var reservedUrlTrimmed in _reservedUrlsCache
|
||||
.Split(new[] {","}, StringSplitOptions.RemoveEmptyEntries)
|
||||
.Select(x => x.Trim().ToLowerInvariant())
|
||||
.Where(x => x.IsNullOrWhiteSpace() == false)
|
||||
.Select(reservedUrl => IOHelper.ResolveUrl(reservedUrl).Trim().EnsureStartsWith("/"))
|
||||
.Where(reservedUrlTrimmed => reservedUrlTrimmed.IsNullOrWhiteSpace() == false))
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(reservedUrl))
|
||||
continue;
|
||||
|
||||
|
||||
//resolves the url to support tilde chars
|
||||
string reservedUrlTrimmed = IOHelper.ResolveUrl(reservedUrl.Trim()).Trim().ToLower();
|
||||
if (reservedUrlTrimmed.Length > 0)
|
||||
_newReservedList.Add(reservedUrlTrimmed);
|
||||
newReservedList.Add(reservedUrlTrimmed);
|
||||
}
|
||||
|
||||
foreach (string reservedPath in _reservedPathsCache.Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries))
|
||||
foreach (var reservedPathTrimmed in _reservedPathsCache
|
||||
.Split(new[] {","}, StringSplitOptions.RemoveEmptyEntries)
|
||||
.Select(x => x.Trim().ToLowerInvariant())
|
||||
.Where(x => x.IsNullOrWhiteSpace() == false)
|
||||
.Select(reservedPath => IOHelper.ResolveUrl(reservedPath).Trim().EnsureStartsWith("/").EnsureEndsWith("/"))
|
||||
.Where(reservedPathTrimmed => reservedPathTrimmed.IsNullOrWhiteSpace() == false))
|
||||
{
|
||||
bool trimEnd = !reservedPath.EndsWith("/");
|
||||
if (string.IsNullOrWhiteSpace(reservedPath))
|
||||
continue;
|
||||
|
||||
//resolves the url to support tilde chars
|
||||
string reservedPathTrimmed = IOHelper.ResolveUrl(reservedPath.Trim()).Trim().ToLower();
|
||||
|
||||
if (reservedPathTrimmed.Length > 0)
|
||||
_newReservedList.Add(reservedPathTrimmed + (reservedPathTrimmed.EndsWith("/") ? "" : "/"));
|
||||
newReservedList.Add(reservedPathTrimmed);
|
||||
}
|
||||
|
||||
// use the new list from now on
|
||||
_reservedList = _newReservedList;
|
||||
_reservedList = newReservedList;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -806,107 +799,17 @@ namespace Umbraco.Core.Configuration
|
||||
//The url should be cleaned up before checking:
|
||||
// * If it doesn't contain an '.' in the path then we assume it is a path based URL, if that is the case we should add an trailing '/' because all of our reservedPaths use a trailing '/'
|
||||
// * We shouldn't be comparing the query at all
|
||||
var pathPart = url.Split('?')[0];
|
||||
if (!pathPart.Contains(".") && !pathPart.EndsWith("/"))
|
||||
var pathPart = url.Split(new[] {'?'}, StringSplitOptions.RemoveEmptyEntries)[0].ToLowerInvariant();
|
||||
if (pathPart.Contains(".") == false)
|
||||
{
|
||||
pathPart += "/";
|
||||
pathPart = pathPart.EnsureEndsWith('/');
|
||||
}
|
||||
|
||||
// return true if url starts with an element of the reserved list
|
||||
return _reservedList.StartsWith(pathPart.ToLowerInvariant());
|
||||
return _reservedList.Any(x => pathPart.InvariantStartsWith(x));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Structure that checks in logarithmic time
|
||||
/// if a given string starts with one of the added keys.
|
||||
/// </summary>
|
||||
private class StartsWithContainer
|
||||
{
|
||||
/// <summary>Internal sorted list of keys.</summary>
|
||||
public SortedList<string, string> _list
|
||||
= new SortedList<string, string>(StartsWithComparator.Instance);
|
||||
|
||||
/// <summary>
|
||||
/// Adds the specified new key.
|
||||
/// </summary>
|
||||
/// <param name="newKey">The new key.</param>
|
||||
public void Add(string newKey)
|
||||
{
|
||||
// if the list already contains an element that begins with newKey, return
|
||||
if (String.IsNullOrEmpty(newKey) || StartsWith(newKey))
|
||||
return;
|
||||
|
||||
// create a new collection, so the old one can still be accessed
|
||||
SortedList<string, string> newList
|
||||
= new SortedList<string, string>(_list.Count + 1, StartsWithComparator.Instance);
|
||||
|
||||
// add only keys that don't already start with newKey, others are unnecessary
|
||||
foreach (string key in _list.Keys)
|
||||
if (!key.StartsWith(newKey))
|
||||
newList.Add(key, null);
|
||||
// add the new key
|
||||
newList.Add(newKey, null);
|
||||
|
||||
// update the list (thread safe, _list was never in incomplete state)
|
||||
_list = newList;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks if the given string starts with any of the added keys.
|
||||
/// </summary>
|
||||
/// <param name="target">The target.</param>
|
||||
/// <returns>true if a key is found that matches the start of target</returns>
|
||||
/// <remarks>
|
||||
/// Runs in O(s*log(n)), with n the number of keys and s the length of target.
|
||||
/// </remarks>
|
||||
public bool StartsWith(string target)
|
||||
{
|
||||
return _list.ContainsKey(target);
|
||||
}
|
||||
|
||||
/// <summary>Comparator that tests if a string starts with another.</summary>
|
||||
/// <remarks>Not a real comparator, since it is not reflexive. (x==y does not imply y==x)</remarks>
|
||||
private sealed class StartsWithComparator : IComparer<string>
|
||||
{
|
||||
/// <summary>Default string comparer.</summary>
|
||||
private readonly static Comparer<string> _stringComparer = Comparer<string>.Default;
|
||||
|
||||
/// <summary>Gets an instance of the StartsWithComparator.</summary>
|
||||
public static readonly StartsWithComparator Instance = new StartsWithComparator();
|
||||
|
||||
/// <summary>
|
||||
/// Tests if whole begins with all characters of part.
|
||||
/// </summary>
|
||||
/// <param name="part">The part.</param>
|
||||
/// <param name="whole">The whole.</param>
|
||||
/// <returns>
|
||||
/// Returns 0 if whole starts with part, otherwise performs standard string comparison.
|
||||
/// </returns>
|
||||
public int Compare(string part, string whole)
|
||||
{
|
||||
// let the default string comparer deal with null or when part is not smaller then whole
|
||||
if (part == null || whole == null || part.Length >= whole.Length)
|
||||
return _stringComparer.Compare(part, whole);
|
||||
|
||||
////ensure both have a / on the end
|
||||
//part = part.EndsWith("/") ? part : part + "/";
|
||||
//whole = whole.EndsWith("/") ? whole : whole + "/";
|
||||
//if (part.Length >= whole.Length)
|
||||
// return _stringComparer.Compare(part, whole);
|
||||
|
||||
// loop through all characters that part and whole have in common
|
||||
int pos = 0;
|
||||
bool match;
|
||||
do
|
||||
{
|
||||
match = (part[pos] == whole[pos]);
|
||||
} while (match && ++pos < part.Length);
|
||||
|
||||
// return result of last comparison
|
||||
return match ? 0 : (part[pos] < whole[pos] ? -1 : 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace Umbraco.Core.Configuration
|
||||
{
|
||||
public class UmbracoVersion
|
||||
{
|
||||
private static readonly Version Version = new Version("7.3.0");
|
||||
private static readonly Version Version = new Version("7.3.4");
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current version of Umbraco.
|
||||
@@ -24,7 +24,7 @@ namespace Umbraco.Core.Configuration
|
||||
/// Gets the version comment (like beta or RC).
|
||||
/// </summary>
|
||||
/// <value>The version comment.</value>
|
||||
public static string CurrentComment { get { return "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
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
public const string Users = "users";
|
||||
|
||||
/// <summary>
|
||||
/// Application alias for the users section.
|
||||
/// Application alias for the forms section.
|
||||
/// </summary>
|
||||
public const string Forms = "forms";
|
||||
}
|
||||
|
||||
@@ -2,91 +2,96 @@
|
||||
|
||||
namespace Umbraco.Core
|
||||
{
|
||||
public static partial class Constants
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the identifiers for Umbraco object types as constants for easy centralized access/management.
|
||||
/// </summary>
|
||||
public static class ObjectTypes
|
||||
{
|
||||
/// <summary>
|
||||
/// Guid for a Content Item object.
|
||||
/// </summary>
|
||||
public const string ContentItem = "10E2B09F-C28B-476D-B77A-AA686435E44A";
|
||||
public static partial class Constants
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the identifiers for Umbraco object types as constants for easy centralized access/management.
|
||||
/// </summary>
|
||||
public static class ObjectTypes
|
||||
{
|
||||
/// <summary>
|
||||
/// Guid for a Content Item object.
|
||||
/// </summary>
|
||||
public const string ContentItem = "10E2B09F-C28B-476D-B77A-AA686435E44A";
|
||||
|
||||
/// <summary>
|
||||
/// Guid for a Content Item Type object.
|
||||
/// </summary>
|
||||
public const string ContentItemType = "7A333C54-6F43-40A4-86A2-18688DC7E532";
|
||||
/// <summary>
|
||||
/// Guid for a Content Item Type object.
|
||||
/// </summary>
|
||||
public const string ContentItemType = "7A333C54-6F43-40A4-86A2-18688DC7E532";
|
||||
|
||||
/// <summary>
|
||||
/// Guid for the Content Recycle Bin.
|
||||
/// </summary>
|
||||
public const string ContentRecycleBin = "01BB7FF2-24DC-4C0C-95A2-C24EF72BBAC8";
|
||||
/// <summary>
|
||||
/// Guid for the Content Recycle Bin.
|
||||
/// </summary>
|
||||
public const string ContentRecycleBin = "01BB7FF2-24DC-4C0C-95A2-C24EF72BBAC8";
|
||||
|
||||
/// <summary>
|
||||
/// Guid for a DataType object.
|
||||
/// </summary>
|
||||
public const string DataType = "30A2A501-1978-4DDB-A57B-F7EFED43BA3C";
|
||||
/// <summary>
|
||||
/// Guid for a DataType object.
|
||||
/// </summary>
|
||||
public const string DataType = "30A2A501-1978-4DDB-A57B-F7EFED43BA3C";
|
||||
|
||||
/// <summary>
|
||||
/// Guid for a Document object.
|
||||
/// </summary>
|
||||
public const string Document = "C66BA18E-EAF3-4CFF-8A22-41B16D66A972";
|
||||
/// <summary>
|
||||
/// Guid for a Document object.
|
||||
/// </summary>
|
||||
public const string Document = "C66BA18E-EAF3-4CFF-8A22-41B16D66A972";
|
||||
|
||||
/// <summary>
|
||||
/// Guid for a Document Type object.
|
||||
/// </summary>
|
||||
public const string DocumentType = "A2CB7800-F571-4787-9638-BC48539A0EFB";
|
||||
/// <summary>
|
||||
/// Guid for a Document Type object.
|
||||
/// </summary>
|
||||
public const string DocumentType = "A2CB7800-F571-4787-9638-BC48539A0EFB";
|
||||
|
||||
/// <summary>
|
||||
/// Guid for a Media object.
|
||||
/// </summary>
|
||||
public const string Media = "B796F64C-1F99-4FFB-B886-4BF4BC011A9C";
|
||||
/// <summary>
|
||||
/// Guid for a Media object.
|
||||
/// </summary>
|
||||
public const string Media = "B796F64C-1F99-4FFB-B886-4BF4BC011A9C";
|
||||
|
||||
/// <summary>
|
||||
/// Guid for the Media Recycle Bin.
|
||||
/// </summary>
|
||||
public const string MediaRecycleBin = "CF3D8E34-1C1C-41e9-AE56-878B57B32113";
|
||||
/// <summary>
|
||||
/// Guid for the Media Recycle Bin.
|
||||
/// </summary>
|
||||
public const string MediaRecycleBin = "CF3D8E34-1C1C-41e9-AE56-878B57B32113";
|
||||
|
||||
/// <summary>
|
||||
/// Guid for a Media Type object.
|
||||
/// </summary>
|
||||
public const string MediaType = "4EA4382B-2F5A-4C2B-9587-AE9B3CF3602E";
|
||||
/// <summary>
|
||||
/// Guid for a Media Type object.
|
||||
/// </summary>
|
||||
public const string MediaType = "4EA4382B-2F5A-4C2B-9587-AE9B3CF3602E";
|
||||
|
||||
/// <summary>
|
||||
/// Guid for a Member object.
|
||||
/// </summary>
|
||||
public const string Member = "39EB0F98-B348-42A1-8662-E7EB18487560";
|
||||
/// <summary>
|
||||
/// Guid for a Member object.
|
||||
/// </summary>
|
||||
public const string Member = "39EB0F98-B348-42A1-8662-E7EB18487560";
|
||||
|
||||
/// <summary>
|
||||
/// Guid for a Member Group object.
|
||||
/// </summary>
|
||||
public const string MemberGroup = "366E63B9-880F-4E13-A61C-98069B029728";
|
||||
/// <summary>
|
||||
/// Guid for a Member Group object.
|
||||
/// </summary>
|
||||
public const string MemberGroup = "366E63B9-880F-4E13-A61C-98069B029728";
|
||||
|
||||
/// <summary>
|
||||
/// Guid for a Member Type object.
|
||||
/// </summary>
|
||||
public const string MemberType = "9B5416FB-E72F-45A9-A07B-5A9A2709CE43";
|
||||
/// <summary>
|
||||
/// Guid for a Member Type object.
|
||||
/// </summary>
|
||||
public const string MemberType = "9B5416FB-E72F-45A9-A07B-5A9A2709CE43";
|
||||
|
||||
/// <summary>
|
||||
/// Guid for a Stylesheet object.
|
||||
/// </summary>
|
||||
/// <summary>
|
||||
/// Guid for a Stylesheet object.
|
||||
/// </summary>
|
||||
[Obsolete("This no longer exists in the database")]
|
||||
public const string Stylesheet = "9F68DA4F-A3A8-44C2-8226-DCBD125E4840";
|
||||
|
||||
[Obsolete("This no longer exists in the database")]
|
||||
internal const string StylesheetProperty = "5555da4f-a123-42b2-4488-dcdfb25e4111";
|
||||
|
||||
/// <summary>
|
||||
/// Guid for the System Root.
|
||||
/// </summary>
|
||||
public const string SystemRoot = "EA7D8624-4CFE-4578-A871-24AA946BF34D";
|
||||
/// <summary>
|
||||
/// Guid for the System Root.
|
||||
/// </summary>
|
||||
public const string SystemRoot = "EA7D8624-4CFE-4578-A871-24AA946BF34D";
|
||||
|
||||
/// <summary>
|
||||
/// Guid for a Template object.
|
||||
/// </summary>
|
||||
public const string Template = "6FBDE604-4178-42CE-A10B-8A2600A2F07D";
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Guid for a Template object.
|
||||
/// </summary>
|
||||
public const string Template = "6FBDE604-4178-42CE-A10B-8A2600A2F07D";
|
||||
|
||||
/// <summary>
|
||||
/// Guid for a Lock object.
|
||||
/// </summary>
|
||||
public const string LockObject = "87A9F1FF-B1E4-4A25-BABB-465A4A47EC41";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -310,13 +310,13 @@ namespace Umbraco.Core
|
||||
public const string TextboxAlias = "Umbraco.Textbox";
|
||||
|
||||
/// <summary>
|
||||
/// Guid for the Textbox multiple datatype.
|
||||
/// Guid for the Textarea datatype.
|
||||
/// </summary>
|
||||
[Obsolete("GUIDs are no longer used to reference Property Editors, use the Alias constant instead. This will be removed in future versions")]
|
||||
public const string TextboxMultiple = "67DB8357-EF57-493E-91AC-936D305E0F2A";
|
||||
|
||||
/// <summary>
|
||||
/// Alias for the Textbox multiple datatype.
|
||||
/// Alias for the Textarea datatype.
|
||||
/// </summary>
|
||||
public const string TextboxMultipleAlias = "Umbraco.TextboxMultiple";
|
||||
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
public const int DefaultMediaListViewDataTypeId = -96;
|
||||
public const int DefaultMembersListViewDataTypeId = -97;
|
||||
|
||||
// identifiers for lock objects
|
||||
public const int ServersLock = -331;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,7 @@
|
||||
namespace Umbraco.Core
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace Umbraco.Core
|
||||
{
|
||||
public static partial class Constants
|
||||
{
|
||||
@@ -15,6 +18,8 @@
|
||||
/// <summary>
|
||||
/// The auth cookie name
|
||||
/// </summary>
|
||||
[Obsolete("DO NOT USE THIS, USE ISecuritySection.AuthCookieName, this will be removed in future versions")]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public const string AuthCookieName = "UMB_UCONTEXT";
|
||||
|
||||
}
|
||||
|
||||
@@ -159,15 +159,16 @@ namespace Umbraco.Core
|
||||
/// <returns></returns>
|
||||
protected virtual ServiceContext CreateServiceContext(DatabaseContext dbContext, IDatabaseFactory dbFactory)
|
||||
{
|
||||
//default transient factory
|
||||
var msgFactory = new TransientMessagesFactory();
|
||||
return new ServiceContext(
|
||||
new RepositoryFactory(ApplicationCache, ProfilingLogger.Logger, dbContext.SqlSyntax, UmbracoConfig.For.UmbracoSettings()),
|
||||
new PetaPocoUnitOfWorkProvider(dbFactory),
|
||||
new FileUnitOfWorkProvider(),
|
||||
new PublishingStrategy(),
|
||||
new PublishingStrategy(msgFactory, ProfilingLogger.Logger),
|
||||
ApplicationCache,
|
||||
ProfilingLogger.Logger,
|
||||
//default transient factory
|
||||
new TransientMessagesFactory());
|
||||
msgFactory);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -379,14 +380,19 @@ namespace Umbraco.Core
|
||||
if (ApplicationContext.IsConfigured == false) return;
|
||||
if (ApplicationContext.DatabaseContext.IsDatabaseConfigured == false) return;
|
||||
|
||||
//try now
|
||||
if (ApplicationContext.DatabaseContext.CanConnect)
|
||||
return;
|
||||
|
||||
var currentTry = 0;
|
||||
while (currentTry < 5)
|
||||
{
|
||||
//first wait, then retry
|
||||
Thread.Sleep(1000);
|
||||
|
||||
if (ApplicationContext.DatabaseContext.CanConnect)
|
||||
break;
|
||||
|
||||
//wait and retry
|
||||
Thread.Sleep(1000);
|
||||
currentTry++;
|
||||
}
|
||||
|
||||
@@ -394,7 +400,6 @@ namespace Umbraco.Core
|
||||
{
|
||||
throw new UmbracoStartupFailedException("Umbraco cannot start. A connection string is configured but the Umbraco cannot connect to the database.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Threading;
|
||||
|
||||
namespace Umbraco.Core
|
||||
{
|
||||
public static class DelegateExtensions
|
||||
{
|
||||
public static Attempt<T> RetryUntilSuccessOrTimeout<T>(this Func<Attempt<T>> task, TimeSpan timeout, TimeSpan pause)
|
||||
{
|
||||
if (pause.TotalMilliseconds < 0)
|
||||
{
|
||||
throw new ArgumentException("pause must be >= 0 milliseconds");
|
||||
}
|
||||
var stopwatch = Stopwatch.StartNew();
|
||||
do
|
||||
{
|
||||
var result = task();
|
||||
if (result) { return result; }
|
||||
Thread.Sleep((int)pause.TotalMilliseconds);
|
||||
}
|
||||
while (stopwatch.Elapsed < timeout);
|
||||
return Attempt<T>.Fail();
|
||||
}
|
||||
|
||||
public static Attempt<T> RetryUntilSuccessOrMaxAttempts<T>(this Func<int, Attempt<T>> task, int totalAttempts, TimeSpan pause)
|
||||
{
|
||||
if (pause.TotalMilliseconds < 0)
|
||||
{
|
||||
throw new ArgumentException("pause must be >= 0 milliseconds");
|
||||
}
|
||||
int attempts = 0;
|
||||
do
|
||||
{
|
||||
attempts++;
|
||||
var result = task(attempts);
|
||||
if (result) { return result; }
|
||||
Thread.Sleep((int)pause.TotalMilliseconds);
|
||||
}
|
||||
while (attempts < totalAttempts);
|
||||
return Attempt<T>.Fail();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -63,6 +63,17 @@ namespace Umbraco.Core.Events
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// if this instance supports cancellation, this will set Cancel to true with an affiliated cancellation message
|
||||
/// </summary>
|
||||
/// <param name="cancelationMessage"></param>
|
||||
public void CancelOperation(EventMessage cancelationMessage)
|
||||
{
|
||||
Cancel = true;
|
||||
cancelationMessage.IsDefaultEventMessage = true;
|
||||
Messages.Add(cancelationMessage);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the EventMessages object which is used to add messages to the message collection for this event
|
||||
/// </summary>
|
||||
|
||||
@@ -4,12 +4,56 @@ namespace Umbraco.Core.Events
|
||||
{
|
||||
public class DeleteEventArgs<TEntity> : CancellableObjectEventArgs<IEnumerable<TEntity>>
|
||||
{
|
||||
/// <summary>
|
||||
/// Constructor accepting multiple entities that are used in the delete operation
|
||||
/// </summary>
|
||||
/// <param name="eventObject"></param>
|
||||
/// <param name="canCancel"></param>
|
||||
public DeleteEventArgs(IEnumerable<TEntity> eventObject, bool canCancel) : base(eventObject, canCancel)
|
||||
/// <summary>
|
||||
/// Constructor accepting multiple entities that are used in the delete operation
|
||||
/// </summary>
|
||||
/// <param name="eventObject"></param>
|
||||
/// <param name="canCancel"></param>
|
||||
/// <param name="eventMessages"></param>
|
||||
public DeleteEventArgs(IEnumerable<TEntity> eventObject, bool canCancel, EventMessages eventMessages) : base(eventObject, canCancel, eventMessages)
|
||||
{
|
||||
MediaFilesToDelete = new List<string>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor accepting multiple entities that are used in the delete operation
|
||||
/// </summary>
|
||||
/// <param name="eventObject"></param>
|
||||
/// <param name="eventMessages"></param>
|
||||
public DeleteEventArgs(IEnumerable<TEntity> eventObject, EventMessages eventMessages) : base(eventObject, eventMessages)
|
||||
{
|
||||
MediaFilesToDelete = new List<string>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor accepting a single entity instance
|
||||
/// </summary>
|
||||
/// <param name="eventObject"></param>
|
||||
/// <param name="eventMessages"></param>
|
||||
public DeleteEventArgs(TEntity eventObject, EventMessages eventMessages)
|
||||
: base(new List<TEntity> { eventObject }, eventMessages)
|
||||
{
|
||||
MediaFilesToDelete = new List<string>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor accepting a single entity instance
|
||||
/// </summary>
|
||||
/// <param name="eventObject"></param>
|
||||
/// <param name="canCancel"></param>
|
||||
/// <param name="eventMessages"></param>
|
||||
public DeleteEventArgs(TEntity eventObject, bool canCancel, EventMessages eventMessages)
|
||||
: base(new List<TEntity> { eventObject }, canCancel, eventMessages)
|
||||
{
|
||||
MediaFilesToDelete = new List<string>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor accepting multiple entities that are used in the delete operation
|
||||
/// </summary>
|
||||
/// <param name="eventObject"></param>
|
||||
/// <param name="canCancel"></param>
|
||||
public DeleteEventArgs(IEnumerable<TEntity> eventObject, bool canCancel) : base(eventObject, canCancel)
|
||||
{
|
||||
MediaFilesToDelete = new List<string>();
|
||||
}
|
||||
@@ -60,7 +104,13 @@ namespace Umbraco.Core.Events
|
||||
|
||||
public class DeleteEventArgs : CancellableEventArgs
|
||||
{
|
||||
public DeleteEventArgs(int id, bool canCancel)
|
||||
public DeleteEventArgs(int id, bool canCancel, EventMessages eventMessages)
|
||||
: base(canCancel, eventMessages)
|
||||
{
|
||||
Id = id;
|
||||
}
|
||||
|
||||
public DeleteEventArgs(int id, bool canCancel)
|
||||
: base(canCancel)
|
||||
{
|
||||
Id = id;
|
||||
|
||||
@@ -8,34 +8,6 @@ namespace Umbraco.Core.Events
|
||||
/// </summary>
|
||||
public static class EventExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Raises the event and checks if a cancelation has occurred, if so it checks if any messages have been
|
||||
/// added to the event messages collection and if not it adds a default cancelation message
|
||||
/// </summary>
|
||||
/// <typeparam name="TSender"></typeparam>
|
||||
/// <typeparam name="TArgs"></typeparam>
|
||||
/// <param name="eventHandler"></param>
|
||||
/// <param name="evtMsgs"></param>
|
||||
/// <param name="args"></param>
|
||||
/// <param name="sender"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsRaisedEventCancelled<TSender, TArgs>(
|
||||
this TypedEventHandler<TSender, TArgs> eventHandler,
|
||||
EventMessages evtMsgs,
|
||||
Func<EventMessages, TArgs> args,
|
||||
TSender sender)
|
||||
where TArgs : CancellableEventArgs
|
||||
{
|
||||
var evtArgs = args(evtMsgs);
|
||||
|
||||
if (eventHandler != null)
|
||||
{
|
||||
eventHandler(sender, evtArgs);
|
||||
}
|
||||
|
||||
return evtArgs.Cancel;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raises the event and returns a boolean value indicating if the event was cancelled
|
||||
/// </summary>
|
||||
@@ -56,30 +28,7 @@ namespace Umbraco.Core.Events
|
||||
|
||||
return args.Cancel;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raises the event with EventMessages
|
||||
/// </summary>
|
||||
/// <typeparam name="TSender"></typeparam>
|
||||
/// <typeparam name="TArgs"></typeparam>
|
||||
/// <param name="eventHandler"></param>
|
||||
/// <param name="evtMsgs"></param>
|
||||
/// <param name="args"></param>
|
||||
/// <param name="sender"></param>
|
||||
public static void RaiseEvent<TSender, TArgs>(
|
||||
this TypedEventHandler<TSender, TArgs> eventHandler,
|
||||
EventMessages evtMsgs,
|
||||
Func<EventMessages, TArgs> args,
|
||||
TSender sender)
|
||||
where TArgs : EventArgs
|
||||
{
|
||||
if (eventHandler != null)
|
||||
{
|
||||
var evtArgs = args(evtMsgs);
|
||||
eventHandler(sender, evtArgs);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Raises the event
|
||||
/// </summary>
|
||||
|
||||
@@ -18,5 +18,10 @@ namespace Umbraco.Core.Events
|
||||
public string Category { get; private set; }
|
||||
public string Message { get; private set; }
|
||||
public EventMessageType MessageType { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// This is used to track if this message should be used as a default message so that Umbraco doesn't also append it's own default messages
|
||||
/// </summary>
|
||||
internal bool IsDefaultEventMessage { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,49 @@ namespace Umbraco.Core.Events
|
||||
{
|
||||
public class MoveEventArgs<TEntity> : CancellableObjectEventArgs<TEntity>
|
||||
{
|
||||
/// <summary>
|
||||
/// Constructor accepting a collection of MoveEventInfo objects
|
||||
/// </summary>
|
||||
/// <param name="canCancel"></param>
|
||||
/// <param name="eventMessages"></param>
|
||||
/// <param name="moveInfo">
|
||||
/// A colleciton of MoveEventInfo objects that exposes all entities that have been moved during a single move operation
|
||||
/// </param>
|
||||
public MoveEventArgs(bool canCancel, EventMessages eventMessages, params MoveEventInfo<TEntity>[] moveInfo)
|
||||
: base(default(TEntity), canCancel, eventMessages)
|
||||
{
|
||||
if (moveInfo.FirstOrDefault() == null)
|
||||
{
|
||||
throw new ArgumentException("moveInfo argument must contain at least one item");
|
||||
}
|
||||
|
||||
MoveInfoCollection = moveInfo;
|
||||
//assign the legacy props
|
||||
EventObject = moveInfo.First().Entity;
|
||||
ParentId = moveInfo.First().NewParentId;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor accepting a collection of MoveEventInfo objects
|
||||
/// </summary>
|
||||
/// <param name="eventMessages"></param>
|
||||
/// <param name="moveInfo">
|
||||
/// A colleciton of MoveEventInfo objects that exposes all entities that have been moved during a single move operation
|
||||
/// </param>
|
||||
public MoveEventArgs(EventMessages eventMessages, params MoveEventInfo<TEntity>[] moveInfo)
|
||||
: base(default(TEntity), eventMessages)
|
||||
{
|
||||
if (moveInfo.FirstOrDefault() == null)
|
||||
{
|
||||
throw new ArgumentException("moveInfo argument must contain at least one item");
|
||||
}
|
||||
|
||||
MoveInfoCollection = moveInfo;
|
||||
//assign the legacy props
|
||||
EventObject = moveInfo.First().Entity;
|
||||
ParentId = moveInfo.First().NewParentId;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor accepting a collection of MoveEventInfo objects
|
||||
/// </summary>
|
||||
|
||||
@@ -4,6 +4,52 @@ namespace Umbraco.Core.Events
|
||||
{
|
||||
public class PublishEventArgs<TEntity> : CancellableObjectEventArgs<IEnumerable<TEntity>>
|
||||
{
|
||||
/// <summary>
|
||||
/// Constructor accepting multiple entities that are used in the publish operation
|
||||
/// </summary>
|
||||
/// <param name="eventObject"></param>
|
||||
/// <param name="canCancel"></param>
|
||||
/// <param name="isAllPublished"></param>
|
||||
/// <param name="eventMessages"></param>
|
||||
public PublishEventArgs(IEnumerable<TEntity> eventObject, bool canCancel, bool isAllPublished, EventMessages eventMessages)
|
||||
: base(eventObject, canCancel, eventMessages)
|
||||
{
|
||||
IsAllRepublished = isAllPublished;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor accepting multiple entities that are used in the publish operation
|
||||
/// </summary>
|
||||
/// <param name="eventObject"></param>
|
||||
/// <param name="eventMessages"></param>
|
||||
public PublishEventArgs(IEnumerable<TEntity> eventObject, EventMessages eventMessages)
|
||||
: base(eventObject, eventMessages)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor accepting a single entity instance
|
||||
/// </summary>
|
||||
/// <param name="eventObject"></param>
|
||||
/// <param name="eventMessages"></param>
|
||||
public PublishEventArgs(TEntity eventObject, EventMessages eventMessages)
|
||||
: base(new List<TEntity> { eventObject }, eventMessages)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor accepting a single entity instance
|
||||
/// </summary>
|
||||
/// <param name="eventObject"></param>
|
||||
/// <param name="canCancel"></param>
|
||||
/// <param name="isAllPublished"></param>
|
||||
/// <param name="eventMessages"></param>
|
||||
public PublishEventArgs(TEntity eventObject, bool canCancel, bool isAllPublished, EventMessages eventMessages)
|
||||
: base(new List<TEntity> { eventObject }, canCancel, eventMessages)
|
||||
{
|
||||
IsAllRepublished = isAllPublished;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor accepting multiple entities that are used in the publish operation
|
||||
/// </summary>
|
||||
|
||||
@@ -152,12 +152,7 @@ namespace Umbraco.Core.IO
|
||||
/// <returns>A value indicating whether the filepath is valid.</returns>
|
||||
internal static bool VerifyEditPath(string filePath, string validDir)
|
||||
{
|
||||
if (filePath.StartsWith(MapPath(SystemDirectories.Root)) == false)
|
||||
filePath = MapPath(filePath);
|
||||
if (validDir.StartsWith(MapPath(SystemDirectories.Root)) == false)
|
||||
validDir = MapPath(validDir);
|
||||
|
||||
return filePath.StartsWith(validDir);
|
||||
return VerifyEditPath(filePath, new[] { validDir });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -182,15 +177,31 @@ namespace Umbraco.Core.IO
|
||||
/// <returns>A value indicating whether the filepath is valid.</returns>
|
||||
internal static bool VerifyEditPath(string filePath, IEnumerable<string> validDirs)
|
||||
{
|
||||
// this is called from ScriptRepository, PartialViewRepository, etc.
|
||||
// filePath is the fullPath (rooted, filesystem path, can be trusted)
|
||||
// validDirs are virtual paths (eg ~/Views)
|
||||
//
|
||||
// except that for templates, filePath actually is a virtual path
|
||||
|
||||
//TODO
|
||||
// what's below is dirty, there are too many ways to get the root dir, etc.
|
||||
// not going to fix everything today
|
||||
|
||||
var mappedRoot = MapPath(SystemDirectories.Root);
|
||||
if (filePath.StartsWith(mappedRoot) == false)
|
||||
filePath = MapPath(filePath);
|
||||
|
||||
// yes we can (see above)
|
||||
//// don't trust what we get, it may contain relative segments
|
||||
//filePath = Path.GetFullPath(filePath);
|
||||
|
||||
foreach (var dir in validDirs)
|
||||
{
|
||||
var validDir = dir;
|
||||
if (filePath.StartsWith(MapPath(SystemDirectories.Root)) == false)
|
||||
filePath = MapPath(filePath);
|
||||
if (validDir.StartsWith(MapPath(SystemDirectories.Root)) == false)
|
||||
if (validDir.StartsWith(mappedRoot) == false)
|
||||
validDir = MapPath(validDir);
|
||||
|
||||
if (filePath.StartsWith(validDir))
|
||||
if (PathStartsWith(filePath, validDir, Path.DirectorySeparatorChar))
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -219,11 +230,8 @@ namespace Umbraco.Core.IO
|
||||
/// <returns>A value indicating whether the filepath is valid.</returns>
|
||||
internal static bool VerifyFileExtension(string filePath, List<string> validFileExtensions)
|
||||
{
|
||||
if (filePath.StartsWith(MapPath(SystemDirectories.Root)) == false)
|
||||
filePath = MapPath(filePath);
|
||||
var f = new FileInfo(filePath);
|
||||
|
||||
return validFileExtensions.Contains(f.Extension.Substring(1));
|
||||
var ext = Path.GetExtension(filePath);
|
||||
return ext != null && validFileExtensions.Contains(ext.TrimStart('.'));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -240,6 +248,16 @@ namespace Umbraco.Core.IO
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool PathStartsWith(string path, string root, char separator)
|
||||
{
|
||||
// either it is identical to root,
|
||||
// or it is root + separator + anything
|
||||
|
||||
if (path.StartsWith(root, StringComparison.OrdinalIgnoreCase) == false) return false;
|
||||
if (path.Length == root.Length) return true;
|
||||
if (path.Length < root.Length) return false;
|
||||
return path[root.Length] == separator;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the path to the root of the application, by getting the path to where the assembly where this
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Umbraco.Core.Logging;
|
||||
|
||||
@@ -9,7 +8,12 @@ namespace Umbraco.Core.IO
|
||||
{
|
||||
public class PhysicalFileSystem : IFileSystem
|
||||
{
|
||||
internal string RootPath { get; private set; }
|
||||
// the rooted, filesystem path, using directory separator chars, NOT ending with a separator
|
||||
// eg "c:" or "c:\path\to\site" or "\\server\path"
|
||||
private readonly string _rootPath;
|
||||
|
||||
// the ??? url, using url separator chars, NOT ending with a separator
|
||||
// eg "" (?) or "/Scripts" or ???
|
||||
private readonly string _rootUrl;
|
||||
|
||||
public PhysicalFileSystem(string virtualRoot)
|
||||
@@ -18,8 +22,13 @@ namespace Umbraco.Core.IO
|
||||
if (virtualRoot.StartsWith("~/") == false)
|
||||
throw new ArgumentException("The virtualRoot argument must be a virtual path and start with '~/'");
|
||||
|
||||
RootPath = IOHelper.MapPath(virtualRoot);
|
||||
_rootPath = IOHelper.MapPath(virtualRoot);
|
||||
_rootPath = EnsureDirectorySeparatorChar(_rootPath);
|
||||
_rootPath = _rootPath.TrimEnd(Path.DirectorySeparatorChar);
|
||||
|
||||
_rootUrl = IOHelper.ResolveUrl(virtualRoot);
|
||||
_rootUrl = EnsureUrlSeparatorChar(_rootUrl);
|
||||
_rootUrl = _rootUrl.TrimEnd('/');
|
||||
}
|
||||
|
||||
public PhysicalFileSystem(string rootPath, string rootUrl)
|
||||
@@ -33,18 +42,31 @@ namespace Umbraco.Core.IO
|
||||
if (rootPath.StartsWith("~/"))
|
||||
throw new ArgumentException("The rootPath argument cannot be a virtual path and cannot start with '~/'");
|
||||
|
||||
RootPath = rootPath;
|
||||
_rootUrl = rootUrl;
|
||||
// rootPath should be... rooted, as in, it's a root path!
|
||||
// but the test suite App.config cannot really "root" anything so we'll have to do it here
|
||||
|
||||
//var localRoot = AppDomain.CurrentDomain.BaseDirectory;
|
||||
var localRoot = IOHelper.GetRootDirectorySafe();
|
||||
if (Path.IsPathRooted(rootPath) == false)
|
||||
{
|
||||
rootPath = Path.Combine(localRoot, rootPath);
|
||||
}
|
||||
|
||||
rootPath = EnsureDirectorySeparatorChar(rootPath);
|
||||
rootUrl = EnsureUrlSeparatorChar(rootUrl);
|
||||
|
||||
_rootPath = rootPath.TrimEnd(Path.DirectorySeparatorChar);
|
||||
_rootUrl = rootUrl.TrimEnd('/');
|
||||
}
|
||||
|
||||
public IEnumerable<string> GetDirectories(string path)
|
||||
{
|
||||
path = EnsureTrailingSeparator(GetFullPath(path));
|
||||
var fullPath = GetFullPath(path);
|
||||
|
||||
try
|
||||
{
|
||||
if (Directory.Exists(path))
|
||||
return Directory.EnumerateDirectories(path).Select(GetRelativePath);
|
||||
if (Directory.Exists(fullPath))
|
||||
return Directory.EnumerateDirectories(fullPath).Select(GetRelativePath);
|
||||
}
|
||||
catch (UnauthorizedAccessException ex)
|
||||
{
|
||||
@@ -65,12 +87,13 @@ namespace Umbraco.Core.IO
|
||||
|
||||
public void DeleteDirectory(string path, bool recursive)
|
||||
{
|
||||
if (DirectoryExists(path) == false)
|
||||
var fullPath = GetFullPath(path);
|
||||
if (Directory.Exists(fullPath) == false)
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
Directory.Delete(GetFullPath(path), recursive);
|
||||
Directory.Delete(fullPath, recursive);
|
||||
}
|
||||
catch (DirectoryNotFoundException ex)
|
||||
{
|
||||
@@ -80,7 +103,8 @@ namespace Umbraco.Core.IO
|
||||
|
||||
public bool DirectoryExists(string path)
|
||||
{
|
||||
return Directory.Exists(GetFullPath(path));
|
||||
var fullPath = GetFullPath(path);
|
||||
return Directory.Exists(fullPath);
|
||||
}
|
||||
|
||||
public void AddFile(string path, Stream stream)
|
||||
@@ -90,17 +114,17 @@ namespace Umbraco.Core.IO
|
||||
|
||||
public void AddFile(string path, Stream stream, bool overrideIfExists)
|
||||
{
|
||||
var fsRelativePath = GetRelativePath(path);
|
||||
var fullPath = GetFullPath(path);
|
||||
var exists = File.Exists(fullPath);
|
||||
if (exists && overrideIfExists == false)
|
||||
throw new InvalidOperationException(string.Format("A file at path '{0}' already exists", path));
|
||||
|
||||
var exists = FileExists(fsRelativePath);
|
||||
if (exists && overrideIfExists == false) throw new InvalidOperationException(string.Format("A file at path '{0}' already exists", path));
|
||||
|
||||
EnsureDirectory(Path.GetDirectoryName(fsRelativePath));
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(fullPath)); // ensure it exists
|
||||
|
||||
if (stream.CanSeek)
|
||||
stream.Seek(0, 0);
|
||||
|
||||
using (var destination = (Stream)File.Create(GetFullPath(fsRelativePath)))
|
||||
using (var destination = (Stream)File.Create(fullPath))
|
||||
stream.CopyTo(destination);
|
||||
}
|
||||
|
||||
@@ -111,9 +135,7 @@ namespace Umbraco.Core.IO
|
||||
|
||||
public IEnumerable<string> GetFiles(string path, string filter)
|
||||
{
|
||||
var fsRelativePath = GetRelativePath(path);
|
||||
|
||||
var fullPath = EnsureTrailingSeparator(GetFullPath(fsRelativePath));
|
||||
var fullPath = GetFullPath(path);
|
||||
|
||||
try
|
||||
{
|
||||
@@ -140,12 +162,13 @@ namespace Umbraco.Core.IO
|
||||
|
||||
public void DeleteFile(string path)
|
||||
{
|
||||
if (!FileExists(path))
|
||||
var fullPath = GetFullPath(path);
|
||||
if (File.Exists(fullPath) == false)
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
File.Delete(GetFullPath(path));
|
||||
File.Delete(fullPath);
|
||||
}
|
||||
catch (FileNotFoundException ex)
|
||||
{
|
||||
@@ -155,39 +178,86 @@ namespace Umbraco.Core.IO
|
||||
|
||||
public bool FileExists(string path)
|
||||
{
|
||||
return File.Exists(GetFullPath(path));
|
||||
var fullpath = GetFullPath(path);
|
||||
return File.Exists(fullpath);
|
||||
}
|
||||
|
||||
// beware, many things depend on how the GetRelative/AbsolutePath methods work!
|
||||
|
||||
/// <summary>
|
||||
/// Gets the relative path.
|
||||
/// </summary>
|
||||
/// <param name="fullPathOrUrl">The full path or url.</param>
|
||||
/// <returns>The path, relative to this filesystem's root.</returns>
|
||||
/// <remarks>
|
||||
/// <para>The relative path is relative to this filesystem's root, not starting with any
|
||||
/// directory separator. If input was recognized as a url (path), then output uses url (path) separator
|
||||
/// chars.</para>
|
||||
/// </remarks>
|
||||
public string GetRelativePath(string fullPathOrUrl)
|
||||
{
|
||||
var relativePath = fullPathOrUrl
|
||||
.TrimStart(_rootUrl)
|
||||
.Replace('/', Path.DirectorySeparatorChar)
|
||||
.TrimStart(RootPath)
|
||||
.TrimStart(Path.DirectorySeparatorChar);
|
||||
// test url
|
||||
var path = fullPathOrUrl.Replace('\\', '/'); // ensure url separator char
|
||||
|
||||
return relativePath;
|
||||
if (IOHelper.PathStartsWith(path, _rootUrl, '/')) // if it starts with the root url...
|
||||
return path.Substring(_rootUrl.Length) // strip it
|
||||
.TrimStart('/'); // it's relative
|
||||
|
||||
// test path
|
||||
path = EnsureDirectorySeparatorChar(fullPathOrUrl);
|
||||
|
||||
if (IOHelper.PathStartsWith(path, _rootPath, Path.DirectorySeparatorChar)) // if it starts with the root path
|
||||
return path.Substring(_rootPath.Length) // strip it
|
||||
.TrimStart(Path.DirectorySeparatorChar); // it's relative
|
||||
|
||||
// unchanged - including separators
|
||||
return fullPathOrUrl;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the full path.
|
||||
/// </summary>
|
||||
/// <param name="path">The full or relative path.</param>
|
||||
/// <returns>The full path.</returns>
|
||||
/// <remarks>
|
||||
/// <para>On the physical filesystem, the full path is the rooted (ie non-relative), safe (ie within this
|
||||
/// filesystem's root) path. All separators are converted to Path.DirectorySeparatorChar.</para>
|
||||
/// </remarks>
|
||||
public string GetFullPath(string path)
|
||||
{
|
||||
//if the path starts with a '/' then it's most likely not a FS relative path which is required so convert it
|
||||
if (path.StartsWith("/"))
|
||||
{
|
||||
path = GetRelativePath(path);
|
||||
}
|
||||
// normalize
|
||||
var opath = path;
|
||||
path = EnsureDirectorySeparatorChar(path);
|
||||
|
||||
return !path.StartsWith(RootPath)
|
||||
? Path.Combine(RootPath, path)
|
||||
: path;
|
||||
// not sure what we are doing here - so if input starts with a (back) slash,
|
||||
// we assume it's not a FS relative path and we try to convert it... but it
|
||||
// really makes little sense?
|
||||
if (path.StartsWith(Path.DirectorySeparatorChar.ToString()))
|
||||
path = GetRelativePath(path);
|
||||
|
||||
// if already a full path, return
|
||||
if (IOHelper.PathStartsWith(path, _rootPath, Path.DirectorySeparatorChar))
|
||||
return path;
|
||||
|
||||
// else combine and sanitize, ie GetFullPath will take care of any relative
|
||||
// segments in path, eg '../../foo.tmp' - it may throw a SecurityException
|
||||
// if the combined path reaches illegal parts of the filesystem
|
||||
var fpath = Path.Combine(_rootPath, path);
|
||||
fpath = Path.GetFullPath(fpath);
|
||||
|
||||
// at that point, path is within legal parts of the filesystem, ie we have
|
||||
// permissions to reach that path, but it may nevertheless be outside of
|
||||
// our root path, due to relative segments, so better check
|
||||
if (IOHelper.PathStartsWith(fpath, _rootPath, Path.DirectorySeparatorChar))
|
||||
return fpath;
|
||||
|
||||
throw new FileSecurityException("File '" + opath + "' is outside this filesystem's root.");
|
||||
}
|
||||
|
||||
public string GetUrl(string path)
|
||||
{
|
||||
return _rootUrl.TrimEnd("/") + "/" + path
|
||||
.TrimStart(Path.DirectorySeparatorChar)
|
||||
.Replace(Path.DirectorySeparatorChar, '/')
|
||||
.TrimEnd("/");
|
||||
path = EnsureUrlSeparatorChar(path).Trim('/');
|
||||
return _rootUrl + "/" + path;
|
||||
}
|
||||
|
||||
public DateTimeOffset GetLastModified(string path)
|
||||
@@ -214,9 +284,19 @@ namespace Umbraco.Core.IO
|
||||
|
||||
protected string EnsureTrailingSeparator(string path)
|
||||
{
|
||||
if (!path.EndsWith(Path.DirectorySeparatorChar.ToString(CultureInfo.InvariantCulture), StringComparison.Ordinal))
|
||||
path = path + Path.DirectorySeparatorChar;
|
||||
return path.EnsureEndsWith(Path.DirectorySeparatorChar);
|
||||
}
|
||||
|
||||
protected string EnsureDirectorySeparatorChar(string path)
|
||||
{
|
||||
path = path.Replace('/', Path.DirectorySeparatorChar);
|
||||
path = path.Replace('\\', Path.DirectorySeparatorChar);
|
||||
return path;
|
||||
}
|
||||
|
||||
protected string EnsureUrlSeparatorChar(string path)
|
||||
{
|
||||
path = path.Replace('\\', '/');
|
||||
return path;
|
||||
}
|
||||
|
||||
|
||||
@@ -154,7 +154,7 @@ namespace Umbraco.Core.IO
|
||||
{
|
||||
get
|
||||
{
|
||||
return IOHelper.ReturnPath("umbracoWebservicesPath", "~/umbraco/webservices");
|
||||
return IOHelper.ReturnPath("umbracoWebservicesPath", Umbraco.EnsureEndsWith("/") + "webservices");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,8 +22,8 @@ namespace Umbraco.Core.Logging
|
||||
private CancellationTokenSource _loggingCancelationTokenSource;
|
||||
private CancellationToken _loggingCancelationToken;
|
||||
private Task _loggingTask;
|
||||
private Double _shutdownFlushTimeout = 5;
|
||||
private TimeSpan _shutdownFlushTimespan = TimeSpan.FromSeconds(5);
|
||||
private Double _shutdownFlushTimeout = 1;
|
||||
private TimeSpan _shutdownFlushTimespan = TimeSpan.FromSeconds(1);
|
||||
private static readonly Type ThisType = typeof(ParallelForwardingAppender);
|
||||
private volatile bool _shutDownRequested;
|
||||
private int? _bufferSize = DefaultBufferSize;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
@@ -140,11 +141,22 @@ namespace Umbraco.Core.Manifest
|
||||
{
|
||||
var result = new List<PackageManifest>();
|
||||
foreach (var m in manifestFileContents)
|
||||
{
|
||||
if (m.IsNullOrWhiteSpace()) continue;
|
||||
{
|
||||
var manifestContent = m;
|
||||
|
||||
if (manifestContent.IsNullOrWhiteSpace()) continue;
|
||||
|
||||
// Strip byte object marker, JSON.NET does not like it
|
||||
var preamble = Encoding.UTF8.GetString(Encoding.UTF8.GetPreamble());
|
||||
|
||||
// Strangely StartsWith(preamble) would always return true
|
||||
if (manifestContent.Substring(0, 1) == preamble)
|
||||
manifestContent = manifestContent.Remove(0, preamble.Length);
|
||||
|
||||
if (manifestContent.IsNullOrWhiteSpace()) continue;
|
||||
|
||||
//remove any comments first
|
||||
var replaced = CommentsSurround.Replace(m, match => " ");
|
||||
var replaced = CommentsSurround.Replace(manifestContent, match => " ");
|
||||
replaced = CommentsLine.Replace(replaced, match => "");
|
||||
|
||||
JObject deserialized;
|
||||
@@ -154,7 +166,7 @@ namespace Umbraco.Core.Manifest
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Error<ManifestParser>("An error occurred parsing manifest with contents: " + m, ex);
|
||||
LogHelper.Error<ManifestParser>("An error occurred parsing manifest with contents: " + manifestContent, ex);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -95,13 +95,7 @@ namespace Umbraco.Core.Models
|
||||
[DataMember]
|
||||
public virtual ITemplate Template
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_template == null)
|
||||
return _contentType.DefaultTemplate;
|
||||
|
||||
return _template;
|
||||
}
|
||||
get { return _template; }
|
||||
set
|
||||
{
|
||||
SetPropertyValueAndDetectChanges(o =>
|
||||
|
||||
@@ -560,8 +560,7 @@ namespace Umbraco.Core.Models
|
||||
//Additional thumbnails configured as prevalues on the DataType
|
||||
if (thumbnailSizes != null)
|
||||
{
|
||||
var sep = (thumbnailSizes.Contains("") == false && thumbnailSizes.Contains(",")) ? ',' : ';';
|
||||
foreach (var thumb in thumbnailSizes.Split(sep))
|
||||
foreach (var thumb in thumbnailSizes.Split(new[] { ";", "," }, StringSplitOptions.RemoveEmptyEntries))
|
||||
{
|
||||
int thumbSize;
|
||||
if (thumb != "" && int.TryParse(thumb, out thumbSize))
|
||||
|
||||
@@ -533,6 +533,18 @@ namespace Umbraco.Core.Models
|
||||
/// <param name="propertyGroupName">Name of the <see cref="PropertyGroup"/> to remove</param>
|
||||
public void RemovePropertyGroup(string propertyGroupName)
|
||||
{
|
||||
// if no group exists with that name, do nothing
|
||||
var group = PropertyGroups[propertyGroupName];
|
||||
if (group == null) return;
|
||||
|
||||
// re-assign the group's properties to no group
|
||||
foreach (var property in group.PropertyTypes)
|
||||
{
|
||||
property.PropertyGroupId = new Lazy<int>(() => 0);
|
||||
_propertyTypes.Add(property);
|
||||
}
|
||||
|
||||
// actually remove the group
|
||||
PropertyGroups.RemoveItem(propertyGroupName);
|
||||
OnPropertyChanged(PropertyGroupCollectionSelector);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Models.EntityBase;
|
||||
|
||||
namespace Umbraco.Core.Models
|
||||
@@ -15,12 +17,20 @@ namespace Umbraco.Core.Models
|
||||
{
|
||||
private string _path;
|
||||
private string _originalPath;
|
||||
private string _content = string.Empty; //initialize to empty string, not null
|
||||
|
||||
protected File(string path)
|
||||
// initialize to string.Empty so that it is possible to save a new file,
|
||||
// should use the lazyContent ctor to set it to null when loading existing.
|
||||
// cannot simply use HasIdentity as some classes (eg Script) override it
|
||||
// in a weird way.
|
||||
private string _content;
|
||||
internal Func<File, string> GetFileContent { get; set; }
|
||||
|
||||
protected File(string path, Func<File, string> getFileContent = null)
|
||||
{
|
||||
_path = path;
|
||||
_path = SanitizePath(path);
|
||||
_originalPath = _path;
|
||||
GetFileContent = getFileContent;
|
||||
_content = getFileContent != null ? null : string.Empty;
|
||||
}
|
||||
|
||||
private static readonly PropertyInfo ContentSelector = ExpressionHelper.GetPropertyInfo<File, string>(x => x.Content);
|
||||
@@ -28,6 +38,14 @@ namespace Umbraco.Core.Models
|
||||
private string _alias;
|
||||
private string _name;
|
||||
|
||||
private static string SanitizePath(string path)
|
||||
{
|
||||
return path
|
||||
.Replace('\\', System.IO.Path.DirectorySeparatorChar)
|
||||
.Replace('/', System.IO.Path.DirectorySeparatorChar);
|
||||
//.TrimStart(System.IO.Path.DirectorySeparatorChar);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Name of the File including extension
|
||||
/// </summary>
|
||||
@@ -71,7 +89,7 @@ namespace Umbraco.Core.Models
|
||||
|
||||
SetPropertyValueAndDetectChanges(o =>
|
||||
{
|
||||
_path = value;
|
||||
_path = SanitizePath(value);
|
||||
return _path;
|
||||
}, _path, PathSelector);
|
||||
}
|
||||
@@ -96,15 +114,26 @@ namespace Umbraco.Core.Models
|
||||
/// <summary>
|
||||
/// Gets or sets the Content of a File
|
||||
/// </summary>
|
||||
/// <remarks>Marked as DoNotClone, because it should be lazy-reloaded from disk.</remarks>
|
||||
[DataMember]
|
||||
[DoNotClone]
|
||||
public virtual string Content
|
||||
{
|
||||
get { return _content; }
|
||||
get
|
||||
{
|
||||
if (_content != null)
|
||||
return _content;
|
||||
|
||||
// else, must lazy-load, and ensure it's not null
|
||||
if (GetFileContent != null)
|
||||
_content = GetFileContent(this);
|
||||
return _content ?? (_content = string.Empty);
|
||||
}
|
||||
set
|
||||
{
|
||||
SetPropertyValueAndDetectChanges(o =>
|
||||
{
|
||||
_content = value;
|
||||
_content = value ?? string.Empty; // cannot set to null
|
||||
return _content;
|
||||
}, _content, ContentSelector);
|
||||
}
|
||||
@@ -121,17 +150,32 @@ namespace Umbraco.Core.Models
|
||||
return true;
|
||||
}
|
||||
|
||||
// this exists so that class that manage name and alias differently, eg Template,
|
||||
// can implement their own cloning - (though really, not sure it's even needed)
|
||||
protected virtual void DeepCloneNameAndAlias(File clone)
|
||||
{
|
||||
// set fields that have a lazy value, by forcing evaluation of the lazy
|
||||
clone._name = Name;
|
||||
clone._alias = Alias;
|
||||
}
|
||||
|
||||
public override object DeepClone()
|
||||
{
|
||||
var clone = (File)base.DeepClone();
|
||||
//turn off change tracking
|
||||
var clone = (File) base.DeepClone();
|
||||
|
||||
// clear fields that were memberwise-cloned and that we don't want to clone
|
||||
clone._content = null;
|
||||
|
||||
// turn off change tracking
|
||||
clone.DisableChangeTracking();
|
||||
//need to manually assign since they are readonly properties
|
||||
clone._alias = Alias;
|
||||
clone._name = Name;
|
||||
//this shouldn't really be needed since we're not tracking
|
||||
|
||||
// ...
|
||||
DeepCloneNameAndAlias(clone);
|
||||
|
||||
// this shouldn't really be needed since we're not tracking
|
||||
clone.ResetDirtyProperties(false);
|
||||
//re-enable tracking
|
||||
|
||||
// re-enable tracking
|
||||
clone.EnableChangeTracking();
|
||||
|
||||
return clone;
|
||||
|
||||
@@ -8,5 +8,10 @@ namespace Umbraco.Core.Models
|
||||
string DomainName { get; set; }
|
||||
int? RootContentId { get; set; }
|
||||
bool IsWildcard { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Readonly value of the language ISO code for the domain
|
||||
/// </summary>
|
||||
string LanguageIsoCode { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
|
||||
namespace Umbraco.Core.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a cached content with a GUID key.
|
||||
/// </summary>
|
||||
/// <remarks>This is temporary, because we cannot add the Key property to IPublishedContent without
|
||||
/// breaking backward compatibility. With v8, it will be merged into IPublishedContent.</remarks>
|
||||
public interface IPublishedContentWithKey : IPublishedContent
|
||||
{
|
||||
Guid Key { get; }
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,11 @@ namespace Umbraco.Core.Models
|
||||
/// </summary>
|
||||
bool IsActive { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether the server is master.
|
||||
/// </summary>
|
||||
bool IsMaster { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the date and time the registration was created.
|
||||
/// </summary>
|
||||
|
||||
@@ -4,6 +4,7 @@ using AutoMapper;
|
||||
|
||||
using Umbraco.Core.Models.Mapping;
|
||||
using Umbraco.Core.Models.Membership;
|
||||
using Umbraco.Core.Security;
|
||||
|
||||
namespace Umbraco.Core.Models.Identity
|
||||
{
|
||||
@@ -24,6 +25,18 @@ namespace Umbraco.Core.Models.Identity
|
||||
.ForMember(user => user.UserTypeAlias, expression => expression.MapFrom(user => user.UserType.Alias))
|
||||
.ForMember(user => user.AccessFailedCount, expression => expression.MapFrom(user => user.FailedPasswordAttempts))
|
||||
.ForMember(user => user.AllowedSections, expression => expression.MapFrom(user => user.AllowedSections.ToArray()));
|
||||
|
||||
config.CreateMap<BackOfficeIdentityUser, UserData>()
|
||||
.ConstructUsing((BackOfficeIdentityUser user) => new UserData(Guid.NewGuid().ToString("N"))) //this is the 'session id'
|
||||
.ForMember(detail => detail.Id, opt => opt.MapFrom(user => user.Id))
|
||||
.ForMember(detail => detail.AllowedApplications, opt => opt.MapFrom(user => user.AllowedSections))
|
||||
.ForMember(detail => detail.RealName, opt => opt.MapFrom(user => user.Name))
|
||||
.ForMember(detail => detail.Roles, opt => opt.MapFrom(user => new[] { user.UserTypeAlias }))
|
||||
.ForMember(detail => detail.StartContentNode, opt => opt.MapFrom(user => user.StartContentId))
|
||||
.ForMember(detail => detail.StartMediaNode, opt => opt.MapFrom(user => user.StartMediaId))
|
||||
.ForMember(detail => detail.Username, opt => opt.MapFrom(user => user.UserName))
|
||||
.ForMember(detail => detail.Culture, opt => opt.MapFrom(user => user.Culture))
|
||||
.ForMember(detail => detail.SessionId, opt => opt.MapFrom(user => user.SecurityStamp.IsNullOrWhiteSpace() ? Guid.NewGuid().ToString("N") : user.SecurityStamp));
|
||||
}
|
||||
|
||||
private string GetPasswordHash(string storedPass)
|
||||
|
||||
@@ -64,7 +64,7 @@ namespace Umbraco.Core.Models
|
||||
[IgnoreDataMember]
|
||||
public CultureInfo CultureInfo
|
||||
{
|
||||
get { return CultureInfo.CreateSpecificCulture(IsoCode); }
|
||||
get { return CultureInfo.GetCultureInfo(IsoCode); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -280,7 +280,7 @@ namespace Umbraco.Core.Models
|
||||
//This is the default value if the prop is not found
|
||||
true);
|
||||
if (a.Success == false) return a.Result;
|
||||
|
||||
if (Properties[Constants.Conventions.Member.IsApproved].Value == null) return true;
|
||||
var tryConvert = Properties[Constants.Conventions.Member.IsApproved].Value.TryConvertTo<bool>();
|
||||
if (tryConvert.Success)
|
||||
{
|
||||
@@ -313,7 +313,7 @@ namespace Umbraco.Core.Models
|
||||
{
|
||||
var a = WarnIfPropertyTypeNotFoundOnGet(Constants.Conventions.Member.IsLockedOut, "IsLockedOut", false);
|
||||
if (a.Success == false) return a.Result;
|
||||
|
||||
if (Properties[Constants.Conventions.Member.IsLockedOut].Value == null) return false;
|
||||
var tryConvert = Properties[Constants.Conventions.Member.IsLockedOut].Value.TryConvertTo<bool>();
|
||||
if (tryConvert.Success)
|
||||
{
|
||||
@@ -346,7 +346,7 @@ namespace Umbraco.Core.Models
|
||||
{
|
||||
var a = WarnIfPropertyTypeNotFoundOnGet(Constants.Conventions.Member.LastLoginDate, "LastLoginDate", default(DateTime));
|
||||
if (a.Success == false) return a.Result;
|
||||
|
||||
if (Properties[Constants.Conventions.Member.LastLoginDate].Value == null) return default(DateTime);
|
||||
var tryConvert = Properties[Constants.Conventions.Member.LastLoginDate].Value.TryConvertTo<DateTime>();
|
||||
if (tryConvert.Success)
|
||||
{
|
||||
@@ -379,7 +379,7 @@ namespace Umbraco.Core.Models
|
||||
{
|
||||
var a = WarnIfPropertyTypeNotFoundOnGet(Constants.Conventions.Member.LastPasswordChangeDate, "LastPasswordChangeDate", default(DateTime));
|
||||
if (a.Success == false) return a.Result;
|
||||
|
||||
if (Properties[Constants.Conventions.Member.LastPasswordChangeDate].Value == null) return default(DateTime);
|
||||
var tryConvert = Properties[Constants.Conventions.Member.LastPasswordChangeDate].Value.TryConvertTo<DateTime>();
|
||||
if (tryConvert.Success)
|
||||
{
|
||||
@@ -412,7 +412,7 @@ namespace Umbraco.Core.Models
|
||||
{
|
||||
var a = WarnIfPropertyTypeNotFoundOnGet(Constants.Conventions.Member.LastLockoutDate, "LastLockoutDate", default(DateTime));
|
||||
if (a.Success == false) return a.Result;
|
||||
|
||||
if (Properties[Constants.Conventions.Member.LastLockoutDate].Value == null) return default(DateTime);
|
||||
var tryConvert = Properties[Constants.Conventions.Member.LastLockoutDate].Value.TryConvertTo<DateTime>();
|
||||
if (tryConvert.Success)
|
||||
{
|
||||
@@ -446,7 +446,7 @@ namespace Umbraco.Core.Models
|
||||
{
|
||||
var a = WarnIfPropertyTypeNotFoundOnGet(Constants.Conventions.Member.FailedPasswordAttempts, "FailedPasswordAttempts", 0);
|
||||
if (a.Success == false) return a.Result;
|
||||
|
||||
if (Properties[Constants.Conventions.Member.FailedPasswordAttempts].Value == null) return default(int);
|
||||
var tryConvert = Properties[Constants.Conventions.Member.FailedPasswordAttempts].Value.TryConvertTo<int>();
|
||||
if (tryConvert.Success)
|
||||
{
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text.RegularExpressions;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Services;
|
||||
|
||||
namespace Umbraco.Core.Models
|
||||
{
|
||||
@@ -15,12 +12,14 @@ namespace Umbraco.Core.Models
|
||||
[DataContract(IsReference = true)]
|
||||
public class PartialView : File, IPartialView
|
||||
{
|
||||
|
||||
public PartialView(string path)
|
||||
: base(path)
|
||||
{
|
||||
base.Path = path;
|
||||
}
|
||||
: this(path, null)
|
||||
{ }
|
||||
|
||||
internal PartialView(string path, Func<File, string> getFileContent)
|
||||
: base(path, getFileContent)
|
||||
{ }
|
||||
|
||||
internal PartialViewType ViewType { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace Umbraco.Core.Models
|
||||
{
|
||||
internal enum PartialViewType : byte
|
||||
{
|
||||
Unknown = 0, // default
|
||||
PartialView = 1,
|
||||
PartialViewMacro = 2
|
||||
}
|
||||
}
|
||||
@@ -62,9 +62,20 @@ namespace Umbraco.Core.Models.PublishedContent
|
||||
// model and therefore returned the original content unchanged.
|
||||
|
||||
var model = content.CreateModel();
|
||||
var extended = model == content // == means the factory did not create a model
|
||||
? new PublishedContentExtended(content) // so we have to extend
|
||||
: model; // else we can use what the factory returned
|
||||
IPublishedContent extended;
|
||||
if (model == content) // == means the factory did not create a model
|
||||
{
|
||||
// so we have to extend
|
||||
var contentWithKey = content as IPublishedContentWithKey;
|
||||
extended = contentWithKey == null
|
||||
? new PublishedContentExtended(content)
|
||||
: new PublishedContentWithKeyExtended(contentWithKey);
|
||||
}
|
||||
else
|
||||
{
|
||||
// else we can use what the factory returned
|
||||
extended = model;
|
||||
}
|
||||
|
||||
// so extended should always implement IPublishedContentExtended, however if
|
||||
// by mistake the factory returned a different object that does not implement
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
|
||||
namespace Umbraco.Core.Models.PublishedContent
|
||||
{
|
||||
public class PublishedContentWithKeyExtended : PublishedContentExtended, IPublishedContentWithKey
|
||||
{
|
||||
// protected for models, internal for PublishedContentExtended static Extend method
|
||||
protected internal PublishedContentWithKeyExtended(IPublishedContentWithKey content)
|
||||
: base(content)
|
||||
{ }
|
||||
|
||||
public Guid Key { get { return ((IPublishedContentWithKey) Content).Key; } }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
|
||||
namespace Umbraco.Core.Models.PublishedContent
|
||||
{
|
||||
public abstract class PublishedContentWithKeyModel : PublishedContentModel, IPublishedContentWithKey
|
||||
{
|
||||
protected PublishedContentWithKeyModel(IPublishedContentWithKey content)
|
||||
: base (content)
|
||||
{ }
|
||||
|
||||
public Guid Key { get { return ((IPublishedContentWithKey) Content).Key; } }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
|
||||
namespace Umbraco.Core.Models.PublishedContent
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides an abstract base class for <c>IPublishedContentWithKey</c> implementations that
|
||||
/// wrap and extend another <c>IPublishedContentWithKey</c>.
|
||||
/// </summary>
|
||||
public class PublishedContentWithKeyWrapped : PublishedContentWrapped, IPublishedContentWithKey
|
||||
{
|
||||
protected PublishedContentWithKeyWrapped(IPublishedContentWithKey content)
|
||||
: base(content)
|
||||
{ }
|
||||
|
||||
public virtual Guid Key { get { return ((IPublishedContentWithKey) Content).Key; } }
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ using System.Collections.Generic;
|
||||
using System.Security.AccessControl;
|
||||
using Umbraco.Core.Persistence;
|
||||
using Umbraco.Core.Persistence.DatabaseAnnotations;
|
||||
using Umbraco.Core.Persistence.DatabaseModelDefinitions;
|
||||
|
||||
namespace Umbraco.Core.Models.Rdbms
|
||||
{
|
||||
@@ -30,11 +31,11 @@ namespace Umbraco.Core.Models.Rdbms
|
||||
public int NoAccessNodeId { get; set; }
|
||||
|
||||
[Column("createDate")]
|
||||
[Constraint(Default = "getdate()")]
|
||||
[Constraint(Default = SystemMethods.CurrentDateTime)]
|
||||
public DateTime CreateDate { get; set; }
|
||||
|
||||
[Column("updateDate")]
|
||||
[Constraint(Default = "getdate()")]
|
||||
[Constraint(Default = SystemMethods.CurrentDateTime)]
|
||||
public DateTime UpdateDate { get; set; }
|
||||
|
||||
[ResultColumn]
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using Umbraco.Core.Persistence;
|
||||
using Umbraco.Core.Persistence.DatabaseAnnotations;
|
||||
using Umbraco.Core.Persistence.DatabaseModelDefinitions;
|
||||
|
||||
namespace Umbraco.Core.Models.Rdbms
|
||||
{
|
||||
@@ -25,11 +26,11 @@ namespace Umbraco.Core.Models.Rdbms
|
||||
public string RuleType { get; set; }
|
||||
|
||||
[Column("createDate")]
|
||||
[Constraint(Default = "getdate()")]
|
||||
[Constraint(Default = SystemMethods.CurrentDateTime)]
|
||||
public DateTime CreateDate { get; set; }
|
||||
|
||||
[Column("updateDate")]
|
||||
[Constraint(Default = "getdate()")]
|
||||
[Constraint(Default = SystemMethods.CurrentDateTime)]
|
||||
public DateTime UpdateDate { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using Umbraco.Core.Persistence;
|
||||
using Umbraco.Core.Persistence.DatabaseAnnotations;
|
||||
using Umbraco.Core.Persistence.DatabaseModelDefinitions;
|
||||
|
||||
namespace Umbraco.Core.Models.Rdbms
|
||||
{
|
||||
@@ -23,7 +24,7 @@ namespace Umbraco.Core.Models.Rdbms
|
||||
public Guid VersionId { get; set; }
|
||||
|
||||
[Column("VersionDate")]
|
||||
[Constraint(Default = "getdate()")]
|
||||
[Constraint(Default = SystemMethods.CurrentDateTime)]
|
||||
public DateTime VersionDate { get; set; }
|
||||
|
||||
[ResultColumn]
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using Umbraco.Core.Persistence;
|
||||
using Umbraco.Core.Persistence.DatabaseAnnotations;
|
||||
using Umbraco.Core.Persistence.DatabaseModelDefinitions;
|
||||
|
||||
namespace Umbraco.Core.Models.Rdbms
|
||||
{
|
||||
@@ -38,7 +39,7 @@ namespace Umbraco.Core.Models.Rdbms
|
||||
public DateTime? ExpiresDate { get; set; }
|
||||
|
||||
[Column("updateDate")]
|
||||
[Constraint(Default = "getdate()")]
|
||||
[Constraint(Default = SystemMethods.CurrentDateTime)]
|
||||
public DateTime UpdateDate { get; set; }
|
||||
|
||||
[Column("templateId")]
|
||||
|
||||
@@ -23,5 +23,11 @@ namespace Umbraco.Core.Models.Rdbms
|
||||
|
||||
[Column("domainName")]
|
||||
public string DomainName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Used for a result on the query to get the associated language for a domain if there is one
|
||||
/// </summary>
|
||||
[ResultColumn("languageISOCode")]
|
||||
public string IsoCode { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using Umbraco.Core.Persistence;
|
||||
using Umbraco.Core.Persistence.DatabaseAnnotations;
|
||||
using Umbraco.Core.Persistence.DatabaseModelDefinitions;
|
||||
|
||||
namespace Umbraco.Core.Models.Rdbms
|
||||
{
|
||||
@@ -27,7 +28,7 @@ namespace Umbraco.Core.Models.Rdbms
|
||||
public string ProviderKey { get; set; }
|
||||
|
||||
[Column("createDate")]
|
||||
[Constraint(Default = "getdate()")]
|
||||
[Constraint(Default = SystemMethods.CurrentDateTime)]
|
||||
public DateTime CreateDate { get; set; }
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using Umbraco.Core.Persistence;
|
||||
using Umbraco.Core.Persistence.DatabaseAnnotations;
|
||||
using Umbraco.Core.Persistence.DatabaseModelDefinitions;
|
||||
|
||||
namespace Umbraco.Core.Models.Rdbms
|
||||
{
|
||||
@@ -21,7 +22,7 @@ namespace Umbraco.Core.Models.Rdbms
|
||||
public int NodeId { get; set; }
|
||||
|
||||
[Column("Datestamp")]
|
||||
[Constraint(Default = "getdate()")]
|
||||
[Constraint(Default = SystemMethods.CurrentDateTime)]
|
||||
public DateTime Datestamp { get; set; }
|
||||
|
||||
[Column("logHeader")]
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using Umbraco.Core.Persistence;
|
||||
using Umbraco.Core.Persistence.DatabaseAnnotations;
|
||||
using Umbraco.Core.Persistence.DatabaseModelDefinitions;
|
||||
|
||||
namespace Umbraco.Core.Models.Rdbms
|
||||
{
|
||||
@@ -10,7 +11,7 @@ namespace Umbraco.Core.Models.Rdbms
|
||||
internal class MigrationDto
|
||||
{
|
||||
[Column("id")]
|
||||
[PrimaryKeyColumn(AutoIncrement = true)]
|
||||
[PrimaryKeyColumn(AutoIncrement = true, IdentitySeed = 100)]
|
||||
public int Id { get; set; }
|
||||
|
||||
[Column("name")]
|
||||
@@ -19,7 +20,7 @@ namespace Umbraco.Core.Models.Rdbms
|
||||
public string Name { get; set; }
|
||||
|
||||
[Column("createDate")]
|
||||
[Constraint(Default = "getdate()")]
|
||||
[Constraint(Default = SystemMethods.CurrentDateTime)]
|
||||
public DateTime CreateDate { get; set; }
|
||||
|
||||
[Column("version")]
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using Umbraco.Core.Persistence;
|
||||
using Umbraco.Core.Persistence.DatabaseAnnotations;
|
||||
using Umbraco.Core.Persistence.DatabaseModelDefinitions;
|
||||
|
||||
namespace Umbraco.Core.Models.Rdbms
|
||||
{
|
||||
@@ -48,7 +49,7 @@ namespace Umbraco.Core.Models.Rdbms
|
||||
[Column("uniqueID")]
|
||||
[NullSetting(NullSetting = NullSettings.NotNull)]
|
||||
[Index(IndexTypes.UniqueNonClustered, Name = "IX_umbracoNodeUniqueID")]
|
||||
[Constraint(Default = "newid()")]
|
||||
[Constraint(Default = SystemMethods.NewGuid)]
|
||||
public Guid UniqueId { get; set; }
|
||||
|
||||
[Column("text")]
|
||||
@@ -61,7 +62,7 @@ namespace Umbraco.Core.Models.Rdbms
|
||||
public Guid? NodeObjectType { get; set; }
|
||||
|
||||
[Column("createDate")]
|
||||
[Constraint(Default = "getdate()")]
|
||||
[Constraint(Default = SystemMethods.CurrentDateTime)]
|
||||
public DateTime CreateDate { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using Umbraco.Core.Persistence;
|
||||
using Umbraco.Core.Persistence.DatabaseAnnotations;
|
||||
using Umbraco.Core.Persistence.DatabaseModelDefinitions;
|
||||
|
||||
namespace Umbraco.Core.Models.Rdbms
|
||||
{
|
||||
@@ -61,7 +62,7 @@ namespace Umbraco.Core.Models.Rdbms
|
||||
|
||||
[Column("UniqueID")]
|
||||
[NullSetting(NullSetting = NullSettings.NotNull)]
|
||||
[Constraint(Default = "newid()")]
|
||||
[Constraint(Default = SystemMethods.NewGuid)]
|
||||
[Index(IndexTypes.UniqueNonClustered, Name = "IX_cmsPropertyTypeUniqueID")]
|
||||
public Guid UniqueId { get; set; }
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using Umbraco.Core.Persistence;
|
||||
using Umbraco.Core.Persistence.DatabaseAnnotations;
|
||||
using Umbraco.Core.Persistence.DatabaseModelDefinitions;
|
||||
|
||||
namespace Umbraco.Core.Models.Rdbms
|
||||
{
|
||||
@@ -26,7 +27,7 @@ namespace Umbraco.Core.Models.Rdbms
|
||||
public int RelationType { get; set; }
|
||||
|
||||
[Column("datetime")]
|
||||
[Constraint(Default = "getdate()")]
|
||||
[Constraint(Default = SystemMethods.CurrentDateTime)]
|
||||
public DateTime Datetime { get; set; }
|
||||
|
||||
[Column("comment")]
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using Umbraco.Core.Persistence;
|
||||
using Umbraco.Core.Persistence.DatabaseAnnotations;
|
||||
using Umbraco.Core.Persistence.DatabaseModelDefinitions;
|
||||
|
||||
namespace Umbraco.Core.Models.Rdbms
|
||||
{
|
||||
@@ -23,7 +24,7 @@ namespace Umbraco.Core.Models.Rdbms
|
||||
public string ServerIdentity { get; set; }
|
||||
|
||||
[Column("registeredDate")]
|
||||
[Constraint(Default = "getdate()")]
|
||||
[Constraint(Default = SystemMethods.CurrentDateTime)]
|
||||
public DateTime DateRegistered { get; set; }
|
||||
|
||||
[Column("lastNotifiedDate")]
|
||||
@@ -33,6 +34,7 @@ namespace Umbraco.Core.Models.Rdbms
|
||||
[Index(IndexTypes.NonClustered)]
|
||||
public bool IsActive { get; set; }
|
||||
|
||||
|
||||
[Column("isMaster")]
|
||||
public bool IsMaster { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using Umbraco.Core.Persistence;
|
||||
using Umbraco.Core.Persistence.DatabaseAnnotations;
|
||||
using Umbraco.Core.Persistence.DatabaseModelDefinitions;
|
||||
|
||||
namespace Umbraco.Core.Models.Rdbms
|
||||
{
|
||||
@@ -34,7 +35,7 @@ namespace Umbraco.Core.Models.Rdbms
|
||||
public int UserId { get; set; }
|
||||
|
||||
[Column("DateTime")]
|
||||
[Constraint(Default = "getdate()")]
|
||||
[Constraint(Default = SystemMethods.CurrentDateTime)]
|
||||
public DateTime DateTime { get; set; }
|
||||
|
||||
[Column("Comment")]
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.UmbracoSettings;
|
||||
using Umbraco.Core.IO;
|
||||
|
||||
@@ -15,16 +13,17 @@ namespace Umbraco.Core.Models
|
||||
public class Script : File
|
||||
{
|
||||
public Script(string path)
|
||||
: base(path)
|
||||
{
|
||||
|
||||
}
|
||||
: this(path, (Func<File, string>) null)
|
||||
{ }
|
||||
|
||||
internal Script(string path, Func<File, string> getFileContent)
|
||||
: base(path, getFileContent)
|
||||
{ }
|
||||
|
||||
[Obsolete("This is no longer used and will be removed from the codebase in future versions")]
|
||||
public Script(string path, IContentSection contentConfig)
|
||||
: this(path)
|
||||
{
|
||||
}
|
||||
: base(path)
|
||||
{ }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the current entity has an identity, which in this case is a path/name.
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
using System.Globalization;
|
||||
using System.Reflection;
|
||||
using Umbraco.Core.Models.EntityBase;
|
||||
using Umbraco.Core.Sync;
|
||||
|
||||
namespace Umbraco.Core.Models
|
||||
{
|
||||
@@ -14,10 +13,12 @@ namespace Umbraco.Core.Models
|
||||
private string _serverAddress;
|
||||
private string _serverIdentity;
|
||||
private bool _isActive;
|
||||
private bool _isMaster;
|
||||
|
||||
private static readonly PropertyInfo ServerAddressSelector = ExpressionHelper.GetPropertyInfo<ServerRegistration, string>(x => x.ServerAddress);
|
||||
private static readonly PropertyInfo ServerIdentitySelector = ExpressionHelper.GetPropertyInfo<ServerRegistration, string>(x => x.ServerIdentity);
|
||||
private static readonly PropertyInfo IsActiveSelector = ExpressionHelper.GetPropertyInfo<ServerRegistration, bool>(x => x.IsActive);
|
||||
private static readonly PropertyInfo IsMasterSelector = ExpressionHelper.GetPropertyInfo<ServerRegistration, bool>(x => x.IsMaster);
|
||||
|
||||
/// <summary>
|
||||
/// Initialiazes a new instance of the <see cref="ServerRegistration"/> class.
|
||||
@@ -34,7 +35,8 @@ namespace Umbraco.Core.Models
|
||||
/// <param name="registered">The date and time the registration was created.</param>
|
||||
/// <param name="accessed">The date and time the registration was last accessed.</param>
|
||||
/// <param name="isActive">A value indicating whether the registration is active.</param>
|
||||
public ServerRegistration(int id, string serverAddress, string serverIdentity, DateTime registered, DateTime accessed, bool isActive)
|
||||
/// <param name="isMaster">A value indicating whether the registration is master.</param>
|
||||
public ServerRegistration(int id, string serverAddress, string serverIdentity, DateTime registered, DateTime accessed, bool isActive, bool isMaster)
|
||||
{
|
||||
UpdateDate = accessed;
|
||||
CreateDate = registered;
|
||||
@@ -43,6 +45,7 @@ namespace Umbraco.Core.Models
|
||||
ServerAddress = serverAddress;
|
||||
ServerIdentity = serverIdentity;
|
||||
IsActive = isActive;
|
||||
IsMaster = isMaster;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -108,6 +111,22 @@ namespace Umbraco.Core.Models
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether the server is master.
|
||||
/// </summary>
|
||||
public bool IsMaster
|
||||
{
|
||||
get { return _isMaster; }
|
||||
set
|
||||
{
|
||||
SetPropertyValueAndDetectChanges(o =>
|
||||
{
|
||||
_isMaster = value;
|
||||
return _isMaster;
|
||||
}, _isMaster, IsMasterSelector);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the date and time the registration was created.
|
||||
/// </summary>
|
||||
@@ -124,7 +143,7 @@ namespace Umbraco.Core.Models
|
||||
/// <returns></returns>
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("{{\"{0}\", \"{1}\", {2}active}}", ServerAddress, ServerIdentity, IsActive ? "" : "!");
|
||||
return string.Format("{{\"{0}\", \"{1}\", {2}active, {3}master}}", ServerAddress, ServerIdentity, IsActive ? "" : "!", IsMaster ? "" : "!");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Strings.Css;
|
||||
|
||||
@@ -16,12 +16,16 @@ namespace Umbraco.Core.Models
|
||||
[DataContract(IsReference = true)]
|
||||
public class Stylesheet : File
|
||||
{
|
||||
public Stylesheet(string path)
|
||||
: base(path)
|
||||
{
|
||||
public Stylesheet(string path)
|
||||
: this(path, null)
|
||||
{ }
|
||||
|
||||
internal Stylesheet(string path, Func<File, string> getFileContent)
|
||||
: base(path.EnsureEndsWith(".css"), getFileContent)
|
||||
{
|
||||
InitializeProperties();
|
||||
}
|
||||
|
||||
|
||||
private Lazy<List<StylesheetProperty>> _properties;
|
||||
|
||||
private void InitializeProperties()
|
||||
@@ -81,7 +85,7 @@ namespace Umbraco.Core.Models
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
void Property_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
|
||||
void Property_PropertyChanged(object sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
var prop = (StylesheetProperty) sender;
|
||||
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.UmbracoSettings;
|
||||
using Umbraco.Core.IO;
|
||||
@@ -29,12 +32,16 @@ namespace Umbraco.Core.Models
|
||||
private static readonly PropertyInfo NameSelector = ExpressionHelper.GetPropertyInfo<Template, string>(x => x.Name);
|
||||
|
||||
public Template(string name, string alias)
|
||||
: base(string.Empty)
|
||||
: this(name, alias, (Func<File, string>) null)
|
||||
{ }
|
||||
|
||||
internal Template(string name, string alias, Func<File, string> getFileContent)
|
||||
: base(string.Empty, getFileContent)
|
||||
{
|
||||
_name = name;
|
||||
_alias = alias.ToCleanString(CleanStringType.UnderscoreAlias);
|
||||
_masterTemplateId = new Lazy<int>(() => -1);
|
||||
}
|
||||
}
|
||||
|
||||
[Obsolete("This constructor should not be used, file path is determined by alias, setting the path here will have no affect")]
|
||||
public Template(string path, string name, string alias)
|
||||
@@ -123,7 +130,6 @@ namespace Umbraco.Core.Models
|
||||
Key = Guid.NewGuid();
|
||||
}
|
||||
|
||||
|
||||
public void SetMasterTemplate(ITemplate masterTemplate)
|
||||
{
|
||||
if (masterTemplate == null)
|
||||
@@ -139,27 +145,9 @@ namespace Umbraco.Core.Models
|
||||
|
||||
}
|
||||
|
||||
public override object DeepClone()
|
||||
protected override void DeepCloneNameAndAlias(File clone)
|
||||
{
|
||||
|
||||
//We cannot call in to the base classes to clone because the base File class treats Alias, Name.. differently so we need to manually do the clone
|
||||
|
||||
//Memberwise clone on Entity will work since it doesn't have any deep elements
|
||||
// for any sub class this will work for standard properties as well that aren't complex object's themselves.
|
||||
var clone = (Template)MemberwiseClone();
|
||||
//turn off change tracking
|
||||
clone.DisableChangeTracking();
|
||||
//Automatically deep clone ref properties that are IDeepCloneable
|
||||
DeepCloneHelper.DeepCloneRefProperties(this, clone);
|
||||
|
||||
//this shouldn't really be needed since we're not tracking
|
||||
clone.ResetDirtyProperties(false);
|
||||
//re-enable tracking
|
||||
clone.EnableChangeTracking();
|
||||
|
||||
return clone;
|
||||
// do nothing - prevents File from doing its stuff
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,12 @@ namespace Umbraco.Core.Models
|
||||
_domainName = domainName;
|
||||
}
|
||||
|
||||
public UmbracoDomain(string domainName, string languageIsoCode)
|
||||
: this(domainName)
|
||||
{
|
||||
LanguageIsoCode = languageIsoCode;
|
||||
}
|
||||
|
||||
private int? _contentId;
|
||||
private int? _languageId;
|
||||
private string _domainName;
|
||||
@@ -70,9 +76,9 @@ namespace Umbraco.Core.Models
|
||||
get { return string.IsNullOrWhiteSpace(DomainName) || DomainName.StartsWith("*"); }
|
||||
}
|
||||
|
||||
public string IsoCode
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// Readonly value of the language ISO code for the domain
|
||||
/// </summary>
|
||||
public string LanguageIsoCode { get; internal set; }
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using Umbraco.Core.Models.Identity;
|
||||
using Umbraco.Core.Models.Membership;
|
||||
using Umbraco.Core.Services;
|
||||
|
||||
|
||||
@@ -20,6 +20,6 @@ namespace Umbraco.Core.Persistence.DatabaseAnnotations
|
||||
/// <summary>
|
||||
/// Gets or sets the Default value
|
||||
/// </summary>
|
||||
public string Default { get; set; }
|
||||
public object Default { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -3,8 +3,8 @@ namespace Umbraco.Core.Persistence.DatabaseModelDefinitions
|
||||
public enum SystemMethods
|
||||
{
|
||||
NewGuid,
|
||||
NewSequentialId,
|
||||
CurrentDateTime,
|
||||
CurrentUTCDateTime
|
||||
//NewSequentialId,
|
||||
//CurrentUTCDateTime
|
||||
}
|
||||
}
|
||||
@@ -80,9 +80,6 @@ namespace Umbraco.Core.Persistence
|
||||
var creation = new DatabaseSchemaCreation(_db, _logger, _syntaxProvider);
|
||||
creation.InitializeDatabaseSchema();
|
||||
|
||||
//Now ensure to cretae the tag in the db for the current migration version
|
||||
migrationEntryService.CreateEntry(GlobalSettings.UmbracoMigrationName, UmbracoVersion.GetSemanticVersion());
|
||||
|
||||
_logger.Info<Database>("Finalized database schema creation");
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Umbraco.Core.Persistence
|
||||
{
|
||||
internal static class DatabaseNodeLockExtensions
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private static void ValidateDatabase(UmbracoDatabase database)
|
||||
{
|
||||
if (database == null)
|
||||
throw new ArgumentNullException("database");
|
||||
if (database.CurrentTransactionIsolationLevel < IsolationLevel.RepeatableRead)
|
||||
throw new InvalidOperationException("A transaction with minimum RepeatableRead isolation level is required.");
|
||||
}
|
||||
|
||||
// updating a record within a repeatable-read transaction gets an exclusive lock on
|
||||
// that record which will be kept until the transaction is ended, effectively locking
|
||||
// out all other accesses to that record - thus obtaining an exclusive lock over the
|
||||
// protected resources.
|
||||
public static void AcquireLockNodeWriteLock(this UmbracoDatabase database, int nodeId)
|
||||
{
|
||||
ValidateDatabase(database);
|
||||
|
||||
database.Execute("UPDATE umbracoNode SET sortOrder = (CASE WHEN (sortOrder=1) THEN -1 ELSE 1 END) WHERE id=@id",
|
||||
new { @id = nodeId });
|
||||
}
|
||||
|
||||
// reading a record within a repeatable-read transaction gets a shared lock on
|
||||
// that record which will be kept until the transaction is ended, effectively preventing
|
||||
// other write accesses to that record - thus obtaining a shared lock over the protected
|
||||
// resources.
|
||||
public static void AcquireLockNodeReadLock(this UmbracoDatabase database, int nodeId)
|
||||
{
|
||||
ValidateDatabase(database);
|
||||
|
||||
database.ExecuteScalar<int>("SELECT sortOrder FROM umbracoNode WHERE id=@id",
|
||||
new { @id = nodeId });
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@ using System.Data.SqlClient;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Umbraco.Core.Logging;
|
||||
|
||||
namespace Umbraco.Core.Persistence
|
||||
{
|
||||
@@ -75,8 +76,10 @@ namespace Umbraco.Core.Persistence
|
||||
connection.Open();
|
||||
connection.Close();
|
||||
}
|
||||
catch (DbException)
|
||||
catch (DbException exc)
|
||||
{
|
||||
// Don't swallow this error, the exception is super handy for knowing "why" its not available
|
||||
LogHelper.WarnWithException<IDbConnection>("Configured database is reporting as not being available!", exc);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace Umbraco.Core.Persistence.Factories
|
||||
{
|
||||
public ServerRegistration BuildEntity(ServerRegistrationDto dto)
|
||||
{
|
||||
var model = new ServerRegistration(dto.Id, dto.ServerAddress, dto.ServerIdentity, dto.DateRegistered, dto.DateAccessed, dto.IsActive);
|
||||
var model = new ServerRegistration(dto.Id, dto.ServerAddress, dto.ServerIdentity, dto.DateRegistered, dto.DateAccessed, dto.IsActive, dto.IsMaster);
|
||||
//on initial construction we don't want to have dirty properties tracked
|
||||
// http://issues.umbraco.org/issue/U4-1946
|
||||
model.ResetDirtyProperties(false);
|
||||
@@ -21,6 +21,7 @@ namespace Umbraco.Core.Persistence.Factories
|
||||
ServerAddress = entity.ServerAddress,
|
||||
DateRegistered = entity.CreateDate,
|
||||
IsActive = entity.IsActive,
|
||||
IsMaster = ((ServerRegistration) entity).IsMaster,
|
||||
DateAccessed = entity.UpdateDate,
|
||||
ServerIdentity = entity.ServerIdentity
|
||||
};
|
||||
|
||||
@@ -33,9 +33,9 @@ namespace Umbraco.Core.Persistence.Factories
|
||||
|
||||
#region Implementation of IEntityFactory<ITemplate,TemplateDto>
|
||||
|
||||
public Template BuildEntity(TemplateDto dto, IEnumerable<IUmbracoEntity> childDefinitions)
|
||||
public Template BuildEntity(TemplateDto dto, IEnumerable<IUmbracoEntity> childDefinitions, Func<File, string> getFileContent)
|
||||
{
|
||||
var template = new Template(dto.NodeDto.Text, dto.Alias)
|
||||
var template = new Template(dto.NodeDto.Text, dto.Alias, getFileContent)
|
||||
{
|
||||
CreateDate = dto.NodeDto.CreateDate,
|
||||
Id = dto.NodeId,
|
||||
@@ -43,12 +43,8 @@ namespace Umbraco.Core.Persistence.Factories
|
||||
Path = dto.NodeDto.Path
|
||||
};
|
||||
|
||||
if (childDefinitions.Any(x => x.ParentId == dto.NodeId))
|
||||
{
|
||||
template.IsMasterTemplate = true;
|
||||
}
|
||||
template.IsMasterTemplate = childDefinitions.Any(x => x.ParentId == dto.NodeId);
|
||||
|
||||
//TODO: Change this to ParentId: http://issues.umbraco.org/issue/U4-5846
|
||||
if(dto.NodeDto.ParentId > 0)
|
||||
template.MasterTemplateId = new Lazy<int>(() => dto.NodeDto.ParentId);
|
||||
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using Umbraco.Core.Persistence.Repositories;
|
||||
using Umbraco.Core.Persistence.UnitOfWork;
|
||||
|
||||
namespace Umbraco.Core.Persistence
|
||||
{
|
||||
internal class LockedRepository<TRepository>
|
||||
where TRepository : IDisposable, IRepository
|
||||
{
|
||||
public LockedRepository(Transaction transaction, IDatabaseUnitOfWork unitOfWork, TRepository repository)
|
||||
{
|
||||
Transaction = transaction;
|
||||
UnitOfWork = unitOfWork;
|
||||
Repository = repository;
|
||||
}
|
||||
|
||||
public Transaction Transaction { get; private set; }
|
||||
public IDatabaseUnitOfWork UnitOfWork { get; private set; }
|
||||
public TRepository Repository { get; private set; }
|
||||
|
||||
public void Commit()
|
||||
{
|
||||
UnitOfWork.Commit();
|
||||
Transaction.Complete();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using Umbraco.Core.Persistence.Repositories;
|
||||
using Umbraco.Core.Persistence.UnitOfWork;
|
||||
|
||||
namespace Umbraco.Core.Persistence
|
||||
{
|
||||
internal class LockingRepository<TRepository>
|
||||
where TRepository : IDisposable, IRepository
|
||||
{
|
||||
private readonly IDatabaseUnitOfWorkProvider _uowProvider;
|
||||
private readonly Func<IDatabaseUnitOfWork, TRepository> _repositoryFactory;
|
||||
private readonly int[] _readLockIds, _writeLockIds;
|
||||
|
||||
public LockingRepository(IDatabaseUnitOfWorkProvider uowProvider, Func<IDatabaseUnitOfWork, TRepository> repositoryFactory,
|
||||
IEnumerable<int> readLockIds, IEnumerable<int> writeLockIds)
|
||||
{
|
||||
Mandate.ParameterNotNull(uowProvider, "uowProvider");
|
||||
Mandate.ParameterNotNull(repositoryFactory, "repositoryFactory");
|
||||
|
||||
_uowProvider = uowProvider;
|
||||
_repositoryFactory = repositoryFactory;
|
||||
_readLockIds = readLockIds == null ? new int[0] : readLockIds.ToArray();
|
||||
_writeLockIds = writeLockIds == null ? new int[0] : writeLockIds.ToArray();
|
||||
}
|
||||
|
||||
public void WithReadLocked(Action<LockedRepository<TRepository>> action, bool autoCommit = true)
|
||||
{
|
||||
var uow = _uowProvider.GetUnitOfWork();
|
||||
using (var transaction = uow.Database.GetTransaction(IsolationLevel.RepeatableRead))
|
||||
{
|
||||
foreach (var lockId in _readLockIds)
|
||||
uow.Database.AcquireLockNodeReadLock(lockId);
|
||||
|
||||
using (var repository = _repositoryFactory(uow))
|
||||
{
|
||||
action(new LockedRepository<TRepository>(transaction, uow, repository));
|
||||
if (autoCommit == false) return;
|
||||
uow.Commit();
|
||||
transaction.Complete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public TResult WithReadLocked<TResult>(Func<LockedRepository<TRepository>, TResult> func, bool autoCommit = true)
|
||||
{
|
||||
var uow = _uowProvider.GetUnitOfWork();
|
||||
using (var transaction = uow.Database.GetTransaction(IsolationLevel.RepeatableRead))
|
||||
{
|
||||
foreach (var lockId in _readLockIds)
|
||||
uow.Database.AcquireLockNodeReadLock(lockId);
|
||||
|
||||
using (var repository = _repositoryFactory(uow))
|
||||
{
|
||||
var ret = func(new LockedRepository<TRepository>(transaction, uow, repository));
|
||||
if (autoCommit == false) return ret;
|
||||
uow.Commit();
|
||||
transaction.Complete();
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void WithWriteLocked(Action<LockedRepository<TRepository>> action, bool autoCommit = true)
|
||||
{
|
||||
var uow = _uowProvider.GetUnitOfWork();
|
||||
using (var transaction = uow.Database.GetTransaction(IsolationLevel.RepeatableRead))
|
||||
{
|
||||
foreach (var lockId in _writeLockIds)
|
||||
uow.Database.AcquireLockNodeWriteLock(lockId);
|
||||
|
||||
using (var repository = _repositoryFactory(uow))
|
||||
{
|
||||
action(new LockedRepository<TRepository>(transaction, uow, repository));
|
||||
if (autoCommit == false) return;
|
||||
uow.Commit();
|
||||
transaction.Complete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public TResult WithWriteLocked<TResult>(Func<LockedRepository<TRepository>, TResult> func, bool autoCommit = true)
|
||||
{
|
||||
var uow = _uowProvider.GetUnitOfWork();
|
||||
using (var transaction = uow.Database.GetTransaction(IsolationLevel.RepeatableRead))
|
||||
{
|
||||
foreach (var lockId in _writeLockIds)
|
||||
uow.Database.AcquireLockNodeReadLock(lockId);
|
||||
|
||||
using (var repository = _repositoryFactory(uow))
|
||||
{
|
||||
var ret = func(new LockedRepository<TRepository>(transaction, uow, repository));
|
||||
if (autoCommit == false) return ret;
|
||||
uow.Commit();
|
||||
transaction.Complete();
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -30,6 +30,7 @@ namespace Umbraco.Core.Persistence.Mappers
|
||||
{
|
||||
CacheMap<ServerRegistration, ServerRegistrationDto>(src => src.Id, dto => dto.Id);
|
||||
CacheMap<ServerRegistration, ServerRegistrationDto>(src => src.IsActive, dto => dto.IsActive);
|
||||
CacheMap<ServerRegistration, ServerRegistrationDto>(src => src.IsMaster, dto => dto.IsMaster);
|
||||
CacheMap<ServerRegistration, ServerRegistrationDto>(src => src.ServerAddress, dto => dto.ServerAddress);
|
||||
CacheMap<ServerRegistration, ServerRegistrationDto>(src => src.CreateDate, dto => dto.DateRegistered);
|
||||
CacheMap<ServerRegistration, ServerRegistrationDto>(src => src.UpdateDate, dto => dto.DateAccessed);
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
using System.Collections.Concurrent;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Models.Rdbms;
|
||||
|
||||
namespace Umbraco.Core.Persistence.Mappers
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a <see cref="TaskType"/> to DTO mapper used to translate the properties of the public api
|
||||
/// implementation to that of the database's DTO as sql: [tableName].[columnName].
|
||||
/// </summary>
|
||||
[MapperFor(typeof(TaskType))]
|
||||
public sealed class TaskTypeMapper : BaseMapper
|
||||
{
|
||||
private static readonly ConcurrentDictionary<string, DtoMapModel> PropertyInfoCacheInstance = new ConcurrentDictionary<string, DtoMapModel>();
|
||||
|
||||
//NOTE: its an internal class but the ctor must be public since we're using Activator.CreateInstance to create it
|
||||
// otherwise that would fail because there is no public constructor.
|
||||
public TaskTypeMapper()
|
||||
{
|
||||
BuildMap();
|
||||
}
|
||||
|
||||
#region Overrides of BaseMapper
|
||||
|
||||
internal override ConcurrentDictionary<string, DtoMapModel> PropertyInfoCache
|
||||
{
|
||||
get { return PropertyInfoCacheInstance; }
|
||||
}
|
||||
|
||||
internal override void BuildMap()
|
||||
{
|
||||
CacheMap<TaskType, TaskTypeDto>(src => src.Id, dto => dto.Id);
|
||||
CacheMap<TaskType, TaskTypeDto>(src => src.Alias, dto => dto.Alias);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Models.Rdbms;
|
||||
|
||||
@@ -86,11 +87,17 @@ namespace Umbraco.Core.Persistence.Migrations.Initial
|
||||
{
|
||||
CreateUmbracoRelationTypeData();
|
||||
}
|
||||
|
||||
if (tableName.Equals("cmsTaskType"))
|
||||
{
|
||||
CreateCmsTaskTypeData();
|
||||
}
|
||||
|
||||
if (tableName.Equals("umbracoMigration"))
|
||||
{
|
||||
CreateUmbracoMigrationData();
|
||||
}
|
||||
|
||||
_logger.Info<BaseDataCreation>(string.Format("Done creating data in table {0}", tableName));
|
||||
}
|
||||
|
||||
@@ -101,7 +108,7 @@ namespace Umbraco.Core.Persistence.Migrations.Initial
|
||||
_database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = -21, Trashed = false, ParentId = -1, UserId = 0, Level = 0, Path = "-1,-21", SortOrder = 0, UniqueId = new Guid("BF7C7CBC-952F-4518-97A2-69E9C7B33842"), Text = "Recycle Bin", NodeObjectType = new Guid(Constants.ObjectTypes.MediaRecycleBin), CreateDate = DateTime.Now });
|
||||
_database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = -92, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,-92", SortOrder = 35, UniqueId = new Guid("f0bc4bfb-b499-40d6-ba86-058885a5178c"), Text = "Label", NodeObjectType = new Guid(Constants.ObjectTypes.DataType), CreateDate = DateTime.Now });
|
||||
_database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = -90, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,-90", SortOrder = 34, UniqueId = new Guid("84c6b441-31df-4ffe-b67e-67d5bc3ae65a"), Text = "Upload", NodeObjectType = new Guid(Constants.ObjectTypes.DataType), CreateDate = DateTime.Now });
|
||||
_database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = -89, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,-89", SortOrder = 33, UniqueId = new Guid("c6bac0dd-4ab9-45b1-8e30-e4b619ee5da3"), Text = "Textbox multiple", NodeObjectType = new Guid(Constants.ObjectTypes.DataType), CreateDate = DateTime.Now });
|
||||
_database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = -89, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,-89", SortOrder = 33, UniqueId = new Guid("c6bac0dd-4ab9-45b1-8e30-e4b619ee5da3"), Text = "Textarea", NodeObjectType = new Guid(Constants.ObjectTypes.DataType), CreateDate = DateTime.Now });
|
||||
_database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = -88, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,-88", SortOrder = 32, UniqueId = new Guid("0cc0eba1-9960-42c9-bf9b-60e150b429ae"), Text = "Textstring", NodeObjectType = new Guid(Constants.ObjectTypes.DataType), CreateDate = DateTime.Now });
|
||||
_database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = -87, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,-87", SortOrder = 4, UniqueId = new Guid("ca90c950-0aff-4e72-b976-a30b1ac57dad"), Text = "Richtext editor", NodeObjectType = new Guid(Constants.ObjectTypes.DataType), CreateDate = DateTime.Now });
|
||||
_database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = -51, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,-51", SortOrder = 2, UniqueId = new Guid("2e6d3631-066e-44b8-aec4-96f09099b2b5"), Text = "Numeric", NodeObjectType = new Guid(Constants.ObjectTypes.DataType), CreateDate = DateTime.Now });
|
||||
@@ -274,5 +281,18 @@ namespace Umbraco.Core.Persistence.Migrations.Initial
|
||||
{
|
||||
_database.Insert("cmsTaskType", "id", false, new TaskTypeDto { Id = 1, Alias = "toTranslate" });
|
||||
}
|
||||
|
||||
private void CreateUmbracoMigrationData()
|
||||
{
|
||||
var dto = new MigrationDto
|
||||
{
|
||||
Id = 1,
|
||||
Name = GlobalSettings.UmbracoMigrationName,
|
||||
Version = UmbracoVersion.GetSemanticVersion().ToString(),
|
||||
CreateDate = DateTime.Now
|
||||
};
|
||||
|
||||
_database.Insert("umbracoMigration", "pk", false, dto);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,13 +16,7 @@ namespace Umbraco.Core.Persistence.Migrations
|
||||
{
|
||||
public ISqlSyntaxProvider SqlSyntax { get; private set; }
|
||||
public ILogger Logger { get; private set; }
|
||||
|
||||
[Obsolete("Use the other constructor specifying all dependencies instead")]
|
||||
protected MigrationBase()
|
||||
: this(SqlSyntaxContext.SqlSyntaxProvider, LoggerResolver.Current.Logger)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
protected MigrationBase(ISqlSyntaxProvider sqlSyntax, ILogger logger)
|
||||
{
|
||||
SqlSyntax = sqlSyntax;
|
||||
@@ -48,7 +42,7 @@ namespace Umbraco.Core.Persistence.Migrations
|
||||
|
||||
public IAlterSyntaxBuilder Alter
|
||||
{
|
||||
get { return new AlterSyntaxBuilder(Context); }
|
||||
get { return new AlterSyntaxBuilder(Context, SqlSyntax); }
|
||||
}
|
||||
|
||||
public ICreateBuilder Create
|
||||
@@ -63,27 +57,27 @@ namespace Umbraco.Core.Persistence.Migrations
|
||||
|
||||
public IExecuteBuilder Execute
|
||||
{
|
||||
get { return new ExecuteBuilder(Context); }
|
||||
get { return new ExecuteBuilder(Context, SqlSyntax); }
|
||||
}
|
||||
|
||||
public IInsertBuilder Insert
|
||||
{
|
||||
get { return new InsertBuilder(Context); }
|
||||
get { return new InsertBuilder(Context, SqlSyntax); }
|
||||
}
|
||||
|
||||
public IRenameBuilder Rename
|
||||
{
|
||||
get { return new RenameBuilder(Context); }
|
||||
get { return new RenameBuilder(Context, SqlSyntax); }
|
||||
}
|
||||
|
||||
public IUpdateBuilder Update
|
||||
{
|
||||
get { return new UpdateBuilder(Context); }
|
||||
get { return new UpdateBuilder(Context, SqlSyntax); }
|
||||
}
|
||||
|
||||
public IIfDatabaseBuilder IfDatabase(params DatabaseProviders[] databaseProviders)
|
||||
{
|
||||
return new IfDatabaseBuilder(Context, databaseProviders);
|
||||
return new IfDatabaseBuilder(Context, SqlSyntax, databaseProviders);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,22 +7,22 @@ namespace Umbraco.Core.Persistence.Migrations
|
||||
{
|
||||
public abstract class MigrationExpressionBase : IMigrationExpression
|
||||
{
|
||||
[Obsolete("Use the other constructors specifying an ISqlSyntaxProvider instead")]
|
||||
protected MigrationExpressionBase()
|
||||
: this(SqlSyntaxContext.SqlSyntaxProvider)
|
||||
{
|
||||
}
|
||||
//[Obsolete("Use the other constructors specifying an ISqlSyntaxProvider instead")]
|
||||
//protected MigrationExpressionBase()
|
||||
// : this(SqlSyntaxContext.SqlSyntaxProvider)
|
||||
//{
|
||||
//}
|
||||
|
||||
[Obsolete("Use the other constructors specifying an ISqlSyntaxProvider instead")]
|
||||
protected MigrationExpressionBase(DatabaseProviders current, DatabaseProviders[] databaseProviders)
|
||||
: this(current, databaseProviders, SqlSyntaxContext.SqlSyntaxProvider)
|
||||
{
|
||||
}
|
||||
//[Obsolete("Use the other constructors specifying an ISqlSyntaxProvider instead")]
|
||||
//protected MigrationExpressionBase(DatabaseProviders current, DatabaseProviders[] databaseProviders)
|
||||
// : this(current, databaseProviders, SqlSyntaxContext.SqlSyntaxProvider)
|
||||
//{
|
||||
//}
|
||||
|
||||
protected MigrationExpressionBase(ISqlSyntaxProvider sqlSyntax)
|
||||
{
|
||||
SqlSyntax = sqlSyntax;
|
||||
}
|
||||
//protected MigrationExpressionBase(ISqlSyntaxProvider sqlSyntax)
|
||||
//{
|
||||
// SqlSyntax = sqlSyntax;
|
||||
//}
|
||||
|
||||
protected MigrationExpressionBase(DatabaseProviders current, DatabaseProviders[] databaseProviders, ISqlSyntaxProvider sqlSyntax)
|
||||
{
|
||||
@@ -76,8 +76,10 @@ namespace Umbraco.Core.Persistence.Migrations
|
||||
case TypeCode.UInt32:
|
||||
case TypeCode.UInt64:
|
||||
return val.ToString();
|
||||
case TypeCode.DateTime:
|
||||
return SqlSyntax.GetQuotedValue(SqlSyntax.FormatDateTime((DateTime) val));
|
||||
default:
|
||||
return SqlSyntaxContext.SqlSyntaxProvider.GetQuotedValue(val.ToString());
|
||||
return SqlSyntax.GetQuotedValue(val.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using log4net;
|
||||
using Semver;
|
||||
using Umbraco.Core.Configuration;
|
||||
@@ -243,13 +245,43 @@ namespace Umbraco.Core.Persistence.Migrations
|
||||
//TODO: We should output all of these SQL calls to files in a migration folder in App_Data/TEMP
|
||||
// so if people want to executed them manually on another environment, they can.
|
||||
|
||||
_logger.Info<MigrationRunner>("Executing sql statement " + i + ": " + sql);
|
||||
database.Execute(sql);
|
||||
//The following ensures the multiple statement sare executed one at a time, this is a requirement
|
||||
// of SQLCE, it's unfortunate but necessary.
|
||||
// http://stackoverflow.com/questions/13665491/sql-ce-inconsistent-with-multiple-statements
|
||||
var sb = new StringBuilder();
|
||||
using (var reader = new StringReader(sql))
|
||||
{
|
||||
string line;
|
||||
while ((line = reader.ReadLine()) != null)
|
||||
{
|
||||
line = line.Trim();
|
||||
if (line.Equals("GO", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
//Execute the SQL up to the point of a GO statement
|
||||
var exeSql = sb.ToString();
|
||||
_logger.Info<MigrationRunner>("Executing sql statement " + i + ": " + exeSql);
|
||||
database.Execute(exeSql);
|
||||
|
||||
//restart the string builder
|
||||
sb.Remove(0, sb.Length);
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.AppendLine(line);
|
||||
}
|
||||
}
|
||||
//execute anything remaining
|
||||
if (sb.Length > 0)
|
||||
{
|
||||
var exeSql = sb.ToString();
|
||||
_logger.Info<MigrationRunner>("Executing sql statement " + i + ": " + exeSql);
|
||||
database.Execute(exeSql);
|
||||
}
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
transaction.Complete();
|
||||
|
||||
//Now that this is all complete, we need to add an entry to the migrations table flagging that migrations
|
||||
|
||||
@@ -1,30 +1,35 @@
|
||||
using Umbraco.Core.Persistence.Migrations.Syntax.Alter.Column;
|
||||
using Umbraco.Core.Persistence.Migrations.Syntax.Alter.Expressions;
|
||||
using Umbraco.Core.Persistence.Migrations.Syntax.Alter.Table;
|
||||
using Umbraco.Core.Persistence.SqlSyntax;
|
||||
|
||||
namespace Umbraco.Core.Persistence.Migrations.Syntax.Alter
|
||||
{
|
||||
public class AlterSyntaxBuilder : IAlterSyntaxBuilder
|
||||
{
|
||||
private readonly IMigrationContext _context;
|
||||
private readonly ISqlSyntaxProvider _sqlSyntax;
|
||||
private readonly DatabaseProviders[] _databaseProviders;
|
||||
|
||||
public AlterSyntaxBuilder(IMigrationContext context)
|
||||
public AlterSyntaxBuilder(IMigrationContext context, ISqlSyntaxProvider sqlSyntax, params DatabaseProviders[] databaseProviders)
|
||||
{
|
||||
_context = context;
|
||||
_sqlSyntax = sqlSyntax;
|
||||
_databaseProviders = databaseProviders;
|
||||
}
|
||||
|
||||
public IAlterTableSyntax Table(string tableName)
|
||||
{
|
||||
var expression = new AlterTableExpression { TableName = tableName };
|
||||
var expression = new AlterTableExpression(_context.CurrentDatabaseProvider, _databaseProviders, _sqlSyntax) { TableName = tableName };
|
||||
//_context.Expressions.Add(expression);
|
||||
return new AlterTableBuilder(expression, _context);
|
||||
return new AlterTableBuilder(_context, _databaseProviders, expression);
|
||||
}
|
||||
|
||||
public IAlterColumnSyntax Column(string columnName)
|
||||
{
|
||||
var expression = new AlterColumnExpression { Column = { Name = columnName } };
|
||||
var expression = new AlterColumnExpression(_context.CurrentDatabaseProvider, _databaseProviders, _sqlSyntax) {Column = {Name = columnName}};
|
||||
//_context.Expressions.Add(expression);
|
||||
return new AlterColumnBuilder(expression, _context);
|
||||
return new AlterColumnBuilder(_context, _databaseProviders, expression);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
using Umbraco.Core.Persistence.DatabaseModelDefinitions;
|
||||
using Umbraco.Core.Persistence.Migrations.Syntax.Alter.Expressions;
|
||||
using Umbraco.Core.Persistence.Migrations.Syntax.Expressions;
|
||||
using Umbraco.Core.Persistence.SqlSyntax;
|
||||
|
||||
namespace Umbraco.Core.Persistence.Migrations.Syntax.Alter.Column
|
||||
{
|
||||
@@ -11,11 +12,13 @@ namespace Umbraco.Core.Persistence.Migrations.Syntax.Alter.Column
|
||||
IAlterColumnOptionForeignKeyCascadeSyntax
|
||||
{
|
||||
private readonly IMigrationContext _context;
|
||||
private readonly DatabaseProviders[] _databaseProviders;
|
||||
|
||||
public AlterColumnBuilder(AlterColumnExpression expression, IMigrationContext context)
|
||||
public AlterColumnBuilder(IMigrationContext context, DatabaseProviders[] databaseProviders, AlterColumnExpression expression)
|
||||
: base(expression)
|
||||
{
|
||||
_context = context;
|
||||
_databaseProviders = databaseProviders;
|
||||
}
|
||||
|
||||
public ForeignKeyDefinition CurrentForeignKey { get; set; }
|
||||
@@ -33,7 +36,7 @@ namespace Umbraco.Core.Persistence.Migrations.Syntax.Alter.Column
|
||||
|
||||
public IAlterColumnOptionSyntax WithDefault(SystemMethods method)
|
||||
{
|
||||
var dc = new AlterDefaultConstraintExpression
|
||||
var dc = new AlterDefaultConstraintExpression(_context.CurrentDatabaseProvider, _databaseProviders, Expression.SqlSyntax)
|
||||
{
|
||||
TableName = Expression.TableName,
|
||||
SchemaName = Expression.SchemaName,
|
||||
@@ -51,7 +54,7 @@ namespace Umbraco.Core.Persistence.Migrations.Syntax.Alter.Column
|
||||
|
||||
public IAlterColumnOptionSyntax WithDefaultValue(object value)
|
||||
{
|
||||
var dc = new AlterDefaultConstraintExpression
|
||||
var dc = new AlterDefaultConstraintExpression(_context.CurrentDatabaseProvider, _databaseProviders, Expression.SqlSyntax)
|
||||
{
|
||||
TableName = Expression.TableName,
|
||||
SchemaName = Expression.SchemaName,
|
||||
@@ -81,15 +84,12 @@ namespace Umbraco.Core.Persistence.Migrations.Syntax.Alter.Column
|
||||
{
|
||||
Expression.Column.IsIndexed = true;
|
||||
|
||||
var index = new CreateIndexExpression
|
||||
{
|
||||
Index = new IndexDefinition
|
||||
{
|
||||
Name = indexName,
|
||||
SchemaName = Expression.SchemaName,
|
||||
TableName = Expression.TableName
|
||||
}
|
||||
};
|
||||
var index = new CreateIndexExpression(_context.CurrentDatabaseProvider, _databaseProviders, Expression.SqlSyntax, new IndexDefinition
|
||||
{
|
||||
Name = indexName,
|
||||
SchemaName = Expression.SchemaName,
|
||||
TableName = Expression.TableName
|
||||
});
|
||||
|
||||
index.Index.Columns.Add(new IndexColumnDefinition
|
||||
{
|
||||
@@ -135,16 +135,13 @@ namespace Umbraco.Core.Persistence.Migrations.Syntax.Alter.Column
|
||||
{
|
||||
Expression.Column.IsUnique = true;
|
||||
|
||||
var index = new CreateIndexExpression
|
||||
{
|
||||
Index = new IndexDefinition
|
||||
{
|
||||
Name = indexName,
|
||||
SchemaName = Expression.SchemaName,
|
||||
TableName = Expression.TableName,
|
||||
IsUnique = true
|
||||
}
|
||||
};
|
||||
var index = new CreateIndexExpression(_context.CurrentDatabaseProvider, _databaseProviders, Expression.SqlSyntax, new IndexDefinition
|
||||
{
|
||||
Name = indexName,
|
||||
SchemaName = Expression.SchemaName,
|
||||
TableName = Expression.TableName,
|
||||
IsUnique = true
|
||||
});
|
||||
|
||||
index.Index.Columns.Add(new IndexColumnDefinition
|
||||
{
|
||||
@@ -172,17 +169,14 @@ namespace Umbraco.Core.Persistence.Migrations.Syntax.Alter.Column
|
||||
{
|
||||
Expression.Column.IsForeignKey = true;
|
||||
|
||||
var fk = new CreateForeignKeyExpression
|
||||
{
|
||||
ForeignKey = new ForeignKeyDefinition
|
||||
{
|
||||
Name = foreignKeyName,
|
||||
PrimaryTable = primaryTableName,
|
||||
PrimaryTableSchema = primaryTableSchema,
|
||||
ForeignTable = Expression.TableName,
|
||||
ForeignTableSchema = Expression.SchemaName
|
||||
}
|
||||
};
|
||||
var fk = new CreateForeignKeyExpression(_context.CurrentDatabaseProvider, _databaseProviders, Expression.SqlSyntax, new ForeignKeyDefinition
|
||||
{
|
||||
Name = foreignKeyName,
|
||||
PrimaryTable = primaryTableName,
|
||||
PrimaryTableSchema = primaryTableSchema,
|
||||
ForeignTable = Expression.TableName,
|
||||
ForeignTableSchema = Expression.SchemaName
|
||||
});
|
||||
|
||||
fk.ForeignKey.PrimaryColumns.Add(primaryColumnName);
|
||||
fk.ForeignKey.ForeignColumns.Add(Expression.Column.Name);
|
||||
@@ -212,17 +206,14 @@ namespace Umbraco.Core.Persistence.Migrations.Syntax.Alter.Column
|
||||
public IAlterColumnOptionForeignKeyCascadeSyntax ReferencedBy(string foreignKeyName, string foreignTableSchema,
|
||||
string foreignTableName, string foreignColumnName)
|
||||
{
|
||||
var fk = new CreateForeignKeyExpression
|
||||
{
|
||||
ForeignKey = new ForeignKeyDefinition
|
||||
{
|
||||
Name = foreignKeyName,
|
||||
PrimaryTable = Expression.TableName,
|
||||
PrimaryTableSchema = Expression.SchemaName,
|
||||
ForeignTable = foreignTableName,
|
||||
ForeignTableSchema = foreignTableSchema
|
||||
}
|
||||
};
|
||||
var fk = new CreateForeignKeyExpression(_context.CurrentDatabaseProvider, _databaseProviders, Expression.SqlSyntax, new ForeignKeyDefinition
|
||||
{
|
||||
Name = foreignKeyName,
|
||||
PrimaryTable = Expression.TableName,
|
||||
PrimaryTableSchema = Expression.SchemaName,
|
||||
ForeignTable = foreignTableName,
|
||||
ForeignTableSchema = foreignTableSchema
|
||||
});
|
||||
|
||||
fk.ForeignKey.PrimaryColumns.Add(Expression.Column.Name);
|
||||
fk.ForeignKey.ForeignColumns.Add(foreignColumnName);
|
||||
|
||||
+18
-18
@@ -6,11 +6,11 @@ namespace Umbraco.Core.Persistence.Migrations.Syntax.Alter.Expressions
|
||||
{
|
||||
public class AlterColumnExpression : MigrationExpressionBase
|
||||
{
|
||||
public AlterColumnExpression(ISqlSyntaxProvider sqlSyntax)
|
||||
: base(sqlSyntax)
|
||||
{
|
||||
Column = new ColumnDefinition() { ModificationType = ModificationType.Alter };
|
||||
}
|
||||
//public AlterColumnExpression(ISqlSyntaxProvider sqlSyntax)
|
||||
// : base(sqlSyntax)
|
||||
//{
|
||||
// Column = new ColumnDefinition() { ModificationType = ModificationType.Alter };
|
||||
//}
|
||||
|
||||
public AlterColumnExpression(DatabaseProviders current, DatabaseProviders[] databaseProviders, ISqlSyntaxProvider sqlSyntax)
|
||||
: base(current, databaseProviders, sqlSyntax)
|
||||
@@ -18,17 +18,17 @@ namespace Umbraco.Core.Persistence.Migrations.Syntax.Alter.Expressions
|
||||
Column = new ColumnDefinition() { ModificationType = ModificationType.Alter };
|
||||
}
|
||||
|
||||
[Obsolete("Use the constructor specifying an ISqlSyntaxProvider instead")]
|
||||
public AlterColumnExpression()
|
||||
: this(SqlSyntaxContext.SqlSyntaxProvider)
|
||||
{
|
||||
}
|
||||
//[Obsolete("Use the constructor specifying an ISqlSyntaxProvider instead")]
|
||||
//public AlterColumnExpression()
|
||||
// : this(SqlSyntaxContext.SqlSyntaxProvider)
|
||||
//{
|
||||
//}
|
||||
|
||||
[Obsolete("Use the constructor specifying an ISqlSyntaxProvider instead")]
|
||||
public AlterColumnExpression(DatabaseProviders current, DatabaseProviders[] databaseProviders)
|
||||
: this(current, databaseProviders, SqlSyntaxContext.SqlSyntaxProvider)
|
||||
{
|
||||
}
|
||||
//[Obsolete("Use the constructor specifying an ISqlSyntaxProvider instead")]
|
||||
//public AlterColumnExpression(DatabaseProviders current, DatabaseProviders[] databaseProviders)
|
||||
// : this(current, databaseProviders, SqlSyntaxContext.SqlSyntaxProvider)
|
||||
//{
|
||||
//}
|
||||
|
||||
|
||||
|
||||
@@ -42,9 +42,9 @@ namespace Umbraco.Core.Persistence.Migrations.Syntax.Alter.Expressions
|
||||
// SqlSyntaxContext.SqlSyntaxProvider.GetQuotedColumnName(Column.Name),
|
||||
// SqlSyntaxContext.SqlSyntaxProvider.Format(Column));
|
||||
|
||||
return string.Format(SqlSyntaxContext.SqlSyntaxProvider.AlterColumn,
|
||||
SqlSyntaxContext.SqlSyntaxProvider.GetQuotedTableName(TableName),
|
||||
SqlSyntaxContext.SqlSyntaxProvider.Format(Column));
|
||||
return string.Format(SqlSyntax.AlterColumn,
|
||||
SqlSyntax.GetQuotedTableName(TableName),
|
||||
SqlSyntax.Format(Column));
|
||||
|
||||
//return string.Format(SqlSyntaxContext.SqlSyntaxProvider.AlterColumn,
|
||||
// SqlSyntaxContext.SqlSyntaxProvider.GetQuotedTableName(TableName),
|
||||
|
||||
+5
-8
@@ -4,11 +4,8 @@ namespace Umbraco.Core.Persistence.Migrations.Syntax.Alter.Expressions
|
||||
{
|
||||
public class AlterDefaultConstraintExpression : MigrationExpressionBase
|
||||
{
|
||||
public AlterDefaultConstraintExpression()
|
||||
{
|
||||
}
|
||||
|
||||
public AlterDefaultConstraintExpression(DatabaseProviders current, DatabaseProviders[] databaseProviders) : base(current, databaseProviders)
|
||||
public AlterDefaultConstraintExpression(DatabaseProviders current, DatabaseProviders[] databaseProviders, ISqlSyntaxProvider sqlSyntax)
|
||||
: base(current, databaseProviders, sqlSyntax)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -22,9 +19,9 @@ namespace Umbraco.Core.Persistence.Migrations.Syntax.Alter.Expressions
|
||||
{
|
||||
//NOTE Should probably investigate if Deleting a Default Constraint is different from deleting a 'regular' constraint
|
||||
|
||||
return string.Format(SqlSyntaxContext.SqlSyntaxProvider.DeleteConstraint,
|
||||
SqlSyntaxContext.SqlSyntaxProvider.GetQuotedTableName(TableName),
|
||||
SqlSyntaxContext.SqlSyntaxProvider.GetQuotedName(ConstraintName));
|
||||
return string.Format(SqlSyntax.DeleteConstraint,
|
||||
SqlSyntax.GetQuotedTableName(TableName),
|
||||
SqlSyntax.GetQuotedName(ConstraintName));
|
||||
}
|
||||
}
|
||||
}
|
||||
+5
-5
@@ -1,12 +1,12 @@
|
||||
namespace Umbraco.Core.Persistence.Migrations.Syntax.Alter.Expressions
|
||||
using Umbraco.Core.Persistence.SqlSyntax;
|
||||
|
||||
namespace Umbraco.Core.Persistence.Migrations.Syntax.Alter.Expressions
|
||||
{
|
||||
public class AlterTableExpression : MigrationExpressionBase
|
||||
{
|
||||
public AlterTableExpression()
|
||||
{
|
||||
}
|
||||
|
||||
public AlterTableExpression(DatabaseProviders current, DatabaseProviders[] databaseProviders) : base(current, databaseProviders)
|
||||
public AlterTableExpression(DatabaseProviders current, DatabaseProviders[] databaseProviders, ISqlSyntaxProvider sqlSyntax)
|
||||
: base(current, databaseProviders, sqlSyntax)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using Umbraco.Core.Persistence.DatabaseModelDefinitions;
|
||||
using Umbraco.Core.Persistence.Migrations.Syntax.Alter.Expressions;
|
||||
using Umbraco.Core.Persistence.Migrations.Syntax.Expressions;
|
||||
using Umbraco.Core.Persistence.SqlSyntax;
|
||||
|
||||
namespace Umbraco.Core.Persistence.Migrations.Syntax.Alter.Table
|
||||
{
|
||||
@@ -10,11 +11,13 @@ namespace Umbraco.Core.Persistence.Migrations.Syntax.Alter.Table
|
||||
IAlterTableColumnOptionForeignKeyCascadeSyntax
|
||||
{
|
||||
private readonly IMigrationContext _context;
|
||||
private readonly DatabaseProviders[] _databaseProviders;
|
||||
|
||||
public AlterTableBuilder(AlterTableExpression expression, IMigrationContext context)
|
||||
public AlterTableBuilder(IMigrationContext context, DatabaseProviders[] databaseProviders, AlterTableExpression expression)
|
||||
: base(expression)
|
||||
{
|
||||
_context = context;
|
||||
_databaseProviders = databaseProviders;
|
||||
}
|
||||
|
||||
public ColumnDefinition CurrentColumn { get; set; }
|
||||
@@ -36,7 +39,7 @@ namespace Umbraco.Core.Persistence.Migrations.Syntax.Alter.Table
|
||||
{
|
||||
if (CurrentColumn.ModificationType == ModificationType.Alter)
|
||||
{
|
||||
var dc = new AlterDefaultConstraintExpression
|
||||
var dc = new AlterDefaultConstraintExpression(_context.CurrentDatabaseProvider, _databaseProviders, Expression.SqlSyntax)
|
||||
{
|
||||
TableName = Expression.TableName,
|
||||
SchemaName = Expression.SchemaName,
|
||||
@@ -66,15 +69,12 @@ namespace Umbraco.Core.Persistence.Migrations.Syntax.Alter.Table
|
||||
{
|
||||
CurrentColumn.IsIndexed = true;
|
||||
|
||||
var index = new CreateIndexExpression
|
||||
{
|
||||
Index = new IndexDefinition
|
||||
{
|
||||
Name = indexName,
|
||||
SchemaName = Expression.SchemaName,
|
||||
TableName = Expression.TableName
|
||||
}
|
||||
};
|
||||
var index = new CreateIndexExpression(_context.CurrentDatabaseProvider, _databaseProviders, Expression.SqlSyntax, new IndexDefinition
|
||||
{
|
||||
Name = indexName,
|
||||
SchemaName = Expression.SchemaName,
|
||||
TableName = Expression.TableName
|
||||
});
|
||||
|
||||
index.Index.Columns.Add(new IndexColumnDefinition
|
||||
{
|
||||
@@ -120,16 +120,13 @@ namespace Umbraco.Core.Persistence.Migrations.Syntax.Alter.Table
|
||||
{
|
||||
CurrentColumn.IsUnique = true;
|
||||
|
||||
var index = new CreateIndexExpression
|
||||
{
|
||||
Index = new IndexDefinition
|
||||
{
|
||||
Name = indexName,
|
||||
SchemaName = Expression.SchemaName,
|
||||
TableName = Expression.TableName,
|
||||
IsUnique = true
|
||||
}
|
||||
};
|
||||
var index = new CreateIndexExpression(_context.CurrentDatabaseProvider, _databaseProviders, Expression.SqlSyntax, new IndexDefinition
|
||||
{
|
||||
Name = indexName,
|
||||
SchemaName = Expression.SchemaName,
|
||||
TableName = Expression.TableName,
|
||||
IsUnique = true
|
||||
});
|
||||
|
||||
index.Index.Columns.Add(new IndexColumnDefinition
|
||||
{
|
||||
@@ -157,17 +154,14 @@ namespace Umbraco.Core.Persistence.Migrations.Syntax.Alter.Table
|
||||
{
|
||||
CurrentColumn.IsForeignKey = true;
|
||||
|
||||
var fk = new CreateForeignKeyExpression
|
||||
{
|
||||
ForeignKey = new ForeignKeyDefinition
|
||||
{
|
||||
Name = foreignKeyName,
|
||||
PrimaryTable = primaryTableName,
|
||||
PrimaryTableSchema = primaryTableSchema,
|
||||
ForeignTable = Expression.TableName,
|
||||
ForeignTableSchema = Expression.SchemaName
|
||||
}
|
||||
};
|
||||
var fk = new CreateForeignKeyExpression(_context.CurrentDatabaseProvider, _databaseProviders, Expression.SqlSyntax, new ForeignKeyDefinition
|
||||
{
|
||||
Name = foreignKeyName,
|
||||
PrimaryTable = primaryTableName,
|
||||
PrimaryTableSchema = primaryTableSchema,
|
||||
ForeignTable = Expression.TableName,
|
||||
ForeignTableSchema = Expression.SchemaName
|
||||
});
|
||||
|
||||
fk.ForeignKey.PrimaryColumns.Add(primaryColumnName);
|
||||
fk.ForeignKey.ForeignColumns.Add(CurrentColumn.Name);
|
||||
@@ -197,17 +191,14 @@ namespace Umbraco.Core.Persistence.Migrations.Syntax.Alter.Table
|
||||
public IAlterTableColumnOptionForeignKeyCascadeSyntax ReferencedBy(string foreignKeyName, string foreignTableSchema,
|
||||
string foreignTableName, string foreignColumnName)
|
||||
{
|
||||
var fk = new CreateForeignKeyExpression
|
||||
{
|
||||
ForeignKey = new ForeignKeyDefinition
|
||||
{
|
||||
Name = foreignKeyName,
|
||||
PrimaryTable = Expression.TableName,
|
||||
PrimaryTableSchema = Expression.SchemaName,
|
||||
ForeignTable = foreignTableName,
|
||||
ForeignTableSchema = foreignTableSchema
|
||||
}
|
||||
};
|
||||
var fk = new CreateForeignKeyExpression(_context.CurrentDatabaseProvider, _databaseProviders, Expression.SqlSyntax, new ForeignKeyDefinition
|
||||
{
|
||||
Name = foreignKeyName,
|
||||
PrimaryTable = Expression.TableName,
|
||||
PrimaryTableSchema = Expression.SchemaName,
|
||||
ForeignTable = foreignTableName,
|
||||
ForeignTableSchema = foreignTableSchema
|
||||
});
|
||||
|
||||
fk.ForeignKey.PrimaryColumns.Add(CurrentColumn.Name);
|
||||
fk.ForeignKey.ForeignColumns.Add(foreignColumnName);
|
||||
@@ -220,7 +211,7 @@ namespace Umbraco.Core.Persistence.Migrations.Syntax.Alter.Table
|
||||
public IAlterTableColumnTypeSyntax AddColumn(string name)
|
||||
{
|
||||
var column = new ColumnDefinition { Name = name, ModificationType = ModificationType.Create };
|
||||
var createColumn = new CreateColumnExpression
|
||||
var createColumn = new CreateColumnExpression(_context.CurrentDatabaseProvider, _databaseProviders, Expression.SqlSyntax)
|
||||
{
|
||||
Column = column,
|
||||
SchemaName = Expression.SchemaName,
|
||||
@@ -236,12 +227,12 @@ namespace Umbraco.Core.Persistence.Migrations.Syntax.Alter.Table
|
||||
public IAlterTableColumnTypeSyntax AlterColumn(string name)
|
||||
{
|
||||
var column = new ColumnDefinition { Name = name, ModificationType = ModificationType.Alter };
|
||||
var alterColumn = new AlterColumnExpression
|
||||
{
|
||||
Column = column,
|
||||
SchemaName = Expression.SchemaName,
|
||||
TableName = Expression.TableName
|
||||
};
|
||||
var alterColumn = new AlterColumnExpression(_context.CurrentDatabaseProvider, _databaseProviders, Expression.SqlSyntax)
|
||||
{
|
||||
Column = column,
|
||||
SchemaName = Expression.SchemaName,
|
||||
TableName = Expression.TableName
|
||||
};
|
||||
|
||||
CurrentColumn = column;
|
||||
|
||||
|
||||
+33
-42
@@ -1,6 +1,7 @@
|
||||
using System.Data;
|
||||
using Umbraco.Core.Persistence.DatabaseModelDefinitions;
|
||||
using Umbraco.Core.Persistence.Migrations.Syntax.Expressions;
|
||||
using Umbraco.Core.Persistence.SqlSyntax;
|
||||
|
||||
namespace Umbraco.Core.Persistence.Migrations.Syntax.Create.Column
|
||||
{
|
||||
@@ -10,11 +11,13 @@ namespace Umbraco.Core.Persistence.Migrations.Syntax.Create.Column
|
||||
ICreateColumnOptionForeignKeyCascadeSyntax
|
||||
{
|
||||
private readonly IMigrationContext _context;
|
||||
private readonly DatabaseProviders[] _databaseProviders;
|
||||
|
||||
public CreateColumnBuilder(CreateColumnExpression expression, IMigrationContext context)
|
||||
public CreateColumnBuilder(IMigrationContext context, DatabaseProviders[] databaseProviders, CreateColumnExpression expression)
|
||||
: base(expression)
|
||||
{
|
||||
_context = context;
|
||||
_databaseProviders = databaseProviders;
|
||||
}
|
||||
|
||||
public ForeignKeyDefinition CurrentForeignKey { get; set; }
|
||||
@@ -56,15 +59,12 @@ namespace Umbraco.Core.Persistence.Migrations.Syntax.Create.Column
|
||||
{
|
||||
Expression.Column.IsIndexed = true;
|
||||
|
||||
var index = new CreateIndexExpression
|
||||
{
|
||||
Index = new IndexDefinition
|
||||
{
|
||||
Name = indexName,
|
||||
SchemaName = Expression.SchemaName,
|
||||
TableName = Expression.TableName
|
||||
}
|
||||
};
|
||||
var index = new CreateIndexExpression(_context.CurrentDatabaseProvider, _databaseProviders, Expression.SqlSyntax, new IndexDefinition
|
||||
{
|
||||
Name = indexName,
|
||||
SchemaName = Expression.SchemaName,
|
||||
TableName = Expression.TableName
|
||||
});
|
||||
|
||||
index.Index.Columns.Add(new IndexColumnDefinition
|
||||
{
|
||||
@@ -110,16 +110,13 @@ namespace Umbraco.Core.Persistence.Migrations.Syntax.Create.Column
|
||||
{
|
||||
Expression.Column.IsUnique = true;
|
||||
|
||||
var index = new CreateIndexExpression
|
||||
{
|
||||
Index = new IndexDefinition
|
||||
{
|
||||
Name = indexName,
|
||||
SchemaName = Expression.SchemaName,
|
||||
TableName = Expression.TableName,
|
||||
IsUnique = true
|
||||
}
|
||||
};
|
||||
var index = new CreateIndexExpression(_context.CurrentDatabaseProvider, _databaseProviders, Expression.SqlSyntax, new IndexDefinition
|
||||
{
|
||||
Name = indexName,
|
||||
SchemaName = Expression.SchemaName,
|
||||
TableName = Expression.TableName,
|
||||
IsUnique = true
|
||||
});
|
||||
|
||||
index.Index.Columns.Add(new IndexColumnDefinition
|
||||
{
|
||||
@@ -147,17 +144,14 @@ namespace Umbraco.Core.Persistence.Migrations.Syntax.Create.Column
|
||||
{
|
||||
Expression.Column.IsForeignKey = true;
|
||||
|
||||
var fk = new CreateForeignKeyExpression
|
||||
{
|
||||
ForeignKey = new ForeignKeyDefinition
|
||||
{
|
||||
Name = foreignKeyName,
|
||||
PrimaryTable = primaryTableName,
|
||||
PrimaryTableSchema = primaryTableSchema,
|
||||
ForeignTable = Expression.TableName,
|
||||
ForeignTableSchema = Expression.SchemaName
|
||||
}
|
||||
};
|
||||
var fk = new CreateForeignKeyExpression(_context.CurrentDatabaseProvider, _databaseProviders, Expression.SqlSyntax, new ForeignKeyDefinition
|
||||
{
|
||||
Name = foreignKeyName,
|
||||
PrimaryTable = primaryTableName,
|
||||
PrimaryTableSchema = primaryTableSchema,
|
||||
ForeignTable = Expression.TableName,
|
||||
ForeignTableSchema = Expression.SchemaName
|
||||
});
|
||||
|
||||
fk.ForeignKey.PrimaryColumns.Add(primaryColumnName);
|
||||
fk.ForeignKey.ForeignColumns.Add(Expression.Column.Name);
|
||||
@@ -187,17 +181,14 @@ namespace Umbraco.Core.Persistence.Migrations.Syntax.Create.Column
|
||||
public ICreateColumnOptionForeignKeyCascadeSyntax ReferencedBy(string foreignKeyName, string foreignTableSchema,
|
||||
string foreignTableName, string foreignColumnName)
|
||||
{
|
||||
var fk = new CreateForeignKeyExpression
|
||||
{
|
||||
ForeignKey = new ForeignKeyDefinition
|
||||
{
|
||||
Name = foreignKeyName,
|
||||
PrimaryTable = Expression.TableName,
|
||||
PrimaryTableSchema = Expression.SchemaName,
|
||||
ForeignTable = foreignTableName,
|
||||
ForeignTableSchema = foreignTableSchema
|
||||
}
|
||||
};
|
||||
var fk = new CreateForeignKeyExpression(_context.CurrentDatabaseProvider, _databaseProviders, Expression.SqlSyntax, new ForeignKeyDefinition
|
||||
{
|
||||
Name = foreignKeyName,
|
||||
PrimaryTable = Expression.TableName,
|
||||
PrimaryTableSchema = Expression.SchemaName,
|
||||
ForeignTable = foreignTableName,
|
||||
ForeignTableSchema = foreignTableSchema
|
||||
});
|
||||
|
||||
fk.ForeignKey.PrimaryColumns.Add(Expression.Column.Name);
|
||||
fk.ForeignKey.ForeignColumns.Add(foreignColumnName);
|
||||
|
||||
@@ -19,75 +19,66 @@ namespace Umbraco.Core.Persistence.Migrations.Syntax.Create
|
||||
|
||||
public CreateBuilder(IMigrationContext context, ISqlSyntaxProvider sqlSyntax, params DatabaseProviders[] databaseProviders)
|
||||
{
|
||||
if (context == null) throw new ArgumentNullException("context");
|
||||
if (sqlSyntax == null) throw new ArgumentNullException("sqlSyntax");
|
||||
|
||||
_context = context;
|
||||
_sqlSyntax = sqlSyntax;
|
||||
_databaseProviders = databaseProviders;
|
||||
}
|
||||
|
||||
[Obsolete("Use alternate ctor specifying ISqlSyntaxProvider instead")]
|
||||
public CreateBuilder(IMigrationContext context, params DatabaseProviders[] databaseProviders)
|
||||
:this(context, SqlSyntaxContext.SqlSyntaxProvider, databaseProviders)
|
||||
{
|
||||
}
|
||||
|
||||
public ICreateTableWithColumnSyntax Table(string tableName)
|
||||
{
|
||||
var expression = new CreateTableExpression { TableName = tableName };
|
||||
var expression = new CreateTableExpression(_context.CurrentDatabaseProvider, _databaseProviders, _sqlSyntax) { TableName = tableName };
|
||||
_context.Expressions.Add(expression);
|
||||
return new CreateTableBuilder(expression, _context);
|
||||
return new CreateTableBuilder(_context, _databaseProviders, expression);
|
||||
}
|
||||
|
||||
public ICreateColumnOnTableSyntax Column(string columnName)
|
||||
{
|
||||
var expression = _databaseProviders == null
|
||||
? new CreateColumnExpression { Column = { Name = columnName } }
|
||||
: new CreateColumnExpression(_context.CurrentDatabaseProvider, _databaseProviders) { Column = { Name = columnName } };
|
||||
var expression = new CreateColumnExpression(_context.CurrentDatabaseProvider, _databaseProviders, _sqlSyntax) { Column = { Name = columnName } };
|
||||
_context.Expressions.Add(expression);
|
||||
return new CreateColumnBuilder(expression, _context);
|
||||
return new CreateColumnBuilder(_context, _databaseProviders, expression);
|
||||
}
|
||||
|
||||
public ICreateForeignKeyFromTableSyntax ForeignKey()
|
||||
{
|
||||
var expression = _databaseProviders == null
|
||||
? new CreateForeignKeyExpression()
|
||||
: new CreateForeignKeyExpression(_context.CurrentDatabaseProvider, _databaseProviders);
|
||||
var expression = new CreateForeignKeyExpression(_context.CurrentDatabaseProvider, _databaseProviders, _sqlSyntax);
|
||||
_context.Expressions.Add(expression);
|
||||
return new CreateForeignKeyBuilder(expression);
|
||||
}
|
||||
|
||||
public ICreateForeignKeyFromTableSyntax ForeignKey(string foreignKeyName)
|
||||
{
|
||||
var expression = _databaseProviders == null
|
||||
? new CreateForeignKeyExpression { ForeignKey = { Name = foreignKeyName } }
|
||||
: new CreateForeignKeyExpression(_context.CurrentDatabaseProvider, _databaseProviders) { ForeignKey = { Name = foreignKeyName } };
|
||||
var expression = new CreateForeignKeyExpression(_context.CurrentDatabaseProvider, _databaseProviders, _sqlSyntax) { ForeignKey = { Name = foreignKeyName } };
|
||||
_context.Expressions.Add(expression);
|
||||
return new CreateForeignKeyBuilder(expression);
|
||||
}
|
||||
|
||||
public ICreateIndexForTableSyntax Index()
|
||||
{
|
||||
var expression = new CreateIndexExpression(_sqlSyntax);
|
||||
var expression = new CreateIndexExpression(_context.CurrentDatabaseProvider, _databaseProviders, _sqlSyntax);
|
||||
_context.Expressions.Add(expression);
|
||||
return new CreateIndexBuilder(expression);
|
||||
}
|
||||
|
||||
public ICreateIndexForTableSyntax Index(string indexName)
|
||||
{
|
||||
var expression = new CreateIndexExpression(_sqlSyntax) { Index = { Name = indexName } };
|
||||
var expression = new CreateIndexExpression(_context.CurrentDatabaseProvider, _databaseProviders, _sqlSyntax) { Index = { Name = indexName } };
|
||||
_context.Expressions.Add(expression);
|
||||
return new CreateIndexBuilder(expression);
|
||||
}
|
||||
|
||||
public ICreateConstraintOnTableSyntax PrimaryKey()
|
||||
{
|
||||
var expression = new CreateConstraintExpression(ConstraintType.PrimaryKey);
|
||||
var expression = new CreateConstraintExpression(_context.CurrentDatabaseProvider, _databaseProviders, _sqlSyntax, ConstraintType.PrimaryKey);
|
||||
_context.Expressions.Add(expression);
|
||||
return new CreateConstraintBuilder(expression);
|
||||
}
|
||||
|
||||
public ICreateConstraintOnTableSyntax PrimaryKey(string primaryKeyName)
|
||||
{
|
||||
var expression = new CreateConstraintExpression(ConstraintType.PrimaryKey);
|
||||
var expression = new CreateConstraintExpression(_context.CurrentDatabaseProvider, _databaseProviders, _sqlSyntax, ConstraintType.PrimaryKey);
|
||||
expression.Constraint.ConstraintName = primaryKeyName;
|
||||
_context.Expressions.Add(expression);
|
||||
return new CreateConstraintBuilder(expression);
|
||||
@@ -95,14 +86,14 @@ namespace Umbraco.Core.Persistence.Migrations.Syntax.Create
|
||||
|
||||
public ICreateConstraintOnTableSyntax UniqueConstraint()
|
||||
{
|
||||
var expression = new CreateConstraintExpression(ConstraintType.Unique);
|
||||
var expression = new CreateConstraintExpression(_context.CurrentDatabaseProvider, _databaseProviders, _sqlSyntax, ConstraintType.Unique);
|
||||
_context.Expressions.Add(expression);
|
||||
return new CreateConstraintBuilder(expression);
|
||||
}
|
||||
|
||||
public ICreateConstraintOnTableSyntax UniqueConstraint(string constraintName)
|
||||
{
|
||||
var expression = new CreateConstraintExpression(ConstraintType.Unique);
|
||||
var expression = new CreateConstraintExpression(_context.CurrentDatabaseProvider, _databaseProviders, _sqlSyntax, ConstraintType.Unique);
|
||||
expression.Constraint.ConstraintName = constraintName;
|
||||
_context.Expressions.Add(expression);
|
||||
return new CreateConstraintBuilder(expression);
|
||||
@@ -110,7 +101,7 @@ namespace Umbraco.Core.Persistence.Migrations.Syntax.Create
|
||||
|
||||
public ICreateConstraintOnTableSyntax Constraint(string constraintName)
|
||||
{
|
||||
var expression = new CreateConstraintExpression(ConstraintType.NonUnique);
|
||||
var expression = new CreateConstraintExpression(_context.CurrentDatabaseProvider, _databaseProviders, _sqlSyntax, ConstraintType.NonUnique);
|
||||
expression.Constraint.ConstraintName = constraintName;
|
||||
_context.Expressions.Add(expression);
|
||||
return new CreateConstraintBuilder(expression);
|
||||
|
||||
+9
-7
@@ -6,10 +6,12 @@ namespace Umbraco.Core.Persistence.Migrations.Syntax.Create.Expressions
|
||||
{
|
||||
public class CreateConstraintExpression : MigrationExpressionBase
|
||||
{
|
||||
public CreateConstraintExpression(ConstraintType type)
|
||||
public CreateConstraintExpression(DatabaseProviders current, DatabaseProviders[] databaseProviders, ISqlSyntaxProvider sqlSyntax, ConstraintType constraint)
|
||||
: base(current, databaseProviders, sqlSyntax)
|
||||
{
|
||||
Constraint = new ConstraintDefinition(type);
|
||||
Constraint = new ConstraintDefinition(constraint);
|
||||
}
|
||||
|
||||
|
||||
public ConstraintDefinition Constraint { get; private set; }
|
||||
|
||||
@@ -17,7 +19,7 @@ namespace Umbraco.Core.Persistence.Migrations.Syntax.Create.Expressions
|
||||
{
|
||||
var constraintType = (Constraint.IsPrimaryKeyConstraint) ? "PRIMARY KEY" : "UNIQUE";
|
||||
|
||||
if (Constraint.IsPrimaryKeyConstraint && SqlSyntaxContext.SqlSyntaxProvider.SupportsClustered())
|
||||
if (Constraint.IsPrimaryKeyConstraint && SqlSyntax.SupportsClustered())
|
||||
constraintType += " CLUSTERED";
|
||||
|
||||
if (Constraint.IsNonUniqueConstraint)
|
||||
@@ -27,12 +29,12 @@ namespace Umbraco.Core.Persistence.Migrations.Syntax.Create.Expressions
|
||||
|
||||
for (int i = 0; i < Constraint.Columns.Count; i++)
|
||||
{
|
||||
columns[i] = SqlSyntaxContext.SqlSyntaxProvider.GetQuotedColumnName(Constraint.Columns.ElementAt(i));
|
||||
columns[i] = SqlSyntax.GetQuotedColumnName(Constraint.Columns.ElementAt(i));
|
||||
}
|
||||
|
||||
return string.Format(SqlSyntaxContext.SqlSyntaxProvider.CreateConstraint,
|
||||
SqlSyntaxContext.SqlSyntaxProvider.GetQuotedTableName(Constraint.TableName),
|
||||
SqlSyntaxContext.SqlSyntaxProvider.GetQuotedName(Constraint.ConstraintName),
|
||||
return string.Format(SqlSyntax.CreateConstraint,
|
||||
SqlSyntax.GetQuotedTableName(Constraint.TableName),
|
||||
SqlSyntax.GetQuotedName(Constraint.ConstraintName),
|
||||
constraintType,
|
||||
string.Join(", ", columns));
|
||||
}
|
||||
|
||||
+16
-16
@@ -7,24 +7,24 @@ namespace Umbraco.Core.Persistence.Migrations.Syntax.Create.Expressions
|
||||
{
|
||||
public class CreateTableExpression : MigrationExpressionBase
|
||||
{
|
||||
[Obsolete("Use the other constructors specifying an ISqlSyntaxProvider instead")]
|
||||
public CreateTableExpression()
|
||||
{
|
||||
Columns = new List<ColumnDefinition>();
|
||||
}
|
||||
//[Obsolete("Use the other constructors specifying an ISqlSyntaxProvider instead")]
|
||||
//public CreateTableExpression()
|
||||
//{
|
||||
// Columns = new List<ColumnDefinition>();
|
||||
//}
|
||||
|
||||
[Obsolete("Use the other constructors specifying an ISqlSyntaxProvider instead")]
|
||||
public CreateTableExpression(DatabaseProviders current, DatabaseProviders[] databaseProviders)
|
||||
: base(current, databaseProviders)
|
||||
{
|
||||
Columns = new List<ColumnDefinition>();
|
||||
}
|
||||
//[Obsolete("Use the other constructors specifying an ISqlSyntaxProvider instead")]
|
||||
//public CreateTableExpression(DatabaseProviders current, DatabaseProviders[] databaseProviders)
|
||||
// : base(current, databaseProviders)
|
||||
//{
|
||||
// Columns = new List<ColumnDefinition>();
|
||||
//}
|
||||
|
||||
public CreateTableExpression(ISqlSyntaxProvider sqlSyntax)
|
||||
: base(sqlSyntax)
|
||||
{
|
||||
Columns = new List<ColumnDefinition>();
|
||||
}
|
||||
//public CreateTableExpression(ISqlSyntaxProvider sqlSyntax)
|
||||
// : base(sqlSyntax)
|
||||
//{
|
||||
// Columns = new List<ColumnDefinition>();
|
||||
//}
|
||||
|
||||
public CreateTableExpression(DatabaseProviders current, DatabaseProviders[] databaseProviders, ISqlSyntaxProvider sqlSyntax)
|
||||
: base(current, databaseProviders, sqlSyntax)
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using Umbraco.Core.Persistence.DatabaseModelDefinitions;
|
||||
using Umbraco.Core.Persistence.Migrations.Syntax.Create.Expressions;
|
||||
using Umbraco.Core.Persistence.Migrations.Syntax.Expressions;
|
||||
using Umbraco.Core.Persistence.SqlSyntax;
|
||||
|
||||
namespace Umbraco.Core.Persistence.Migrations.Syntax.Create.Table
|
||||
{
|
||||
@@ -11,11 +12,13 @@ namespace Umbraco.Core.Persistence.Migrations.Syntax.Create.Table
|
||||
ICreateTableColumnOptionForeignKeyCascadeSyntax
|
||||
{
|
||||
private readonly IMigrationContext _context;
|
||||
private readonly DatabaseProviders[] _databaseProviders;
|
||||
|
||||
public CreateTableBuilder(CreateTableExpression expression, IMigrationContext context)
|
||||
public CreateTableBuilder(IMigrationContext context, DatabaseProviders[] databaseProviders, CreateTableExpression expression)
|
||||
: base(expression)
|
||||
{
|
||||
_context = context;
|
||||
_databaseProviders = databaseProviders;
|
||||
}
|
||||
|
||||
public ColumnDefinition CurrentColumn { get; set; }
|
||||
@@ -62,15 +65,12 @@ namespace Umbraco.Core.Persistence.Migrations.Syntax.Create.Table
|
||||
{
|
||||
CurrentColumn.IsIndexed = true;
|
||||
|
||||
var index = new CreateIndexExpression
|
||||
{
|
||||
Index = new IndexDefinition
|
||||
{
|
||||
Name = indexName,
|
||||
SchemaName = Expression.SchemaName,
|
||||
TableName = Expression.TableName
|
||||
}
|
||||
};
|
||||
var index = new CreateIndexExpression(_context.CurrentDatabaseProvider, _databaseProviders, Expression.SqlSyntax, new IndexDefinition
|
||||
{
|
||||
Name = indexName,
|
||||
SchemaName = Expression.SchemaName,
|
||||
TableName = Expression.TableName
|
||||
});
|
||||
|
||||
index.Index.Columns.Add(new IndexColumnDefinition
|
||||
{
|
||||
@@ -86,15 +86,25 @@ namespace Umbraco.Core.Persistence.Migrations.Syntax.Create.Table
|
||||
{
|
||||
CurrentColumn.IsPrimaryKey = true;
|
||||
|
||||
var expression = new CreateConstraintExpression(ConstraintType.PrimaryKey)
|
||||
//For MySQL, the PK will be created WITH the create table expression, however for
|
||||
// SQL Server, the PK get's created in a different Alter table expression afterwords.
|
||||
// MySQL will choke if the same constraint is again added afterword
|
||||
// TODO: This is a super hack, I'd rather not add another property like 'CreatesPkInCreateTableDefinition' to check
|
||||
// for this, but I don't see another way around. MySQL doesn't support checking for a constraint before creating
|
||||
// it... except in a very strange way but it doesn't actually provider error feedback if it doesn't work so we cannot use
|
||||
// it. For now, this is what I'm doing
|
||||
if (Expression.CurrentDatabaseProvider != DatabaseProviders.MySql)
|
||||
{
|
||||
Constraint =
|
||||
var expression = new CreateConstraintExpression(_context.CurrentDatabaseProvider, _databaseProviders, Expression.SqlSyntax, ConstraintType.PrimaryKey)
|
||||
{
|
||||
Constraint =
|
||||
{
|
||||
TableName = CurrentColumn.TableName,
|
||||
Columns = new[] { CurrentColumn.Name }
|
||||
}
|
||||
};
|
||||
_context.Expressions.Add(expression);
|
||||
};
|
||||
_context.Expressions.Add(expression);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
@@ -104,16 +114,27 @@ namespace Umbraco.Core.Persistence.Migrations.Syntax.Create.Table
|
||||
CurrentColumn.IsPrimaryKey = true;
|
||||
CurrentColumn.PrimaryKeyName = primaryKeyName;
|
||||
|
||||
var expression = new CreateConstraintExpression(ConstraintType.PrimaryKey)
|
||||
//For MySQL, the PK will be created WITH the create table expression, however for
|
||||
// SQL Server, the PK get's created in a different Alter table expression afterwords.
|
||||
// MySQL will choke if the same constraint is again added afterword
|
||||
// TODO: This is a super hack, I'd rather not add another property like 'CreatesPkInCreateTableDefinition' to check
|
||||
// for this, but I don't see another way around. MySQL doesn't support checking for a constraint before creating
|
||||
// it... except in a very strange way but it doesn't actually provider error feedback if it doesn't work so we cannot use
|
||||
// it. For now, this is what I'm doing
|
||||
|
||||
if (Expression.CurrentDatabaseProvider != DatabaseProviders.MySql)
|
||||
{
|
||||
Constraint =
|
||||
var expression = new CreateConstraintExpression(_context.CurrentDatabaseProvider, _databaseProviders, Expression.SqlSyntax, ConstraintType.PrimaryKey)
|
||||
{
|
||||
Constraint =
|
||||
{
|
||||
ConstraintName = primaryKeyName,
|
||||
TableName = CurrentColumn.TableName,
|
||||
Columns = new[] { CurrentColumn.Name }
|
||||
}
|
||||
};
|
||||
_context.Expressions.Add(expression);
|
||||
};
|
||||
_context.Expressions.Add(expression);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
@@ -139,16 +160,13 @@ namespace Umbraco.Core.Persistence.Migrations.Syntax.Create.Table
|
||||
{
|
||||
CurrentColumn.IsUnique = true;
|
||||
|
||||
var index = new CreateIndexExpression
|
||||
{
|
||||
Index = new IndexDefinition
|
||||
{
|
||||
Name = indexName,
|
||||
SchemaName = Expression.SchemaName,
|
||||
TableName = Expression.TableName,
|
||||
IsUnique = true
|
||||
}
|
||||
};
|
||||
var index = new CreateIndexExpression(_context.CurrentDatabaseProvider, _databaseProviders, Expression.SqlSyntax, new IndexDefinition
|
||||
{
|
||||
Name = indexName,
|
||||
SchemaName = Expression.SchemaName,
|
||||
TableName = Expression.TableName,
|
||||
IsUnique = true
|
||||
});
|
||||
|
||||
index.Index.Columns.Add(new IndexColumnDefinition
|
||||
{
|
||||
@@ -176,17 +194,14 @@ namespace Umbraco.Core.Persistence.Migrations.Syntax.Create.Table
|
||||
{
|
||||
CurrentColumn.IsForeignKey = true;
|
||||
|
||||
var fk = new CreateForeignKeyExpression
|
||||
{
|
||||
ForeignKey = new ForeignKeyDefinition
|
||||
{
|
||||
Name = foreignKeyName,
|
||||
PrimaryTable = primaryTableName,
|
||||
PrimaryTableSchema = primaryTableSchema,
|
||||
ForeignTable = Expression.TableName,
|
||||
ForeignTableSchema = Expression.SchemaName
|
||||
}
|
||||
};
|
||||
var fk = new CreateForeignKeyExpression(_context.CurrentDatabaseProvider, _databaseProviders, Expression.SqlSyntax, new ForeignKeyDefinition
|
||||
{
|
||||
Name = foreignKeyName,
|
||||
PrimaryTable = primaryTableName,
|
||||
PrimaryTableSchema = primaryTableSchema,
|
||||
ForeignTable = Expression.TableName,
|
||||
ForeignTableSchema = Expression.SchemaName
|
||||
});
|
||||
|
||||
fk.ForeignKey.PrimaryColumns.Add(primaryColumnName);
|
||||
fk.ForeignKey.ForeignColumns.Add(CurrentColumn.Name);
|
||||
@@ -216,17 +231,14 @@ namespace Umbraco.Core.Persistence.Migrations.Syntax.Create.Table
|
||||
public ICreateTableColumnOptionForeignKeyCascadeSyntax ReferencedBy(string foreignKeyName, string foreignTableSchema,
|
||||
string foreignTableName, string foreignColumnName)
|
||||
{
|
||||
var fk = new CreateForeignKeyExpression
|
||||
{
|
||||
ForeignKey = new ForeignKeyDefinition
|
||||
{
|
||||
Name = foreignKeyName,
|
||||
PrimaryTable = Expression.TableName,
|
||||
PrimaryTableSchema = Expression.SchemaName,
|
||||
ForeignTable = foreignTableName,
|
||||
ForeignTableSchema = foreignTableSchema
|
||||
}
|
||||
};
|
||||
var fk = new CreateForeignKeyExpression(_context.CurrentDatabaseProvider, _databaseProviders, Expression.SqlSyntax, new ForeignKeyDefinition
|
||||
{
|
||||
Name = foreignKeyName,
|
||||
PrimaryTable = Expression.TableName,
|
||||
PrimaryTableSchema = Expression.SchemaName,
|
||||
ForeignTable = foreignTableName,
|
||||
ForeignTableSchema = foreignTableSchema
|
||||
});
|
||||
|
||||
fk.ForeignKey.PrimaryColumns.Add(CurrentColumn.Name);
|
||||
fk.ForeignKey.ForeignColumns.Add(foreignColumnName);
|
||||
|
||||
@@ -23,69 +23,57 @@ namespace Umbraco.Core.Persistence.Migrations.Syntax.Delete
|
||||
_databaseProviders = databaseProviders;
|
||||
}
|
||||
|
||||
[Obsolete("Use the other constructor specifying an ISqlSyntaxProvider instead")]
|
||||
public DeleteBuilder(IMigrationContext context, params DatabaseProviders[] databaseProviders)
|
||||
: this(context, SqlSyntaxContext.SqlSyntaxProvider, databaseProviders)
|
||||
{
|
||||
}
|
||||
|
||||
public void Table(string tableName)
|
||||
{
|
||||
var expression = new DeleteTableExpression { TableName = tableName };
|
||||
var expression = new DeleteTableExpression(_context.CurrentDatabaseProvider, _databaseProviders, _sqlSyntax) { TableName = tableName };
|
||||
_context.Expressions.Add(expression);
|
||||
}
|
||||
|
||||
public IDeleteColumnFromTableSyntax Column(string columnName)
|
||||
{
|
||||
var expression = _databaseProviders == null
|
||||
? new DeleteColumnExpression { ColumnNames = { columnName } }
|
||||
: new DeleteColumnExpression(_context.CurrentDatabaseProvider, _databaseProviders) { ColumnNames = { columnName } };
|
||||
var expression = new DeleteColumnExpression(_context.CurrentDatabaseProvider, _databaseProviders, _sqlSyntax) {ColumnNames = {columnName}};
|
||||
_context.Expressions.Add(expression);
|
||||
return new DeleteColumnBuilder(expression);
|
||||
}
|
||||
|
||||
public IDeleteForeignKeyFromTableSyntax ForeignKey()
|
||||
{
|
||||
var expression = _databaseProviders == null
|
||||
? new DeleteForeignKeyExpression(_sqlSyntax)
|
||||
: new DeleteForeignKeyExpression(_context.CurrentDatabaseProvider, _databaseProviders, _sqlSyntax);
|
||||
var expression = new DeleteForeignKeyExpression(_context.CurrentDatabaseProvider, _databaseProviders, _sqlSyntax);
|
||||
_context.Expressions.Add(expression);
|
||||
return new DeleteForeignKeyBuilder(expression);
|
||||
}
|
||||
|
||||
public IDeleteForeignKeyOnTableSyntax ForeignKey(string foreignKeyName)
|
||||
{
|
||||
var expression = _databaseProviders == null
|
||||
? new DeleteForeignKeyExpression(_sqlSyntax) { ForeignKey = { Name = foreignKeyName } }
|
||||
: new DeleteForeignKeyExpression(_context.CurrentDatabaseProvider, _databaseProviders, _sqlSyntax) { ForeignKey = { Name = foreignKeyName } };
|
||||
var expression = new DeleteForeignKeyExpression(_context.CurrentDatabaseProvider, _databaseProviders, _sqlSyntax) {ForeignKey = {Name = foreignKeyName}};
|
||||
_context.Expressions.Add(expression);
|
||||
return new DeleteForeignKeyBuilder(expression);
|
||||
}
|
||||
|
||||
public IDeleteDataSyntax FromTable(string tableName)
|
||||
{
|
||||
var expression = new DeleteDataExpression { TableName = tableName };
|
||||
var expression = new DeleteDataExpression(_context.CurrentDatabaseProvider, _databaseProviders, _sqlSyntax) { TableName = tableName };
|
||||
_context.Expressions.Add(expression);
|
||||
return new DeleteDataBuilder(expression);
|
||||
}
|
||||
|
||||
public IDeleteIndexForTableSyntax Index()
|
||||
{
|
||||
var expression = new DeleteIndexExpression();
|
||||
var expression = new DeleteIndexExpression(_context.CurrentDatabaseProvider, _databaseProviders, _sqlSyntax);
|
||||
_context.Expressions.Add(expression);
|
||||
return new DeleteIndexBuilder(expression);
|
||||
}
|
||||
|
||||
public IDeleteIndexForTableSyntax Index(string indexName)
|
||||
{
|
||||
var expression = new DeleteIndexExpression { Index = { Name = indexName } };
|
||||
var expression = new DeleteIndexExpression(_context.CurrentDatabaseProvider, _databaseProviders, _sqlSyntax) { Index = { Name = indexName } };
|
||||
_context.Expressions.Add(expression);
|
||||
return new DeleteIndexBuilder(expression);
|
||||
}
|
||||
|
||||
public IDeleteConstraintOnTableSyntax PrimaryKey(string primaryKeyName)
|
||||
{
|
||||
var expression = new DeleteConstraintExpression(_context.CurrentDatabaseProvider, _databaseProviders, ConstraintType.PrimaryKey)
|
||||
var expression = new DeleteConstraintExpression(_context.CurrentDatabaseProvider, _databaseProviders, _sqlSyntax, ConstraintType.PrimaryKey)
|
||||
{
|
||||
Constraint = { ConstraintName = primaryKeyName }
|
||||
};
|
||||
@@ -95,7 +83,7 @@ namespace Umbraco.Core.Persistence.Migrations.Syntax.Delete
|
||||
|
||||
public IDeleteConstraintOnTableSyntax UniqueConstraint(string constraintName)
|
||||
{
|
||||
var expression = new DeleteConstraintExpression(ConstraintType.Unique)
|
||||
var expression = new DeleteConstraintExpression(_context.CurrentDatabaseProvider, _databaseProviders, _sqlSyntax, ConstraintType.Unique)
|
||||
{
|
||||
Constraint = { ConstraintName = constraintName }
|
||||
};
|
||||
@@ -105,9 +93,7 @@ namespace Umbraco.Core.Persistence.Migrations.Syntax.Delete
|
||||
|
||||
public IDeleteDefaultConstraintOnTableSyntax DefaultConstraint()
|
||||
{
|
||||
var expression = _databaseProviders == null
|
||||
? new DeleteDefaultConstraintExpression()
|
||||
: new DeleteDefaultConstraintExpression(_context.CurrentDatabaseProvider, _databaseProviders);
|
||||
var expression = new DeleteDefaultConstraintExpression(_context.CurrentDatabaseProvider, _databaseProviders, _sqlSyntax);
|
||||
_context.Expressions.Add(expression);
|
||||
return new DeleteDefaultConstraintBuilder(expression);
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user