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

Add 'update' command #111

Open
3 of 7 tasks
ghost opened this issue Nov 25, 2020 · 48 comments
Open
3 of 7 tasks

Add 'update' command #111

ghost opened this issue Nov 25, 2020 · 48 comments

Comments

@ghost
Copy link

ghost commented Nov 25, 2020

I just realised that we don't have an update command for updating a module/theme/layout to a new version. We should add one.

Work is in progress on the issue-111-update-command branch. Huge thanks to @TheMetMan for getting this feature started.

The current branch should work ok for a single site, or a multisite that only uses site specific module/theme/layout folders. It will download all updates.

⚠️ WARNING: It is not recommended to use this branch directly on production until #297 is merged. ⚠️

@ghost ghost added the type: enhancement label Nov 25, 2020
@cptX
Copy link

cptX commented Jun 5, 2021

I just installed bee, and the first thing I noticed is this functionality missing. We definitely need this!

@laryn
Copy link
Member

laryn commented Nov 11, 2021

+1

It would be nice to allow to specify one or more items to update, or just to use a global update command to update all that have new releases. I think on Drupal you could do (for example) drush up and it would check and update all; or drush up paragraphs or drush up drupal to pinpoint the update you want to do. Also potentially useful: a flag to say only do security updates.

@yorkshire-pudding
Copy link
Collaborator

yorkshire-pudding commented Jan 26, 2022

+1

As a starter for ten here is draft help based on @laryn 's comment above. This could form requirements:

update
Description: Updates backdrop, modules, themes and layouts with new releases
Aliases: up , pm-update
Arguments:

  • project - (optional) one or more space separated projects (including 'backdrop') to update. Leave blank to update all projects including backdrop itself
    Options:
  • --security-updates-only - only updates projects/backdrop with security releases
    Examples:
  • bee update - update everything with a new release
  • bee update webform tatsu - updates the Webform module and Tatsu theme only
  • bee update backdrop --security-updates-only - updates only core backdrop and only security releases

If I wanted to have a go at doing this (no promises as not sure that I can), is there a good place to start?

@ghost
Copy link
Author

ghost commented Jan 26, 2022

@yorkshire-pudding The new command would go into https://github.com/backdrop-contrib/bee/blob/1.x-1.x/commands/update.bee.inc

See https://github.com/backdrop-contrib/bee/blob/1.x-1.x/API.md for an explanation of the various options when creating commands.

@yorkshire-pudding
Copy link
Collaborator

yorkshire-pudding commented Jan 26, 2022

Thanks @BWPanda - that is really useful. Is this the right bit of core api ? https://docs.backdropcms.org/api/backdrop/core%21modules%21system%21system.updater.inc/1

@yorkshire-pudding
Copy link
Collaborator

yorkshire-pudding commented Jan 27, 2022

if anyone is interested or would like to help, I've started work here: branch removed
So far, all I've done is add the details to update_bee_command and create a skeleton update_bee_callback function with a long list of todos. Even if its just to let me know if I'm on the right lines:

/*  
* @todo consider if any drush extension code can be re-used https://github.com/backdrop-contrib/backdrop-drush-extension/blob/1.x-1.x/commands/pm/backdrop_pm.drush.inc
  * @todo consider if brush can be re-used https://github.com/backdrop-contrib/brush/blob/1.x-1.x/commands/pm/updatecode.pm.inc
  * @todo check if file permissions allow backdrop to update itself? 
  * @todo determine required files:
  *   - core/modules/update/update.fetch.inc
  *   - core/modules/system/system.updater.inc ?? (https://docs.backdropcms.org/api/backdrop/core%21modules%21system%21system.updater.inc/1)
  *   - core/includes/update.inc
  *   - core/modules/installer/installer.manager.inc (https://docs.backdropcms.org/api/backdrop/core%21modules%21installer%21installer.manager.inc/1)
  *   - core/modules/installer/installer.manager.inc (https://docs.backdropcms.org/api/backdrop/core%21modules%21installer%21installer.manager.inc/function/installer_manager_update_ready_form/1)
  * @todo process arguments (list of projects)
  * @todo process option (security-updates-only)
  * @todo check for config item - update_disabled_extensions (Configuration>Update settings>) - if this is true (1) then need to check disabled projects also
  * @todo get list of installed projects (core, modules, themes, layouts) if no argument list of projects
  * @todo list of projects is either all installed + core, all enabled + core or argument list of projects
  * @todo get current backdrop version
  * @todo for each project in list get current version, type, name
  * @todo for each project in list get available version
  * @todo compare versions and prepare list of possible updates
  * @todo ??option to review and proceed or cancel??
  * @todo download updates to temp directory
  * @todo install updates
  * @todo can we / should we check if database updates needed and let user know
*/

