Skip to content

Commit ed6d01f

Browse files
committed
Added Application install support
1 parent 5725566 commit ed6d01f

File tree

6 files changed

+219
-0
lines changed

6 files changed

+219
-0
lines changed

src/PleskX/Api/Operator/Aps.php

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,82 @@
22
// Copyright 1999-2016. Parallels IP Holdings GmbH.
33

44
namespace PleskX\Api\Operator;
5+
use PleskX\Api\Struct\Aps as Struct;
56

67
class Aps extends \PleskX\Api\Operator
78
{
89

10+
/**
11+
* @param array $properties
12+
* @return Struct\Info
13+
*/
14+
public function create(array $domaininfo,array $package,array $database,array $settings)
15+
{
16+
$packet = $this->_client->getPacket();
17+
18+
$infoInstall = $packet->addChild($this->_wrapperTag)->addChild('install');
19+
20+
foreach ($domaininfo as $name => $value) {
21+
$infoInstall->addChild($name, $value);
22+
}
23+
$infoPackage = $infoInstall->addChild('package');
24+
foreach($package as $name => $value)
25+
{
26+
$infoPackage->addChild($name,$value);
27+
}
28+
$infoInstall->addChild('ssl', true);
29+
30+
$infoDatabase = $infoInstall->addChild('database');
31+
foreach($database as $name => $value)
32+
{
33+
34+
$infoDatabase->addChild($name,$value);
35+
}
36+
37+
$infoSettings = $infoInstall->addChild('settings');
38+
foreach($settings as $settings_array => $setting_array)
39+
{
40+
$infoSetting = $infoSettings->addChild('setting');
41+
foreach($setting_array as $name => $value)
42+
{
43+
$infoSetting->addChild($name,$value);
44+
}
45+
}
46+
47+
$response = $this->_client->request($packet);
48+
49+
$info = new Struct\Info($response);
50+
51+
return $info;
52+
}
53+
54+
/**
55+
* @param string $field
56+
* @param integer|string $value
57+
* @return bool
58+
*/
59+
public function delete($field, $value)
60+
{
61+
return $this->_delete($field, $value);
62+
}
63+
64+
/**
65+
* @param string $field
66+
* @param integer|string $value
67+
* @return Struct\GeneralInfo
68+
*/
69+
public function get($field, $value)
70+
{
71+
$items = $this->_getItems(Struct\GeneralInfo::class, 'install', $field, $value);
72+
return reset($items);
73+
}
74+
75+
/**
76+
* @return Struct\GeneralInfo[]
77+
*/
78+
public function getAll()
79+
{
80+
return $this->_getItems(Struct\GeneralInfo::class, 'aps');
81+
}
82+
983
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
// Copyright 1999-2016. Parallels IP Holdings GmbH.
3+
4+
namespace PleskX\Api\Struct\Aps;
5+
6+
class DatabaseInfo extends \PleskX\Api\Struct
7+
{
8+
/** @var string */
9+
public $name;
10+
11+
/** @var string */
12+
public $login;
13+
14+
/** @var string */
15+
public $password;
16+
17+
/** @var string */
18+
public $server;
19+
20+
/** @var string */
21+
public $prefix;
22+
23+
public function __construct($apiResponse)
24+
{
25+
$this->_initScalarProperties($apiResponse, [
26+
'name',
27+
'login',
28+
'password',
29+
'server',
30+
'prefix'
31+
]);
32+
}
33+
}

src/PleskX/Api/Struct/Aps/Info.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
// Copyright 1999-2016. Parallels IP Holdings GmbH.
3+
4+
namespace PleskX\Api\Struct\Aps;
5+
6+
class Info extends \PleskX\Api\Struct
7+
{
8+
/** @var string */
9+
public $status;
10+
11+
public function __construct($apiResponse)
12+
{
13+
$this->_initScalarProperties($apiResponse, [
14+
'status'
15+
]);
16+
}
17+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
// Copyright 1999-2016. Parallels IP Holdings GmbH.
3+
4+
namespace PleskX\Api\Struct\Aps;
5+
6+
class InstallInfo extends \PleskX\Api\Struct
7+
{
8+
/** @var int */
9+
public $domain_id;
10+
11+
/** @var string */
12+
public $domain_name;
13+
14+
/** @var int */
15+
public $subdomain_id;
16+
17+
/** @var string */
18+
public $subdomain_name;
19+
20+
public function __construct($apiResponse)
21+
{
22+
$this->_initScalarProperties($apiResponse, [
23+
['domain-id' => 'domain_id'],
24+
['domain-name' => 'domain_name'],
25+
['subdomain-id' => 'subdomain_id'],
26+
['subdomain-name' => 'subdomain_name']
27+
]);
28+
}
29+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php
2+
// Copyright 1999-2016. Parallels IP Holdings GmbH.
3+
4+
namespace PleskX\Api\Struct\Aps;
5+
6+
class PackageInfo extends \PleskX\Api\Struct
7+
{
8+
/** @var string */
9+
public $name;
10+
11+
/** @var string */
12+
public $version;
13+
14+
/** @var string */
15+
public $release;
16+
17+
/** @var string */
18+
public $vendor;
19+
20+
/** @var string */
21+
public $packager;
22+
23+
/** @var string */
24+
public $isUploaded;
25+
26+
/** @var string */
27+
public $isVisible;
28+
29+
/** @var int */
30+
public $id;
31+
32+
public function __construct($apiResponse)
33+
{
34+
$this->_initScalarProperties($apiResponse, [
35+
'name',
36+
'version',
37+
'release',
38+
'vendor',
39+
'packager',
40+
'is_uploaded' => 'isUploaded',
41+
'isVisible' => 'isVisible',
42+
'id'
43+
]);
44+
}
45+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
// Copyright 1999-2016. Parallels IP Holdings GmbH.
3+
4+
namespace PleskX\Api\Struct\Aps;
5+
6+
class SettingsInfo extends \PleskX\Api\Struct
7+
{
8+
/** @var string */
9+
public $name;
10+
11+
/** @var string */
12+
public $value;
13+
14+
public function __construct($apiResponse)
15+
{
16+
$this->_initScalarProperties($apiResponse, [
17+
'name',
18+
'value'
19+
]);
20+
}
21+
}

0 commit comments

Comments
 (0)