TYPO3 how to execute code when the extension was activated? - typo3

I have TYPO3 version 7.6.16. how to execute code when the extension was activated ? Do you know how to do it ?
I need to send email with some information (IP, host) after extension was activated.

I think the signal afterExtensionInstall in Extensionmanager should do the trick. Otherwise, you can look for further signals or hooks offered by Extensionmanager.
Example in ext_localconf.php
$signalSlotDispatcher->connect(
\TYPO3\CMS\Extensionmanager\Utility\InstallUtility::class,
'afterExtensionInstall',
\Vendor\Extension\Hooks\ExtensionInstallation::class,
'afterInstallation'
);

Related

Autocompletion for CakePHP finders in VSCode?

is there a way in VScode to have autocompletion for custom finders when using $this->Table->find('finderName') ? Each time I have to check in the Table file to see which finder exists.
I tried using PHP doc when defining the finder function
Thanks !
According to https://github.com/dereuromark/cakephp-ide-helper/wiki/Visual-Studio-Code
https://github.com/dereuromark/cakephp-ide-helper should work fine as long as you have Intelephense Extension.

VSCode extension activation event onCreate file

I'm looking for create a extension on vscode but I want to trigger it when someone create a new file. I read the documentation but I find nothing on OnCreate activation event. Somebody know if it's possible to trigger this event ? Or why VSCode don't allow to trigger this event ?
Thanks in advance for the response ;)
As of VS Code 1.29, there is no generic fileCreated activation event. Please file a feature request if this is something you want to see
If you are only interested in files of a specific language, use the onLanguage: activation event. This will be fired when a new file is created of a given language.
Otherwise, you can activate on *. If you do this, try to defer any extensive operations until they are really needed since your extension will always be activated
There are events on the workspace object that one can listen to: onWillCreateFiles and onDidCreateFiles

TYPO3 REST Extension setup

I'm trying to setup the REST-Extension v2 in TYPO3 8.7 following this tutorial. I included the 2 templates called Virtual-Object-Page and Virtual-Object-Content in my template. I made a new extension using Extension Builder 8.7 from Github with a simple model. I installed the new extension and made some Instances of my model in the List View on my start page. In the Typoscript of my template I added:
plugin.tx_rest.settings.paths {
1 {
path = me-kinder-child
read = allow
write = allow
}
}
Me is the Vendor, kinder my extension key and child is my model.
When I'm calling http://localhost/rest/ I get The requested URL /rest/ was not found on this server.
What am I missing?
The path in the setup is explained being possible with several options, so perhaps try different configuration, possible is also all.
I don't see a fault in your setup, so the fault might be related to the server-file .htaccess or the extension realurl respectively the combination of both perhaps.
If you try it already with realurl or cooluri then disable that to get it running without first.
The htaccess file you can disable first too and enable it later again to adjust all requirements to each other.
The problem was not about RealURL was missing in any way. I just did not clear a cache that got cleared while installing RealURL. I guess that the "Clear all caches"-button in the Install-Tool would do it too.

Configure TinyMCE in Typo3 to run over HTTPS

we are using Typo3 7.6.6 for our new homepage. To simplify the process of writing new articles, we introduced the extension TinyMCE4 as TYPO3 RTE. On our test-system tinyMCE works fine, the editors are satisfied.
To prepare for production environment we introduced SSL. Hence the homepage is referenced over https://....
Since this change tinyMCE no longer appeared. After some research we found out, that the tinyMCE extension tries to load a specific dynamically generated js-file tinymceConfiguration....js over HTTP (not over SSL as preferred).
Since we have a strict policy, the server doesn't allow the client to catch the script without using SSL. Unfortunately we cannot change that policy.
The question is: where does the extension get the URL from. Can I overwrite it to reference the https://.. path?
I already tried changing
config.baseURL
tinyMCE.init({
...
document_base_url : "https://.."
});
But it didn't work.
Does anybody have an idea?
Regards,
Thomas
you could try to tell your browser to use "Content-Security-Policy" in that way all http links are rewriten by the browser itself. Maybe the lazy way.
https://developers.google.com/web/fundamentals/security/encrypt-in-transit/why-https?hl=en
http://www.html5rocks.com/en/tutorials/security/content-security-policy/
Regards
Pete

How to set SwifMailer plugins when using the Laravel mail class?

Laravel does not return any useful information to show the reason that email fails. The SwifMailer Logger plugins helps with debugging during the process of sending. What is the correct way to set this plugin (and other swifmailer plugins) when emails are sent through Laravel's Mail class?
Use
Mail::getSwiftMailer()->registerPlugin();
You can place this code into some service provider for example to be executed on application startup. Or you can override Illuminate\Mail\Mailer entirely if you want.