[TYPO3-dev] Searching for hook

Sascha Hierold Sascha.Hierold at atp-autoteile.de
Wed Jun 16 08:40:44 CEST 2010


Hi,

> Sascha Hierold wrote:
>> Directory-structure
>> ===================
>> Ext-Folder: typo3conf/ext/***_ad_sync
>>
>> Files:
>> ------
>> /ext_localconf.php
>> /class.tx_***_ad_sync_hooks.php
>
> Missing ext_emconf.php. Use extension kickstarter to generate a proper file
> structure.

ext_emconf.php is existing. I used kickstarter to create this extension 
but kickstarter generate no ext_localconf.php. This file I create by my own.

Here the structure of the whole directory:

/doc/wizard_form.dat
/doc/wizard_form.html
ChangeLog
class.tx_xxx_ad_sync_hooks.php
ext_emconf.php
ext_icon.gif
ext_localconf.php
README.txt

And here the content of ext_emconf.php:

$EM_CONF[$_EXTKEY] = array(
	'title' => 'XXX Active Directory Sync',
	'description' => 'XXX Active Directory Extension to write back some 
personal data from FE-Users to the Active Directory',
	'category' => 'be',
	'author' => 'Sascha Hierold',
	'author_email' => 'Sascha.Hierold at xxx-xxxxxxxxxx.de',
	'shy' => '',
	'dependencies' => '',
	'conflicts' => '',
	'priority' => '',
	'module' => '',
	'state' => 'alpha',
	'internal' => '',
	'uploadfolder' => 0,
	'createDirs' => '',
	'modify_tables' => '',
	'clearCacheOnLoad' => 0,
	'lockType' => '',
	'author_company' => '',
	'version' => '0.0.0',
	'constraints' => array(
		'depends' => array(
		),
		'conflicts' => array(
		),
		'suggests' => array(
		),
	),
	'_md5_values_when_last_written' => 
'a:5:{s:9:"ChangeLog";s:4:"d86b";s:10:"README.txt";s:4:"ee2d";s:12:"ext_icon.gif";s:4:"1bdc";s:19:"doc/wizard_form.dat";s:4:"f6cd";s:20:"doc/wizard_form.html";s:4:"352f";}',
);


>> $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['postUserLookUp'][]
>> =
>> 'EXT:***_ad_sync/class.tx_***_ad_sync_hooks.php:tx_***_ad_sync_hooks->syncAD';
>
> Not a problem but FYI: do not use [], use [$_EXTKEY]. In certain rare cases
> ext_localconf can be loaded twice, which means you will have two copies of
> your hook running.

I think it should be updated in the documentation on 
http://typo3.org/development/articles/how-to-use-existing-hooks/page/3/. 
There the [] is described.

With "use [$_EXTKEY]" you mean I define the hook by the following?

$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['postUserLookUp'][$_xxx_ad_sync] 
= 
'EXT:xxx_ad_sync/class.tx_xxx_ad_sync_hooks.php:tx_xxx_ad_sync_hooks->syncAD';

In which cases ext_localconf is loaded twice, it sounds like a error for me.


>>      function syncAD($params, $parent='') {
>>          echo $params;
>
> Use debug() instead and enable debug in the Install tool.
>
>>          t3lib_div::devLog('Hooks: '.t3lib_div::arrayToLogString($params,
>> array(), 100), 'tx_***_ad_sync_hooks');
>
> This works only if you have any of devLog extensions.
>
>> Devlog logs a error with the message: [Unable to autoload class
>> "tx_***_ad_sync_hooks.php"]
>
> This means you changed ext_localconf.php but did not clear configuration
> cache where the old version of this file is cached ;)

Thats the reason, after clearing the cache it looks like the hook is 
working and die at the position I set the PHP die; command.

Thanks for your help...

Bye Sascha






More information about the TYPO3-dev mailing list