Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F97577843
PhabricatorElasticsearchHost.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
Sun, Jan 5, 10:08
Size
1 KB
Mime Type
text/x-php
Expires
Tue, Jan 7, 10:08 (2 d)
Engine
blob
Format
Raw Data
Handle
23430037
Attached To
rPH Phabricator
PhabricatorElasticsearchHost.php
View Options
<?php
final
class
PhabricatorElasticsearchHost
extends
PhabricatorSearchHost
{
private
$version
=
5
;
private
$path
=
'phabricator/'
;
private
$protocol
=
'http'
;
const
KEY_REFS
=
'search.elastic.refs'
;
public
function
setConfig
(
$config
)
{
$this
->
setRoles
(
idx
(
$config
,
'roles'
,
$this
->
getRoles
()))
->
setHost
(
idx
(
$config
,
'host'
,
$this
->
host
))
->
setPort
(
idx
(
$config
,
'port'
,
$this
->
port
))
->
setProtocol
(
idx
(
$config
,
'protocol'
,
$this
->
protocol
))
->
setPath
(
idx
(
$config
,
'path'
,
$this
->
path
))
->
setVersion
(
idx
(
$config
,
'version'
,
$this
->
version
));
return
$this
;
}
public
function
getDisplayName
()
{
return
pht
(
'Elasticsearch'
);
}
public
function
getStatusViewColumns
()
{
return
array
(
pht
(
'Protocol'
)
=>
$this
->
getProtocol
(),
pht
(
'Host'
)
=>
$this
->
getHost
(),
pht
(
'Port'
)
=>
$this
->
getPort
(),
pht
(
'Index Path'
)
=>
$this
->
getPath
(),
pht
(
'Elastic Version'
)
=>
$this
->
getVersion
(),
pht
(
'Roles'
)
=>
implode
(
', '
,
array_keys
(
$this
->
getRoles
())),
);
}
public
function
setProtocol
(
$protocol
)
{
$this
->
protocol
=
$protocol
;
return
$this
;
}
public
function
getProtocol
()
{
return
$this
->
protocol
;
}
public
function
setPath
(
$path
)
{
$this
->
path
=
$path
;
return
$this
;
}
public
function
getPath
()
{
return
$this
->
path
;
}
public
function
setVersion
(
$version
)
{
$this
->
version
=
$version
;
return
$this
;
}
public
function
getVersion
()
{
return
$this
->
version
;
}
public
function
getURI
(
$to_path
=
null
)
{
$uri
=
id
(
new
PhutilURI
(
'http://'
.
$this
->
getHost
()))
->
setProtocol
(
$this
->
getProtocol
())
->
setPort
(
$this
->
getPort
())
->
setPath
(
$this
->
getPath
());
if
(
$to_path
)
{
$uri
->
appendPath
(
$to_path
);
}
return
$uri
;
}
public
function
getConnectionStatus
()
{
$status
=
$this
->
getEngine
()->
indexIsSane
(
$this
);
return
$status
?
parent
::
STATUS_OKAY
:
parent
::
STATUS_FAIL
;
}
}
Event Timeline
Log In to Comment