Last active
August 8, 2023 08:38
-
-
Save schmengler/88fa071822a95224373f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Generate modman file from Magento Connect 2.0 package.xml | |
* | |
* Usage: | |
* | |
* php package2modman.php path/to/package.xml > path/to/modman | |
* | |
*/ | |
require_once(__DIR__ . "/../www/app/Mage.php"); | |
$package = new Mage_Connect_Package($argv[1]); | |
$modmanDefinition = array(); | |
foreach ($package->getContents() as $path) { | |
$path = preg_replace('{^\./}', '', $path); | |
$path = preg_replace('{^app/code/(.*?)/(.*?)/(.*?)/(.*)$}', 'app/code/$1/$2/$3', $path); | |
$path = preg_replace('{^lib/(.*?)/(.*)$}', 'lib/$1', $path); | |
$path = preg_replace('{^js/(.*?)/(.*?)/(.*)$}', 'js/$1', $path); | |
$path = preg_replace('{^app/design/(.*?)/(.*?)/default/layout/(.*?)/(.*)$}', 'app/design/$1/$2/default/layout/$3', $path); | |
$path = preg_replace('{^app/design/(.*?)/(.*?)/default/template/(.*?)/(.*)$}', 'app/design/$1/$2/default/template/$3', $path); | |
$path = preg_replace('{^skin/(.*?)/(.*?)/default/(.*?)/(.*?)/(.*)$}', 'skin/$1/$2/default/$3/$4', $path); | |
$modmanDefinition[$path] = $path; | |
} | |
foreach ($modmanDefinition as $source => $target) { | |
printf("%s %s\n", $source, $target); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
wenn du das als repo machst und ne modman dazu packst, kann man das sogar ganz schön mit integrieren :)