Simple Machines Community Forum

SMF Development => Feature Requests => Next SMF Discussion => Topic started by: Suki on October 05, 2011, 04:13:04 PM

Title: [2.1] Hooks in 2.1
Post by: Suki on October 05, 2011, 04:13:04 PM
Hi all, the Devs are considering an overhaul for the existing hooks system

We will like to hear all opinions about this, ways to improve the usage, handling, structure, design, scope, removal from database, etc.

Please share your thoughts on this :)
Title: Re: Hooks
Post by: live627 on October 05, 2011, 05:50:19 PM
Overhaul how, exactly?
Title: Re: Hooks
Post by: ziycon on October 05, 2011, 05:53:06 PM
LDAP...............................

I know a good few people that would like this authentication option, I was going to write it myself but haven't had the time to look at how to write mod packages for SMF just yet due to life and work getting in the way.
Title: Re: Hooks
Post by: Illori on October 05, 2011, 05:54:55 PM
and how does LDAP apply to the overhaul of hooks?
Title: Re: Hooks
Post by: Suki on October 05, 2011, 05:56:00 PM
Quote from: live627 on October 05, 2011, 05:50:19 PM
Overhaul how, exactly?

in general, in every possible way, in every possible approach.

An example, some of us are thinking in hooks having its own table.
find a better way to handle hooks on uninstall/upgrading
finding a solution on the current system where you load a file everytime.

things like that.
Title: Re: Hooks
Post by: ziycon on October 05, 2011, 06:01:05 PM
Quote from: Illori on October 05, 2011, 05:54:55 PM
and how does LDAP apply to the overhaul of hooks?
Maybe I picked it up wrong or it means different things depending what community your in but I would interpret it to be considered the extension of existing functions/functionality to allow new options or features.

Please correct me if I'm wrong in the sense of SMF :)
Title: Re: Hooks
Post by: Illori on October 05, 2011, 06:25:55 PM
we mean the already built in hooks, that mod authors can use when creating mods.

http://wiki.simplemachines.org/smf/Integration_hooks
Title: Re: Hooks
Post by: live627 on October 05, 2011, 06:27:46 PM
Quote from: Miss All Sunday on October 05, 2011, 05:56:00 PM
Quote from: live627 on October 05, 2011, 05:50:19 PM
Overhaul how, exactly?

in general, in every possible way, in every possible approach.

An example, some of us are thinking in hooks having its own table.
find a better way to handle hooks on uninstall/upgrading
finding a solution on the current system where you load a file everytime.

things like that.
Oh.... so not only the core hook functions, but also the package manager.


Perhaps, in package-info, blocks could be used for hooks, like

<install>
    <hook point="pre_load">my_plugin</hook>
</install>

Same for uninstall.

I saw Sinan mention he wanted hooks to also call files. I'd say to do it. Then such pseudo-hooks could be removed like admin_include, pre_include,  theme_include.

I don't know about hooks living in their own table. Where they are seems fine to me. They could even be a serialized array instead of CSV which could also help in storing multiple values such as file, class, function.

I remember hearing that Matt put a mod with tons of hooks for the core on the team boards before he left. In anticipation of that, I did not suggest any new hooks (even when Norv asked me to :P)
Title: Re: Hooks
Post by: Suki on October 05, 2011, 06:38:35 PM
Yes there is some ideas as to provide another tag for hooks.

Yes all the hooks SD left are now on 2.1

I will vote for having a separate table for hooks, settings is already too bloated IMO, plus it will make handling hooks a little better.

We also discuss about having an admin page where you can enable/disable or otherwise administrate hooks
Title: What about new hooks for SMF 2.x
Post by: Bugo on October 14, 2011, 05:48:51 AM
integrate_message (Display.php)
integrate_member_data (Load.php)
integrate_attachments (Display.template.php)
integrate_message_buttons (Display.template.php)
Title: Re: What about new hooks for SMF 2.x
Post by: feline on October 14, 2011, 07:24:05 AM
Add a hook in Subs for custom menu functions AFTER the load from cache:

