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

Update patch_views.sh #408

Merged
merged 5 commits into from
Dec 10, 2024
Merged

Update patch_views.sh #408

merged 5 commits into from
Dec 10, 2024

Conversation

DonRichards
Copy link
Member

Drupal console is no longer being maintained and the latest version of isle-dc doesn't include it. It turns out it's pretty difficult to even install it at this point.

This PR is to:

  1. update this script to use drush
  2. Add some debug visibility incase something goes wrong by outputting the enabled views list to a text file.
  3. Works on 1 view at a time (instead of disabling everything and then re-enabling the ones from the list)

To test:

Run the make command.

make fix_views

Output:

Successfully copied 4.1kB to isle-dc-drupal-1:/var/www/drupal/patch_views.sh
Reloading view: advanced_search
 [success] advanced_search disabled.
 [success] advanced_search enabled.
Reloading view: all_taxonomy_terms
 [success] all_taxonomy_terms disabled.
 [success] all_taxonomy_terms enabled.
...

This should only select the enabled views, output the list to a file (/var/www/enabled_views.txt), and for each enabled view disable, then enable the view. Hopefully correcting any broken references within the view. Then it should run a few drush commands to clean up and rebuild cache/menus. This part was already part of the script.

This script could use some improvements but to keep the scope of this PR focussed it's mainly to replace drupal console with drush.

@seth-shaw-asu seth-shaw-asu requested a review from alxp October 16, 2024 17:17
@alxp
Copy link
Contributor

alxp commented Oct 24, 2024

Getting an error message when I run the script:

iMac:isle-dc aoneill$ make fix_views
Successfully copied 4.1kB to isle-dc-drupal-1:/var/www/drupal/patch_views.sh
/var/www/drupal/patch_views.sh: line 10: syntax error near unexpected token `('
 [success] Cache rebuild complete.
iMac:isle-dc aoneill$ 

@aOelschlager
Copy link
Contributor

I just looked at the patch_views script and I think that error is happening because this line is meant to be a comment but is missing the "#"
https://github.com/Islandora-Devops/isle-dc/blob/replace_console_with_drush/scripts/patch_views.sh#L10

@DonRichards
Copy link
Member Author

Thanks Annie. I think you're right.

@alxp
Copy link
Contributor

alxp commented Nov 20, 2024

I still seem to be getting a syntax error when running the make command:

Alexanders-MacBook-Pro:isle-dc alexanderoneill$ make fix_views 
                                             Successfully copied 4.1kB to isle-dc-drupal-1:/var/www/drupal/patch_views.sh
/var/www/drupal/patch_views.sh: line 64: syntax error: unexpected end of file
 [success] Cache rebuild complete.
Alexanders-MacBook-Pro:isle-dc alexanderoneill$ git pull origin `gcb`
From github.com:Islandora-Devops/isle-dc
 * branch            replace_console_with_drush -> FETCH_HEAD
Already up to date.
Alexanders-MacBook-Pro:isle-dc alexanderoneill$ 

@DonRichards Any ideas?

@DonRichards
Copy link
Member Author

@alxp OK, I rewrote a lot of it to provide more clarity and to fix the error.

@alxp
Copy link
Contributor

alxp commented Dec 4, 2024

Sorry for the delay,

Trying this again. The script runs and the last output is taht it's successful, but there's an error:

Alexanders-MacBook-Pro:isle-dc alexanderoneill$ make fix_views 
                                             Successfully copied 5.12kB to isle-dc-drupal-1:/var/www/drupal/patch_views.sh
[2024-12-04 17:42:37] Drush is already installed
[2024-12-04 17:42:39] Detected Error Message: ''
[2024-12-04 17:42:40] Views file contents:
[2024-12-04 17:42:40] /tmp/enabled_views.txt
---------------------
[2024-12-04 17:42:41] Devel module initial state: Enabled
[2024-12-04 17:42:41] Attempting Islandora module uninstallation...

In SiteProcess.php line 214:
                                                                               
  The command "/var/www/drupal/vendor/bin/drush pm:uninstall islandora --uri=  
  islandora.traefik.me" failed.                                                
                                                                               
  Exit Code: 1(General error)                                                  
                                                                               
  Working directory:                                                           
                                                                               
  Output:                                                                      
  ================                                                             
                                                                               
                                                                               
  Error Output:                                                                
  ================                                                             
                                                                               
  In PmCommands.php line 200:                                                  
                                                                               
                                                                               
    islandora: The <em class="placeholder">Media track</em> field type is use  
  d                                                                            
    in the following field: media.field_track                                  
                                                                               

[2024-12-04 17:42:44] Islandora uninstall may have partial failure. This can be ignored.
[2024-12-04 17:42:44] Rebuilding caches...
 [success] Cache rebuild complete.
sendmail: can't connect to remote host (127.0.0.1): Connection refused
 [error]  Error sending email (from [email protected] to [email protected] with reply-to not set). 
 [error]  Message: Unable to send email. Contact the site administrator if the problem persists.
 
[2024-12-04 17:42:50] Troubleshooting complete.
[2024-12-04 17:42:50] Script completed successfully
Check LOG at /tmp/drupal_troubleshoot_20241204_174237.log
 [success] Cache rebuild complete.
Alexanders-MacBook-Pro:isle-dc alexanderoneill$ 

@DonRichards is this error expected? I'm running this on a fresh isle-dc with nothing in it.

@DonRichards
Copy link
Member Author

@alxp What does your /tmp/drupal_troubleshoot_20241204_174237.log file say? This looks fine to me but I'd check the log first. The reinstall of Islandora isn't absolutely needed. So I'll remove it. It worked for new installs without content. The other error is cron triggering an email. That should be unrelated.

Copy link
Contributor

@alxp alxp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-pulled this branch and the fix_views make task ran without errors.

@alxp alxp merged commit 57bbd3f into development Dec 10, 2024
1 check passed
@alxp alxp deleted the replace_console_with_drush branch December 10, 2024 23:55
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.

3 participants