Project

General

Profile

Actions

Feature #12340

closed

Enhance the tx_linkvalidator_linkTypes_Interface

Added by Ernesto Baschny about 13 years ago. Updated over 10 years ago.

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

100%

Estimated time:
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


Files

12340.diff (11.8 KB) 12340.diff Michael Miousse, 2011-01-18 22:02
12340_v2.diff (15 KB) 12340_v2.diff Chris topher, 2011-01-19 02:26
12340_v3.diff (22.9 KB) 12340_v3.diff Michael Miousse, 2011-01-19 17:37
12340_v4.diff (21.5 KB) 12340_v4.diff Chris topher, 2011-01-19 20:02
12340_v5.diff (19.8 KB) 12340_v5.diff Michael Miousse, 2011-01-19 21:06
12340_v6.diff (21.2 KB) 12340_v6.diff Michael Miousse, 2011-01-19 22:45
12340_v7.diff (20 KB) 12340_v7.diff Michael Miousse, 2011-01-19 22:53
Actions #1

Updated by Michael Miousse about 13 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?

Actions #2

Updated by Ernesto Baschny about 13 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!

Actions #3

Updated by Michael Miousse about 13 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.

Actions #4

Updated by Michael Miousse about 13 years ago

  • Status changed from New to Needs Feedback
Actions #5

Updated by Chris topher about 13 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.
Actions #6

Updated by Ernesto Baschny about 13 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!

Actions #7

Updated by Michael Miousse about 13 years ago

Ernesto Baschny wrote:

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

this check should also be tx_linkvalidator_tasks_ValidateAdditionalFieldProvider

Actions #8

Updated by Michael Miousse about 13 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

Actions #9

Updated by Chris topher about 13 years ago

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

Actions #10

Updated by Michael Miousse about 13 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

Actions #11

Updated by Michael Miousse about 13 years ago

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

here is v5

Actions #12

Updated by Michael Miousse about 13 years ago

refactoring of the throwing exception

Actions #13

Updated by Michael Miousse about 13 years ago

sorry forgot to erase path in the patch

Actions #15

Updated by Michael Miousse about 13 years ago

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

Committed revision 42368.

Actions #16

Updated by Philipp Gampe about 13 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

Actions #17

Updated by Chris topher about 13 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

Actions #18

Updated by Chris topher about 12 years ago

  • Status changed from Resolved to Closed
Actions #19

Updated by Michael Stucki over 10 years ago

  • Category set to Linkvalidator
Actions #20

Updated by Michael Stucki over 10 years ago

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

Also available in: Atom PDF