@TheMetMan
Copy link

This is a really useful addition in my humble opinion. Drush does not work in PHP 8, so I need to move on.
I would like to help if I can.
I use PhpStorm for my own code development.
I do not seem able to get the debugging to work and step through Brush or Bee.
For Bee I have the arguments as follows
--root=/home/francis/FG-Docs/public_html/moduledevbd.scorpio/web status
But when I run it it does not pick up the Arguments as shown by this error:

Invalid argument supplied for foreach()
 /home/francis/FG-Docs/PhpstormProjects/Bee/includes/command.inc:13

The $argv variable is null
Would anyone be willing help me get it working? Or am I asking in the wrong place being new to helping on GitHub

@yorkshire-pudding

This comment was marked as off-topic.

@TheMetMan

This comment was marked as off-topic.

@TheMetMan

This comment was marked as off-topic.

@yorkshire-pudding

This comment was marked as off-topic.

@TheMetMan

This comment was marked as off-topic.

@yorkshire-pudding

This comment was marked as off-topic.

@TheMetMan

This comment was marked as off-topic.

@TheMetMan
Copy link

TheMetMan commented Mar 6, 2023

@yorkshire-pudding, much to my surprise, I have got a very basic update working to update the modules and themes, not backdrop itself (already taken care of in the commands).
I have created it on my account here https://github.com/TheMetMan/bee if you fancy a look.
running this comand:
bee update
will update any modules and themes which need updating, no questions asked.

@TheMetMan

This comment was marked as resolved.

@yorkshire-pudding

This comment was marked as resolved.

@TheMetMan

This comment was marked as resolved.

@yorkshire-pudding

This comment was marked as resolved.

@TheMetMan

This comment was marked as resolved.

@TheMetMan

This comment was marked as resolved.

@yorkshire-pudding

This comment was marked as resolved.

@yorkshire-pudding

This comment was marked as resolved.

@TheMetMan

This comment was marked as outdated.

@marioawad
Copy link

I have got a very basic update working to update the modules and themes, not backdrop itself (already taken care of in the commands).

@TheMetMan Can you please point me to the command that you use to update backdrop itself?

I tried using download-core but it refuses to download backdrop in the dir of the website. So currently to update I'm using download-core to an external dir and then manually moving the core dir to the site I want and then finally using update-db which is working really great.

Thank you for creating bee!

@yorkshire-pudding
Copy link
Collaborator

@marioawad - this is not ready yet as a bee command. I need to worth with @TheMetMan and hopefully we will have this ready for release at some point.

bee has been created by a number of people over the years. See https://github.com/backdrop-contrib/bee/graphs/contributors for a list of all contributors who have had code merged.

@marioawad

This comment was marked as off-topic.

@TheMetMan

This comment was marked as off-topic.

@yorkshire-pudding
Copy link
Collaborator

yorkshire-pudding commented Jun 21, 2023

Hi @TheMetMan - I have created a new branch as I think this may require a bit of work before merging to 1.x-1.x .
https://github.com/backdrop-contrib/bee/tree/issue-111-update-command

Please rebase (Sync) your repo to the latest bee and then do a PR to this branch rather than to the 1.x-1.x branch. Don't worry if you create the PR to the wrong branch as I can edit this to the right branch. I will then create some suggestions against your PR.

@TheMetMan

This comment was marked as resolved.

@yorkshire-pudding

This comment was marked as resolved.

@TheMetMan

This comment was marked as off-topic.

@marioawad

This comment was marked as off-topic.

@leeksoup
Copy link

leeksoup commented Nov 24, 2023

What is the status of this, please? This is the number 1 thing that I used drush / brush for until they stopped working ...

@yorkshire-pudding
Copy link
Collaborator

Hi @leeksoup - there is something there that works reasonably well on single site installations (i.e. not multi-site) and @TheMetMan, who started work on this feature is using regularly. It is on this branch.

Depending how you have bee installed it may simply be a case of doing git checkout issue-111-update-command
I am merging changes made in the main branch into this feature branch so if you do decide to use that branch you won't miss out on any other features in bee.

There is a warning at the top to not use on production, so if you use it and it breaks your site, then it is at your own risk; the risk is that running an update deletes a module folder and then the download from GitHub fails for some reason and you are left without a critical module until you can repair it.

Please also note, that it does not yet update core.

