Project

General

Profile

Actions

Feature #17702

closed

Hook request for class.t3lib_extfilefunc.php, changes to show_item.php

Added by Christian Reiter about 17 years ago. Updated about 11 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2007-10-19
Due date:
% Done:

0%

Estimated time:
PHP Version:
5.2
Tags:
Complexity:
Sprint Focus:

Description

If these hooks have already been considered and it was decided that they are unnecessary, or they have been already proposed / are in progress, ignore this reqest.

(In the trunk of the TYPO3 SVN i couldn´t find any hooks in this class and I assume that´s the up to date version)

I would propose hooks

func_rename_post, func_move_post, func_edit_post, func_upload_post, func_delete_post

which enable handling of these events after they take place, and

func_move_pre, func_delete_pre

which are called beforheand, and the operation only takes place if they return true (if there are several hook functions registered, it only takes place if all of them return true)

These are hooks I´ve found necessary for a project, however it might be logical to offer the _pre check for all operations.

Uses are for instance handling file versioning and giving more consideration to the reference index.

example: if a file is renamed, and there are references pointing to it, then a hook script can a) warn the user, or b) suppress the action, or c) automatically update the database elements referring to the file.

At present the potential of the reference index doesn´t really seem to be used in relation to file operations. Just compare this to what people are used to when they rename files in a web editor with site management - if the site cache / reference index is aware of links to the file that is renamed, the elements containing those links are automatically updated; and if a file that has references pointing to it is supposed to be deleted, the user is at least warned.

Likewise through a hook an extension can automatically add uploaded files to a versioning system if they fulfill certain criteria, bend a plain file system rename to an "svn rename" call if the file in question is versioned, etc.

Since these file operations are general "bread and butter" events that happen constantly in using the CMS I think it would be conceptually logical if there were hooks for all relevant file operations. Just as there are hooks called after saving changes/deletions to the db


Another request for similar reasons applies to show_item.php.

This script supports a very nice hook
...['SC_OPTIONS']['typo3/show_item.php']['typeRendering']
which I am using, however if the item that you want to render is a directory, you run into a problem with this code:

if (@is_file($this->file) && t3lib_div::isAllowedAbsPath($this->file))    {
$this->type = 'file';
$this->access = 1;

so if it´s not a file, the hook is never called because it depends on $this->access to be set.

Likewise the makeRef function in show_item.php should be extensible to allow an externally defined method of identifying references, and returning a different result.
(for instance an extension might be tracking file-to-file references additionally to db-to-db and db-to-file references)

it is also easier for users to understand references, if not only tt_content:image UID is shown but also a direct edit link to the file as well as a collection of the page titles that contain content elements with references to the file.With an extensible Makeref / makerefFrom function an extension could supply that.

If there is any interest in some or all of these hook requests I can try to prepare some diffs by generalizing the solutions I have so far been using per xclass.

(issue imported from #M6550)

Actions

Also available in: Atom PDF