Search the Community
Showing results for tags 'uninstall'.
-
Hi all, I have a module which creates numerous fields, pages etc. I would like to disable the ability to uninstall the module if any of the generated pages have children, as a mistaken uninstall could really mess up any website which is using it. Im curious about what is the best way to achieve this, currently I have some like: public function ___uninstall(){ error_log('---- UNINSTALL!! ----'); //check to see if any config pages have been added and abort uninstall if true //to avoid uninstalling and losing any work which has been done up to this point. if($this->canWeUninstall()) { //remove pages $this->deletePages($this->cPages->getPages()); //remove templates and field groups $this->deleteTemplates($this->cTemplates->getTemplates()); //remove repeaters $this->deleteRepeaters($this->cRepeaters->getRepeaters()); //delete fields $this->deleteFields($this->cFields->getFields(), $this->cRepeaters->getRepeaters()); } else { error_log('Uninstall aborted because config settings exist!'); $this->error('Whoops! Module cant be uninstalled as it appears to be in use.'); return; } } This works in the sense that it doesn't remove any of the generated content, which is good as it wont break the website. However it still shows the module as uninstalled, I can achieve what i'm looking for by replacing 'return' with 'die' but that results in a white page and looks rather rubbish so its not really a great solution. I would imagine there must be a better way to achieve this, any thoughts? Would it be possible to do this check via a hook before uninstallation and abort before we get to the point of running the uninstall() method, as I imagine that is what updates the DB to turn the module off so to speak?
-
I love the option to export fields via the CMS, and wondered about using that export data in a module. Basicly, I'd want to configure a field using the CMS and then paste it's export data in the module code as a string, or save it in a seperate file I can read from the module code. Once I have that string as a variable or file, I'd want to run the same code the import option does... but then from my module code's install method! Is that possible? It would save a lot of time configuring fields through the API.
-
Hi, I've put in a support request (as a followup on an existing one) for this but it's nearly 10pm Ryan's time, so I thought I'd ask on here just in case someone can help... Yesterday we purchased ProDrafts, but I couldn't get the key to validate. Every time I hit submit on the module settings screen the key would be removed from the field I entered it in, and then it would complain about the missing value. I put in a support request and Ryan responded last night. It turned out it was because we're behind a proxy/firewall. He gave me a fix to get around that issue - some code to go into admin.php. I put that code in and saved admin.php, but now I can't even get into our admin anymore! (Just to clarify, I took the code back out and saved admin.php but that made no difference. It's definitely not the new code causing the error.) The errors relate to a lack of permission on the ProDrafts module (see attached screenshot). We do have a key, but evidently the code Ryan gave me to add the key in via admin.php isn't taking effect before the error is thrown...? I tried removing the ProDrafts directory from the modules directory, but that hasn't helped. Is there a hook I can put in somewhere to tell it not to load ProDrafts at all, or not check the permissions? Or is there some way to manually uninstall it from the file system? Thanks! Margaret
-
Hi, I installed the TextFormatterVideoEmbed module (great module, btw) but during a power outage my system got corrupted. I am getting an "Error: Exception: Table 'cmoran.textformatter_video_embed'" in the log. When I go to MySQL database folder I can see the textformatter_video_embed.frm file but no MYD or MYI files. In phpMyAdmin it won't open the table (data does not exist, would be my guess). I removed the module folder from site/modules and now I can at least get into the back-end. However, it shows that it is installed but when I click to go into the details and uninstall it, I get the error Table 'cmoran.textformatter_video_embed' doesn't exist. I tried adding it back but it won't reinstall either. I seem to be stuck. I cannot uninstall it and I cannot reinstall it. What do I need to do to get it completely out of the system so that I can reinstall the module? Thx.