aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--phpBB/adm/style/acp_main.html6
-rw-r--r--phpBB/includes/acp/acp_main.php42
-rw-r--r--phpBB/language/en/acp/common.php6
3 files changed, 54 insertions, 0 deletions
diff --git a/phpBB/adm/style/acp_main.html b/phpBB/adm/style/acp_main.html
index 4b6bc1910d..3318215623 100644
--- a/phpBB/adm/style/acp_main.html
+++ b/phpBB/adm/style/acp_main.html
@@ -143,6 +143,12 @@
<dd><input type="hidden" name="action" value="purge_cache" /><input class="button2" type="submit" id="action_purge_cache" name="action_purge_cache" value="{L_RUN}" /></dd>
</dl>
</form>
+ <form id="action_purge_cache_form" method="post" action="{U_ACTION}">
+ <dl>
+ <dt><label for="action_purge_cache">{L_PURGE_SESSIONS}</label><br /><span>{L_PURGE_SESSIONS_EXPLAIN}</span></dt>
+ <dd><input type="hidden" name="action" value="purge_sessions" /><input class="button2" type="submit" id="action_purge_sessions" name="action_purge_sessions" value="{L_RUN}" /></dd>
+ </dl>
+ </form>
<!-- ENDIF -->
</fieldset>
<!-- ENDIF -->
diff --git a/phpBB/includes/acp/acp_main.php b/phpBB/includes/acp/acp_main.php
index 5d6bd40681..42f6aa0b8e 100644
--- a/phpBB/includes/acp/acp_main.php
+++ b/phpBB/includes/acp/acp_main.php
@@ -97,6 +97,10 @@ class acp_main
$confirm = true;
$confirm_lang = 'PURGE_CACHE_CONFIRM';
break;
+ case 'purge_sessions':
+ $confirm = true;
+ $confirm_lang = 'PURGE_SESSIONS_CONFIRM';
+ break;
default:
$confirm = true;
@@ -341,6 +345,44 @@ class acp_main
add_log('admin', 'LOG_PURGE_CACHE');
break;
+
+ case 'purge_sessions':
+ if ((int) $user->data['user_type'] !== USER_FOUNDER)
+ {
+ trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING);
+ }
+
+ $tables = array(CONFIRM_TABLE, SESSIONS_TABLE);
+
+ // DELETE would probably take a lot longer if we're dealing with a runaway table
+ foreach ($tables as $table)
+ {
+ $sql = "TRUNCATE TABLE $table";
+ $db->sql_query($sql);
+ }
+
+ // let's restore the admin session
+ $reinsert_ary = array(
+ 'session_id' => (string) $user->session_id,
+ 'session_page' => (string) substr($user->page['page'], 0, 199),
+ 'session_forum_id' => $user->page['forum'],
+ 'session_user_id' => (int) $user->data['user_id'],
+ 'session_start' => (int) $user->data['session_start'],
+ 'session_last_visit' => (int) $user->data['session_last_visit'],
+ 'session_time' => (int) $user->time_now,
+ 'session_browser' => (string) trim(substr($user->browser, 0, 149)),
+ 'session_forwarded_for' => (string) $user->forwarded_for,
+ 'session_ip' => (string) $user->ip,
+ 'session_autologin' => (int) $user->data['session_autologin'],
+ 'session_admin' => 1,
+ 'session_viewonline' => (int) $user->data['session_viewonline'],
+ );
+
+ $sql = 'INSERT INTO ' . SESSIONS_TABLE . ' ' . $db->sql_build_array('INSERT', $reinsert_ary);
+ $db->sql_query($sql);
+
+ add_log('admin', 'LOG_PURGE_SESSIONS');
+ break;
}
}
}
diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php
index 55c3ed0cac..efcf88e09a 100644
--- a/phpBB/language/en/acp/common.php
+++ b/phpBB/language/en/acp/common.php
@@ -136,6 +136,7 @@ $lang = array_merge($lang, array(
'ACP_PERMISSION_TRACE' => 'Permission trace',
'ACP_PHP_INFO' => 'PHP information',
'ACP_POST_SETTINGS' => 'Post settings',
+ 'ACP_PRUNE_ATTACHMENTS' => 'Prune attachments',
'ACP_PRUNE_FORUMS' => 'Prune forums',
'ACP_PRUNE_USERS' => 'Prune users',
'ACP_PRUNING' => 'Pruning',
@@ -339,6 +340,10 @@ $lang = array_merge($lang, array(
'PURGE_CACHE_CONFIRM' => 'Are you sure you wish to purge the cache?',
'PURGE_CACHE_EXPLAIN' => 'Purge all cache related items, this includes any cached template files or queries.',
+ 'PURGE_SESSIONS' => 'Purge all sessions',
+ 'PURGE_SESSIONS_CONFIRM' => 'Are you sure you wish to purge all sessions? This will log out all users.',
+ 'PURGE_SESSIONS_EXPLAIN' => 'Purge all sessions. This will log out all users by truncating the session table.',
+
'RESET_DATE' => 'Reset board’s start date',
'RESET_DATE_CONFIRM' => 'Are you sure you wish to reset the board’s start date?',
'RESET_ONLINE' => 'Reset most users ever online',
@@ -611,6 +616,7 @@ $lang = array_merge($lang, array(
'LOG_PROFILE_FIELD_REMOVED' => '<strong>Profile field removed</strong><br />» %s',
'LOG_PRUNE' => '<strong>Pruned forums</strong><br />» %s',
+ 'LOG_PRUNE_ATTACHMENTS' => '<strong>Pruned attachments</strong>',
'LOG_AUTO_PRUNE' => '<strong>Auto-pruned forums</strong><br />» %s',
'LOG_PRUNE_USER_DEAC' => '<strong>Users deactivated</strong><br />» %s',
'LOG_PRUNE_USER_DEL_DEL' => '<strong>Users pruned and posts deleted</strong><br />» %s',