Boost Posted July 19, 2023 Posted July 19, 2023 Hei, I installed a module a while back and modified it to suit my needs. Now I'd like to prevent checking for updates so that I don't accidentally update it and lose all my modifications. Any suggestions? Cheers
szabesz Posted July 19, 2023 Posted July 19, 2023 Hello, 1 hour ago, Boost said: I don't accidentally update it and lose all my modifications. Any suggestions? You can do this: https://processwire.com/blog/posts/processwire-core-updates-2.5.14/#multiple-copies-of-the-same-module 1 hour ago, Boost said: Now I'd like to prevent checking for updates so that I don't accidentally update Maybe I'm missing something, but how can one accidentally upgrade a module? Besides, if you think that is an issues, your backups and/or git versions, etc... should cover you, shouldn't they? 1
Boost Posted July 19, 2023 Author Posted July 19, 2023 22 minutes ago, szabesz said: Hello, You can do this: https://processwire.com/blog/posts/processwire-core-updates-2.5.14/#multiple-copies-of-the-same-module Maybe I'm missing something, but how can one accidentally upgrade a module? Besides, if you think that is an issues, your backups and/or git versions, etc... should cover you, shouldn't they? You would be surprised at what human beings are capable of.? Thanks, but my module is not a core one. 1
Robin S Posted July 19, 2023 Posted July 19, 2023 12 hours ago, Boost said: Now I'd like to prevent checking for updates so that I don't accidentally update it and lose all my modifications. When I modify a module that exists in the modules directory I put my initials in the module title or summary as a reminder, e.g. "Some Module: RPS mod". Then I disable the download button and add a notice to the "Download and Update" form just in case I forget. $wire->addHookAfter('ProcessModule::buildDownloadConfirmForm', function(HookEvent $event) { $data = $event->arguments(0); /* @var InputfieldForm $form */ $form = $event->return; $modules = $event->wire()->modules; // Return early if the module isn't already installed if(!$modules->isInstalled($data['class_name'])) return; // Get info about the installed module $info = $modules->getModuleInfoVerbose($data['class_name']); // Return early if special string doesn't occur in the title or summary if(strpos($info['title'], 'RPS mod') === false && strpos($info['summary'], 'RPS mod') === false) return; // Disable download button and add warning notice $update_button = $form->getChildByName('godownload'); if($update_button) { $update_button->value = 'Update disabled (RPS custom mod)'; $update_button->attr('style', 'opacity:0.5;'); $update_button->attr('disabled', 'disabled'); $this->warning('Module has custom RPS modifications: update disabled'); } $event->return = $form; 8
Boost Posted July 20, 2023 Author Posted July 20, 2023 8 hours ago, Robin S said: When I modify a module that exists in the modules directory I put my initials in the module title or summary as a reminder, e.g. "Some Module: RPS mod". Then I disable the download button and add a notice to the "Download and Update" form just in case I forget. $wire->addHookAfter('ProcessModule::buildDownloadConfirmForm', function(HookEvent $event) { $data = $event->arguments(0); /* @var InputfieldForm $form */ $form = $event->return; $modules = $event->wire()->modules; // Return early if the module isn't already installed if(!$modules->isInstalled($data['class_name'])) return; // Get info about the installed module $info = $modules->getModuleInfoVerbose($data['class_name']); // Return early if special string doesn't occur in the title or summary if(strpos($info['title'], 'RPS mod') === false && strpos($info['summary'], 'RPS mod') === false) return; // Disable download button and add warning notice $update_button = $form->getChildByName('godownload'); if($update_button) { $update_button->value = 'Update disabled (RPS custom mod)'; $update_button->attr('style', 'opacity:0.5;'); $update_button->attr('disabled', 'disabled'); $this->warning('Module has custom RPS modifications: update disabled'); } $event->return = $form; Perfect! Thank you. 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now