Browse Source

Remove forum thread autolocking

spaghetti 4 years ago
parent
commit
bb0f0d66d8

+ 0
- 2
gazelle.sql View File

@@ -366,8 +366,6 @@ CREATE TABLE `forums` (
366 366
   `LastPostAuthorID` int(10) NOT NULL DEFAULT '0',
367 367
   `LastPostTopicID` int(10) NOT NULL DEFAULT '0',
368 368
   `LastPostTime` datetime,
369
-  `AutoLock` enum('0','1') DEFAULT '1',
370
-  `AutoLockWeeks` int(3) unsigned NOT NULL DEFAULT '4',
371 369
   PRIMARY KEY (`ID`),
372 370
   KEY `Sort` (`Sort`),
373 371
   KEY `MinClassRead` (`MinClassRead`)

+ 0
- 41
sections/schedule/daily/lock_old_threads.php View File

@@ -1,41 +0,0 @@
1
-<?
2
-//------------- Lock old threads ----------------------------------------//
3
-
4
-$DB->query("
5
-  SELECT t.ID, t.ForumID
6
-  FROM forums_topics AS t
7
-    JOIN forums AS f ON t.ForumID = f.ID
8
-  WHERE t.IsLocked = '0'
9
-    AND t.IsSticky = '0'
10
-    AND DATEDIFF(CURDATE(), DATE(t.LastPostTime)) / 7 > f.AutoLockWeeks
11
-    AND f.AutoLock = '1'");
12
-$IDs = $DB->collect('ID');
13
-$ForumIDs = $DB->collect('ForumID');
14
-
15
-if (count($IDs) > 0) {
16
-  $LockIDs = implode(',', $IDs);
17
-  $DB->query("
18
-    UPDATE forums_topics
19
-    SET IsLocked = '1'
20
-    WHERE ID IN($LockIDs)");
21
-  sleep(2);
22
-  $DB->query("
23
-    DELETE FROM forums_last_read_topics
24
-    WHERE TopicID IN($LockIDs)");
25
-
26
-  foreach ($IDs as $ID) {
27
-    $Cache->begin_transaction("thread_$ID".'_info');
28
-    $Cache->update_row(false, array('IsLocked' => '1'));
29
-    $Cache->commit_transaction(3600 * 24 * 30);
30
-    $Cache->expire_value("thread_$ID".'_catalogue_0', 3600 * 24 * 30);
31
-    $Cache->expire_value("thread_$ID".'_info', 3600 * 24 * 30);
32
-    Forums::add_topic_note($ID, 'Locked automatically by schedule', 0);
33
-  }
34
-
35
-  $ForumIDs = array_flip(array_flip($ForumIDs));
36
-  foreach ($ForumIDs as $ForumID) {
37
-    $Cache->delete_value("forums_$ForumID");
38
-  }
39
-}
40
-echo "Old threads locked\n";
41
-?>

+ 3
- 6
sections/tools/managers/forum_alter.php View File

@@ -28,7 +28,6 @@ if (isset($_POST['submit']) && $_POST['submit'] == 'Delete') { //Delete
28 28
   if ($P['minclassread'] > $LoggedUser['Class'] || $P['minclasswrite'] > $LoggedUser['Class'] || $P['minclasscreate'] > $LoggedUser['Class']) {
29 29
     error(403);
30 30
   }
31
-  $P['autolock'] = isset($_POST['autolock']) ? '1' : '0';
32 31
 
33 32
   if (isset($_POST['submit']) && $_POST['submit'] == 'Edit') { //Edit
34 33
     if (!is_number($_POST['id']) || $_POST['id'] == '') {
@@ -56,16 +55,14 @@ if (isset($_POST['submit']) && $_POST['submit'] == 'Delete') { //Delete
56 55
         Description = '$P[description]',
57 56
         MinClassRead = '$P[minclassread]',
58 57
         MinClassWrite = '$P[minclasswrite]',
59
-        MinClassCreate = '$P[minclasscreate]',
60
-        AutoLock = '$P[autolock]',
61
-        AutoLockWeeks = '$P[autolockweeks]'
58
+        MinClassCreate = '$P[minclasscreate]'
62 59
       WHERE ID = '$P[id]'");
63 60
   } else { //Create
64 61
     $DB->query("
65 62
       INSERT INTO forums
66
-        (Sort, CategoryID, Name, Description, MinClassRead, MinClassWrite, MinClassCreate, AutoLock, AutoLockWeeks)
63
+        (Sort, CategoryID, Name, Description, MinClassRead, MinClassWrite, MinClassCreate)
67 64
       VALUES
68
-        ('$P[sort]', '$P[categoryid]', '$P[name]', '$P[description]', '$P[minclassread]', '$P[minclasswrite]', '$P[minclasscreate]', '$P[autolock]', '$P[autolockweeks]')");
65
+        ('$P[sort]', '$P[categoryid]', '$P[name]', '$P[description]', '$P[minclassread]', '$P[minclasswrite]', '$P[minclasscreate]')");
69 66
   }
70 67
 }
71 68
 

+ 2
- 18
sections/tools/managers/forum_list.php View File

@@ -53,9 +53,7 @@ $DB->query('
53 53
     Description,
54 54
     MinClassRead,
55 55
     MinClassWrite,
56
-    MinClassCreate,
57
-    AutoLock,
58
-    AutoLockWeeks
56
+    MinClassCreate
59 57
   FROM forums
60 58
   ORDER BY CategoryID, Sort ASC');
61 59
 ?>
@@ -72,12 +70,10 @@ $DB->query('
72 70
     <td>Min class read</td>
73 71
     <td>Min class write</td>
74 72
     <td>Min class create</td>
75
-    <td>Auto-lock</td>
76
-    <td>Auto-lock weeks</td>
77 73
     <td>Submit</td>
78 74
   </tr>
79 75
 <?
80
-while (list($ID, $CategoryID, $Sort, $Name, $Description, $MinClassRead, $MinClassWrite, $MinClassCreate, $AutoLock, $AutoLockWeeks) = $DB->next_record()) {
76
+while (list($ID, $CategoryID, $Sort, $Name, $Description, $MinClassRead, $MinClassWrite, $MinClassCreate) = $DB->next_record()) {
81 77
 ?>
82 78
   <tr class="row">
83 79
     <form class="manage_form" name="forums" action="" method="post">
@@ -117,12 +113,6 @@ while (list($ID, $CategoryID, $Sort, $Name, $Description, $MinClassRead, $MinCla
117 113
           <?=class_list($MinClassCreate)?>
118 114
         </select>
119 115
       </td>
120
-      <td>
121
-        <input type="checkbox" name="autolock"<?=($AutoLock == '1') ? ' checked="checked"' : ''?> />
122
-      </td>
123
-      <td>
124
-        <input type="text" name="autolockweeks" value="<?=$AutoLockWeeks?>" />
125
-      </td>
126 116
       <td>
127 117
         <input type="submit" name="submit" value="Edit" />
128 118
         <input type="submit" name="submit" value="Delete" />
@@ -172,12 +162,6 @@ while (list($ID, $CategoryID, $Sort, $Name, $Description, $MinClassRead, $MinCla
172 162
           <?=class_list()?>
173 163
         </select>
174 164
       </td>
175
-      <td>
176
-        <input type="checkbox" name="autolock" checked="checked" />
177
-      </td>
178
-      <td>
179
-        <input type="text" name="autolockweeks" value="4" />
180
-      </td>
181 165
       <td>
182 166
         <input type="submit" value="Create" />
183 167
       </td>

Loading…
Cancel
Save