Skip to content

Commit a012602

Browse files
authored
Merge pull request #1914 from johnhenley/dev10/issues-deprecated-1909-b
TASK: Remove deprecated methods and properties, and SQL procedures
2 parents ad28779 + 34732f6 commit a012602

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

Dnn.CommunityForums/sql/10.00.00.SqlDataProvider

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,36 @@ IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'{databaseOwn
149149
DROP PROCEDURE {databaseOwner}[{objectQualifier}activeforums_UserProfiles_Members]
150150
GO
151151

152+
/*activeforums_UserProfiles_UpdateActivity*/
153+
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'{databaseOwner}[{objectQualifier}activeforums_UserProfiles_UpdateActivity]') AND type in (N'P', N'PC'))
154+
DROP PROCEDURE {databaseOwner}[{objectQualifier}activeforums_UserProfiles_UpdateActivity]
155+
GO
156+
CREATE PROCEDURE {databaseOwner}[{objectQualifier}activeforums_UserProfiles_UpdateActivity]
157+
@PortalId int,
158+
@UserId int
159+
160+
AS
161+
If @UserId > 0
162+
IF NOT EXISTS(Select ProfileId FROM {databaseOwner}{objectQualifier}activeforums_UserProfiles WHERE UserId = @UserId AND PortalId = @PortalId)
163+
BEGIN
164+
INSERT INTO {databaseOwner}{objectQualifier}activeforums_UserProfiles
165+
(UserId, PortalId, DateLastActivity)
166+
VALUES
167+
(@UserId, @PortalId, GETUTCDATE())
168+
DECLARE @TopicCount int
169+
DECLARE @ReplyCount int
170+
SELECT @TopicCount = Count(*) FROM {databaseOwner}{objectQualifier}activeforums_Topics as T INNER JOIN
171+
{databaseOwner}{objectQualifier}activeforums_Content as C ON T.ContentId = C.ContentId
172+
WHERE c.authorid = @UserId
173+
SELECT @ReplyCount = Count(*) FROM {databaseOwner}{objectQualifier}activeforums_Replies as R INNER JOIN
174+
{databaseOwner}{objectQualifier}activeforums_Content as C ON R.ContentId = C.ContentId
175+
WHERE c.authorid = @UserId
176+
UPDATE {databaseOwner}{objectQualifier}activeforums_UserProfiles
177+
SET TopicCount = @TopicCount, ReplyCount = @ReplyCount WHERE UserId = @UserId AND PortalId = @PortalId
178+
END
179+
UPDATE {databaseOwner}{objectQualifier}activeforums_UserProfiles SET DateLastActivity = GETUTCDATE() WHERE UserId = @UserId and PortalId = @PortalId
180+
GO
181+
152182
/* issue 1909 - end - remove deprecated procedures */
153183

154184

0 commit comments

Comments
 (0)