@@ -12,7 +12,7 @@ class Database extends \PleskX\Api\Operator
1212 */
1313 public function create ($ properties )
1414 {
15- return new Struct \Info ($ this ->_create ('add-db ' , $ properties ));
15+ return new Struct \Info ($ this ->_process ('add-db ' , $ properties ));
1616 }
1717
1818 /**
@@ -21,26 +21,40 @@ public function create($properties)
2121 */
2222 public function createUser ($ properties )
2323 {
24- return new Struct \UserInfo ($ this ->_create ('add-db-user ' , $ properties ));
24+ return new Struct \UserInfo ($ this ->_process ('add-db-user ' , $ properties ));
2525 }
2626
2727 /**
2828 * @param $command
2929 * @param array $properties
3030 * @return \PleskX\Api\XmlResponse
3131 */
32- private function _create ($ command , array $ properties )
32+ private function _process ($ command , array $ properties )
3333 {
3434 $ packet = $ this ->_client ->getPacket ();
3535 $ info = $ packet ->addChild ($ this ->_wrapperTag )->addChild ($ command );
3636
3737 foreach ($ properties as $ name => $ value ) {
38+ if (false !== strpos ($ value , '& ' )) {
39+ $ info ->$ name = $ value ;
40+ continue ;
41+ }
3842 $ info ->addChild ($ name , $ value );
3943 }
4044
4145 return $ this ->_client ->request ($ packet );
4246 }
4347
48+ /**
49+ * @param array $properties
50+ * @return bool
51+ */
52+ public function updateUser (array $ properties )
53+ {
54+ $ response = $ this ->_process ('set-db-user ' , $ properties );
55+ return 'ok ' === (string )$ response ->status ;
56+ }
57+
4458 /**
4559 * @param string $field
4660 * @param integer|string $value
0 commit comments