Skip to content

Create admin session cookie file only in JSON workflow #13

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

Open
wants to merge 2 commits into
base: feature/ghost4-x
Choose a base branch
from

Conversation

rija
Copy link
Contributor

@rija rija commented Feb 21, 2023

This PR implements the issue #12:

The admin session cookie file is, I believe, needed only to allow backup and restoration of the Ghost JSON export.
So when the backup/restore workflow doesn't involve the Ghost JSON export, the function that create the admin session cookie file should not be invoked.

How is it done?

I've removed invocation to createGhostAdminCookie() from the bottom of common.sh, so it stops being called automatically, even when the -J option is passed to the backup command.
Then, I've added invocation of that function at the top of the blocks where it is needed, namely in the backupGhostJsonFile() and restoreGhostJsonFile() functions.

How to test?

I have added automated unit tests in the tests/ directory. After installing bats-core, they can be run as shown below:

$ bats tests
json_export_workflow.bats
 ✓ Don't call function to create cookie when -J is passed
 ✓ Function to create cookie is called when JSON backup is enabled
 ✓ Function to create cookie is called when restoring JSON file

3 tests, 0 failures

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

Successfully merging this pull request may close these issues.

1 participant