Uploaded image for project: 'phpBB3'
  1. phpBB3
  2. PHPBB3-12432

Migrator should not automatically revert custom functions defined in update_data()

    Details

    • Type: Bug
    • Status: Unverified Fix
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 3.1.0-b2
    • Fix Version/s: 3.1.0-b3
    • Component/s: Other
    • Labels:
      None

      Description

      When deleting an extension's data, the migrator attempts to automatically revert the custom functions defined in update_data() by calling these functions. This should not be the case. Reverting of custom actions should be done with revert_data() (https://wiki.phpbb.com/Migrations/Data_Changes#revert_data).

      This current behaviour is causing problems when uninstalling extensions (https://www.phpbb.com/community/viewtopic.php?p=13609246#p13609246 https://www.phpbb.com/community/viewtopic.php?p=13591096#p13591096). Since the custom functions are not aware of whether they're being reverted, it falls on them to figure out what state the data is in before proceeding in order to work around this.

        Activity

        Hide
        PayBas PayBas added a comment -

        Can confirm. The current behavior is weird, or at least confusing.

        Show
        PayBas PayBas added a comment - Can confirm. The current behavior is weird, or at least confusing.
        Hide
        nicofuma nicofuma added a comment - - edited

        I think i may have a patch but i can't test it now:
        in phpbb\db\migrator::get_callable_from_step, line 512:

        change

        return array(
        	$parameters[0],
        	array($last_result),
        );
        

        by

        if ($revert)
        {
        	return false;
        }
        else
        {
        	return array(
        		$parameters[0],
        		array($last_result),
        	);
        }
        

        Show
        nicofuma nicofuma added a comment - - edited I think i may have a patch but i can't test it now: in phpbb\db\migrator::get_callable_from_step, line 512: change return array ( $parameters [0], array ( $last_result ), ); by if ( $revert ) { return false; } else { return array ( $parameters [0], array ( $last_result ), ); }
        Hide
        nicofuma nicofuma added a comment -

        i don't see another solution and it seems to be good.

        Show
        nicofuma nicofuma added a comment - i don't see another solution and it seems to be good.

          People

          • Assignee:
            EXreaction EXreaction [X] (Inactive)
            Reporter:
            prototech prototech
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development