Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F90924
D7780.diff
All Users
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
5 KB
Referenced Files
None
Subscribers
None
D7780.diff
View Options
diff --git a/resources/sql/patches/20131217.pushlogphid.1.col.sql b/resources/sql/patches/20131217.pushlogphid.1.col.sql
new file mode 100644
--- /dev/null
+++ b/resources/sql/patches/20131217.pushlogphid.1.col.sql
@@ -0,0 +1,2 @@
+ALTER TABLE {$NAMESPACE}_repository.repository_pushlog
+ ADD phid VARCHAR(64) NOT NULL COLLATE utf8_bin AFTER id;
diff --git a/resources/sql/patches/20131217.pushlogphid.2.mig.php b/resources/sql/patches/20131217.pushlogphid.2.mig.php
new file mode 100644
--- /dev/null
+++ b/resources/sql/patches/20131217.pushlogphid.2.mig.php
@@ -0,0 +1,20 @@
+<?php
+
+$table = new PhabricatorRepositoryPushLog();
+$conn_w = $table->establishConnection('w');
+
+echo "Assigning PHIDs to push logs...\n";
+
+$logs = new LiskMigrationIterator($table);
+foreach ($logs as $log) {
+ $id = $log->getID();
+ echo "Updating {$id}...\n";
+ queryfx(
+ $conn_w,
+ 'UPDATE %T SET phid = %s WHERE id = %d',
+ $table->getTableName(),
+ $log->generatePHID(),
+ $id);
+}
+
+echo "Done.\n";
diff --git a/resources/sql/patches/20131217.pushlogphid.3.key.sql b/resources/sql/patches/20131217.pushlogphid.3.key.sql
new file mode 100644
--- /dev/null
+++ b/resources/sql/patches/20131217.pushlogphid.3.key.sql
@@ -0,0 +1,2 @@
+ALTER TABLE {$NAMESPACE}_repository.repository_pushlog
+ ADD UNIQUE KEY `key_phid` (phid);
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -1798,6 +1798,7 @@
'PhabricatorRepositoryPHIDTypeArcanistProject' => 'applications/repository/phid/PhabricatorRepositoryPHIDTypeArcanistProject.php',
'PhabricatorRepositoryPHIDTypeCommit' => 'applications/repository/phid/PhabricatorRepositoryPHIDTypeCommit.php',
'PhabricatorRepositoryPHIDTypeMirror' => 'applications/repository/phid/PhabricatorRepositoryPHIDTypeMirror.php',
+ 'PhabricatorRepositoryPHIDTypePushLog' => 'applications/repository/phid/PhabricatorRepositoryPHIDTypePushLog.php',
'PhabricatorRepositoryPHIDTypeRepository' => 'applications/repository/phid/PhabricatorRepositoryPHIDTypeRepository.php',
'PhabricatorRepositoryPullEngine' => 'applications/repository/engine/PhabricatorRepositoryPullEngine.php',
'PhabricatorRepositoryPullLocalDaemon' => 'applications/repository/daemon/PhabricatorRepositoryPullLocalDaemon.php',
@@ -4363,6 +4364,7 @@
'PhabricatorRepositoryPHIDTypeArcanistProject' => 'PhabricatorPHIDType',
'PhabricatorRepositoryPHIDTypeCommit' => 'PhabricatorPHIDType',
'PhabricatorRepositoryPHIDTypeMirror' => 'PhabricatorPHIDType',
+ 'PhabricatorRepositoryPHIDTypePushLog' => 'PhabricatorPHIDType',
'PhabricatorRepositoryPHIDTypeRepository' => 'PhabricatorPHIDType',
'PhabricatorRepositoryPullEngine' => 'PhabricatorRepositoryEngine',
'PhabricatorRepositoryPullLocalDaemon' => 'PhabricatorDaemon',
diff --git a/src/applications/repository/phid/PhabricatorRepositoryPHIDTypePushLog.php b/src/applications/repository/phid/PhabricatorRepositoryPHIDTypePushLog.php
new file mode 100644
--- /dev/null
+++ b/src/applications/repository/phid/PhabricatorRepositoryPHIDTypePushLog.php
@@ -0,0 +1,44 @@
+<?php
+
+final class PhabricatorRepositoryPHIDTypePushLog
+ extends PhabricatorPHIDType {
+
+ const TYPECONST = 'PSHL';
+
+ public function getTypeConstant() {
+ return self::TYPECONST;
+ }
+
+ public function getTypeName() {
+ return pht('Push Log');
+ }
+
+ public function newObject() {
+ return new PhabricatorRepositoryPushLog();
+ }
+
+ protected function buildQueryForObjects(
+ PhabricatorObjectQuery $query,
+ array $phids) {
+
+ return id(new PhabricatorRepositoryPushLogQuery())
+ ->withPHIDs($phids);
+ }
+
+ public function loadHandles(
+ PhabricatorHandleQuery $query,
+ array $handles,
+ array $objects) {
+
+ foreach ($handles as $phid => $handle) {
+ $log = $objects[$phid];
+
+ $handle->setName(pht('Push Log %d', $log->getID()));
+ }
+ }
+
+ public function canLoadNamedObject($name) {
+ return false;
+ }
+
+}
diff --git a/src/applications/repository/storage/PhabricatorRepositoryPushLog.php b/src/applications/repository/storage/PhabricatorRepositoryPushLog.php
--- a/src/applications/repository/storage/PhabricatorRepositoryPushLog.php
+++ b/src/applications/repository/storage/PhabricatorRepositoryPushLog.php
@@ -57,10 +57,16 @@
public function getConfiguration() {
return array(
+ self::CONFIG_AUX_PHID => true,
self::CONFIG_TIMESTAMPS => false,
) + parent::getConfiguration();
}
+ public function generatePHID() {
+ return PhabricatorPHID::generateNewPHID(
+ PhabricatorRepositoryPHIDTypePushLog::TYPECONST);
+ }
+
public function attachRepository(PhabricatorRepository $repository) {
$this->repository = $repository;
return $this;
diff --git a/src/infrastructure/storage/patch/PhabricatorBuiltinPatchList.php b/src/infrastructure/storage/patch/PhabricatorBuiltinPatchList.php
--- a/src/infrastructure/storage/patch/PhabricatorBuiltinPatchList.php
+++ b/src/infrastructure/storage/patch/PhabricatorBuiltinPatchList.php
@@ -1832,6 +1832,18 @@
'type' => 'sql',
'name' => $this->getPatchPath('20131211.phragmentedges.sql'),
),
+ '20131217.pushlogphid.1.col.sql' => array(
+ 'type' => 'sql',
+ 'name' => $this->getPatchPath('20131217.pushlogphid.1.col.sql'),
+ ),
+ '20131217.pushlogphid.2.mig.php' => array(
+ 'type' => 'php',
+ 'name' => $this->getPatchPath('20131217.pushlogphid.2.mig.php'),
+ ),
+ '20131217.pushlogphid.3.key.sql' => array(
+ 'type' => 'sql',
+ 'name' => $this->getPatchPath('20131217.pushlogphid.3.key.sql'),
+ ),
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Storage Engine
amazon-s3
Storage Format
Raw Data
Storage Handle
phabricator/fk/xn/h565itczwfyxydmr
Default Alt Text
D7780.diff (5 KB)
Attached To
Mode
D7780: Assign PHIDs to PushLogs
Attached
Detach File
Event Timeline
Log In to Comment