private function requireAllPatchesApplied(PhabricatorStorageManagementAPI $api) { $applied = $api->getAppliedPatches(); if ($applied === null) { throw new PhutilArgumentUsageException(pht('You have not initialized the database yet. You must initialize ' . 'the database before you can adjust schemata. Run `%s` ' . 'to initialize the database.', 'storage upgrade')); } $applied = array_fuse($applied); $patches = $this->getPatches(); $patches = mpull($patches, null, 'getFullKey'); $missing = array_diff_key($patches, $applied); if ($missing) { throw new PhutilArgumentUsageException(pht('You have not applied all available storage patches yet. You must ' . 'apply all available patches before you can adjust schemata. ' . 'Run `%s` to show patch status, and `%s` to apply missing patches.', 'storage status', 'storage upgrade')); } }