diff --git a/README.md b/README.md index de376cea193..2926afbc08c 100644 --- a/README.md +++ b/README.md @@ -116,6 +116,7 @@ Do not use 20.x.x if you need IE support. - removed module `Mage_PageCache` [#2258](https://github.com/OpenMage/magento-lts/pull/2258) - removed lib/flex containing unused ActionScript "file uploader" files [#2271](https://github.com/OpenMage/magento-lts/pull/2271) - enabled website level config cache [#2355](https://github.com/OpenMage/magento-lts/pull/2355) +- make overrides of Mage_Core_Model_Resource_Db_Abstract::delete respect parent api [#1257](https://github.com/OpenMage/magento-lts/pull/1257) For full list of changes, you can [compare tags](https://github.com/OpenMage/magento-lts/compare/1.9.4.x...20.0). diff --git a/app/code/core/Mage/Admin/Model/Resource/User.php b/app/code/core/Mage/Admin/Model/Resource/User.php index 43a43f0a02a..c4fda8de925 100644 --- a/app/code/core/Mage/Admin/Model/Resource/User.php +++ b/app/code/core/Mage/Admin/Model/Resource/User.php @@ -189,7 +189,8 @@ protected function _afterLoad(Mage_Core_Model_Abstract $user) * Delete user role record with user * * @param Mage_Core_Model_Abstract $user - * @return bool + * @return $this + * @throws Exception */ public function delete(Mage_Core_Model_Abstract $user) { @@ -206,15 +207,12 @@ public function delete(Mage_Core_Model_Abstract $user) $adapter->delete($this->getMainTable(), $conditions); $adapter->delete($this->getTable('admin/role'), $conditions); $adapter->commit(); - } catch (Mage_Core_Exception $e) { + } catch (Throwable $e) { $adapter->rollBack(); throw $e; - } catch (Exception $e) { - $adapter->rollBack(); - return false; } $this->_afterDelete($user); - return true; + return $this; } /** diff --git a/app/code/core/Mage/Api/Model/Resource/User.php b/app/code/core/Mage/Api/Model/Resource/User.php index c39549046f8..b7d338ad36b 100644 --- a/app/code/core/Mage/Api/Model/Resource/User.php +++ b/app/code/core/Mage/Api/Model/Resource/User.php @@ -230,7 +230,8 @@ protected function _beforeSave(Mage_Core_Model_Abstract $user) * Delete the object * * @param Mage_Core_Model_Abstract $user - * @return boolean + * @return $this + * @throws Exception */ public function delete(Mage_Core_Model_Abstract $user) { @@ -241,14 +242,11 @@ public function delete(Mage_Core_Model_Abstract $user) $dbh->delete($this->getTable('api/user'), ['user_id = ?' => $uid]); $dbh->delete($this->getTable('api/role'), ['user_id = ?' => $uid]); $dbh->commit(); - } catch (Mage_Core_Exception $e) { + } catch (Throwable $e) { $dbh->rollBack(); throw $e; - } catch (Exception $e) { - $dbh->rollBack(); - return false; } - return true; + return $this; } /** diff --git a/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php b/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php index fe1412db17b..a00fb8f5bd4 100644 --- a/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php +++ b/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php @@ -509,6 +509,7 @@ public function forsedSave(Mage_Core_Model_Abstract $object) * * @param Mage_Core_Model_Abstract $object * @return $this + * @throws Exception */ public function delete(Mage_Core_Model_Abstract $object) {