call_integration_hook('integrate_dynamic_buttons', array(&$menu_buttons));

$context['menu_buttons'] = $menu_buttons;
Title: Re: What about new hooks for SMF 2.x
Post by: Bugo on October 14, 2011, 07:50:06 AM
Quote from: feline on October 14, 2011, 07:24:05 AM
Add a hook in Subs for custom menu functions AFTER the load from cache:

call_integration_hook('integrate_dynamic_buttons', array(&$menu_buttons));

$context['menu_buttons'] = $menu_buttons;

Yes, it'a great idea.
Title: Re: What about new hooks for SMF 2.x
Post by: live627 on October 14, 2011, 07:44:44 PM
And this (Oh, you ask what this technocrap is. A unified diff!)

Index: Load.php
===================================================================
@@ -945,57 +984,49 @@

if ($set == 'normal')
{
- $select_columns = '
- IFNULL(lo.log_time, 0) AS is_online, IFNULL(a.id_attach, 0) AS id_attach, a.filename, a.attachment_type,
- mem.signature, mem.personal_text, mem.location, mem.gender, mem.avatar, mem.id_member, mem.member_name,
- mem.real_name, mem.email_address, mem.hide_email, mem.date_registered, mem.website_title, mem.website_url,
- mem.birthdate, mem.member_ip, mem.member_ip2, mem.icq, mem.aim, mem.yim, mem.msn, mem.posts, mem.last_login,
- mem.karma_good, mem.id_post_group, mem.karma_bad, mem.lngfile, mem.id_group, mem.time_offset, mem.show_online,
- mem.buddy_list, mg.online_color AS member_group_color, IFNULL(mg.group_name, {string:blank_string}) AS member_group,
- pg.online_color AS post_group_color, IFNULL(pg.group_name, {string:blank_string}) AS post_group, mem.is_activated, mem.warning,
- CASE WHEN mem.id_group = 0 OR mg.stars = {string:blank_string} THEN pg.stars ELSE mg.stars END AS stars' . (!empty($modSettings['titlesEnable']) ? ',
- mem.usertitle' : '');
- $select_tables = '
- LEFT JOIN {db_prefix}log_online AS lo ON (lo.id_member = mem.id_member)
- LEFT JOIN {db_prefix}attachments AS a ON (a.id_member = mem.id_member)
- LEFT JOIN {db_prefix}membergroups AS pg ON (pg.id_group = mem.id_post_group)
- LEFT JOIN {db_prefix}membergroups AS mg ON (mg.id_group = mem.id_group)';
+ $select_columns = array(
+ 'IFNULL(lo.log_time, 0) AS is_online', 'IFNULL(a.id_attach, 0) AS id_attach', 'a.filename', 'a.attachment_type', 'mem.signature', 'mem.personal_text', 'mem.location', 'mem.gender', 'mem.avatar', 'mem.id_member', 'mem.member_name', 'mem.real_name', 'mem.email_address', 'mem.hide_email', 'mem.date_registered', 'mem.website_title', 'mem.website_url', 'mem.birthdate', 'mem.member_ip', 'mem.member_ip2', 'mem.icq', 'mem.aim', 'mem.yim', 'mem.msn', 'mem.posts', 'mem.last_login', 'mem.karma_good', 'mem.id_post_group', 'mem.karma_bad', 'mem.lngfile', 'mem.id_group', 'mem.time_offset', 'mem.show_online', 'mem.buddy_list', 'mg.online_color AS member_group_color', 'IFNULL(mg.group_name, {string:blank_string}) AS member_group', 'pg.online_color AS post_group_color', 'IFNULL(pg.group_name, {string:blank_string}) AS post_group', 'mem.is_activated', 'mem.warning', 'CASE WHEN mem.id_group = 0 OR mg.stars = {string:blank_string} THEN pg.stars ELSE mg.stars END AS stars',
+ );
+ if (!empty($modSettings['titlesEnable']))
+ $select_columns[] = 'mem.usertitle';
+ $select_tables = array(
+ 'LEFT JOIN {db_prefix}log_online AS lo ON (lo.id_member = mem.id_member)',
+ 'LEFT JOIN {db_prefix}attachments AS a ON (a.id_member = mem.id_member)',
+ 'LEFT JOIN {db_prefix}membergroups AS pg ON (pg.id_group = mem.id_post_group)',
+ 'LEFT JOIN {db_prefix}membergroups AS mg ON (mg.id_group = mem.id_group)',
+ );
}
elseif ($set == 'profile')
{
- $select_columns = '
- IFNULL(lo.log_time, 0) AS is_online, IFNULL(a.id_attach, 0) AS id_attach, a.filename, a.attachment_type,
- mem.signature, mem.personal_text, mem.location, mem.gender, mem.avatar, mem.id_member, mem.member_name,
- mem.real_name, mem.email_address, mem.hide_email, mem.date_registered, mem.website_title, mem.website_url,
- mem.openid_uri, mem.birthdate, mem.icq, mem.aim, mem.yim, mem.msn, mem.posts, mem.last_login, mem.karma_good,
- mem.karma_bad, mem.member_ip, mem.member_ip2, mem.lngfile, mem.id_group, mem.id_theme, mem.buddy_list,
- mem.pm_ignore_list, mem.pm_email_notify, mem.pm_receive_from, mem.time_offset' . (!empty($modSettings['titlesEnable']) ? ', mem.usertitle' : '') . ',
- mem.time_format, mem.secret_question, mem.is_activated, mem.additional_groups, mem.smiley_set, mem.show_online,
- mem.total_time_logged_in, mem.id_post_group, mem.notify_announcements, mem.notify_regularity, mem.notify_send_body,
- mem.notify_types, lo.url, mg.online_color AS member_group_color, IFNULL(mg.group_name, {string:blank_string}) AS member_group,
- pg.online_color AS post_group_color, IFNULL(pg.group_name, {string:blank_string}) AS post_group, mem.ignore_boards, mem.warning,
- CASE WHEN mem.id_group = 0 OR mg.stars = {string:blank_string} THEN pg.stars ELSE mg.stars END AS stars, mem.password_salt, mem.pm_prefs';
- $select_tables = '
- LEFT JOIN {db_prefix}log_online AS lo ON (lo.id_member = mem.id_member)
- LEFT JOIN {db_prefix}attachments AS a ON (a.id_member = mem.id_member)
- LEFT JOIN {db_prefix}membergroups AS pg ON (pg.id_group = mem.id_post_group)
- LEFT JOIN {db_prefix}membergroups AS mg ON (mg.id_group = mem.id_group)';
+ $select_columns = array(
+ 'IFNULL(lo.log_time, 0) AS is_online', 'IFNULL(a.id_attach, 0) AS id_attach', 'a.filename', 'a.attachment_type', 'mem.signature', 'mem.personal_text', 'mem.location', 'mem.gender', 'mem.avatar', 'mem.id_member', 'mem.member_name', 'mem.real_name', 'mem.email_address', 'mem.hide_email', 'mem.date_registered', 'mem.website_title', 'mem.website_url', 'mem.openid_uri', 'mem.birthdate', 'mem.icq', 'mem.aim', 'mem.yim', 'mem.msn', 'mem.posts', 'mem.last_login', 'mem.karma_good', 'mem.karma_bad', 'mem.member_ip', 'mem.member_ip2', 'mem.lngfile', 'mem.id_group', 'mem.id_theme', 'mem.buddy_list', 'mem.pm_ignore_list', 'mem.pm_email_notify', 'mem.pm_receive_from', 'mem.time_offset', 'mem.time_format', 'mem.secret_question', 'mem.is_activated', 'mem.additional_groups', 'mem.smiley_set', 'mem.show_online', 'mem.total_time_logged_in', 'mem.id_post_group', 'mem.notify_announcements', 'mem.notify_regularity', 'mem.notify_send_body', 'mem.notify_types', 'lo.url', 'mg.online_color AS member_group_color', 'IFNULL(mg.group_name, {string:blank_string}) AS member_group', 'pg.online_color AS post_group_color', 'IFNULL(pg.group_name, {string:blank_string}) AS post_group', 'mem.ignore_boards', 'mem.warning', 'CASE WHEN mem.id_group = 0 OR mg.stars = {string:blank_string} THEN pg.stars ELSE mg.stars END AS stars', 'mem.password_salt', 'mem.pm_prefs',
+ );
+ if (!empty($modSettings['titlesEnable']))
+ $select_columns[] = 'mem.usertitle';
+ $select_tables = array(
+ 'LEFT JOIN {db_prefix}log_online AS lo ON (lo.id_member = mem.id_member)',
+ 'LEFT JOIN {db_prefix}attachments AS a ON (a.id_member = mem.id_member)',
+ 'LEFT JOIN {db_prefix}membergroups AS pg ON (pg.id_group = mem.id_post_group)',
+ 'LEFT JOIN {db_prefix}membergroups AS mg ON (mg.id_group = mem.id_group)',
+ );
}
elseif ($set == 'minimal')
{
- $select_columns = '
- mem.id_member, mem.member_name, mem.real_name, mem.email_address, mem.hide_email, mem.date_registered,
- mem.posts, mem.last_login, mem.member_ip, mem.member_ip2, mem.lngfile, mem.id_group';
- $select_tables = '';
+ $select_columns = array(
+ 'mem.id_member', 'mem.member_name', 'mem.real_name', 'mem.email_address', 'mem.hide_email', 'mem.date_registered', 'mem.posts', 'mem.last_login', 'mem.member_ip', 'mem.member_ip2', 'mem.lngfile', 'mem.id_group',
+ );
+ $select_tables = array();
}
else
trigger_error('loadMemberData(): Invalid member data set \'' . $set . '\'', E_USER_WARNING);

