mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 00:42:41 +01:00
Add --purge-user to bin/cache purge
Summary: Ref T4103. Provide a CLI mechanism for purging the user cache. Test Plan: - Purged with `--purge-user` and `--purge-all`. - Verified cache table got wiped. Reviewers: chad Reviewed By: chad Maniphest Tasks: T4103 Differential Revision: https://secure.phabricator.com/D16033
This commit is contained in:
parent
fc45de29a6
commit
e3f4f051fe
1 changed files with 21 additions and 0 deletions
|
@ -26,6 +26,10 @@ final class PhabricatorCacheManagementPurgeWorkflow
|
|||
'name' => 'purge-general',
|
||||
'help' => pht('Purge the general cache.'),
|
||||
),
|
||||
array(
|
||||
'name' => 'purge-user',
|
||||
'help' => pht('Purge the user cache.'),
|
||||
),
|
||||
));
|
||||
}
|
||||
|
||||
|
@ -38,6 +42,7 @@ final class PhabricatorCacheManagementPurgeWorkflow
|
|||
'remarkup' => $purge_all || $args->getArg('purge-remarkup'),
|
||||
'changeset' => $purge_all || $args->getArg('purge-changeset'),
|
||||
'general' => $purge_all || $args->getArg('purge-general'),
|
||||
'user' => $purge_all || $args->getArg('purge-user'),
|
||||
);
|
||||
|
||||
if (!array_filter($purge)) {
|
||||
|
@ -72,6 +77,12 @@ final class PhabricatorCacheManagementPurgeWorkflow
|
|||
$this->purgeGeneralCache();
|
||||
$console->writeOut("%s\n", pht('Done.'));
|
||||
}
|
||||
|
||||
if ($purge['user']) {
|
||||
$console->writeOut(pht('Purging user cache...'));
|
||||
$this->purgeUserCache();
|
||||
$console->writeOut("%s\n", pht('Done.'));
|
||||
}
|
||||
}
|
||||
|
||||
private function purgeRemarkupCache() {
|
||||
|
@ -100,4 +111,14 @@ final class PhabricatorCacheManagementPurgeWorkflow
|
|||
'cache_general');
|
||||
}
|
||||
|
||||
private function purgeUserCache() {
|
||||
$table = new PhabricatorUserCache();
|
||||
$conn_w = $table->establishConnection('w');
|
||||
|
||||
queryfx(
|
||||
$conn_w,
|
||||
'TRUNCATE TABLE %T',
|
||||
$table->getTableName());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue