[ZBX-5489] remove alert create() and delete() Created: 2012 Aug 23  Updated: 2017 May 30  Resolved: 2012 Aug 28

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: API (A), Documentation (D)
Affects Version/s: 2.0.2, 2.1.0
Fix Version/s: 2.0.3rc1, 2.1.0

Type: Incident report Priority: Major
Reporter: richlv Assignee: Martins Valkovskis
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates ZBX-5049 remove event.create and event.delete ... Closed
duplicates ZBX-5446 Permission check in the alert.delete ... Closed
is duplicated by ZBX-3905 Documentation of create alert is miss... Closed

 Description   

api methods alert.create and alert.delete should be removed



 Comments   
Comment by Oleksii Zagorskyi [ 2012 Aug 23 ]

It looks similar to ZBX-5049

<Eduard> RESOLVED

Comment by Alexey Fukalov [ 2012 Aug 24 ]

Removed docs for these methods.

<Eduard> RESOLVED

Comment by Eduards Samersovs (Inactive) [ 2012 Aug 27 ]

Fixed in development branch svn://svn.zabbix.com/branches/dev/ZBX-5489

Comment by Toms (Inactive) [ 2012 Aug 27 ]

(1) Should CEvent deleteByTriggerIDs() function be removed?

<Eduard> We remove delete methods, why deleteByTriggerIDs must stay? Especially that it isn't used where in a code.

<Toms> CLOSED. It was just for clarification. Hope that no one relays on undocumented functions.

Comment by Toms (Inactive) [ 2012 Aug 27 ]

(2) Missing newlines at the end of changed files.

<Eduard> Can't repeat.

<Toms> CLOSED. Seems like subversion doesn't show last newline.

Comment by Toms (Inactive) [ 2012 Aug 27 ]

(3) @param string $triggerids should be @param int|array $triggerids

<Eduard> RESOLVED

<Toms> CLOSED

Comment by Toms (Inactive) [ 2012 Aug 27 ]

(4) function addEvent() in triggers.inc.php should be carefully refactored:

a) zbx_objectValues($events, 'objectid') same as $triggerids;

b) unnecessary check if ($event['object'] != EVENT_OBJECT_TRIGGER). because 'object' => EVENT_OBJECT_TRIGGER;

c) $eventDbFields unused;

d) can't call self::exception() in this scope;

e) getting eventid and storing in DB should be done in transaction + eventid could be just incremented on next inserts

f) looping through triggers and events can be done in a single loop

I think there could be more as well.

<Eduard> RESOLVED, good testing!

<Toms> CLOSED. done some refactoring

Comment by Toms (Inactive) [ 2012 Aug 27 ]

(5) only TRIGGER_VALUE_UNKNOWN events can be created by frontend, this should be forced within function and commented as well, so there would be no possibility to call addEvent() with different tyope of events.
Function should be renamed addUnknownEvent() or something like that.

<Eduard> RESOLVED, Good advice!

<Toms> CLOSED

Comment by Toms (Inactive) [ 2012 Aug 27 ]

(6)
$hostids should be written as $hostIds, every word starts with a capital letter in variable naming, except first one

<Eduard> Decided with Aleksey and Sasha to launch new exception for variables names witch ends with "id" or "ids" write with lowercase first letter, because otherwise we needs rename all frontend with API..

<richlv> then that must be documented at https://zabbix.org/wiki/Docs/specs/coding_style#Naming_conventions

<Eduard> Done.

<richlv> is that only when it ends with "id[s]" ? what if it's something like "matchTriggerIdToSomethingElse" ?

<Eduard> Mainly it's exception only for variables like $triggerids where "ids" at the end of a name, all others events must be like "matchTriggerIdToSomethingElse"

<richlv> ok, i really don't like it, because it's terribly convoluted and inconsistent, but i clarified that point a bit - please, review

<Toms> CLOSED. But don't like inconsistency

Comment by Toms (Inactive) [ 2012 Aug 27 ]

Review my changes up to r29864

<Eduard> CLOSED, Great job!

Comment by Toms (Inactive) [ 2012 Aug 28 ]

TESTED

Comment by Eduards Samersovs (Inactive) [ 2012 Aug 28 ]

Fixed in versions pre-2.1.0 (beta) r29884, pre-2.0.3 r29882

Generated at Fri Apr 19 00:12:06 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.