1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-15 11:22:40 +01:00
phorge-phorge/src/applications/files/controller
epriestley 45b386596e Make the Files "TTL" API more structured
Summary:
Ref T11357. When creating a file, callers can currently specify a `ttl`. However, it isn't unambiguous what you're supposed to pass, and some callers get it wrong.

For example, to mean "this file expires in 60 minutes", you might pass either of these:

  - `time() + phutil_units('60 minutes in seconds')`
  - `phutil_units('60 minutes in seconds')`

The former means "60 minutes from now". The latter means "1 AM, January 1, 1970". In practice, because the GC normally runs only once every four hours (at least, until recently), and all the bad TTLs are cases where files are normally accessed immediately, these 1970 TTLs didn't cause any real problems.

Split `ttl` into `ttl.relative` and `ttl.absolute`, and make sure the values are sane. Then correct all callers, and simplify out the `time()` calls where possible to make switching to `PhabricatorTime` easier.

Test Plan:
- Generated an SSH keypair.
- Viewed a changeset.
- Viewed a raw diff.
- Viewed a commit's file data.
- Viewed a temporary file's details, saw expiration date and relative time.
- Ran unit tests.
- (Didn't really test Phragment.)

Reviewers: chad

Reviewed By: chad

Subscribers: hach-que

Maniphest Tasks: T11357

Differential Revision: https://secure.phabricator.com/D17616
2017-04-04 16:16:28 -07:00
..
PhabricatorFileComposeController.php When users choose a default project icon, make a permanent file 2016-07-11 09:24:00 -07:00
PhabricatorFileController.php Remove newFromMenu() from SideNav 2016-01-14 05:33:34 -08:00
PhabricatorFileDataController.php Only require POST to fetch file data if the viewer is logged in 2017-04-04 16:16:01 -07:00
PhabricatorFileDeleteController.php Update Files to new UI 2016-04-05 15:58:27 -07:00
PhabricatorFileDropUploadController.php Provide an <input type="file"> control in Remarkup for mobile and users with esoteric windowing systems 2016-05-20 16:24:22 -07:00
PhabricatorFileEditController.php Move Files editing and commenting to EditEngine 2017-04-04 16:15:11 -07:00
PhabricatorFileIconSetSelectController.php Add more icon choices to Badges 2017-03-03 13:45:53 -08:00
PhabricatorFileImageProxyController.php Fix a bug in the imageproxy controller 2016-09-26 10:44:55 -04:00
PhabricatorFileInfoController.php Make the Files "TTL" API more structured 2017-04-04 16:16:28 -07:00
PhabricatorFileLightboxController.php Allow lightbox comments to be viewed logged out 2017-02-13 13:54:13 -08:00
PhabricatorFileListController.php Remove newFromMenu() from SideNav 2016-01-14 05:33:34 -08:00
PhabricatorFileTransformController.php When file transforms race and lose, accept defeat gracefully 2015-05-21 09:42:20 -07:00
PhabricatorFileTransformListController.php Update Files to new UI 2016-04-05 15:58:27 -07:00
PhabricatorFileUploadController.php Update Files to new UI 2016-04-05 15:58:27 -07:00
PhabricatorFileUploadDialogController.php Allow Pholio mocks to be created and edited without drag-and-drop 2016-06-09 08:43:38 -07:00