+ call_hook('load_member_context', array(&$set, $users, &$select_columns, &$select_tables));
+
if (!empty($users))
{
// Load the member's data.
$request = $smcFunc['db_query']('', '
- SELECT' . $select_columns . '
+ SELECT ' . implode(', ', $select_columns) . '
FROM {db_prefix}members AS mem' . $select_tables . '
WHERE mem.' . ($is_name ? 'member_name' : 'id_member') . (count($users) == 1 ? ' = {' . ($is_name ? 'string' : 'int') . ':users}' : ' IN ({' . ($is_name ? 'array_string' : 'array_int') . ':users})'),
array(
@@ -1268,6 +1299,7 @@
}
}

+ call_hook('load_member_context', array(&$memberContext[$user]));
return true;
}

@@ -1319,6 +1351,8 @@
// Robots shouldn't be logging in or registering.  So, they aren't a bot.  Better to be wrong than sorry (or people won't be able to log in!), anyway.
if ((isset($_REQUEST['action']) && in_array($_REQUEST['action'], array('login', 'login2', 'register'))) || !$user_info['is_guest'])
$context['browser']['possibly_robot'] = false;
+
+ call_hook('detect_browser', array(&$context['browser']));
}

// Load a theme, by ID.
Title: Re: What about new hooks for SMF 2.x
Post by: Suki on October 14, 2011, 10:30:08 PM
See, this is what I was talking about here (http://www.simplemachines.org/community/index.php?topic=454883.0)  ;)
Title: Re: Hooks
Post by: Suki on October 15, 2011, 08:56:12 PM
oh! and magically they were merged :P
Title: Re: Hooks in 2.1
Post by: Matthew K. on October 19, 2011, 01:24:55 PM
No need for Menu Hooks if Menu Editor is implemented. Mods can then simply add their buttons to the database, and then reload the menu cache file.
Quote from: feline on October 14, 2011, 07:24:05 AM
Add a hook in Subs for custom menu functions AFTER the load from cache:

call_integration_hook('integrate_dynamic_buttons', array(&$menu_buttons));

$context['menu_buttons'] = $menu_buttons;


I agree that the hooks system should be rethought out. Definitely it's own table, that's just the smart thing to do, in my opinion.
Title: Re: Hooks in 2.1
Post by: live627 on October 19, 2011, 08:14:13 PM
Quote from: Labradoodle-360 on October 19, 2011, 01:24:55 PM
Definitely it's own table, that's just the smart thing to do, in my opinion.
Why?


Consider: Which is more important: performance, or elegance?
Title: Re: Hooks in 2.1
Post by: 4Kstore on October 23, 2011, 03:03:40 AM
For me the use of the hook will exist if there is good documentation on them, so that has to be good translations and good examples of their use.
the hooks are a good tool but you have to use and above all we must teach use this tool

Quote from: Bugo on October 14, 2011, 05:48:51 AM
integrate_message (Display.php)
integrate_member_data (Load.php)
integrate_attachments (Display.template.php)
integrate_message_buttons (Display.template.php)


x2 agree
Title: Re: Hooks in 2.1
Post by: KensonPlays on October 23, 2011, 03:50:26 AM
Quote from: live627 on October 19, 2011, 08:14:13 PM
Quote from: Labradoodle-360 on October 19, 2011, 01:24:55 PM
Definitely it's own table, that's just the smart thing to do, in my opinion.
Why?


Consider: Which is more important: performance, or elegance?
Performance, then elegance. And yes hooks (more) would be nice.
Title: Re: Hooks in 2.1
Post by: live627 on October 23, 2011, 05:33:25 PM
Quote from: Kcmartz on October 23, 2011, 03:50:26 AM
Performance, then elegance. And yes hooks (more) would be nice.
Exactly! ESPECIALLY when bootstrapping.
Title: Re: Hooks in 2.1
Post by: Matthew K. on October 23, 2011, 11:25:07 PM
Having a separate table, does not just outright mean it's going to decrease performance. A loaded row, compared to an optimized, indexed, table that was thought through well, and then fed out and cached smartly, is actually possible to INCREASE performance.
Quote from: live627 on October 19, 2011, 08:14:13 PM
Quote from: Labradoodle-360 on October 19, 2011, 01:24:55 PM
Definitely it's own table, that's just the smart thing to do, in my opinion.
Why?


Consider: Which is more important: performance, or elegance?
Title: Re: Hooks in 2.1
Post by: live627 on October 24, 2011, 01:48:41 AM
So then the hooks would be cached? I still think that storing them in smf_settings will save on a query per page load.
Title: Re: Hooks in 2.1
Post by: Matthew K. on October 24, 2011, 11:08:30 AM
Adding a query doesn't automatically mean performance decrease. If optimized well it can do just fine.
Title: Re: Hooks in 2.1
Post by: Fustrate on October 24, 2011, 12:36:15 PM
There's no reason not to cache the hooks - it's not like they change every page load or two.
Title: Re: Hooks in 2.1
Post by: feline on October 24, 2011, 04:18:25 PM
caching of the hooks itself is no problem, but the hook code must run on each page load, else dynamic hooks don't work ...
Title: Re: Hooks in 2.1
Post by: Matthew K. on October 24, 2011, 04:25:38 PM
Well right, that's how it works now. I just think that it should be moved from a row, to a table.
Quote from: feline on October 24, 2011, 04:18:25 PM
caching of the hooks itself is no problem, but the hook code must run on each page load, else dynamic hooks don't work ...
Title: Re: Hooks in 2.1
Post by: Joshua Dickerson on December 14, 2011, 11:52:09 PM
I just wanted to make a note that the next version will feature a LOT more hooks. Along with that, there is a function loadFile() which has a hook in it before loading of the file and after loading of the file. You can set your plugin to make use of that to completely change any file (as in not include it). Hopefully that doesn't get too much use, but it gives you an idea of how hooks will be used.

Along with that, CSS and JS are loaded through a function as well. So, you can do the same thing.

SlammedDime also gave us a ton of hooks which I implemented a while back.
Title: Re: Hooks in 2.1
Post by: live627 on December 15, 2011, 06:00:59 PM
Nifty! So are plugins or mods  still going  to be installed like now, where package-info dictates where files get copied to, or will they be run from a dedicated folder?
Title: Re: Hooks in 2.1
Post by: Joshua Dickerson on December 15, 2011, 07:02:58 PM
hmm... hadn't thought much about it. It is an interesting idea - only allow plugins to be placed in a certain directory. Although that is very prone to abuse, it would keep things clean. I like it. Need to add that as a bug report.
Title: Re: Hooks in 2.1
Post by: Joshua Dickerson on December 15, 2011, 07:06:11 PM
Tracked Bug #4909: Only allow plugins in a plugins directory (http://dev.simplemachines.org/mantis/view.php?id=4909)
Title: Re: Hooks in 2.1
Post by: live627 on December 15, 2011, 07:51:57 PM
loadFile('require_once_for_plugins_my_ass.php', 'live627:my_plgin');
Same format for loadTemplate?
Title: Re: Hooks in 2.1
Post by: Joshua Dickerson on December 15, 2011, 08:14:34 PM
/**
* Load a file
* @param string $filename
* @param string $directory_type = 'source' (always lowercase) or used as a directory if no type is found
*/
function loadFile($filename, $type = 'source')
Title: Re: [2.1] Hooks in 2.1
Post by: mkress on April 15, 2012, 01:28:31 PM
I think its very important to have a list of available and installed/used hooks in admin area.


Also there have to be much more hooks on several positions in smf...
Title: Re: [2.1] Hooks in 2.1
Post by: IchBin™ on April 16, 2012, 04:51:04 PM
There are literally over a 100 hooks in the next version of SMF already.
Title: Re: [2.1] Hooks in 2.1
Post by: Joshua Dickerson on April 17, 2012, 09:00:21 AM
I think it is somewhere around 250 new hooks.
Title: Re: [2.1] Hooks in 2.1
Post by: inter on August 31, 2012, 03:52:54 AM
 8)

