Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14746837
D18147.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D18147.diff
View Options
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -2162,6 +2162,7 @@
'PhabricatorBoolEditField' => 'applications/transactions/editfield/PhabricatorBoolEditField.php',
'PhabricatorBritishEnglishTranslation' => 'infrastructure/internationalization/translation/PhabricatorBritishEnglishTranslation.php',
'PhabricatorBuiltinDraftEngine' => 'applications/transactions/draft/PhabricatorBuiltinDraftEngine.php',
+ 'PhabricatorBuiltinFileCachePurger' => 'applications/cache/purger/PhabricatorBuiltinFileCachePurger.php',
'PhabricatorBuiltinPatchList' => 'infrastructure/storage/patch/PhabricatorBuiltinPatchList.php',
'PhabricatorBulkContentSource' => 'infrastructure/daemon/contentsource/PhabricatorBulkContentSource.php',
'PhabricatorCacheDAO' => 'applications/cache/storage/PhabricatorCacheDAO.php',
@@ -7362,6 +7363,7 @@
'PhabricatorBoolEditField' => 'PhabricatorEditField',
'PhabricatorBritishEnglishTranslation' => 'PhutilTranslation',
'PhabricatorBuiltinDraftEngine' => 'PhabricatorDraftEngine',
+ 'PhabricatorBuiltinFileCachePurger' => 'PhabricatorCachePurger',
'PhabricatorBuiltinPatchList' => 'PhabricatorSQLPatchList',
'PhabricatorBulkContentSource' => 'PhabricatorContentSource',
'PhabricatorCacheDAO' => 'PhabricatorLiskDAO',
diff --git a/src/applications/cache/management/PhabricatorCacheManagementPurgeWorkflow.php b/src/applications/cache/management/PhabricatorCacheManagementPurgeWorkflow.php
--- a/src/applications/cache/management/PhabricatorCacheManagementPurgeWorkflow.php
+++ b/src/applications/cache/management/PhabricatorCacheManagementPurgeWorkflow.php
@@ -64,7 +64,11 @@
}
}
+ $viewer = $this->getViewer();
+
foreach ($purgers as $key => $purger) {
+ $purger->setViewer($viewer);
+
echo tsprintf(
"%s\n",
pht(
diff --git a/src/applications/cache/purger/PhabricatorBuiltinFileCachePurger.php b/src/applications/cache/purger/PhabricatorBuiltinFileCachePurger.php
new file mode 100644
--- /dev/null
+++ b/src/applications/cache/purger/PhabricatorBuiltinFileCachePurger.php
@@ -0,0 +1,22 @@
+<?php
+
+final class PhabricatorBuiltinFileCachePurger
+ extends PhabricatorCachePurger {
+
+ const PURGERKEY = 'builtin-file';
+
+ public function purgeCache() {
+ $viewer = $this->getViewer();
+
+ $files = id(new PhabricatorFileQuery())
+ ->setViewer($viewer)
+ ->withIsBuiltin(true)
+ ->execute();
+
+ $engine = new PhabricatorDestructionEngine();
+ foreach ($files as $file) {
+ $engine->destroyObject($file);
+ }
+ }
+
+}
diff --git a/src/applications/files/query/PhabricatorFileQuery.php b/src/applications/files/query/PhabricatorFileQuery.php
--- a/src/applications/files/query/PhabricatorFileQuery.php
+++ b/src/applications/files/query/PhabricatorFileQuery.php
@@ -18,6 +18,7 @@
private $isDeleted;
private $needTransforms;
private $builtinKeys;
+ private $isBuiltin;
public function withIDs(array $ids) {
$this->ids = $ids;
@@ -54,6 +55,11 @@
return $this;
}
+ public function withIsBuiltin($is_builtin) {
+ $this->isBuiltin = $is_builtin;
+ return $this;
+ }
+
/**
* Select files which are transformations of some other file. For example,
* you can use this query to find previously generated thumbnails of an image
@@ -416,6 +422,18 @@
$this->builtinKeys);
}
+ if ($this->isBuiltin !== null) {
+ if ($this->isBuiltin) {
+ $where[] = qsprintf(
+ $conn,
+ 'builtinKey IS NOT NULL');
+ } else {
+ $where[] = qsprintf(
+ $conn,
+ 'builtinKey IS NULL');
+ }
+ }
+
return $where;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Jan 22, 9:54 AM (1 h, 56 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7029330
Default Alt Text
D18147.diff (3 KB)
Attached To
Mode
D18147: Add a cache purger for builtin files
Attached
Detach File
Event Timeline
Log In to Comment