You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: config/vanilla/bootstrap.early.php
+8-9Lines changed: 8 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -159,17 +159,16 @@
159
159
->column('CountWatchedCategories', 'int', null)
160
160
->set(false, false);
161
161
162
-
// Set count of Watched Categories for users
162
+
// Set count of WatchedCategories for users
163
163
Gdn::sql()->query('update GDN_User u set u.CountWatchedCategories = (
164
-
select count(c.CategoryID) from GDN_Category c, (select distinct SUBSTRING_INDEX(um.Name, ".", -1) as CategoryID from GDN_UserMeta um
165
-
where um.Name LIKE "Preferences.%" AND um.UserID = u.UserID and Value = 1) ws where ws.CategoryID = c.CategoryID)', 'update');
164
+
select count(c.CategoryID) from GDN_Category c, (select distinct CAST(SUBSTRING_INDEX(um.Name, ".", -1) as UNSIGNED) as CategoryID from GDN_UserMeta um
165
+
where um.Name LIKE "Preferences.%" AND UserID = u.UserID and Value = 1) ws where ws.CategoryID = c.CategoryID)', 'update');
// Re-calculate count of Watched Categories if CountWatchedCategories is null
170
-
// Remove it later. It should be executed only once when the column is added
171
-
Gdn::sql()->query('update GDN_User u set u.CountWatchedCategories = (
172
-
select count(c.CategoryID) from GDN_Category c, (select distinct SUBSTRING_INDEX(um.Name, ".", -1) as CategoryID from GDN_UserMeta um
173
-
where um.Name LIKE "Preferences.%" AND um.UserID = u.UserID and Value = 1) ws where ws.CategoryID = c.CategoryID) where CountWatchedCategories is null', 'update');
174
-
170
+
// Re-calculate count of WatchedCategories if WatchedCategories is null
171
+
// Gdn::sql()->query('update GDN_User u set u.CountWatchedCategories = (
172
+
// select count(c.CategoryID) from GDN_Category c, (select distinct CAST(SUBSTRING_INDEX(um.Name, ".", -1) as UNSIGNED) as CategoryID from GDN_UserMeta um
173
+
// where um.Name LIKE "Preferences.%" AND UserID = u.UserID and Value = 1) ws where ws.CategoryID = c.CategoryID) where CountWatchedCategories is null', 'update');
0 commit comments