Who.php:

find:
$context['copyrights'] = array(
'smf' => sprintf($forum_copyright, $forum_version),

/* Modification Authors:  You may add a copyright statement to this array for your mods.
Copyright statements should be in the form of a value only without a array key.  I.E.:
'Some Mod by Thantos &copy; 2010',
$txt['some_mod_copyright'],
*/
'mods' => array(
),
);


replace:
$context['copyrights'] = array(
'smf' => sprintf($forum_copyright, $forum_version),

/* Modification Authors:  You may add a copyright statement to this array for your mods.
Copyright statements should be in the form of a value only without a array key.  I.E.:
'Some Mod by Thantos &copy; 2010',
$txt['some_mod_copyright'],
*/
'mods' => array(
),
);
call_integration_hook('modification_authors', array(&$context['copyrights']['mods']));
Title: Re: Hooks in 2.1
Post by: emanuele on August 31, 2012, 04:32:35 AM
Quote from: 4Kstore on October 23, 2011, 03:03:40 AM
For me the use of the hook will exist if there is good documentation on them, so that has to be good translations and good examples of their use.
That is a good point.
But there is a problem: write documentation takes time. I just did a search in the code for "call_integration_hook" and I found 248 matches, considering the function itself, a couple of places where SMF checks if the function exists, some hooks that are used in multiple places, I think we are about 220 unique hooks (*but* some of them are "generic" so that a single hook can cover multiple things (like lists and menus), so in the end the real number of things you can change with hooks in 2.1 is difficult to estimate).

