Code Duplication    Length = 13-13 lines in 4 locations

sources/subs/ScheduledTask/WeeklyMaintenance.php 4 locations

@@ 76-88 (lines=13) @@
73
			if (!empty($modSettings['pruningOptions']) && strpos($modSettings['pruningOptions'], ',') !== false)
74
				list ($modSettings['pruneErrorLog'], $modSettings['pruneModLog'], $modSettings['pruneBanLog'], $modSettings['pruneReportLog'], $modSettings['pruneScheduledTaskLog'], $modSettings['pruneSpiderHitLog']) = explode(',', $modSettings['pruningOptions']);
75
76
			if (!empty($modSettings['pruneErrorLog']))
77
			{
78
				// Figure out when our cutoff time is.  1 day = 86400 seconds.
79
				$t = time() - $modSettings['pruneErrorLog'] * 86400;
80
81
				$db->query('', '
82
					DELETE FROM {db_prefix}log_errors
83
					WHERE log_time < {int:log_time}',
84
					array(
85
						'log_time' => $t,
86
					)
87
				);
88
			}
89
90
			if (!empty($modSettings['pruneModLog']))
91
			{
@@ 106-118 (lines=13) @@
103
				);
104
			}
105
106
			if (!empty($modSettings['pruneBanLog']))
107
			{
108
				// Figure out when our cutoff time is.  1 day = 86400 seconds.
109
				$t = time() - $modSettings['pruneBanLog'] * 86400;
110
111
				$db->query('', '
112
					DELETE FROM {db_prefix}log_banned
113
					WHERE log_time < {int:log_time}',
114
					array(
115
						'log_time' => $t,
116
					)
117
				);
118
			}
119
120
			if (!empty($modSettings['pruneBadbehaviorLog']))
121
			{
@@ 120-132 (lines=13) @@
117
				);
118
			}
119
120
			if (!empty($modSettings['pruneBadbehaviorLog']))
121
			{
122
				// Figure out when our cutoff time is.  1 day = 86400 seconds.
123
				$t = time() - $modSettings['pruneBadbehaviorLog'] * 86400;
124
125
				$db->query('', '
126
					DELETE FROM {db_prefix}log_badbehavior
127
					WHERE log_time < {int:log_time}',
128
					array(
129
						'log_time' => $t,
130
					)
131
				);
132
			}
133
134
			if (!empty($modSettings['pruneReportLog']))
135
			{
@@ 176-188 (lines=13) @@
173
				}
174
			}
175
176
			if (!empty($modSettings['pruneScheduledTaskLog']))
177
			{
178
				// Figure out when our cutoff time is.  1 day = 86400 seconds.
179
				$t = time() - $modSettings['pruneScheduledTaskLog'] * 86400;
180
181
				$db->query('', '
182
					DELETE FROM {db_prefix}log_scheduled_tasks
183
					WHERE time_run < {int:time_run}',
184
					array(
185
						'time_run' => $t,
186
					)
187
				);
188
			}
189
190
			if (!empty($modSettings['pruneSpiderHitLog']))
191
			{