Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Paste
P2088
nuker.php
Active
Public
Actions
Authored by
epriestley
on Apr 6 2018, 12:03 AM.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Award Token
Flag For Later
Tags
None
Referenced Files
F5507990: nuker.php
Apr 6 2018, 12:03 AM
2018-04-06 00:03:47 (UTC+0)
Subscribers
None
<?php
require_once
'/usr/local/phab/phabricator/scripts/__init_script__.php'
;
$phids
=
file_get_contents
(
'php://stdin'
);
$phids
=
explode
(
"
\n
"
,
$phids
);
$phids
=
array_filter
(
$phids
);
$diff_table
=
id
(
new
DifferentialDiff
())->
getTableName
();
$changeset_table
=
id
(
new
DifferentialChangeset
())->
getTableName
();
$property_table
=
id
(
new
DifferentialDiffProperty
())->
getTableName
();
$hunk_table
=
id
(
new
DifferentialHunk
())->
getTableName
();
$modern_table
=
id
(
new
DifferentialHunkModern
())->
getTableName
();
$conn
=
id
(
new
DifferentialDiff
())->
establishConnection
(
'w'
);
foreach
(
$phids
as
$phid
)
{
$diff
=
id
(
new
DifferentialDiff
())->
loadOneWhere
(
'phid = %s'
,
$phid
);
if
(!
$diff
)
{
echo
'x'
;
continue
;
}
$diff_id
=
$diff
->
getID
();
queryfx
(
$conn
,
'DELETE FROM %T WHERE diffID = %d'
,
$property_table
,
$diff_id
);
$changesets
=
queryfx_all
(
$conn
,
'SELECT id FROM %T WHERE diffID = %d'
,
$changeset_table
,
$diff_id
)
$changeset_ids
=
ipull
(
$changesets
,
'id'
);
if
(
$changeset_ids
)
{
queryfx
(
$conn
,
'DELETE FROM %T WHERE changesetID IN (%Ld)'
,
$hunk_table
,
$changeset_ids
);
queryfx
(
$conn
,
'DELETE FROM %T WHERE changesetID IN (%Ld)'
,
$modern_table
,
$changeset_ids
);
}
quefyfx
(
$conn
,
'DELETE FROM %T WHERE diffID = %d'
,
$changeset_table
,
$diff_id
);
queryfx
(
$conn
,
'DELETE FROM %T WHERE id = %d'
,
$diff_table
,
$diff_id
);
echo
'.'
;
}
Event Timeline
epriestley
created this paste.
Apr 6 2018, 12:03 AM
2018-04-06 00:03:47 (UTC+0)
Log In to Comment