1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-02-06 11:58:30 +01:00
phorge-phorge/src/applications/files/editor/PhabricatorFileEditEngine.php
Austin McKinley be00264ae7 Make daemons perform file deletion
Summary:
Deletion is a possibly time-intensive process, especially with large
files that are backed by high-latency, chunked storage (such as
S3). Even ~200mb objects take minutes to delete, which makes for an
unhappy experience. Fixes T10828.

Test Plan:
Delete a large file, and stare in awe of the swiftness with
which I am redirected to the main file application.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: thoughtpolice, Korvin

Maniphest Tasks: T10828

Differential Revision: https://secure.phabricator.com/D15743
2017-04-18 11:09:41 -07:00

81 lines
2 KiB
PHP

<?php
final class PhabricatorFileEditEngine
extends PhabricatorEditEngine {
const ENGINECONST = 'files.file';
public function getEngineName() {
return pht('Files');
}
protected function supportsEditEngineConfiguration() {
return false;
}
protected function getCreateNewObjectPolicy() {
// TODO: For now, this EditEngine can only edit objects, since there is
// a lot of complexity in dealing with file data during file creation.
return PhabricatorPolicies::POLICY_NOONE;
}
public function getSummaryHeader() {
return pht('Configure Files Forms');
}
public function getSummaryText() {
return pht('Configure creation and editing forms in Files.');
}
public function getEngineApplicationClass() {
return 'PhabricatorFilesApplication';
}
protected function newEditableObject() {
return PhabricatorFile::initializeNewFile();
}
protected function newObjectQuery() {
$query = new PhabricatorFileQuery();
$query->withIsDeleted(false);
return $query;
}
protected function getObjectCreateTitleText($object) {
return pht('Create New File');
}
protected function getObjectEditTitleText($object) {
return pht('Edit File: %s', $object->getName());
}
protected function getObjectEditShortText($object) {
return $object->getMonogram();
}
protected function getObjectCreateShortText() {
return pht('Create File');
}
protected function getObjectName() {
return pht('File');
}
protected function getObjectViewURI($object) {
return $object->getURI();
}
protected function buildCustomEditFields($object) {
return array(
id(new PhabricatorTextEditField())
->setKey('name')
->setLabel(pht('Name'))
->setTransactionType(PhabricatorFileNameTransaction::TRANSACTIONTYPE)
->setDescription(pht('The name of the file.'))
->setConduitDescription(pht('Rename the file.'))
->setConduitTypeDescription(pht('New file name.'))
->setValue($object->getName()),
);
}
}