Hello,
i just created a plugin which create a table on the database, but this table is not deleted when i uninstall this plugin.
Do you have an idea for this ?
Thanks
Hello,
i just created a plugin which create a table on the database, but this table is not deleted when i uninstall this plugin.
Do you have an idea for this ?
Thanks
Please show us the install.sql file. Normally it should throw an exception if it does not know how to destroy it.
Hello,
thank you.
My install.sql file is pretty simple, and contain only one line :
INSERT INTO `wcf1_language` (`languageID`, `languageCode`, `languageName`, `countryCode`, `isDefault`, `hasContent`, `isDisabled`) VALUES (NULL, 'fr', 'Français', 'it', '0', '0', '0');
There is no error, during uninstallation of the plugin.
To delete a database table row during uninstallation you need to create a php file under files\acp\uninstall\ and name it after your package identifier e.g.
files\acp\uninstall\com.example.package.php. In order to delete the row you need to put the following code into the php file.
Great ! Thank you very much ! I'll try it soon
You actually did not create a table in the database but rather inserted a row in the wcf1_language table. INSERT operations are not reversed by the system after uninstalling a package. I am also not sure if you should really remove the row again but you can use a uninstall PHP script to delete the row: If your package is called com.example.wcf.french, deliver a file acp/uninstall/com.example.wcf.french.php using the file package installation plugin in which you can use PHP to delete the row.
Also: You do not need the backticks ` here.
PS: Way too slow writing this post
Hello,
yes, it's true, it's an insert.
Ok, i'll try it and say the result here.
Thank you
Why don't you use the Language-PIP which will handle this for you?
As I know the language will be created with only 1 language item. Correct me if I am wrong.
How to do that please N
Thanks
I succeeded to delete the language when i uninstall the plugin, but only if i know the exact ID..
But i don't know how to get the correct ID of this language, so i tried ti use another column (languageCode, or countryName for example), but it doens't work ( error cannot prepare statement)
Any idea for this ?
Thanks
but only if i know the exact ID..
\wcf\system\language\LanguageFactory::getInstance()->getLanguageByCode('fr')->languageID;
\wcf\system\language\LanguageFactory::getInstance()->getLanguageByCode('fr')->languageID;
Thank you !
But i don't know how to insert it in my code :
<?php
use wcf\system\WCF;
$sql = "DELETE FROM wcf".WCF_N."_language WHERE languageCode = ?";
$statement = WCF::getDB()--->prepareStatement($sql);
$statement->execute(['fr']);
This actual code seems worked, it deleted the concerned language.
Thanks
To delete a database table row during uninstallation you need to create a php file under files\acp\uninstall\ and name it after your package identifier e.g.
files\acp\uninstall\com.example.package.php. In order to delete the row you need to put the following code into the php file.
It's exactly that, i didn't read your message attentively :P. Thank you very much !
This actual code seems worked, it deleted the concerned language.
I thought you had something like DELETE FROM [...] WHERE languageID = 1 with a hard-coded ID. The code is correct.
The code I postes gives you the ID of the language matching the fr language code.
I thought you had something like DELETE FROM [...] WHERE languageID = 1 with a hard-coded ID. The code is correct.
The code I postes gives you the ID of the language matching the fr language code.
Yes i had this code like that, but didn't work (and i don't know how to use your solution), so by adding "?" and "fr" in statement execute, it works great.
Could you explain me please ? So i'll learn another thing
Whatever you do, DO NOT create a language by inserting a new row into wcf1_language, all the variables will be missing and will cause major disruption among the phrase-related tools.
You must add the language through your ACP to have it properly created and populated.
Whatever you do, DO NOT create a language by inserting a new row into wcf1_language, all the variables will be missing and will cause major disruption among the phrase-related tools.
You must add the language through your ACP to have it properly created and populated.
Ok, so there is no properly way to add a language without using the ACP ?
Ok, so there is no properly way to add a language without using the ACP ?
Unfortunately, the answer is no.
Ok, thank you
Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!