Просмотр исходного кода

#55 - automatic connections deletions: some fixes

Alex Trofimov 12 лет назад
Родитель
Сommit
0c67b08991

+ 2 - 2
inc/classes/BxDolConnection.php

@@ -571,7 +571,7 @@ class BxDolConnection extends BxDol implements iBxDolFactoryObject {
      */
     public function onDeleteInitiatorAndContent ($iId) {
         $b = $this->onDeleteInitiator ($iId);
-        $b ||= $this->onDeleteContent ($iId);
+        $b = $this->onDeleteContent ($iId) || $b;
         return $b;
     }
 
@@ -590,7 +590,7 @@ class BxDolConnection extends BxDol implements iBxDolFactoryObject {
      * @return true if some connections were deleted
      */
     public function onDeleteContent ($iIdContent) {
-        return $this->_oQuery->onDelete ($iIdInitiator, 'content');
+        return $this->_oQuery->onDelete ($iIdContent, 'content');
     }
 
 

+ 1 - 1
inc/classes/BxDolProfile.php

@@ -260,7 +260,7 @@ class BxDolProfile extends BxDol implements iBxDolProfile {
 
         // delete associated content 
         // TODO: remake deletion of associated content
-        $this->_oQuery->res("DELETE FROM `sys_acl_levels_members` WHERE `IDMember` = {$ID}");        
+        $this->_oQuery->res("DELETE FROM `sys_acl_levels_members` WHERE `IDMember` = {$ID}");
 
         // delete profile
         if (!$this->_oQuery->delete($ID))

+ 3 - 3
modules/base/general/classes/BxBaseModGeneralInstaller.php

@@ -105,12 +105,12 @@ class BxBaseModGeneralInstaller extends BxDolStudioInstaller
                 continue;
 
             $sFuncSuffix = 'DeleteInitiatorAndContent';
-            if ('initiator' == $a['conn'])
+            if (isset($a['conn']) && 'initiator' == $a['conn'])
                 $sFuncSuffix = 'DeleteInitiator';
-            elseif ('content' == $a['conn'])
+            elseif (isset($a['conn']) && 'content' == $a['conn'])
                 $sFuncSuffix = 'DeleteContent';
 
-            if ('profiles' == $a['type']) {
+            if (isset($a['type']) && 'profiles' == $a['type']) {
                 $sFunc = 'onModuleProfile' . $sFuncSuffix;
                 $o->$sFunc($this->_aConfig['name']);
             } else {

+ 11 - 0
modules/base/profile/classes/BxBaseModProfileInstaller.php

@@ -17,6 +17,17 @@ class BxBaseModProfileInstaller extends BxBaseModGeneralInstaller
     {
         parent::__construct($aConfig);
     }
+
+    function disable($aParams) 
+    {    
+        $aResult = parent::disable($aParams);
+
+        if ($aResult['result']) { // disabling was successful
+            // TODO: switch accounts context which active profiles belong to this module
+        }
+
+        return $aResult;
+    }
 }
 
 /** @} */