Enhance the tx_linkvalidator_linkTypes_Interface
The tx_linkvalidator_linkTypes_Interface currently only requires the method "checkLink()".
But the processor and the module also calls these methods on the hook objects:
So these need to be added to the interface to make sure they are available.
- setErrorParams() (from the abstract class) doesn't seem to be part of that interface, so make that method "protected"
Also make sure that all members of these subclasses are "protected" (i.e. in tx_linkvalidator_linktypes_external = $url_reports + $url_error_params and tx_linkvalidator_linkTypes_LinkHandler = $tsconfig).
That would be important to have a stable and reliable API!
#1 Updated by Michael Miousse over 8 years ago
- Assignee set to Michael Miousse
Would it be better if the interface was implemented by tx_linkvalidator_linkTypes_Abstract?
this way we would put all functions needed into the interface and only have to redeclare functions
that we realy need to modify in the childrens since they would be redeclare into the Abstract class?
#2 Updated by Ernesto Baschny over 8 years ago
That should work if you can implement the whole interface in the abstract class already. Subclasses from an abstract class which implements an interface automatically "implement the interface" too, AFAIK.
So just give it a try!
As soon as the interface is there, the loop that goes through all hook objects should check if the $hookObj implements the interface and throw an Exception if not.
Thanks for taking a look at it!
#6 Updated by Ernesto Baschny over 8 years ago
nice work. Some things are still not ok:
1) class.tx_linkvalidator_tasks_validate.php is still missing to declare one variable $this->configuration.
2) the members which are accessed from external class (task) need to be all "public" (e.g. $depth, $page, etc). Else you get an error when saving a new task
=> make sure the scheduler task still work after your changes!
while you are at it:
3) please rename the variables and fieldnames:
- emailonbrokenlinkonly => emailOnBrokenLinkOnly
- emailfile => emailTemplateFile
4) add some error checking in execut() and throw Exceptions if there are some bogus conditions:
a) if !file_exists ($file=t3lib_div::getFileAbsFileName($this->emailfile));
b) if count($parseObj->error) > 0
c) if t3lib_div::validEmail($this->email)
The Exceptions could contain the relevant information what was wrong so that the user knows which field need to be corrected first.
Thanks!!! Nice work!
#16 Updated by Philipp Gampe over 8 years ago
I not sure if it was this patch, but I strongly guess so.
In latest trunk (typo3 & linkvalidator) I don't get valid links any more for broken internal links:
it misses both domain and rootline (I would prefer to get FE-links including transformation by realurl or cooluri).