Announcement

Collapse
No announcement yet.

How to remove module with ScheduledTask feature?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How to remove module with ScheduledTask feature?

    I am trying to add the scheduledtask feature to modules, and it's been going fine until now.

    When I try to uninstall the module with a standard Remove module from store (Utilities), I get a dialog indicating that 'the module is in use by one or more scheduled tasks and cannot be removed.' (Even when I delete the scheduled task.)

    Is there anyone who has used the 'scheduled task' feature and knows how to get around this apparent verification check? It seems to run BEFORE Module_Uninstall_Store is called. Or is the scheduled task intended to be 'install only'?
    Gordon Currie
    Phosphor Media - "Your Success is our Business"

    Improve Your Customer Service | Get MORE Customers | Edit Any Document Easily | Free Modules | Follow Us on Facebook
    phosphormedia.com

    #2
    Just a guess, but there's probably a non-zero reference count in the StoreModules table. Those do seem to get out of synch from time to time ... I would double-check to be sure that all scheduled tasks for this module have been deleted; if so, I'd use phpMyAdmin to zero out the reference count.
    Kent Multer
    Magic Metal Productions
    http://TheMagicM.com
    * Web developer/designer
    * E-commerce and Miva
    * Author, The Official Miva Web Scripting Book -- available on-line:
    http://www.amazon.com/exec/obidos/IS...icmetalproducA

    Comment


      #3
      There IS a non-zero reference count in StoreModules. My code to uninstall takes care of that by deleting all scheduled tasks and running StoreModule_Decrement_ReferenceCount().

      I am trying to remove all scheduled tasks and references within the Module_Uninstall_Store() function of data_store. That is what seems to be the problem. Some internal function(s) appear to run BEFORE the call to Module_Uninstall_Store(), and fail (because the task/reference removal functions have not yet run), thus blocking Module_Uninstall_Store() from ever being called.
      Gordon Currie
      Phosphor Media - "Your Success is our Business"

      Improve Your Customer Service | Get MORE Customers | Edit Any Document Easily | Free Modules | Follow Us on Facebook
      phosphormedia.com

      Comment


        #4
        Yes, I seem to recall running into similar snags in the past. There are some things that a module can't uninstall.
        Kent Multer
        Magic Metal Productions
        http://TheMagicM.com
        * Web developer/designer
        * E-commerce and Miva
        * Author, The Official Miva Web Scripting Book -- available on-line:
        http://www.amazon.com/exec/obidos/IS...icmetalproducA

        Comment


          #5
          Yes, I was hoping someone from Miva would chime in and let me know if there is a way to code what I envision, or that it is impossible.
          Gordon Currie
          Phosphor Media - "Your Success is our Business"

          Improve Your Customer Service | Get MORE Customers | Edit Any Document Easily | Free Modules | Follow Us on Facebook
          phosphormedia.com

          Comment


            #6
            It appears that your reference count got out of wack somehow. Deleting the scheduled task should allow the module to be uninstalled. Try going into your DB and manually changing the refcount on the scheduled task module back to 0, then see if you can uninstall the module.

            Brennan Heyde
            VP Product
            Miva, Inc.
            [email protected]
            https://www.miva.com

            Comment


              #7
              Brennan: Thanks, I did just that and I could uninstall (actually more accurately I was able to Remove the module from the store).

              What I am most concerned about is timing. Does the internal check to see if there are tasks associated with a scheduledtask feature module run BEFORE Module_Uninstall_Store() (using the data_store feature)? I am trying to delete scheduled tasks within that Module_Uninstall_Store() function.

              If I can't do this, I'll need to instruct thousands of customers to delete associated scheduled tasks prior to uninstalling a module. Pretty messy.

              Is there an ACTION associated with Module_Uninstall_Store()? Maybe I could use the system feature to catch the action before the internal test.
              Gordon Currie
              Phosphor Media - "Your Success is our Business"

              Improve Your Customer Service | Get MORE Customers | Edit Any Document Easily | Free Modules | Follow Us on Facebook
              phosphormedia.com

              Comment


                #8
                Hi Gordon,

                Yes, the check for scheduled tasks occurs before Module_Uninstall_Store is called. This is similar to other workings of the software, such as modules that are associated with an order's payment / shipping method cannot be uninstalled.

                There is no action you're going to be able to intercept. You could always have another tab or button that says "Delete Scheduled Tasks" for your module and then instruct your customer's to uninstall the module.

                Are you foreseeing a lot of your users installing and uninstalling this module? The warning message is pretty clear on why the module cannot be uninstalled so the users should be able to figure out that they need to delete the associated scheduled tasks.

                Hope this helps.
                David Carver
                Miva, Inc. | Software Developer

                Comment


                  #9
                  David, thanks for the confirmation. We have the same issue with component feature modules, we'll just extend our approach.

                  Our customer base is widely diverse in terms of technical skills. Anything less than a one-click uninstall will increase the support burden.
                  Gordon Currie
                  Phosphor Media - "Your Success is our Business"

                  Improve Your Customer Service | Get MORE Customers | Edit Any Document Easily | Free Modules | Follow Us on Facebook
                  phosphormedia.com

                  Comment


                    #10
                    Component modules don't have this problem. I have code that I run in my Module_Uninstall_Store function, which can deassign a component from pages, and can also un-hook it from any other component where it's been assigned as an extension.
                    Kent Multer
                    Magic Metal Productions
                    http://TheMagicM.com
                    * Web developer/designer
                    * E-commerce and Miva
                    * Author, The Official Miva Web Scripting Book -- available on-line:
                    http://www.amazon.com/exec/obidos/IS...icmetalproducA

                    Comment


                      #11
                      Kent, we have the same functions. But we have seen in testing that the internal check for component assignments runs before Module_Uninstall_Store.
                      Gordon Currie
                      Phosphor Media - "Your Success is our Business"

                      Improve Your Customer Service | Get MORE Customers | Edit Any Document Easily | Free Modules | Follow Us on Facebook
                      phosphormedia.com

                      Comment


                        #12
                        Originally posted by Gordon - Phosphor Media View Post
                        Kent, we have the same functions. But we have seen in testing that the internal check for component assignments runs before Module_Uninstall_Store.
                        It works for me. I'll post some code if you're interested.
                        Kent Multer
                        Magic Metal Productions
                        http://TheMagicM.com
                        * Web developer/designer
                        * E-commerce and Miva
                        * Author, The Official Miva Web Scripting Book -- available on-line:
                        http://www.amazon.com/exec/obidos/IS...icmetalproducA

                        Comment

                        Working...
                        X