Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F1315188
20170316.rawfiles.01.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
20170316.rawfiles.01.php
View Options
<?php
// Previously, files generated by "View Raw File" were written as permanent
// files with excessively wide view permissions. This destroys these files
// so they are recreated as temporary files with correct permissions when
// next accessed.
$table
=
new
DifferentialChangeset
();
$conn
=
$table
->
establishConnection
(
'w'
);
$viewer
=
PhabricatorUser
::
getOmnipotentUser
();
$iterator
=
new
LiskRawMigrationIterator
(
$conn
,
$table
->
getTableName
());
echo
tsprintf
(
"%s
\n
"
,
pht
(
'Purging old raw changeset file caches...'
));
$keys
=
array
(
'raw:new:phid'
,
'raw:old:phid'
,
);
foreach
(
$iterator
as
$changeset
)
{
try
{
$metadata
=
phutil_json_decode
(
$changeset
[
'metadata'
]);
$phids
=
array
();
foreach
(
$keys
as
$key
)
{
if
(
isset
(
$metadata
[
$key
]))
{
$phids
[]
=
$metadata
[
$key
];
}
}
foreach
(
$phids
as
$phid
)
{
$file
=
id
(
new
PhabricatorFileQuery
())
->
setViewer
(
$viewer
)
->
withPHIDs
(
array
(
$phid
))
->
executeOne
();
if
(
$file
)
{
id
(
new
PhabricatorDestructionEngine
())
->
destroyObject
(
$file
);
}
}
// NOTE: We don't bother updating the changeset record itself: we already
// regenerate the cache properly if the stored value isn't valid.
}
catch
(
Exception
$ex
)
{
// Just move on if we run into trouble.
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, Jul 5, 2:57 PM (1 d, 18 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
313544
Default Alt Text
20170316.rawfiles.01.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment