public
Description: Git mirror of the CMS Made Simple 2.0 rewrite
Homepage: http://cmsmadesimple.org
Clone URL: git://github.com/tedkulp/cmsmadesimple-2-0.git
Search Repo:
Get uninstall working

Signed-off-by: Ted Kulp <ted@cmsmadesimple.org>
tedkulp (author)
Wed Apr 09 20:09:23 -0700 2008
commit  0e7fcce2afe7539f94de74d9df0a8d01081a2e6b
tree    49fc47c33f49300732230ca49d9adf764f6a60b5
parent  54b8b1c04f57455c1bdf545f3a84afa2f50753cb
...
59
60
61
62
 
63
64
65
...
59
60
61
 
62
63
64
65
0
@@ -59,7 +59,7 @@ else if ($action == 'show_post_install' && $module != '')
0
 }
0
 else if ($action == 'uninstall' && $module != '')
0
 {
0
- $result = CmsModuleOperations::uninstall_module($module, false);
0
+ $result = CmsModuleOperations::uninstall_module($module);
0
   if ($result)
0
   {
0
     if (cmsms()->modules[$module]['object']->uninstall_post_message())
...
755
756
757
 
758
759
760
761
 
762
763
764
...
755
756
757
758
759
760
761
762
763
764
765
766
0
@@ -755,10 +755,12 @@ abstract class CmsModuleBase extends CmsObject
0
         include($filename);
0
       }
0
     }
0
+ /* //Maybe the module doesn't need any cleanup?
0
     else
0
     {
0
       return FALSE;
0
     }
0
+ */
0
   }
0
 
0
   /**
...
87
88
89
90
 
91
92
93
...
695
696
697
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
698
699
700
...
87
88
89
 
90
91
92
93
...
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
0
@@ -87,7 +87,7 @@ class CmsModuleOperations extends CmsObject
0
    * @return boolean Whether or not the module is active and installed
0
    * @author Ted Kulp
0
    **/
0
- public static function is_active($module_nakme)
0
+ public static function is_active($module_name)
0
   {
0
     $modules = cmsms()->modules;
0
     return isset($modules[$module_name]) && $modules[$module_name]['installed'] && $modules[$module_name]['active'];
0
@@ -695,6 +695,34 @@ class CmsModuleOperations extends CmsObject
0
     return self::upgrade_module($module);
0
   }
0
   
0
+ function uninstall_module($module_name)
0
+ {
0
+ $modinstance = self::get_module($module_name);
0
+ if ($modinstance == null)
0
+ {
0
+ return false;
0
+ }
0
+
0
+ $result = $modinstance->uninstall();
0
+
0
+ if ($result === FALSE)
0
+ {
0
+ return false;
0
+ }
0
+
0
+ #now delete the record
0
+ $query = "DELETE FROM ".CMS_DB_PREFIX."modules WHERE module_name = ?";
0
+ cms_db()->Execute($query, array($module_name));
0
+
0
+ #delete any dependencies
0
+ $query = "DELETE FROM ".CMS_DB_PREFIX."module_deps WHERE child_module = ?";
0
+ cms_db()->Execute($query, array($module_name));
0
+
0
+ Events::SendEvent('Core', 'ModuleUninstalled', array('name' => $module_name));
0
+
0
+ return true;
0
+ }
0
+
0
   public static function activate_module($module_name)
0
   {
0
     $query = "UPDATE ".CMS_DB_PREFIX."modules SET active = 1 WHERE module_name = ?";

Comments

    No one has commented yet.