Page MenuHomePhabricator

D13223.diff
No OneTemporary

D13223.diff

diff --git a/resources/sql/autopatches/20150609.pastebin.1.sql b/resources/sql/autopatches/20150609.pastebin.1.sql
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20150609.pastebin.1.sql
@@ -0,0 +1,10 @@
+RENAME TABLE {$NAMESPACE}_pastebin.edge
+ TO {$NAMESPACE}_paste.edge;
+RENAME TABLE {$NAMESPACE}_pastebin.edgedata
+ TO {$NAMESPACE}_paste.edgedata;
+RENAME TABLE {$NAMESPACE}_pastebin.pastebin_paste
+ TO {$NAMESPACE}_paste.paste;
+RENAME TABLE {$NAMESPACE}_pastebin.pastebin_pastetransaction
+ TO {$NAMESPACE}_paste.paste_transaction;
+RENAME TABLE {$NAMESPACE}_pastebin.pastebin_pastetransaction_comment
+ TO {$NAMESPACE}_paste.paste_transaction_comment;
diff --git a/resources/sql/autopatches/20150609.pastebin.2.sql b/resources/sql/autopatches/20150609.pastebin.2.sql
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20150609.pastebin.2.sql
@@ -0,0 +1 @@
+DROP DATABASE {$NAMESPACE}_pastebin;
diff --git a/resources/sql/patches/20130801.pastexactions.php b/resources/sql/patches/20130801.pastexactions.php
--- a/resources/sql/patches/20130801.pastexactions.php
+++ b/resources/sql/patches/20130801.pastexactions.php
@@ -1,6 +1,6 @@
<?php
-$table = new PhabricatorPaste();
+$table = id(new PhabricatorAdHocDAO())->setApplicationName('pastebin');
$x_table = new PhabricatorPasteTransaction();
$conn_w = $table->establishConnection('w');
diff --git a/resources/sql/patches/20130805.pastemailkeypop.php b/resources/sql/patches/20130805.pastemailkeypop.php
--- a/resources/sql/patches/20130805.pastemailkeypop.php
+++ b/resources/sql/patches/20130805.pastemailkeypop.php
@@ -2,19 +2,20 @@
echo pht('Populating pastes with mail keys...')."\n";
-$table = new PhabricatorPaste();
-$table->openTransaction();
+$table = id(new PhabricatorAdHocDAO())->setApplicationName('pastebin');
$conn_w = $table->establishConnection('w');
+$conn_w->openTransaction();
-foreach (new LiskMigrationIterator($table) as $paste) {
- $id = $paste->getID();
+$rows = new LiskRawMigrationIterator($conn_w, 'pastebin_paste');
+foreach ($rows as $row) {
+ $id = $row['id'];
echo "P{$id}: ";
- if (!$paste->getMailKey()) {
+ if (!$row['mailKey']) {
queryfx(
$conn_w,
'UPDATE %T SET mailKey = %s WHERE id = %d',
- $paste->getTableName(),
+ 'pastebin_paste',
Filesystem::readRandomCharacters(20),
$id);
echo pht('Generated Key')."\n";
@@ -23,5 +24,5 @@
}
}
-$table->saveTransaction();
+$conn_w->saveTransaction();
echo pht('Done.')."\n";
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
@@ -1294,6 +1294,7 @@
'PhabricatorActionListView' => 'view/layout/PhabricatorActionListView.php',
'PhabricatorActionView' => 'view/layout/PhabricatorActionView.php',
'PhabricatorActivitySettingsPanel' => 'applications/settings/panel/PhabricatorActivitySettingsPanel.php',
+ 'PhabricatorAdHocDAO' => 'infrastructure/storage/lisk/PhabricatorAdHocDAO.php',
'PhabricatorAdministratorsPolicyRule' => 'applications/policy/rule/PhabricatorAdministratorsPolicyRule.php',
'PhabricatorAlmanacApplication' => 'applications/almanac/application/PhabricatorAlmanacApplication.php',
'PhabricatorAmazonAuthProvider' => 'applications/auth/provider/PhabricatorAmazonAuthProvider.php',
@@ -4666,6 +4667,7 @@
'PhabricatorActionListView' => 'AphrontView',
'PhabricatorActionView' => 'AphrontView',
'PhabricatorActivitySettingsPanel' => 'PhabricatorSettingsPanel',
+ 'PhabricatorAdHocDAO' => 'PhabricatorLiskDAO',
'PhabricatorAdministratorsPolicyRule' => 'PhabricatorPolicyRule',
'PhabricatorAlmanacApplication' => 'PhabricatorApplication',
'PhabricatorAmazonAuthProvider' => 'PhabricatorOAuth2AuthProvider',
diff --git a/src/applications/paste/storage/PhabricatorPasteDAO.php b/src/applications/paste/storage/PhabricatorPasteDAO.php
--- a/src/applications/paste/storage/PhabricatorPasteDAO.php
+++ b/src/applications/paste/storage/PhabricatorPasteDAO.php
@@ -3,7 +3,7 @@
abstract class PhabricatorPasteDAO extends PhabricatorLiskDAO {
public function getApplicationName() {
- return 'pastebin';
+ return 'paste';
}
}
diff --git a/src/applications/paste/storage/PhabricatorPasteTransaction.php b/src/applications/paste/storage/PhabricatorPasteTransaction.php
--- a/src/applications/paste/storage/PhabricatorPasteTransaction.php
+++ b/src/applications/paste/storage/PhabricatorPasteTransaction.php
@@ -12,7 +12,7 @@
const MAILTAG_COMMENT = 'paste-comment';
public function getApplicationName() {
- return 'pastebin';
+ return 'paste';
}
public function getApplicationTransactionType() {
diff --git a/src/infrastructure/storage/lisk/PhabricatorAdHocDAO.php b/src/infrastructure/storage/lisk/PhabricatorAdHocDAO.php
new file mode 100644
--- /dev/null
+++ b/src/infrastructure/storage/lisk/PhabricatorAdHocDAO.php
@@ -0,0 +1,29 @@
+<?php
+
+final class PhabricatorAdHocDAO extends PhabricatorLiskDAO {
+
+ private $applicationName;
+
+ protected function getConfiguration() {
+ return array(
+ self::CONFIG_NO_TABLE => true,
+ ) + parent::getConfiguration();
+ }
+
+ public function getApplicationName() {
+ if (!$this->applicationName) {
+ throw new PhutilInvalidStateException('setApplicationName');
+ }
+ return $this->applicationName;
+ }
+
+ public function setApplicationName($application_name) {
+ $this->applicationName = $application_name;
+ return $this;
+ }
+
+ public function getTableName() {
+ throw new Exception('You are doing it wrong!');
+ }
+
+}
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
@@ -67,7 +67,10 @@
'db.metamta' => array(),
'db.oauth_server' => array(),
'db.owners' => array(),
- 'db.pastebin' => array(),
+ 'db.paste' => array(),
+ 'db.pastebin' => array(
+ 'dead' => true,
+ ),
'db.phame' => array(),
'db.phriction' => array(),
'db.project' => array(),

File Metadata

Mime Type
text/plain
Expires
Oct 15 2024, 11:53 PM (4 w, 4 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6710584
Default Alt Text
D13223.diff (6 KB)

Event Timeline