Page Menu
Home
GnuPG
Search
Configure Global Search
Log In
Files
F36276459
PhabricatorConfigKeySchema.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Size
2 KB
Subscribers
None
PhabricatorConfigKeySchema.php
View Options
<?php
final
class
PhabricatorConfigKeySchema
extends
PhabricatorConfigStorageSchema
{
const
MAX_INNODB_KEY_LENGTH
=
767
;
private
$columnNames
;
private
$unique
;
private
$table
;
private
$indexType
;
public
function
setIndexType
(
$index_type
)
{
$this
->
indexType
=
$index_type
;
return
$this
;
}
public
function
getIndexType
()
{
return
$this
->
indexType
;
}
public
function
setProperty
(
$property
)
{
$this
->
property
=
$property
;
return
$this
;
}
public
function
getProperty
()
{
return
$this
->
property
;
}
public
function
setUnique
(
$unique
)
{
$this
->
unique
=
$unique
;
return
$this
;
}
public
function
getUnique
()
{
return
$this
->
unique
;
}
public
function
setTable
(
PhabricatorConfigTableSchema
$table
)
{
$this
->
table
=
$table
;
return
$this
;
}
public
function
getTable
()
{
return
$this
->
table
;
}
public
function
setColumnNames
(
array
$column_names
)
{
$this
->
columnNames
=
array_values
(
$column_names
);
return
$this
;
}
public
function
getColumnNames
()
{
return
$this
->
columnNames
;
}
protected
function
getSubschemata
()
{
return
array
();
}
public
function
getKeyColumnAndPrefix
(
$column_name
)
{
$matches
=
null
;
if
(
preg_match
(
'/^(.*)
\(
(
\d
+)
\)\z
/'
,
$column_name
,
$matches
))
{
return
array
(
$matches
[
1
],
(
int
)
$matches
[
2
]);
}
else
{
return
array
(
$column_name
,
null
);
}
}
public
function
getKeyByteLength
()
{
$size
=
0
;
foreach
(
$this
->
getColumnNames
()
as
$column_spec
)
{
list
(
$column_name
,
$prefix
)
=
$this
->
getKeyColumnAndPrefix
(
$column_spec
);
$column
=
$this
->
getTable
()->
getColumn
(
$column_name
);
if
(!
$column
)
{
$size
=
0
;
break
;
}
$size
+=
$column
->
getKeyByteLength
(
$prefix
);
}
return
$size
;
}
protected
function
compareToSimilarSchema
(
PhabricatorConfigStorageSchema
$expect
)
{
$issues
=
array
();
if
(
$this
->
getColumnNames
()
!==
$expect
->
getColumnNames
())
{
$issues
[]
=
self
::
ISSUE_KEYCOLUMNS
;
}
if
(
$this
->
getUnique
()
!==
$expect
->
getUnique
())
{
$issues
[]
=
self
::
ISSUE_UNIQUE
;
}
// A fulltext index can be of any length.
if
(
$this
->
getIndexType
()
!=
'FULLTEXT'
)
{
if
(
$this
->
getKeyByteLength
()
>
self
::
MAX_INNODB_KEY_LENGTH
)
{
$issues
[]
=
self
::
ISSUE_LONGKEY
;
}
}
return
$issues
;
}
public
function
newEmptyClone
()
{
$clone
=
clone
$this
;
$this
->
table
=
null
;
return
$clone
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Feb 22, 6:44 PM (1 d, 18 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
13/71/48dc5181b9c047650bd2e8bd6523
Attached To
rPHAB Phabricator
Event Timeline
Log In to Comment