Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F91529634
AlmanacNetwork.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
Mon, Nov 11, 22:59
Size
2 KB
Mime Type
text/x-php
Expires
Wed, Nov 13, 22:59 (2 d)
Engine
blob
Format
Raw Data
Handle
22277640
Attached To
rPH Phabricator
AlmanacNetwork.php
View Options
<?php
final
class
AlmanacNetwork
extends
AlmanacDAO
implements
PhabricatorApplicationTransactionInterface
,
PhabricatorPolicyInterface
,
PhabricatorDestructibleInterface
{
protected
$name
;
protected
$mailKey
;
protected
$viewPolicy
;
protected
$editPolicy
;
public
static
function
initializeNewNetwork
()
{
return
id
(
new
AlmanacNetwork
())
->
setViewPolicy
(
PhabricatorPolicies
::
POLICY_USER
)
->
setEditPolicy
(
PhabricatorPolicies
::
POLICY_ADMIN
);
}
protected
function
getConfiguration
()
{
return
array
(
self
::
CONFIG_AUX_PHID
=>
true
,
self
::
CONFIG_COLUMN_SCHEMA
=>
array
(
'name'
=>
'text128'
,
'mailKey'
=>
'bytes20'
,
),
)
+
parent
::
getConfiguration
();
}
public
function
generatePHID
()
{
return
PhabricatorPHID
::
generateNewPHID
(
AlmanacNetworkPHIDType
::
TYPECONST
);
}
public
function
save
()
{
if
(!
$this
->
mailKey
)
{
$this
->
mailKey
=
Filesystem
::
readRandomCharacters
(
20
);
}
return
parent
::
save
();
}
public
function
getURI
()
{
return
'/almanac/network/'
.
$this
->
getID
().
'/'
;
}
/* -( PhabricatorApplicationTransactionInterface )------------------------- */
public
function
getApplicationTransactionEditor
()
{
return
new
AlmanacNetworkEditor
();
}
public
function
getApplicationTransactionObject
()
{
return
$this
;
}
public
function
getApplicationTransactionTemplate
()
{
return
new
AlmanacNetworkTransaction
();
}
public
function
willRenderTimeline
(
PhabricatorApplicationTransactionView
$timeline
,
AphrontRequest
$request
)
{
return
$timeline
;
}
/* -( PhabricatorPolicyInterface )----------------------------------------- */
public
function
getCapabilities
()
{
return
array
(
PhabricatorPolicyCapability
::
CAN_VIEW
,
PhabricatorPolicyCapability
::
CAN_EDIT
,
);
}
public
function
getPolicy
(
$capability
)
{
switch
(
$capability
)
{
case
PhabricatorPolicyCapability
::
CAN_VIEW
:
return
$this
->
getViewPolicy
();
case
PhabricatorPolicyCapability
::
CAN_EDIT
:
return
$this
->
getEditPolicy
();
}
}
public
function
hasAutomaticCapability
(
$capability
,
PhabricatorUser
$viewer
)
{
return
false
;
}
public
function
describeAutomaticCapability
(
$capability
)
{
return
null
;
}
/* -( PhabricatorDestructibleInterface )----------------------------------- */
public
function
destroyObjectPermanently
(
PhabricatorDestructionEngine
$engine
)
{
$interfaces
=
id
(
new
AlmanacInterfaceQuery
())
->
setViewer
(
PhabricatorUser
::
getOmnipotentUser
())
->
withNetworkPHIDs
(
array
(
$this
->
getPHID
()))
->
execute
();
foreach
(
$interfaces
as
$interface
)
{
$engine
->
destroyObject
(
$interface
);
}
$this
->
delete
();
}
}
Event Timeline
Log In to Comment