1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-01 11:12:42 +01:00
phorge-phorge/src/applications/phragment/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
..
PhragmentBrowseController.php Moderize Phragment 2016-04-02 14:24:40 +00:00
PhragmentController.php Remove all setObjectURI() from ActionListViews 2015-12-17 08:30:22 -08:00
PhragmentCreateController.php Moderize Phragment 2016-04-02 14:24:40 +00:00
PhragmentHistoryController.php Moderize Phragment 2016-04-02 14:24:40 +00:00
PhragmentPatchController.php Make the Files "TTL" API more structured 2017-04-04 16:16:28 -07:00
PhragmentPolicyController.php Moderize Phragment 2016-04-02 14:24:40 +00:00
PhragmentRevertController.php Moderize Phragment 2016-04-02 14:24:40 +00:00
PhragmentSnapshotCreateController.php Moderize Phragment 2016-04-02 14:24:40 +00:00
PhragmentSnapshotDeleteController.php Moderize Phragment 2016-04-02 14:24:40 +00:00
PhragmentSnapshotPromoteController.php Moderize Phragment 2016-04-02 14:24:40 +00:00
PhragmentSnapshotViewController.php Moderize Phragment 2016-04-02 14:24:40 +00:00
PhragmentUpdateController.php Moderize Phragment 2016-04-02 14:24:40 +00:00
PhragmentVersionController.php Moderize Phragment 2016-04-02 14:24:40 +00:00
PhragmentZIPController.php Make the Files "TTL" API more structured 2017-04-04 16:16:28 -07:00