Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Routeros-suspension: fix a deprecated method and suspend all statuses of suspended services #309

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified plugins/routeros-suspension/routeros-suspension.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion plugins/routeros-suspension/src/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"displayName": "Mikrotik RouterOS - suspension",
"description": "Plugin for handling suspension on RouterOS devices.",
"url": "https://github.com/Ubiquiti-App/UCRM-plugins/tree/master/plugins/routeros-suspension",
"version": "1.2.0",
"version": "1.2.1",
"ucrmVersionCompliancy": {
"min": "2.99.99",
"max": null
Expand Down
6 changes: 3 additions & 3 deletions plugins/routeros-suspension/src/src/Service/RouterOsApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public static function create(array $config): self

public function print(string $endpoint): array
{
return $this->getClient()->write(new Query(sprintf('%s/print', $endpoint)))->read();
return $this->getClient()->query(new Query(sprintf('%s/print', $endpoint)))->read();
}

public function remove(string $endpoint, array $ids): array
Expand All @@ -47,7 +47,7 @@ public function remove(string $endpoint, array $ids): array
$query = (new Query(sprintf('%s/remove', $endpoint)))
->add(sprintf('=.id=%s', implode(',', $ids)));

return $this->getClient()->write($query)->read();
return $this->getClient()->query($query)->read();
}

public function add(string $endpoint, array $sentences, string $commentPrefix = 'ucrm_'): void
Expand All @@ -68,7 +68,7 @@ public function add(string $endpoint, array $sentences, string $commentPrefix =
$query->add(sprintf('=%s=%s', $key, $item));
}

$this->getClient()->write($query)->read();
$this->getClient()->query($query)->read();
}
}

Expand Down
4 changes: 2 additions & 2 deletions plugins/routeros-suspension/src/src/Service/Suspender.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class Suspender

private const COMMENT_SIGNATURE = 'ucrm_';

private const SERVICE_STATUS_ACTIVE = 3;
private const SERVICE_STATUS_ACTIVE = [2, 3, 4, 5, 6, 7, 8];

/**
* @var UcrmApi
Expand Down Expand Up @@ -261,7 +261,7 @@ private function findServicesToSuspend(): array
return $this->ucrmApi->get(
'clients/services',
[
'statuses' => [self::SERVICE_STATUS_ACTIVE],
'statuses' => self::SERVICE_STATUS_ACTIVE,
]
);
}
Expand Down