Skip to content

Commit

Permalink
select correct resource_setup directory when module upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
hws47a committed Feb 4, 2013
1 parent a67dfbc commit f3440da
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Mtool/Codegen/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,16 @@ public function __construct($filepath)
$this->_path = $filepath;
}

/**
* Get xml config
*
* @return SimpleXMLElement
*/
public function getXml()
{
return $this->_xml;
}

/**
* Set config value
*
Expand Down
7 changes: 7 additions & 0 deletions Mtool/Codegen/Entity/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,13 @@ public function upgrade($mode, $versionRequest)

// Create upgrade file
$setupNamspace = strtolower($this->getName()) . '_setup';
if (!$config->get("global/resources/{$setupNamspace}")) {
$xml = $config->getXml()->xpath("global/resources/*/setup/module[text() = '{$this->getName()}']/../..");
if (count($xml)) {
$setupNamspace = $xml[0]->getName();
}
}

$modulesTemplate = new Mtool_Codegen_Template('module_upgrader');

$params = array(
Expand Down

0 comments on commit f3440da

Please sign in to comment.