At the moment hooks documentation is on the wiki (http://wiki.simplemachines.org/smf/integration_hooks), but this solution doesn't scale so well. It is okay for a bunch of hooks (15/30), but with the numbers we will have in 2.1 it will be very difficult to document each and every hook that way, so we are considering using comments in the code itself (that will probably be something will be cleaned up during the beta/rc phase and any help would be highly appreciated of course!)

Of course write examples is "easier". There are already few on the wiki (e.g. how to add a custom action (http://wiki.simplemachines.org/smf/Add_a_custom_action_using_integration_hooks)) and anybody can (and is encouraged) to write new ones (don't worry if your English is not perfect, we have K@ that can translate anything it into gibberish! :P).

tl;dr: if you want to write some documentation feel free to edit the wiki and if in the process of writing you would have any doubt, feel free to post in the SMF Documentation Help (http://www.simplemachines.org/community/index.php?board=202.0) board!
Title: Re: [2.1] Hooks in 2.1
Post by: inter on September 04, 2012, 02:33:14 AM
to do inquiries in a cycle it is impossible  :-\
I think that it is necessary to alter this code

Who.php
$data = array();
foreach ($url_list as $k => $url)
{
...

// Maybe the action is integrated into another system?
if (count($integrate_actions = call_integration_hook('integrate_whos_online', array($actions))) > 0)
{
foreach ($integrate_actions as $integrate_action)
{
if (!empty($integrate_action))
{
$data[$k] = $integrate_action;
break;
}
}
}
}
Title: Re: [2.1] Hooks in 2.1
Post by: emanuele on September 04, 2012, 03:44:20 AM
Quote from: Inter on September 04, 2012, 02:33:14 AM
to do inquiries in a cycle it is impossible  :-\
I think that it is necessary to alter this code
Why it should be changed? And how?
Could you please provide an example?
If you think it's a bug, please open a topic in Bug Reports (http://www.simplemachines.org/community/index.php?board=137.0). ;)
Title: Re: [2.1] Hooks in 2.1
Post by: inter on September 04, 2012, 05:05:48 AM
Quote from: emanuele on September 04, 2012, 03:44:20 AM
Quote from: Inter on September 04, 2012, 02:33:14 AM
to do inquiries in a cycle it is impossible  :-\
I think that it is necessary to alter this code
Why it should be changed? And how?
Could you please provide an example?
If you think it's a bug, please open a topic in Bug Reports (http://www.simplemachines.org/community/index.php?board=137.0). ;)

link (http://www.simplemachines.org/community/index.php?topic=485685.0)
Title: Re: [2.1] Hooks in 2.1
Post by: inter on April 08, 2013, 07:19:13 AM
integrate_clean_cache

for example if you use library which uses own folders of a cache which you too would like to clear in case of forum cache flush

Subs.php

Find:

// Invalidate cache, to be sure!
// ... as long as Load.php can be modified, anyway.
@touch($sourcedir . '/' . 'Load.php');
clearstatcache();


Replace:

// Invalidate cache, to be sure!
// ... as long as Load.php can be modified, anyway.
@touch($sourcedir . '/' . 'Load.php');

        call_integration_hook('integrate_clean_cache');

clearstatcache();
Title: Re: [2.1] Hooks in 2.1
Post by: Joshua Dickerson on April 08, 2013, 11:15:08 AM
That's a good one. Would you mind tracking it as a feature enhancement at https://github.com/SimpleMachines/SMF2.1/issues ? Thanks
Title: Re: [2.1] Hooks in 2.1
Post by: Arantor on April 08, 2013, 12:19:59 PM
Um, why is it a good idea? The whole point of the cache subsystem is that its content is not supposed to be relied upon to exist and plugins actually shouldn't be manually dumping stuff into the cache anyway (because that also means if they are, they're not using proper backends that aren't I/O bound, they should be using cache_put_data and cache_get_data which safely abstract away what actual backend is in use)
Title: Re: [2.1] Hooks in 2.1
Post by: inter on April 09, 2013, 05:53:40 AM
there are libraries which create temporal files
(the generated files for fast operation of library which are updated only in case of physical deleting manually)
here I also thought that would be quite good if they could be cleared together with the general cache flush of a forum
Title: Re: [2.1] Hooks in 2.1
Post by: Arantor on April 09, 2013, 09:39:44 AM
Then it should be the library taking care of it itself in the first place, not requiring a hook for that purpose. Or it should be using the proper facilities. Either way, I don't see the need for the hook.
Title: Re: [2.1] Hooks in 2.1
Post by: emanuele on June 25, 2013, 08:54:45 AM
Split: http://www.simplemachines.org/community/index.php?topic=506525.0