Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F982944
20170811.differential.01.status.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
20170811.differential.01.status.php
View Options
<?php
// Migrate saved Differential revision queries from using a "<select />"
// control with hard-coded status groups for status selection to using a
// tokenizer with status functions.
$table
=
new
PhabricatorSavedQuery
();
$conn
=
$table
->
establishConnection
(
'w'
);
$status_map
=
array
(
'status-open'
=>
array
(
'open()'
),
'status-closed'
=>
array
(
'closed()'
),
'status-accepted'
=>
array
(
'accepted'
),
'status-needs-review'
=>
array
(
'needs-review'
),
'status-needs-revision'
=>
array
(
'needs-revision'
),
'status-abandoned'
=>
array
(
'abandoned'
),
);
foreach
(
new
LiskMigrationIterator
(
$table
)
as
$query
)
{
if
(
$query
->
getEngineClassName
()
!==
'DifferentialRevisionSearchEngine'
)
{
// This isn't a revision query.
continue
;
}
$parameters
=
$query
->
getParameters
();
$status
=
idx
(
$parameters
,
'status'
);
if
(!
$status
)
{
// This query didn't specify a "status" value.
continue
;
}
if
(!
isset
(
$status_map
[
$status
]))
{
// The "status" value is unknown, or does not correspond to a
// modern "status" constraint.
continue
;
}
$parameters
[
'statuses'
]
=
$status_map
[
$status
];
queryfx
(
$conn
,
'UPDATE %T SET parameters = %s WHERE id = %d'
,
$table
->
getTableName
(),
phutil_json_encode
(
$parameters
),
$query
->
getID
());
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Wed, Jun 18, 2:00 PM (1 d, 23 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
236562
Default Alt Text
20170811.differential.01.status.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment