Skip to content

Commit

Permalink
Make the callbacks package hook, and remove symlinks before upgrade a…
Browse files Browse the repository at this point in the history
…nd uninstall.
  • Loading branch information
yunosh committed Oct 10, 2017
1 parent 8224903 commit 372e510
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
6 changes: 4 additions & 2 deletions composer.json
Expand Up @@ -50,7 +50,9 @@
"optimize-autoloader": true
},
"scripts": {
"post-install-cmd": "Horde\\GitTools\\Callbacks::linkHordeRole",
"post-update-cmd": "Horde\\GitTools\\Callbacks::linkHordeRole"
"post-package-install": "Horde\\GitTools\\Callbacks::linkHordeRole",

This comment has been minimized.

Copy link
@mrubinsk

mrubinsk Oct 16, 2017

Member

This breaks installing any packages before the Horde_Role package is installed. I.e., when performing the composer install of horde-git-tools for the first time.

"pre-package-update": "Horde\\GitTools\\Callbacks::unlinkHordeRole",
"post-package-update": "Horde\\GitTools\\Callbacks::linkHordeRole",
"pre-package-uninstall": "Horde\\GitTools\\Callbacks::unlinkHordeRole"
}
}
14 changes: 13 additions & 1 deletion lib/Callbacks.php
Expand Up @@ -18,7 +18,6 @@

class Callbacks
{

/**
* Links the Horde_Role files needed to detect "Horde" as a valid role
* when using PEAR via Composer.
Expand All @@ -37,4 +36,17 @@ public static function linkHordeRole(Event $event)
dirname(__FILE__) . '/../vendor/pear/pear/PEAR/Installer/Role/Horde.xml'
);
}

/**
* Unlinks the Horde_Role files needed to detect "Horde" as a valid role
* when using PEAR via Composer.
*
* @param Event $event [description]
* @return [type] [description]
*/
public static function unlinkHordeRole(Event $event)
{
unlink(dirname(__FILE__) . '/../vendor/pear/pear/PEAR/Installer/Role/Horde.php');
unlink(dirname(__FILE__) . '/../vendor/pear/pear/PEAR/Installer/Role/Horde.xml');
}
}

0 comments on commit 372e510

Please sign in to comment.