add more phpdoc to DomainZones ApiCommand; minor fixes in DirOptions and DirProtections

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2018-11-18 15:07:06 +01:00
parent d2024e06ff
commit 776bb56b24
3 changed files with 81 additions and 37 deletions

View File

@@ -337,7 +337,7 @@ class DirOptions extends ApiCommand implements ResourceEntity
* delete a directory-options by id * delete a directory-options by id
* *
* @param int $id * @param int $id
* optional, the directory-option-id * id of dir-protection entry
* *
* @access admin, customer * @access admin, customer
* @throws Exception * @throws Exception

View File

@@ -120,7 +120,7 @@ class DirProtections extends ApiCommand implements ResourceEntity
* return a directory-protection entry by either id or username * return a directory-protection entry by either id or username
* *
* @param int $id * @param int $id
* optional, the entry-id * optional, the directory-protection-id
* @param string $username * @param string $username
* optional, the username * optional, the username
* *
@@ -185,7 +185,7 @@ class DirProtections extends ApiCommand implements ResourceEntity
* update htaccess protection of a given directory * update htaccess protection of a given directory
* *
* @param int $id * @param int $id
* optional, the entry-id * optional the directory-protection-id
* @param string $username * @param string $username
* optional, the username * optional, the username
* @param int $customerid * @param int $customerid

View File

@@ -18,6 +18,28 @@
class DomainZones extends ApiCommand implements ResourceEntity class DomainZones extends ApiCommand implements ResourceEntity
{ {
/**
* add a new dns zone for a given domain by id or domainname
*
* @param int $id
* optional domain id
* @param string $domainname
* optional domain name
* @param string $record
* optional, default empty
* @param string $type
* optional, zone-entry type (A, AAAA, TXT, etc.), default 'A'
* @param int $prio
* optional, priority, default empty
* @param string $content
* optional, default empty
* @param int $ttl
* optional, default 18000
*
* @access admin, customer
* @throws Exception
* @return array
*/
public function add() public function add()
{ {
if (Settings::Get('system.dnsenabled') != '1') { if (Settings::Get('system.dnsenabled') != '1') {
@@ -61,6 +83,7 @@ class DomainZones extends ApiCommand implements ResourceEntity
$dom_entries = $sel_stmt->fetchAll(PDO::FETCH_ASSOC); $dom_entries = $sel_stmt->fetchAll(PDO::FETCH_ASSOC);
// validation // validation
$errors = array();
if (empty($record)) { if (empty($record)) {
$record = "@"; $record = "@";
} }
@@ -269,11 +292,11 @@ class DomainZones extends ApiCommand implements ResourceEntity
* return a domain-dns entry by either id or domainname * return a domain-dns entry by either id or domainname
* *
* @param int $id * @param int $id
* optional, the domain-id * optional, the domain id
* @param string $domainname * @param string $domainname
* optional, the domainname * optional, the domain name
* *
* @access admin * @access admin, customer
* @throws Exception * @throws Exception
* @return array * @return array
*/ */
@@ -309,16 +332,37 @@ class DomainZones extends ApiCommand implements ResourceEntity
return $this->response(200, "successfull", explode("\n", $zonefile)); return $this->response(200, "successfull", explode("\n", $zonefile));
} }
/**
* You cannot update a dns zone entry.
* You need to delete it and re-add it.
*/
public function update() public function update()
{ {
throw new Exception('You cannot update a dns zone entry. You need to delete it and re-add it.', 303); throw new Exception('You cannot update a dns zone entry. You need to delete it and re-add it.', 303);
} }
/**
* You cannot list dns zones.
* To get all domains use Domains.listing() or SubDomains.listing()
*/
public function listing() public function listing()
{ {
throw new Exception('You cannot list dns zones. To get all domains use Domains.listing() or SubDomains.listing()', 303); throw new Exception('You cannot list dns zones. To get all domains use Domains.listing() or SubDomains.listing()', 303);
} }
/**
* deletes a domain-dns entry by id
*
* @param int $entry_id
* @param int $id
* optional, the domain id
* @param string $domainname
* optional, the domain name
*
* @access admin, customer
* @throws Exception
* @return bool
*/
public function delete() public function delete()
{ {
if (Settings::Get('system.dnsenabled') != '1') { if (Settings::Get('system.dnsenabled') != '1') {