Name: LiipDrushVersionManagerCommand
Owner: Liip
Description: modules update without issuing drush dis module && drush pm-uninstall module
Created: 2013-06-01 16:48:55.0
Updated: 2014-01-25 10:16:40.0
Pushed: 2013-06-03 07:00:59.0
Homepage: null
Size: 144
Language: PHP
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
This drush extension implementes commands to check for new versions of installed modules and update them without issuing drush dis module && drush pm-uninstall module.
On update it uses a custom hook called hook_vm_update()
. With this the module can decide if there is something to do on update. And return true on success or false on failure.
It has the advantage that the hook_install()
and hook_uninstall()
is not issued. (E.g. loosing all data if the hook_uninstall()
cleans a table in the database.
To obtain the sources via composer add the following lines to your composer.json file or complete the list of dependencies.
uire": {
"liip/drushversionmanagercommand": "1.*"
ra": {
"installer-paths": {
"path/2/drush/commands/{$name}/": [
"liip/drushversionmanagercommand"
],
Then execute the following commands on the command line:
url -s http://getcomposer.org/installer | php
hp composer.phar install
Sources fetched? Brilliant.. now we can start using the module updater. In your ModuleName.install file implement the hook_vm_update().
pdate script
return bool
tion ModuleName_vm_update()
// clean out no longer used variables
variable_set('ModuleName_some_variable', 'myValue')
// this update was successful
return (bool) variable_get('ModuleName_some_variable', false);
Add a version to the ModuleName.info file:
..
ion = 1.0
..
in/bash
H="drush"
ore version number from installed modules
SH php-script scripts/invoke_module_update
date modules if needed
SH php-script scripts/update_module_versions
General usage:
ush help vm-update
t information about the specified module(s).
ples:
sh versionmanager-update --all Update every named module to the new version.
ments:
ules A comma delimited list of module names
(e.g. module1,module2,module2)
ons:
ll Run the update on all installed and enabled modules where an
update is available.
ses: vm-update
ash
ush help vm-info
t information about the specified module(s).
ples:
sh versionmanager-information --all Display information about any provided module if there
is an update available.
ments:
ules A comma delimited list of module names
ons:
ll Run the update on all installed and enabled modules
ull show extended information about the module (this is the default)
hort show basic information about the module
ses: vm-info
ush vm-update --all
ting ModuleName1 ... [success]
ing to update for module »ModuleName2« [warning]
ush vm-update ModuleName1, ModuleName2
ting ModuleName1 ... [success]
ting ModuleName2 ... [success]
The neat thing is that you can copy and paste the out put directly to vm-update
and not using the –all switch there. This will make it segnificantly faster.
ush vm-info --all --short
leName1, ModuleName2, ..., ModuleNameN
The –full switch is not only optional but also the default if –short is not declared. As you'd guess ModuleName2 has no update available.
ush vm-info --full --all
e : Title of ModuleName1
: ModuleName1
ion : 0.1
te available to version : 1.5
e : Title of ModuleName2
: ModuleName2
ion : 7.x-2.x-dev