Page MenuHomePhabricator

D10273.id24740.diff
No OneTemporary

D10273.id24740.diff

diff --git a/resources/sql/autopatches/20140815.cancdncase.php b/resources/sql/autopatches/20140815.cancdncase.php
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20140815.cancdncase.php
@@ -0,0 +1,24 @@
+<?php
+
+// This corrects files which incorrectly had a 'cancdn' property written;
+// the property should be 'canCDN'.
+
+$table = new PhabricatorFile();
+$conn_w = $table->establishConnection('w');
+foreach (new LiskMigrationIterator($table) as $file) {
+ $id = $file->getID();
+ echo "Updating capitalization of canCDN property for file {$id}...\n";
+ $meta = $file->getMetadata();
+
+ if (isset($meta['cancdn'])) {
+ $meta['canCDN'] = $meta['cancdn'];
+ unset($meta['cancdn']);
+
+ queryfx(
+ $conn_w,
+ 'UPDATE %T SET metadata = %s WHERE id = %d',
+ $table->getTableName(),
+ json_encode($meta),
+ $id);
+ }
+}
diff --git a/src/applications/files/storage/PhabricatorFile.php b/src/applications/files/storage/PhabricatorFile.php
--- a/src/applications/files/storage/PhabricatorFile.php
+++ b/src/applications/files/storage/PhabricatorFile.php
@@ -849,11 +849,6 @@
return false;
}
- // TODO: Migrate away this old constant and remove this check.
- if (idx($this->metadata, 'cancdn')) {
- return true;
- }
-
return idx($this->metadata, self::METADATA_CAN_CDN);
}

File Metadata

Mime Type
text/plain
Expires
Wed, Oct 23, 9:11 PM (3 w, 3 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6736802
Default Alt Text
D10273.id24740.diff (1 KB)

Event Timeline