-
Notifications
You must be signed in to change notification settings - Fork 754
/
Copy path08.00.00.25.SqlDataProvider
860 lines (790 loc) · 31.8 KB
/
08.00.00.25.SqlDataProvider
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
/* DNN-7141 PageOutputCache */
/*****************************/
/* Add New OutputCache Table */
/*****************************/
IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'{databaseOwner}{objectQualifier}OutputCache') AND OBJECTPROPERTY(id, N'IsTable') = 1)
CREATE TABLE {databaseOwner}{objectQualifier}OutputCache
(
[CacheKey] VarChar (36) NOT NULL,
[ItemId] Int NOT NULL,
[Data] nVarChar(Max) NOT NULL,
[Expiration] DateTime NOT NULL,
CONSTRAINT [PK_{objectQualifier}OutputCache] PRIMARY KEY CLUSTERED ([CacheKey] ASC)
)
GO
/* Add New OutputCacheGetItem */
/*******************************/
IF EXISTS (SELECT * FROM sys.procedures WHERE object_id = object_id(N'{databaseOwner}[{objectQualifier}OutputCacheGetItem]'))
DROP PROCEDURE {databaseOwner}{objectQualifier}OutputCacheGetItem
GO
CREATE PROCEDURE {databaseOwner}{objectQualifier}OutputCacheGetItem
@CacheKey VarChar (36)
AS
BEGIN
SELECT *
FROM {databaseOwner}{objectQualifier}OutputCache
WHERE CacheKey = @CacheKey
END
GO
/* Add New OutputCacheAddItem */
/*******************************/
IF EXISTS (SELECT * FROM sys.procedures WHERE object_id = object_id(N'{databaseOwner}[{objectQualifier}OutputCacheAddItem]'))
DROP PROCEDURE {databaseOwner}{objectQualifier}OutputCacheAddItem
GO
CREATE PROCEDURE {databaseOwner}{objectQualifier}OutputCacheAddItem
@ItemId Int,
@CacheKey VarChar ( 36),
@Data nVarChar(Max),
@Expiration DateTime
AS
BEGIN
INSERT INTO {databaseOwner}{objectQualifier}OutputCache
( ItemId,
CacheKey,
Data,
Expiration
) VALUES
( @ItemId,
@CacheKey,
@Data,
@Expiration
)
END
GO
/* Add New OutputCacheGetItemCount */
/************************************/
IF EXISTS (SELECT * FROM sys.procedures WHERE object_id = object_id(N'{databaseOwner}[{objectQualifier}OutputCacheGetItemCount]'))
DROP PROCEDURE {databaseOwner}{objectQualifier}OutputCacheGetItemCount
GO
CREATE PROCEDURE {databaseOwner}{objectQualifier}OutputCacheGetItemCount
@ItemId int
AS
BEGIN
SELECT COUNT(*) N
FROM {databaseOwner}{objectQualifier}OutputCache
WHERE ItemId = @ItemId
END
GO
/* Add New OutputCachePurgeCache */
/**********************************/
IF EXISTS (SELECT * FROM sys.procedures WHERE object_id = object_id(N'{databaseOwner}[{objectQualifier}OutputCachePurgeCache]'))
DROP PROCEDURE {databaseOwner}{objectQualifier}OutputCachePurgeCache
GO
CREATE PROCEDURE {databaseOwner}{objectQualifier}OutputCachePurgeCache
AS
BEGIN
DELETE
FROM {databaseOwner}{objectQualifier}OutputCache
END
GO
/* Add New OutputCachePurgeExpiredItems */
/*****************************************/
IF EXISTS (SELECT * FROM sys.procedures WHERE object_id = object_id(N'{databaseOwner}[{objectQualifier}OutputCachePurgeExpiredItems]'))
DROP PROCEDURE {databaseOwner}{objectQualifier}OutputCachePurgeExpiredItems
GO
CREATE PROCEDURE {databaseOwner}{objectQualifier}OutputCachePurgeExpiredItems
@CurrentUtcDateTime DateTime
AS
BEGIN
DELETE
FROM {databaseOwner}{objectQualifier}OutputCache
WHERE Expiration <= @CurrentUtcDateTime
END
GO
/* Add New OutputCacheRemoveItem */
/**********************************/
IF EXISTS (SELECT * FROM sys.procedures WHERE object_id = object_id(N'{databaseOwner}[{objectQualifier}OutputCacheRemoveItem]'))
DROP PROCEDURE {databaseOwner}{objectQualifier}OutputCacheRemoveItem
GO
CREATE PROCEDURE {databaseOwner}{objectQualifier}OutputCacheRemoveItem
@ItemId Int
AS
BEGIN
DELETE
FROM {databaseOwner}{objectQualifier}OutputCache
WHERE ItemId = @ItemId
END
GO
/* Add New OutputCacheGetKeys */
/*******************************/
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'{databaseOwner}[{objectQualifier}OutputCacheGetKeys]') AND OBJECTPROPERTY(id, N'IsPROCEDURE') = 1)
DROP PROCEDURE {databaseOwner}{objectQualifier}OutputCacheGetKeys
GO
CREATE PROCEDURE {databaseOwner}{objectQualifier}OutputCacheGetKeys
@ItemId Int
AS
BEGIN
DELETE
FROM {databaseOwner}{objectQualifier}OutputCache
WHERE ItemId = @ItemId OR @ItemId IS NULL
END
GO
/* Add PurgeOutputCache Schedule Job */
/*************************************/
IF NOT EXISTS(SELECT 1 FROM {databaseOwner}{objectQualifier}Schedule WHERE TypeFullName = 'DotNetNuke.Services.OutputCache.PurgeOutputCache, DotNetNuke')
BEGIN
INSERT INTO {databaseOwner}{objectQualifier}Schedule
( [TypeFullName]
,[TimeLapse]
,[TimeLapseMeasurement]
,[RetryTimeLapse]
,[RetryTimeLapseMeasurement]
,[RetainHistoryNum]
,[AttachToEvent]
,[CatchUpEnabled]
,[Enabled]
,[ObjectDependencies]
,[Servers]
,[CreatedByUserID]
,[CreatedOnDate]
,[LastModifiedByUserID]
,[LastModifiedOnDate]
,[FriendlyName]
) VALUES
( 'DotNetNuke.Services.OutputCache.PurgeOutputCache, DotNetNuke'
,1
,N'm'
,30
,N's'
,10
,N''
,0
,0
,N'OutputCache'
,NULL
,NULL
,NULL
,NULL
,NULL
,N'Purge Output Cache'
)
END
GO
/* DNN-6758 */
/************/
-- make sure, the column size has been increased (just in case):
DECLARE @MaxLen SmallInt = 0;
SELECT @MaxLen = max_length FROM Sys.Columns WHERE Object_ID = Object_ID(N'{databaseOwner}[{objectQualifier}Tabs]') AND Name = 'IconFile'
IF @MaxLen > 0 AND @MaxLen < 255
ALTER TABLE {databaseOwner}[{objectQualifier}Tabs] ALTER COLUMN IconFile nVarChar(255);
GO
DECLARE @MaxLen SmallInt = 0;
SELECT @MaxLen = max_length FROM Sys.Columns WHERE Object_ID = Object_ID(N'{databaseOwner}[{objectQualifier}Tabs]') AND Name = 'IconFileLarge'
IF @MaxLen > 0 AND @MaxLen < 255
ALTER TABLE {databaseOwner}[{objectQualifier}Tabs] ALTER COLUMN IconFileLarge nVarChar(255);
GO
IF EXISTS (SELECT * FROM sys.procedures WHERE object_id = object_id(N'{databaseOwner}[{objectQualifier}AddTab]'))
DROP PROCEDURE {databaseOwner}[{objectQualifier}AddTab]
GO
CREATE PROCEDURE {databaseOwner}[{objectQualifier}AddTab]
@ContentItemID Int,
@PortalID Int,
@TabOrder Int,
@UniqueId UniqueIdentifier,
@VersionGuid UniqueIdentifier,
@DefaultLanguageGuid UniqueIdentifier,
@LocalizedVersionGuid UniqueIdentifier,
@TabName nVarChar(200),
@IsVisible Bit,
@DisableLink Bit,
@ParentId Int,
@IconFile nVarChar(255),
@IconFileLarge nVarChar(255),
@Title nVarChar(200),
@Description nVarChar(500),
@KeyWords nVarChar(500),
@Url nVarChar(255),
@SkinSrc nVarChar(200),
@ContainerSrc nVarChar(200),
@StartDate DateTime,
@EndDate DateTime,
@RefreshInterval Int,
@PageHeadText nVarChar(Max),
@IsSecure Bit,
@PermanentRedirect Bit,
@SiteMapPriority Float,
@CreatedByUserID Int,
@CultureCode nVarChar( 10),
@IsSystem bit
AS
BEGIN
INSERT INTO {databaseOwner}{objectQualifier}Tabs (
ContentItemID,
PortalID,
TabOrder,
UniqueId,
VersionGuid,
DefaultLanguageGuid,
LocalizedVersionGuid,
TabName,
IsVisible,
DisableLink,
ParentId,
IconFile,
IconFileLarge,
Title,
Description,
KeyWords,
IsDeleted,
Url,
SkinSrc,
ContainerSrc,
StartDate,
EndDate,
RefreshInterval,
PageHeadText,
IsSecure,
PermanentRedirect,
SiteMapPriority,
CreatedByUserID,
CreatedOnDate,
LastModifiedByUserID,
LastModifiedOnDate,
CultureCode,
IsSystem
)
VALUES (
@ContentItemID,
@PortalID,
@TabOrder,
@UniqueId,
@VersionGuid,
@DefaultLanguageGuid,
@LocalizedVersionGuid,
@TabName,
@IsVisible,
@DisableLink,
@ParentId,
@IconFile,
@IconFileLarge,
@Title,
@Description,
@KeyWords,
0,
@Url,
@SkinSrc,
@ContainerSrc,
@StartDate,
@EndDate,
@RefreshInterval,
@PageHeadText,
@IsSecure,
@PermanentRedirect,
@SiteMapPriority,
@CreatedByUserID,
getdate(),
@CreatedByUserID,
getdate(),
@CultureCode,
@IsSystem
)
DECLARE @TabId Int = SCOPE_IDENTITY();
EXEC {databaseOwner}{objectQualifier}BuildTabLevelAndPath @TabId;
SELECT @TabId;
RETURN @TabId;
END /* Procedure */
GO
IF EXISTS (SELECT * FROM sys.procedures WHERE object_id = object_id(N'{databaseOwner}[{objectQualifier}UpdateTab]'))
DROP PROCEDURE {databaseOwner}[{objectQualifier}UpdateTab]
GO
CREATE PROCEDURE {databaseOwner}[{objectQualifier}UpdateTab]
@TabId Int,
@ContentItemID Int,
@PortalId Int,
@VersionGuid UniqueIdentifier,
@DefaultLanguageGuid UniqueIdentifier,
@LocalizedVersionGuid UniqueIdentifier,
@TabName nVarChar(200),
@IsVisible Bit,
@DisableLink Bit,
@ParentId Int,
@IconFile nVarChar(255),
@IconFileLarge nVarChar(255),
@Title nVarChar(200),
@Description nVarChar(500),
@KeyWords nVarChar(500),
@IsDeleted Bit,
@Url nVarChar(255),
@SkinSrc nVarChar(200),
@ContainerSrc nVarChar(200),
@StartDate DateTime,
@EndDate DateTime,
@RefreshInterval Int,
@PageHeadText nVarChar(max),
@IsSecure Bit,
@PermanentRedirect Bit,
@SiteMapPriority Float,
@LastModifiedByUserID Int,
@CultureCode nVarChar( 10),
@IsSystem Bit
AS
BEGIN
DECLARE @OldParentId Int
SET @OldParentId = (SELECT ParentId FROM {databaseOwner}[{objectQualifier}Tabs] WHERE TabID = @TabId)
DECLARE @TabOrder Int
SET @TabOrder = (SELECT TabOrder FROM {databaseOwner}[{objectQualifier}Tabs] WHERE TabID = @TabId)
-- Get New TabOrder
DECLARE @NewTabOrder Int
SET @NewTabOrder = (SELECT MAX(TabOrder) FROM {databaseOwner}[{objectQualifier}Tabs] WHERE (ParentId = @ParentId OR (ParentId IS NULL AND @ParentId IS NULL)))
IF @NewTabOrder IS NULL
SET @NewTabOrder = 1
ELSE
SET @NewTabOrder = @NewTabOrder + 2
UPDATE {databaseOwner}[{objectQualifier}Tabs]
SET
ContentItemID = @ContentItemID,
PortalId = @PortalId,
VersionGuid = @VersionGuid,
DefaultLanguageGuid = @DefaultLanguageGuid,
LocalizedVersionGuid = @LocalizedVersionGuid,
TabName = @TabName,
IsVisible = @IsVisible,
DisableLink = @DisableLink,
ParentId = @ParentId,
IconFile = @IconFile,
IconFileLarge = @IconFileLarge,
Title = @Title,
Description = @Description,
KeyWords = @KeyWords,
IsDeleted = @IsDeleted,
Url = @Url,
SkinSrc = @SkinSrc,
ContainerSrc = @ContainerSrc,
StartDate = @StartDate,
EndDate = @EndDate,
RefreshInterval = @RefreshInterval,
PageHeadText = @PageHeadText,
IsSecure = @IsSecure,
PermanentRedirect = @PermanentRedirect,
SiteMapPriority = @SiteMapPriority,
LastModifiedByUserID = @LastModifiedByUserID,
LastModifiedOnDate = getdate(),
CultureCode = @CultureCode,
IsSystem = @IsSystem
WHERE TabId = @TabId;
IF (@OldParentId <> @ParentId) BEGIN
-- update TabOrder of Tabs with same original Parent
UPDATE {databaseOwner}[{objectQualifier}Tabs]
SET TabOrder = TabOrder - 2
WHERE (ParentId = @OldParentId)
AND TabOrder > @TabOrder
-- Update Tab with new TabOrder
UPDATE {databaseOwner}[{objectQualifier}Tabs]
SET TabOrder = @NewTabOrder
WHERE TabID = @TabId
END /* IF */
EXEC {databaseOwner}{objectQualifier}BuildTabLevelAndPath @TabId, 1
END /* Procedure */
GO
IF EXISTS (SELECT * FROM sys.procedures WHERE object_id = object_id(N'{databaseOwner}[{objectQualifier}AddTabAfter]'))
DROP PROCEDURE {databaseOwner}[{objectQualifier}AddTabAfter]
GO
CREATE PROCEDURE {databaseOwner}[{objectQualifier}AddTabAfter]
@AfterTabID Int,
@ContentItemID Int,
@PortalID Int,
@UniqueID UniqueIdentifier,
@VersionGuid UniqueIdentifier,
@DefaultLanguageGuid UniqueIdentifier,
@LocalizedVersionGuid UniqueIdentifier,
@TabName nVarChar(200),
@IsVisible Bit,
@DisableLink Bit,
@ParentID Int,
@IconFile nVarChar(255),
@IconFileLarge nVarChar(255),
@Title nVarChar(200),
@Description nVarChar(500),
@KeyWords nVarChar(500),
@Url nVarChar(255),
@SkinSrc nVarChar(200),
@ContainerSrc nVarChar(200),
@StartDate DateTime,
@EndDate DateTime,
@RefreshInterval Int,
@PageHeadText nVarChar(max),
@IsSecure Bit,
@PermanentRedirect Bit,
@SiteMapPriority Float,
@CreatedByUserID Int,
@CultureCode nVarChar( 10),
@IsSystem Bit
AS
BEGIN
DECLARE @TabId Int
DECLARE @TabOrder Int = (SELECT TabOrder FROM {databaseOwner}{objectQualifier}Tabs WHERE TabID = @AfterTabID)
-- Update TabOrders for all Tabs higher than @TabOrder
UPDATE {databaseOwner}{objectQualifier}Tabs
SET TabOrder = TabOrder + 2
WHERE (ParentId = @ParentID OR (ParentId IS NULL AND @ParentID IS NULL))
AND TabOrder > @TabOrder
AND (PortalId = @PortalID OR (PortalId IS NULL AND @PortalID IS NULL))
-- Create Tab
SET @TabOrder = @TabOrder + 2
EXECUTE @TabId = {databaseOwner}{objectQualifier}AddTab
@ContentItemID,
@PortalID,
@TabOrder,
@UniqueId,
@VersionGuid,
@DefaultLanguageGuid,
@LocalizedVersionGuid,
@TabName,
@IsVisible,
@DisableLink,
@ParentID,
@IconFile,
@IconFileLarge,
@Title,
@Description,
@KeyWords,
@Url,
@SkinSrc,
@ContainerSrc,
@StartDate,
@EndDate,
@RefreshInterval,
@PageHeadText,
@IsSecure,
@PermanentRedirect,
@SiteMapPriority,
@CreatedByUserID,
@CultureCode,
@IsSystem;
-- Update Content Item
UPDATE {databaseOwner}{objectQualifier}ContentItems
SET TabID = @TabId
WHERE ContentItemID = @ContentItemID;
SELECT @TabId;
END /* Procedure */
GO
IF EXISTS (SELECT * FROM sys.procedures WHERE object_id = object_id(N'{databaseOwner}[{objectQualifier}AddTabBefore]'))
DROP PROCEDURE {databaseOwner}[{objectQualifier}AddTabBefore]
GO
CREATE PROCEDURE {databaseOwner}[{objectQualifier}AddTabBefore]
@BeforeTabID Int,
@ContentItemID Int,
@PortalID Int,
@UniqueID UniqueIdentifier,
@VersionGuid UniqueIdentifier,
@DefaultLanguageGuid UniqueIdentifier,
@LocalizedVersionGuid UniqueIdentifier,
@TabName nVarChar(200),
@IsVisible Bit,
@DisableLink Bit,
@ParentID Int,
@IconFile nVarChar(255),
@IconFileLarge nVarChar(255),
@Title nVarChar(200),
@Description nVarChar(500),
@KeyWords nVarChar(500),
@Url nVarChar(255),
@SkinSrc nVarChar(200),
@ContainerSrc nVarChar(200),
@StartDate DateTime,
@EndDate DateTime,
@RefreshInterval Int,
@PageHeadText nVarChar(max),
@IsSecure Bit,
@PermanentRedirect Bit,
@SiteMapPriority Float,
@CreatedByUserID Int,
@CultureCode nVarChar( 10),
@IsSystem Bit
AS
BEGIN
DECLARE @TabID Int
DECLARE @TabOrder Int = (SELECT TabOrder FROM {databaseOwner}{objectQualifier}Tabs WHERE TabID = @BeforeTabID);
-- Update TabOrders for all Tabs higher than @TabOrder
UPDATE {databaseOwner}{objectQualifier}Tabs
SET TabOrder = TabOrder + 2
WHERE (ParentId = @ParentId OR (ParentID IS NULL AND @ParentID IS NULL))
AND TabOrder >= @TabOrder
AND (PortalId = @PortalId OR (PortalID IS NULL AND @PortalID IS NULL))
-- Create Tab
EXECUTE @TabId = {databaseOwner}{objectQualifier}AddTab
@ContentItemID,
@PortalID,
@TabOrder,
@UniqueID,
@VersionGuid,
@DefaultLanguageGuid,
@LocalizedVersionGuid,
@TabName,
@IsVisible,
@DisableLink,
@ParentID,
@IconFile,
@IconFileLarge,
@Title,
@Description,
@KeyWords,
@Url,
@SkinSrc,
@ContainerSrc,
@StartDate,
@EndDate,
@RefreshInterval,
@PageHeadText,
@IsSecure,
@PermanentRedirect,
@SiteMapPriority,
@CreatedByUserID,
@CultureCode,
@IsSystem;
-- Update Content Item
UPDATE {databaseOwner}{objectQualifier}ContentItems
SET TabID = @TabId
WHERE ContentItemID = @ContentItemID;
SELECT @TabId;
END /* Procedure */
GO
IF EXISTS (SELECT * FROM sys.procedures WHERE object_id = object_id(N'{databaseOwner}[{objectQualifier}AddTabToEnd]'))
DROP PROCEDURE {databaseOwner}[{objectQualifier}AddTabToEnd]
GO
CREATE PROCEDURE {databaseOwner}{objectQualifier}AddTabToEnd
@ContentItemID Int,
@PortalID Int,
@UniqueID UniqueIdentifier,
@VersionGuid UniqueIdentifier,
@DefaultLanguageGuid UniqueIdentifier,
@LocalizedVersionGuid UniqueIdentifier,
@TabName nVarChar(200),
@IsVisible Bit,
@DisableLink Bit,
@ParentID Int,
@IconFile nVarChar(255),
@IconFileLarge nVarChar(255),
@Title nVarChar(200),
@Description nVarChar(500),
@KeyWords nVarChar(500),
@Url nVarChar(255),
@SkinSrc nVarChar(200),
@ContainerSrc nVarChar(200),
@StartDate DateTime,
@EndDate DateTime,
@RefreshInterval Int,
@PageHeadText nVarChar(max),
@IsSecure Bit,
@PermanentRedirect Bit,
@SiteMapPriority Float,
@CreatedByUserID Int,
@CultureCode nVarChar( 10),
@IsSystem Bit
AS
BEGIN
DECLARE @TabId Int
DECLARE @TabOrder Int
SET @TabOrder = (SELECT MAX(TabOrder) FROM {databaseOwner}{objectQualifier}Tabs
WHERE (PortalId = @PortalID OR (PortalID IS NULL AND @PortalID IS NULL))
AND (ParentId = @ParentID OR (ParentID IS NULL AND @ParentID IS NULL))
)
IF @TabOrder IS NULL
SET @TabOrder = 1
ELSE
SET @TabOrder = @TabOrder + 2
-- Create Tab
EXECUTE @TabId = {databaseOwner}{objectQualifier}AddTab
@ContentItemID,
@PortalID,
@TabOrder,
@UniqueId,
@VersionGuid,
@DefaultLanguageGuid,
@LocalizedVersionGuid,
@TabName,
@IsVisible,
@DisableLink,
@ParentId,
@IconFile,
@IconFileLarge,
@Title,
@Description,
@KeyWords,
@Url,
@SkinSrc,
@ContainerSrc,
@StartDate,
@EndDate,
@RefreshInterval,
@PageHeadText,
@IsSecure,
@PermanentRedirect,
@SiteMapPriority,
@CreatedByUserID,
@CultureCode,
@IsSystem;
-- Update Content Item
UPDATE {databaseOwner}{objectQualifier}ContentItems
SET TabID = @TabId
WHERE ContentItemID = @ContentItemID;
SELECT @TabId;
END /* Procedure */
GO
/* Update version number in DesktopModules */
/*******************************************/
DECLARE @version NVARCHAR(8)
SET @version = '08.00.00'
UPDATE {databaseOwner}{objectQualifier}DesktopModules SET Version = @version WHERE ModuleName='Authentication'
UPDATE {databaseOwner}{objectQualifier}DesktopModules SET Version = @version WHERE ModuleName='Portals'
UPDATE {databaseOwner}{objectQualifier}DesktopModules SET Version = @version WHERE ModuleName='HostSettings'
UPDATE {databaseOwner}{objectQualifier}DesktopModules SET Version = @version WHERE ModuleName='Scheduler'
UPDATE {databaseOwner}{objectQualifier}DesktopModules SET Version = @version WHERE ModuleName='SearchAdmin'
UPDATE {databaseOwner}{objectQualifier}DesktopModules SET Version = @version WHERE ModuleName='Security'
UPDATE {databaseOwner}{objectQualifier}DesktopModules SET Version = @version WHERE ModuleName='SearchResults'
UPDATE {databaseOwner}{objectQualifier}DesktopModules SET Version = @version WHERE ModuleName='Extensions'
UPDATE {databaseOwner}{objectQualifier}DesktopModules SET Version = @version WHERE ModuleName='ViewProfile'
UPDATE {databaseOwner}{objectQualifier}DesktopModules SET Version = @version WHERE ModuleName='Registration'
UPDATE {databaseOwner}{objectQualifier}Packages SET Version = @version WHERE Name='DotNetNuke.Authentication'
UPDATE {databaseOwner}{objectQualifier}Packages SET Version = @version WHERE Name='DotNetNuke.Banners'
UPDATE {databaseOwner}{objectQualifier}Packages SET Version = @version WHERE Name='DotNetNuke.HostSettings'
UPDATE {databaseOwner}{objectQualifier}Packages SET Version = @version WHERE Name='DotNetNuke.Portals'
UPDATE {databaseOwner}{objectQualifier}Packages SET Version = @version WHERE Name='DotNetNuke.Scheduler'
UPDATE {databaseOwner}{objectQualifier}Packages SET Version = @version WHERE Name='DotNetNuke.SearchAdmin'
UPDATE {databaseOwner}{objectQualifier}Packages SET Version = @version WHERE Name='DotNetNuke.SearchResults'
UPDATE {databaseOwner}{objectQualifier}Packages SET Version = @version WHERE Name='DotNetNuke.Security'
UPDATE {databaseOwner}{objectQualifier}Packages SET Version = @version WHERE Name='DotNetNuke.ACTIONBUTTONSkinObject'
UPDATE {databaseOwner}{objectQualifier}Packages SET Version = @version WHERE Name='DotNetNuke.ACTIONSSkinObject'
UPDATE {databaseOwner}{objectQualifier}Packages SET Version = @version WHERE Name='DotNetNuke.BANNERSkinObject'
UPDATE {databaseOwner}{objectQualifier}Packages SET Version = @version WHERE Name='DotNetNuke.BREADCRUMBSkinObject'
UPDATE {databaseOwner}{objectQualifier}Packages SET Version = @version WHERE Name='DotNetNuke.COPYRIGHTSkinObject'
UPDATE {databaseOwner}{objectQualifier}Packages SET Version = @version WHERE Name='DotNetNuke.CURRENTDATESkinObject'
UPDATE {databaseOwner}{objectQualifier}Packages SET Version = @version WHERE Name='DotNetNuke.DOTNETNUKESkinObject'
UPDATE {databaseOwner}{objectQualifier}Packages SET Version = @version WHERE Name='DotNetNuke.DROPDOWNACTIONSSkinObject'
UPDATE {databaseOwner}{objectQualifier}Packages SET Version = @version WHERE Name='DotNetNuke.HELPSkinObject'
UPDATE {databaseOwner}{objectQualifier}Packages SET Version = @version WHERE Name='DotNetNuke.HOSTNAMESkinObject'
UPDATE {databaseOwner}{objectQualifier}Packages SET Version = @version WHERE Name='DotNetNuke.ICONSkinObject'
UPDATE {databaseOwner}{objectQualifier}Packages SET Version = @version WHERE Name='DotNetNuke.LANGUAGESkinObject'
UPDATE {databaseOwner}{objectQualifier}Packages SET Version = @version WHERE Name='DotNetNuke.LINKACTIONSSkinObject'
UPDATE {databaseOwner}{objectQualifier}Packages SET Version = @version WHERE Name='DotNetNuke.LINKSSkinObject'
UPDATE {databaseOwner}{objectQualifier}Packages SET Version = @version WHERE Name='DotNetNuke.LOGINSkinObject'
UPDATE {databaseOwner}{objectQualifier}Packages SET Version = @version WHERE Name='DotNetNuke.LOGOSkinObject'
UPDATE {databaseOwner}{objectQualifier}Packages SET Version = @version WHERE Name='DotNetNuke.MENUSkinObject'
UPDATE {databaseOwner}{objectQualifier}Packages SET Version = @version WHERE Name='DotNetNuke.NAVSkinObject'
UPDATE {databaseOwner}{objectQualifier}Packages SET Version = @version WHERE Name='DotNetNuke.PRINTMODULESkinObject'
UPDATE {databaseOwner}{objectQualifier}Packages SET Version = @version WHERE Name='DotNetNuke.PRIVACYSkinObject'
UPDATE {databaseOwner}{objectQualifier}Packages SET Version = @version WHERE Name='DotNetNuke.SEARCHSkinObject'
UPDATE {databaseOwner}{objectQualifier}Packages SET Version = @version WHERE Name='DotNetNuke.SIGNINSkinObject'
UPDATE {databaseOwner}{objectQualifier}Packages SET Version = @version WHERE Name='DotNetNuke.TERMSSkinObject'
UPDATE {databaseOwner}{objectQualifier}Packages SET Version = @version WHERE Name='DotNetNuke.TITLESkinObject'
UPDATE {databaseOwner}{objectQualifier}Packages SET Version = @version WHERE Name='DotNetNuke.TREEVIEWSkinObject'
UPDATE {databaseOwner}{objectQualifier}Packages SET Version = @version WHERE Name='DotNetNuke.USERSkinObject'
UPDATE {databaseOwner}{objectQualifier}Packages SET Version = @version WHERE Name='DotNetNuke.VISIBILITYSkinObject'
UPDATE {databaseOwner}{objectQualifier}Packages SET Version = @version WHERE Name='DotNetNuke.Extensions'
UPDATE {databaseOwner}{objectQualifier}Packages SET Version = @version WHERE Name='DotNetNuke.TEXTSkinObject'
UPDATE {databaseOwner}{objectQualifier}Packages SET Version = @version WHERE Name='DotNetNuke.STYLESSkinObject'
UPDATE {databaseOwner}{objectQualifier}Packages SET Version = @version WHERE Name='DotNetNuke.LEFTMENUSkinObject'
UPDATE {databaseOwner}{objectQualifier}Packages SET Version = @version WHERE Name='DotNetNuke.JQUERYSkinObject'
UPDATE {databaseOwner}{objectQualifier}Packages SET Version = @version WHERE Name='DotNetNuke.CONTROLPANEL.SkinObject'
UPDATE {databaseOwner}{objectQualifier}Packages SET Version = @version WHERE Name='DefaultAuthentication'
UPDATE {databaseOwner}{objectQualifier}Packages SET Version = @version WHERE Name='DotNetNuke.ViewProfile'
UPDATE {databaseOwner}{objectQualifier}Packages SET Version = @version WHERE Name='DotNetNuke.TagsSkinObject'
UPDATE {databaseOwner}{objectQualifier}Packages SET Version = @version WHERE Name='DotNetNuke.Registration'
UPDATE {databaseOwner}{objectQualifier}Packages SET Version = @version WHERE Name='DotNetNuke.ToastSkinObject'
GO
/*********************************************************************/
/* DNN-8058 - Remove HMAC code from Platform */
/*********************************************************************/
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'{databaseOwner}[{objectQualifier}GetUserByHmacAppId]') AND type in (N'P', N'PC'))
DROP PROCEDURE {databaseOwner}[{objectQualifier}GetUserByHmacAppId]
GO
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'{databaseOwner}[{objectQualifier}GetHmacSecretByHmacAppId]') AND type in (N'P', N'PC'))
DROP PROCEDURE {databaseOwner}[{objectQualifier}GetHmacSecretByHmacAppId]
GO
IF EXISTS (SELECT * FROM Sys.Views WHERE (name = N'{objectQualifier}vw_Users'))
DROP VIEW {databaseOwner}[{objectQualifier}vw_Users]
GO
CREATE VIEW {databaseOwner}[{objectQualifier}vw_Users]
AS
SELECT U.UserId,
UP.PortalId,
U.Username,
U.FirstName,
U.LastName,
U.DisplayName,
U.IsSuperUser,
U.Email,
UP.VanityUrl,
U.AffiliateId,
IsNull(UP.IsDeleted, U.IsDeleted) AS IsDeleted,
UP.RefreshRoles,
U.LastIPAddress,
U.UpdatePassword,
U.PasswordResetToken,
U.PasswordResetExpiration,
UP.Authorised,
U.CreatedByUserId,
U.CreatedOnDate,
U.LastModifiedByUserId,
U.LastModifiedOnDate
FROM {databaseOwner}[{objectQualifier}Users] AS U
LEFT JOIN {databaseOwner}[{objectQualifier}UserPortals] AS UP
ON CASE WHEN U.IsSuperuser = 1 THEN 0 ELSE U.UserId END = UP.UserId
GO
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'{databaseOwner}[{objectQualifier}UpdateUser]') AND type in (N'P', N'PC'))
DROP PROCEDURE {databaseOwner}[{objectQualifier}UpdateUser]
GO
CREATE PROCEDURE {databaseOwner}[{objectQualifier}UpdateUser]
@UserID int,
@PortalID int,
@FirstName nvarchar(50),
@LastName nvarchar(50),
@IsSuperUser bit,
@Email nvarchar(256),
@DisplayName nvarchar(100),
@VanityUrl nvarchar(100),
@UpdatePassword bit,
@Authorised bit,
@RefreshRoles bit,
@LastIPAddress nvarchar(50),
@passwordResetToken uniqueidentifier,
@passwordResetExpiration datetime,
@IsDeleted bit,
@LastModifiedByUserID int
AS
UPDATE {databaseOwner}{objectQualifier}Users
SET
FirstName = @FirstName,
LastName = @LastName,
IsSuperUser = @IsSuperUser,
Email = @Email,
DisplayName = @DisplayName,
UpdatePassword = @UpdatePassword,
PasswordResetToken=@passwordResetToken,
PasswordResetExpiration=@passwordResetExpiration,
LastIPAddress = @LastIPAddress,
LastModifiedByUserID = @LastModifiedByUserID,
LastModifiedOnDate = getdate()
WHERE UserId = @UserID
IF @PortalID IS NULL
BEGIN
UPDATE {databaseOwner}{objectQualifier}Users
SET
IsDeleted = @IsDeleted
WHERE UserId = @UserID
END
ELSE
BEGIN
UPDATE {databaseOwner}{objectQualifier}UserPortals
SET
Authorised = @Authorised,
RefreshRoles = @RefreshRoles,
VanityUrl = @VanityUrl,
IsDeleted = @IsDeleted
WHERE UserId = @UserID
AND PortalId = @PortalID
END
GO
IF EXISTS (SELECT * FROM Sys.columns
WHERE name = N'HmacAppId'
AND object_id = OBJECT_ID(N'{databaseOwner}[{objectQualifier}Users]'))
ALTER TABLE {databaseOwner}[{objectQualifier}Users]
DROP COLUMN HmacAppId
GO
IF EXISTS (SELECT * FROM Sys.columns
WHERE name = N'HmacAppSecret'
AND object_id = OBJECT_ID(N'{databaseOwner}[{objectQualifier}Users]'))
ALTER TABLE {databaseOwner}[{objectQualifier}Users]
DROP COLUMN HmacAppSecret
GO
/*********************************************************************/