Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F96363303
CelerityManagementMapWorkflow.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 25, 22:48
Size
1 KB
Mime Type
text/x-php
Expires
Fri, Dec 27, 22:48 (1 d, 11 h)
Engine
blob
Format
Raw Data
Handle
23172331
Attached To
rPH Phabricator
CelerityManagementMapWorkflow.php
View Options
<?php
final
class
CelerityManagementMapWorkflow
extends
CelerityManagementWorkflow
{
protected
function
didConstruct
()
{
$this
->
setName
(
'map'
)
->
setExamples
(
'**map** [options]'
)
->
setSynopsis
(
pht
(
'Rebuild static resource maps.'
))
->
setArguments
(
array
());
}
public
function
execute
(
PhutilArgumentParser
$args
)
{
$resources_map
=
CelerityPhysicalResources
::
getAll
();
$this
->
log
(
pht
(
'Rebuilding %d resource source(s).'
,
phutil_count
(
$resources_map
)));
foreach
(
$resources_map
as
$name
=>
$resources
)
{
$this
->
rebuildResources
(
$resources
);
}
$this
->
log
(
pht
(
'Done.'
));
return
0
;
}
/**
* Rebuild the resource map for a resource source.
*
* @param CelerityPhysicalResources Resource source to rebuild.
* @return void
*/
private
function
rebuildResources
(
CelerityPhysicalResources
$resources
)
{
$this
->
log
(
pht
(
'Rebuilding resource source "%s" (%s)...'
,
$resources
->
getName
(),
get_class
(
$resources
)));
id
(
new
CelerityResourceMapGenerator
(
$resources
))
->
setDebug
(
true
)
->
generate
()
->
write
();
}
protected
function
log
(
$message
)
{
$console
=
PhutilConsole
::
getConsole
();
$console
->
writeErr
(
"%s
\n
"
,
$message
);
}
}
Event Timeline
Log In to Comment