Conflicting Files ? Success

User tests: Successful: Unsuccessful:

avatar Tchangue
Tchangue
2 Aug 2018

Pull Request for Issue here
There is no issue for this pull request

Summary of Changes

Prevent database changes when an error occurs during the installation of an external component.

Testing Instructions

In the sql file of the component you have to simulate an error of your choice.

Expected result

the database must rollback the transaction for the installation of tables in the database and all the installed tables before the error came must be deleted.

Actual result

the expected result occurs.

Documentation Changes Required

avatar Tchangue Tchangue - open - 2 Aug 2018
avatar Tchangue Tchangue - change - 2 Aug 2018
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 2 Aug 2018
Category Unit Tests Repository Administration com_admin
avatar brianteeman brianteeman - change - 2 Aug 2018
Title
Check before external installation
[4.0] Check before external installation
avatar brianteeman brianteeman - edited - 2 Aug 2018
avatar brianteeman brianteeman - change - 2 Aug 2018
Title
Check before external installation
[4.0] Check before external installation
avatar joomla-cms-bot joomla-cms-bot - change - 2 Aug 2018
Category Unit Tests Repository Administration com_admin Libraries
avatar brianteeman
brianteeman - comment - 2 Aug 2018

@Tchangue please make sure that when you submit a pull request that you make sure it is against the correct branch

avatar mbabker
mbabker - comment - 2 Aug 2018

If we're going to do this, there also needs to be a catch (\Exception $e) block to catch all exceptions and rollback the transaction otherwise the uncaught Exception is going to leave a lingering open transaction and that too will cause problems.

try {
    // Do stuff
} catch (\JDatabaseExceptionExecuting $e) {
    $db->transactionRollback();

    // Do error handling stuff
} catch (\Exception $e) {
    $db->transactionRollback();

    throw $e;
}
avatar wilsonge
wilsonge - comment - 2 Aug 2018

I think this is a good idea - but

  1. Michael is right
  2. You need to revert the changes to the doc blocks which are incorrect and are causing the code style checks to fail :)
avatar Tchangue
Tchangue - comment - 3 Aug 2018

@wilsonge before i commit or push a modification i made always a code review with code sniffer. The failure of the code style comes possibly from the code that was already there.

avatar infograf768
infograf768 - comment - 3 Aug 2018

@Tchangue
I checked. Your patch modifies some stuff.
For example you should have 2 spaces (not one) between string and $basepath
136 | ERROR | Expected 2 spaces after the longest type

avatar Tchangue Tchangue - change - 3 Aug 2018
Labels Added: ? ?
avatar Tchangue
Tchangue - comment - 3 Aug 2018

@mbabker i tried to use your methods but it doen't give anything. I will be unavailable the next wo weeks so if you or someone else could create a new pull request it will be very nice.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/21363.

avatar Tchangue Tchangue - change - 3 Aug 2018
The description was changed
avatar Tchangue Tchangue - edited - 3 Aug 2018
avatar Tchangue Tchangue - change - 3 Aug 2018
The description was changed
avatar Tchangue Tchangue - edited - 3 Aug 2018
avatar Tchangue Tchangue - change - 3 Aug 2018
The description was changed
avatar Tchangue Tchangue - edited - 3 Aug 2018
avatar wilsonge
wilsonge - comment - 3 Aug 2018

Fixed the codestyle manually

avatar mbabker
mbabker - comment - 3 Aug 2018

Added in the catch for the base Exception class. IMO ready for testing/review.

avatar rdeutz rdeutz - change - 8 Aug 2018
Labels Removed: ?
avatar conconnl
conconnl - comment - 4 Apr 2020

I can't this this one.
It's has conflicts with the current branch.

avatar alikon
alikon - comment - 4 Apr 2020

conflict apart this cannot works cause Mysql doesn't allow rollback on DDL

avatar roland-d
roland-d - comment - 1 Aug 2020

@alikon Are you saying this is an impossibility? MySQL supports transactions or am I wrong?

@Tchangue Can you have a look at the merge conflict?

avatar alikon
alikon - comment - 3 Aug 2020

@roland-d yes Mysql support transaction but not on DDL

avatar roland-d
roland-d - comment - 5 Aug 2020

@alikon So this should be closed?

avatar wilsonge
wilsonge - comment - 31 Dec 2020

Looks like this also fails in MariaDB https://mariadb.com/kb/en/start-transaction/#ddl-statements - so I'm closing this. Kinda unfortunate though :(

avatar wilsonge wilsonge - change - 31 Dec 2020
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2020-12-31 03:17:47
Closed_By wilsonge
avatar wilsonge wilsonge - close - 31 Dec 2020

Add a Comment

Login with GitHub to post a comment