Skip to content

Commit 24968cb

Browse files
committed
Deprecate Environment actions returning a single activity
1 parent 9914377 commit 24968cb

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

src/Model/ApiResourceBase.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,7 @@ public function runOperation($op, $method = 'POST', array $body = [])
393393
*/
394394
protected function runLongOperation($op, $method = 'post', array $body = [])
395395
{
396+
@trigger_error('This method is deprecated as actions may return multiple activities. Use runOperation() if possible.', E_USER_DEPRECATED);
396397
$result = $this->runOperation($op, $method, $body);
397398
$activities = $result->getActivities();
398399
if (count($activities) !== 1) {

src/Model/Environment.php

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,9 @@ public function getPublicUrl()
301301
* Leave this empty to use the default type for new
302302
* environments ('development' at the time of writing).
303303
*
304+
* @deprecated use instead: runOperation('branch', 'POST', ['name' => 'git-branch-name', 'title' => 'Untitled', 'clone_parent' => true, 'type' => 'development'])
305+
* @see Environment::runOperation()
306+
*
304307
* @return Activity
305308
*/
306309
public function branch($title, $id = null, $cloneParent = true, $type = null)
@@ -380,6 +383,9 @@ public function isActive()
380383
*
381384
* @throws EnvironmentStateException
382385
*
386+
* @deprecated use instead: runOperation('activate')
387+
* @see Environment::runOperation()
388+
*
383389
* @return Activity
384390
*/
385391
public function activate()
@@ -394,7 +400,7 @@ public function activate()
394400
/**
395401
* Deactivate the environment.
396402
*
397-
* @deprecated use runOperation('deactivate') instead
403+
* @deprecated use instead: runOperation('deactivate')
398404
* @see Environment::runOperation()
399405
*
400406
* @return Activity
@@ -409,6 +415,9 @@ public function deactivate()
409415
*
410416
* @throws OperationUnavailableException
411417
*
418+
* @deprecated use instead: runOperation('merge')
419+
* @see Environment::runOperation()
420+
*
412421
* @return Activity
413422
*/
414423
public function merge()
@@ -429,6 +438,9 @@ public function merge()
429438
*
430439
* @throws \InvalidArgumentException
431440
*
441+
* @deprecated use instead: runOperation('synchronize', 'POST', ['synchronize_data' => false, 'synchronize_code' => false, 'rebase' => false])
442+
* @see Environment::runOperation()
443+
*
432444
* @return Activity
433445
*/
434446
public function synchronize($data = false, $code = false, $rebase = false)
@@ -472,6 +484,9 @@ public static function wrapCollection(array $data, $baseUrl, ClientInterface $cl
472484
* during the backup. So it reduces downtime, at the risk of backing up
473485
* data in an inconsistent state.
474486
*
487+
* @deprecated use instead: runOperation('backup', 'POST', ['safe' => true])
488+
* @see Environment::runOperation()
489+
*
475490
* @return Activity
476491
*/
477492
public function backup($unsafeAllowInconsistent = false)
@@ -587,6 +602,9 @@ public function getRouteUrls()
587602
* An array of files that may be used in conjunction or in place of the
588603
* repository parameter info.
589604
*
605+
* @deprecated use instead: runOperation('initialize', 'POST', ['profile' => '', 'repository' => ''])
606+
* @see Environment::runOperation()
607+
*
590608
* @return Activity
591609
*/
592610
public function initialize($profile, $repository, $files=[])
@@ -650,6 +668,9 @@ public function addUser($user, $role, $byUuid = true)
650668
/**
651669
* Redeploy the environment.
652670
*
671+
* @deprecated use instead: runOperation('redeploy')
672+
* @see Environment::runOperation()
673+
*
653674
* @return Activity
654675
*/
655676
public function redeploy()
@@ -755,6 +776,9 @@ public function runSourceOperation(string $name, array $variables = []): Result
755776
* @see Environment::redeploy()
756777
* @see Environment::status
757778
*
779+
* @deprecated use instead: runOperation('pause')
780+
* @see Environment::runOperation()
781+
*
758782
* @return Activity
759783
*/
760784
public function pause()
@@ -767,6 +791,9 @@ public function pause()
767791
*
768792
* @see Environment::status
769793
*
794+
* @deprecated use instead: runOperation('resume')
795+
* @see Environment::runOperation()
796+
*
770797
* @return Activity
771798
*/
772799
public function resume()

0 commit comments

Comments
 (0)