After a while with very little love, it is now getting some attention again and one bug and one enhancement have been merged into the feature branch thanks to @hosef. Alas, the need to earn a living does limit the time I can spend on it, so it is not progressing as fast as we would like. It is good to know there is interest though and it does help to motivate developers.

@leeksoup
Copy link

leeksoup commented Nov 24, 2023

@yorkshire-pudding - thank you for the detailed response. I was in a hurry so I ended up semi-manually updating by* removing the directories for core and the modules that needed to be updated, and then downloading with bee, restoring / merging settings.php and htaccess, and then updating the DB, also with bee.

Next time, I will try this feature branch. I completely understand about not using on a production site. My workflow is generally update on dev site -> test -> deploy to production.

Oh, for sure there is interest in this feature! I'm sure I'm not the only one. It would probably help point users to his helpful package if "how to install using bee" (and when it is possible, "how to update using bee") were added to the Backdrop Documentation.

ETA: * first making backups, and then ...

@leeksoup
Copy link

So I'm looking to update again and wondering if the status has changed or if @yorkshire-pudding's last comment is still the way to go.

@yorkshire-pudding
Copy link
Collaborator

@leeksoup - I'm afraid the advice remains the same. I have a clearer idea of what is needed, but, alas, the need to earn a living is preventing me spending the time I would like on this feature

@leeksoup
Copy link

Understood, @yorkshire-pudding!

Turns out I only have Backdrop itself to update this time ... ah well.

@manu-mei-singh
Copy link

Thanks so much @yorkshire-pudding and @TheMetMan for all your work on this ! I and ,I am sure others really appreciate it.
The command bee ups works great! I am wondering if there is a road map for that command , bee ups, to also list the backdrop core, something like brush -n up. Or maybe it already does and I missed something? I also understand your needs about earning a living. I am happy to help out as my team (Palante Technology Cooperative) is very interested in this working.

Again, thanks for all your hard work in making this all happen.

Manu

@yorkshire-pudding
Copy link
Collaborator

Hi @manu-mei-singh . Thank you for your interest and the offer of help; Palante have been good friends of Backdrop over the years.

I do have a plan to add support for core updates. This is in #296 .
However, I believe I'm currently blocking this, as quite a few things are now depending on #348 which will make the download_bee_download_project() function more flexible for other functions and help to fix some of the bugs. I have an idea of how to do this, but I haven't been able to devote any time to this recently.

If any of your team is interested in getting involved, I would be happy to discuss as it wouldn't be good to duplicate any effort.

@manu-mei-singh
Copy link

hi @yorkshire-pudding , I can devote some time to getting involved later this month or in early march. Let me know how you would like to proceed.

thanks!

@yorkshire-pudding
Copy link
Collaborator

hi @yorkshire-pudding , I can devote some time to getting involved later this month or in early march. Let me know how you would like to proceed.

thanks!

Hi @manu-mei-singh - please have a look and see if there are any of the tickets that you would be confident in tackling. I can't tell from your GitHub profile how much PHP work you've done so don't know what your ability level is.

@manu-mei-singh
Copy link

@yorkshire-pudding , I am in the process of looking around at the tickets. unfortunately It will be slower going than I had planned...

@leeksoup
Copy link

@yorkshire-pudding - I just tried the bee update functionality with the somewhat-recent Entity Plus update and it appears to have worked just fine.

@herbdool
Copy link
Contributor

@yorkshire-pudding first time I've taken a look at this. My initial thought is that putting a project update command in update.bee.inc is the wrong place for it, in my not-so-humble opinion. That file is about running update hooks (for database/config changes) and not about updating a codebase. So I think putting it in download.bee.inc makes more sense, since it's really a more sophisticated version of that, eliminating the need to delete the project code before downloading.

@yorkshire-pudding
Copy link
Collaborator

@herbdool - thanks for your thoughts.

My initial thought is that putting a project update command in update.bee.inc is the wrong place for it, in my not-so-humble opinion. That file is about running update hooks (for database/config changes) and not about updating a codebase.

My former co-maintainer and I disagree. The file, according to the file doc, is actually about:

/**
 * @file
 * Command(s) for updating Backdrop projects.
 */

So I think putting it in download.bee.inc makes more sense, since it's really a more sophisticated version of that, eliminating the need to delete the project code before downloading.

This will use an enhanced version of download - see #348 - but it doesn't need to be in the same file, and from my point of view it is more logical in update, as well as preferable in keeping download focussed in scope. Update hooks are typically associated with updating the code so they do, in my opinion, and from the user interface process, belong together.

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

No branches or pull requests

8 participants