Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove tests from db table if files does't exist #124

Closed
andrepereiradasilva opened this issue Feb 28, 2016 · 6 comments
Closed

Remove tests from db table if files does't exist #124

andrepereiradasilva opened this issue Feb 28, 2016 · 6 comments

Comments

@andrepereiradasilva
Copy link

Steps to reproduce the issue

When recreating joomla staging by replacing the joomla staging files, if there are applied patchs before they stay in the database, although the patch tester component has removed (because it's not in joomla staging files). This works as for any other extension.

When installing the patchtester in the new recreated joomla staging again we cannot unapply those patchs.
That i know of, we only have two options:

  • Deleting the applied patchs from the #_patchtester_tests table.
  • Uninstalling the patch tester again and installing again

In a normal extension this is obviously not a problem, but the patch tester is for test envirments that are constantly recreted (sometimes several times a day).

So is there a way to the patchtester recognize there is really no pull applied (ex: the txt file is not in the backups directory) and remove it from the #_patchtester_tests table?

@mbabker
Copy link

mbabker commented Mar 5, 2016

The backup files are named with an md5 hash, and actually through this loop the same code that makes applying patches after a reinstall like this not possible is what also blocks installing multiple patches against the same file (since this isn't truly patching files). This might just need another view to check the state of everything and give someone the ability to do a hard reset (nuke whatever's in the backups directory and truncate the tests table).

@andrepereiradasilva
Copy link
Author

couldn't we do it like a "Reset" button that removes all patches (if applied), deletes the txt in the backups dir and truncate the tables?

@mbabker
Copy link

mbabker commented Mar 5, 2016

If you've reinstalled the CMS you've also presumably had to reinstall the component, and at that point we can't rely on anything in the database to track applied states (as the tests table is where we're storing the array with all the patch's changed files and the files in the backup folder are md5 hashed so nothing there can identify what might have been applied).

A reset button could cleanly revert stuff if we have the data, but if the database table is empty and we have stuff in the backups folder, at best we just clean the backups and hope the user is in the expected state.

@andrepereiradasilva
Copy link
Author

so, all we need is: if no data in database table clean backups folder.

@mbabker
Copy link

mbabker commented Mar 5, 2016

Yep. I'd make the button smart (make it pop an alert saying what it'll do) and make the task smart enough to be able to revert everything if we have data in the database as well as just purge the backups folder if there is no data.

@andrepereiradasilva
Copy link
Author

thanks @mbabker

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants