Skip to content
Merged
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
57 changes: 56 additions & 1 deletion src/PleskX/Api/Operator/Certificate.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,32 @@ public function generate($properties)
return new Struct\Info($response);
}


/**
* Ottiene tutti i certificati installati sul server per un determinato nome a dominio.
* @param string $field
* @param integer|string $value
* @return Struct\Info[]
*/
public function getAll($field, $value )
{
$packet = $this->_client->getPacket();
$getTag = $packet->addChild($this->_wrapperTag)->addChild('get-pool');

$filterTag = $getTag->addChild('filter');
$filterTag->addChild($field, $value);

$response = $this->_client->request($packet, \PleskX\Api\Client::RESPONSE_FULL);

$items = [];
foreach ($response->xpath('//result/certificates') as $xmlResult) {
$item = new Struct\PoolInfo($xmlResult->certificate);
$items[] = $item;
}

return $items;
}


/**
* @param $properties
Expand Down Expand Up @@ -51,4 +77,33 @@ public function install($properties)
$response = $this->_client->request($packet);
return new Struct\InstallInfo($response);
}
}


/**
* @param $properties
* @return Struct\RemoveInfo
*/
public function remove($properties)
{
$packet = $this->_client->getPacket();
$removeNode = $packet->addChild($this->_wrapperTag)->addChild('remove');

foreach ($properties as $key => $value) {
if( $key == 'filter' ) {
$filterNode = $removeNode->addChild('filter');

foreach( $value as $contentKey => $contentValue ) {
$filterNode->addChild( $contentKey, $contentValue );
}

continue;
}

$removeNode->addChild($key, $value);
}

$response = $this->_client->request($packet);

return new Struct\RemoveInfo( $response );
}
}
17 changes: 17 additions & 0 deletions src/PleskX/Api/Struct/Certificate/PoolInfo.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php
// Copyright 1999-2016. Parallels IP Holdings GmbH.

namespace PleskX\Api\Struct\Certificate;

class PoolInfo extends \PleskX\Api\Struct
{
/** @var string */
public $name;

public function __construct($apiResponse)
{
$this->_initScalarProperties($apiResponse, [
['name' => 'name'],
]);
}
}
17 changes: 17 additions & 0 deletions src/PleskX/Api/Struct/Certificate/RemoveInfo.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php
// Copyright 1999-2016. Parallels IP Holdings GmbH.

namespace PleskX\Api\Struct\Certificate;

class RemoveInfo extends \PleskX\Api\Struct
{
/** @var string */
public $status;

public function __construct($apiResponse)
{
$this->_initScalarProperties($apiResponse, [
'status',
]);
}
}