0

We are developing an extension for connect manager and we need to get notified if any users uninstalled that extension but didn't found the way How to do that, please help if there is any way to figure out the issue

4
  • Welcome to Magento SE. It's impossible for an extension to react in any way on its own removal. Besides that, this sounds like a shady practice. Extensions should not "call home" at all, but that's just my opinion. – Fabian Schmengler Jul 1 '16 at 13:38
  • Thanks for your response, I too feels the same but we had a forced requirement to know that whether extension in Uninstalled by the user or not, Others way to achieve the requirement will be most welcomed – Vivek Kshatriya Jul 1 '16 at 13:43
  • So what if you tell them it's impossible to achieve this requirement? The only way I can imagine is to constantly ping your server from a cronjob and as soon as these pings stop from a certain domain the extension either has been uninstalled or somebody disabled the cronjob (and has a very bad impression of your company) – Fabian Schmengler Jul 1 '16 at 13:46
  • @fschmengler what do you think about the solution I came up with? Check below and let me know if you have the time. – user41363 Jul 1 '16 at 14:15
1

From what I know about Magento and its extensions what you are trying to do is not possible, however there is a way around. Since Magento Download uninstalls every file that the extension contains, why don't you just do this:

  1. Create a file in a random folder of your extension (.txt for instance), let's call it installed.txt

  2. Put the extension available on the market for download but ask for the domain/URL where the extension will be installed, let's say the domain is http://farfetch.com/

  3. Setup a Cron Job on a server of yours that verifies if the file you embed in the extension (installed.txt) is on that specific domain (http://farfetch.com/) so this way you will know if the extension is still installed or not.

Here is a code sample of how you can do this in PHP:

$domains = array("http://farfetch.com/","http://oppomart.com/","etc"); //Here you insert every domain that installed your extension
foreach($domains as $url){
     $checkFile = file_get_contents($url."your/extension/path/to/embed/file/"."filename.txt"); //Replace with your information
     if($checkFile === FALSE){ //If file is not there, extension was uninstalled
          mail("youremail@here.com","User uninstalled extension","".$url." uninstalled the extension."); //Notify extension's developers by email
     }
}

Just setup a Cron Job that runs this script once a day and you are good to go. If anyone uninstalls the extension you'll know. If you get a warning that the extension was uninstalled you should edit this PHP code and remove that domain from the array, otherwise you will be getting the same warning over and over again. Later on, if you think the array is getting too big for you to manage manually, there are easy ways to control that array automatically through another script.

This way you won't have any suspicious files on your extension nor on your client's server nor any out-traffic will occur on your client's server and you'll still be able to do what you need. If you don't understand something let me know.

4
  • Thanks paul for your suggestion, I got your concern but how we get the users Domains, lets say if our extensions will be listed in magento connect manager then how we get the list of domains in which our extensions is installed ?? does connect manager provides us to take input from the end user ? – Vivek Kshatriya Jul 2 '16 at 7:43
  • @VivekKshatriya I think Magento Connect does not offer that, what it offers is the possibility of redirecting the installation to your website like this extension for instance: magentocommerce.com/magento-connect/one-page-checkout.html and then you can ask the client for the domain before the download happens, just like the extension I mentioned above does. – user41363 Jul 2 '16 at 11:34
  • @VivekKshatriya If you think this is the best solution please accept my answer as correct – user41363 Jul 3 '16 at 23:30
  • @paull I am new user so not having that much reputation – Vivek Kshatriya Jul 4 '16 at 7:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.