Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F19081878
PhabricatorFilesOnDiskBuiltinFile.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
PhabricatorFilesOnDiskBuiltinFile.php
View Options
<?php
final
class
PhabricatorFilesOnDiskBuiltinFile
extends
PhabricatorFilesBuiltinFile
{
private
$name
;
public
function
setName
(
$name
)
{
$this
->
name
=
$name
;
return
$this
;
}
public
function
getName
()
{
if
(
$this
->
name
===
null
)
{
throw
new
PhutilInvalidStateException
(
'setName'
);
}
return
$this
->
name
;
}
public
function
getBuiltinDisplayName
()
{
return
$this
->
getName
();
}
public
function
getBuiltinFileKey
()
{
$name
=
$this
->
getName
();
$desc
=
"disk(name={$name})"
;
$hash
=
PhabricatorHash
::
digestToLength
(
$desc
,
40
);
return
"builtin:{$hash}"
;
}
public
function
loadBuiltinFileData
()
{
$name
=
$this
->
getName
();
$available
=
$this
->
getAllBuiltinFiles
();
if
(
empty
(
$available
[
$name
]))
{
throw
new
Exception
(
pht
(
'Builtin "%s" does not exist!'
,
$name
));
}
return
Filesystem
::
readFile
(
$available
[
$name
]);
}
private
function
getAllBuiltinFiles
()
{
$root
=
dirname
(
phutil_get_library_root
(
'phabricator'
));
$root
=
$root
.
'/resources/builtin/'
;
$map
=
array
();
$list
=
id
(
new
FileFinder
(
$root
))
->
withType
(
'f'
)
->
withFollowSymlinks
(
true
)
->
find
();
foreach
(
$list
as
$file
)
{
$map
[
$file
]
=
$root
.
$file
;
}
return
$map
;
}
public
function
getProjectBuiltinFiles
()
{
$root
=
dirname
(
phutil_get_library_root
(
'phabricator'
));
$root
=
$root
.
'/resources/builtin/projects/'
;
$map
=
array
();
$list
=
id
(
new
FileFinder
(
$root
))
->
withType
(
'f'
)
->
withFollowSymlinks
(
true
)
->
find
();
foreach
(
$list
as
$file
)
{
$map
[
$file
]
=
$root
.
$file
;
}
return
$map
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Thu, Dec 4, 8:40 AM (1 d, 19 h)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
8329267
Default Alt Text
PhabricatorFilesOnDiskBuiltinFile.php (1 KB)
Attached To
Mode
rP Phabricator
Attached
Detach File
Event Timeline
Log In to Comment