Feature #12340

Enhance the tx_linkvalidator_linkTypes_Interface

Added by Ernesto Baschny almost 9 years ago. Updated almost 6 years ago.

Status:
Closed
Priority:
Must have
Category:
Linkvalidator
Target version:
-
Start date:
2011-01-17
Due date:
% Done:

100%

PHP Version:
Tags:
Complexity:
Sprint Focus:

Description

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:

- getErrorParams()
- fetchType()
- getBrokenUrl()

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!

Thanks!

Cheers,
Ernesto

12340.diff View (11.8 KB) Michael Miousse, 2011-01-18 22:02

12340_v2.diff View (15 KB) Chris topher, 2011-01-19 02:26

12340_v3.diff View (22.9 KB) Michael Miousse, 2011-01-19 17:37

12340_v4.diff View (21.5 KB) Chris topher, 2011-01-19 20:02

12340_v5.diff View (19.8 KB) Michael Miousse, 2011-01-19 21:06

12340_v6.diff View (21.2 KB) Michael Miousse, 2011-01-19 22:45

12340_v7.diff View (20 KB) Michael Miousse, 2011-01-19 22:53

History

#1 Updated by Michael Miousse almost 9 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 almost 9 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!

#3 Updated by Michael Miousse almost 9 years ago

i have mad the change i told you and added the "protected" with a comment to all membre.

Tell me if you see something wrong.

I would like someone to review my comments since i'm not totaly shure of my language used.

#4 Updated by Michael Miousse almost 9 years ago

  • Status changed from New to Needs Feedback

#5 Updated by Chris topher almost 9 years ago

Attached is v2:
  • I have checked and improved the comments.
  • The format of the comments in class.tx_linkvalidator_processing.php was fixed.

#6 Updated by Ernesto Baschny almost 9 years ago

Hi Christopher,

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!

#7 Updated by Michael Miousse almost 9 years ago

Ernesto Baschny wrote:

a) if !file_exists ($file=t3lib_div::getFileAbsFileName($this->emailfile));

this check should also be tx_linkvalidator_tasks_ValidateAdditionalFieldProvider

#8 Updated by Michael Miousse almost 9 years ago

Applyed all your recomendations but one if t3lib_div::validEmail($this->email).
This one will be solved by the patch i have submited for the new mail api.

Need someone to double check error messages and double teste it

#9 Updated by Chris topher almost 9 years ago

Checked and tested. Everything seems still to be working, I only changed some texts.

#10 Updated by Michael Miousse almost 9 years ago

Christopher wrote:

Checked and tested. Everything seems still to be working, I only changed some texts.

If no one else find something wrong in this bug, ill comit it to the trunk in about 3 hours

#11 Updated by Michael Miousse almost 9 years ago

i have recreated a patch to take in consideration the modifications that oliver made yesterday

here is v5

#12 Updated by Michael Miousse almost 9 years ago

refactoring of the throwing exception

#13 Updated by Michael Miousse almost 9 years ago

sorry forgot to erase path in the patch

#15 Updated by Michael Miousse almost 9 years ago

  • Status changed from Needs Feedback to Under Review
  • % Done changed from 0 to 100

Committed revision 42368.

#16 Updated by Philipp Gampe almost 9 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:

http:///index.php?id=82

it misses both domain and rootline (I would prefer to get FE-links including transformation by realurl or cooluri).

Best regards
Phil

#17 Updated by Chris topher almost 9 years ago

  • Status changed from Under Review to Resolved

Hi Philipp,

I can reproduce this problem.
This is not caused by this patch, but by changes made in linktypes_internal.php in #12226.

Christopher

#18 Updated by Chris topher over 7 years ago

  • Status changed from Resolved to Closed

#19 Updated by Michael Stucki almost 6 years ago

  • Category set to Linkvalidator

#20 Updated by Michael Stucki almost 6 years ago

  • Project changed from Linkvalidator to TYPO3 Core
  • Category changed from Linkvalidator to Linkvalidator

Also available in: Atom PDF