Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F94183605
20160503.repo.04.mirrormigrate.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, Dec 4, 13:31
Size
959 B
Mime Type
text/x-php
Expires
Fri, Dec 6, 13:31 (2 d)
Engine
blob
Format
Raw Data
Handle
22753094
Attached To
rPH Phabricator
20160503.repo.04.mirrormigrate.php
View Options
<?php
$table
=
new
PhabricatorRepository
();
$conn_w
=
$table
->
establishConnection
(
'w'
);
$mirrors
=
queryfx_all
(
$conn_w
,
'SELECT * FROM %T'
,
'repository_mirror'
);
foreach
(
$mirrors
as
$mirror
)
{
$repository_phid
=
$mirror
[
'repositoryPHID'
];
$uri
=
$mirror
[
'remoteURI'
];
$already_exists
=
id
(
new
PhabricatorRepositoryURI
())->
loadOneWhere
(
'repositoryPHID = %s AND uri = %s'
,
$repository_phid
,
$uri
);
if
(
$already_exists
)
{
// Decline to migrate stuff that looks like it was already migrated.
continue
;
}
$new_uri
=
PhabricatorRepositoryURI
::
initializeNewURI
()
->
setIOType
(
PhabricatorRepositoryURI
::
IO_MIRROR
)
->
setRepositoryPHID
(
$repository_phid
)
->
setURI
(
$uri
)
->
setCredentialPHID
(
$mirror
[
'credentialPHID'
])
->
setDateCreated
(
$mirror
[
'dateCreated'
])
->
setDateModified
(
$mirror
[
'dateModified'
])
->
save
();
echo
tsprintf
(
"%s
\n
"
,
pht
(
'Migrated mirror "%s".'
,
$uri
));
}
Event Timeline
Log In to Comment