Page MenuHomePhabricator

D7780.diff
No OneTemporary

D7780.diff

Index: resources/sql/patches/20131217.pushlogphid.1.col.sql
===================================================================
--- /dev/null
+++ 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;
Index: resources/sql/patches/20131217.pushlogphid.2.mig.php
===================================================================
--- /dev/null
+++ 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";
Index: resources/sql/patches/20131217.pushlogphid.3.key.sql
===================================================================
--- /dev/null
+++ resources/sql/patches/20131217.pushlogphid.3.key.sql
@@ -0,0 +1,2 @@
+ALTER TABLE {$NAMESPACE}_repository.repository_pushlog
+ ADD UNIQUE KEY `key_phid` (phid);
Index: src/__phutil_library_map__.php
===================================================================
--- src/__phutil_library_map__.php
+++ 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',
Index: src/applications/repository/phid/PhabricatorRepositoryPHIDTypePushLog.php
===================================================================
--- /dev/null
+++ 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;
+ }
+
+}
Index: src/applications/repository/storage/PhabricatorRepositoryPushLog.php
===================================================================
--- src/applications/repository/storage/PhabricatorRepositoryPushLog.php
+++ 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;
Index: src/infrastructure/storage/patch/PhabricatorBuiltinPatchList.php
===================================================================
--- src/infrastructure/storage/patch/PhabricatorBuiltinPatchList.php
+++ 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

Mime Type
text/plain
Expires
Mon, Mar 10, 5:40 PM (1 w, 4 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7461290
Default Alt Text
D7780.diff (5 KB)

Event Timeline