usage("Please specify report configurariotn xmls"); } foreach ($names as &$name) { $name = "@name = '{$name}'"; } $qry = '/I2CEConfiguration/configurationGroup//configuration[' . implode(' or ', $names) . ']'; foreach ($arg_files as $arg_file) { if (!is_readable($arg_file)) { I2CE::raiseError("Could not read {$arg_file}"); continue; } if (!is_writable($arg_file)) { I2CE::raiseError("Could not write {$arg_file}"); continue; } $template = new I2CE_TemplateMeister(); if (!$template->loadRootFile(realpath($arg_file))) { I2CE::raiseError("Could not load {$arg_file}"); continue; } //cleanup disabled nodes $remove_qry = '/I2CEConfiguration/configurationGroup//configuration[@name="enabled" and value = 0 ]/..'; if (!($remove_nodes = $template->query($remove_qry)) instanceof DOMNodeList) { I2CE::raiseError("No nodes found to remove. Bad query?"); } else { I2CE::raiseError("Removing " . $remove_nodes->length . " disabled nodes"); foreach ($remove_nodes as $node) { $node->parentNode->removeChild($node); } } //cleanup nodes that have configuarion subnodes-
continue; } $new_version = $next_release . '.0'; if (!prompt("Changes were made to {$module}. Would you like to bump the version of {$module} from {$old_version} to {$new_version} as part of the {$next_release} release of {$pkg_module}?", $bump_version)) { continue; } $mod_file = false; $storage->setIfIsSet($mod_file, "/config/data/{$module}/file"); if (!$mod_file) { I2CE::raiseError("No file recored for {$module}"); continue; } $loc_files = glob(dirname($mod_file) . DIRECTORY_SEPARATOR . 'configs' . DIRECTORY_SEPARATOR . '*' . DIRECTORY_SEPARATOR . basename($mod_file)); $loc_files[] = $mod_file; foreach ($loc_files as $file) { $template = new I2CE_TemplateMeister(); if (!$template->loadRootFile($file)) { echo "\tCould not load\n"; continue; } if (!($res = $template->query('/I2CEConfiguration/metadata/version')) instanceof DOMNodeList || $res->length == 0) { echo "\tVersion not found\n"; continue; } $versNode = $res->item(0); while ($versNode->hasChildNodes()) { $versNode->removeChild($versNode->firstChild); } $versNode->appendChild($template->createTextNode($new_version)); file_put_contents($file, $template->getDisplay()); }
/** * I2CE_Template constructor method. * * This constructor sets up the basic variables for all I2CE_Template objects. * $loadOptions is set to zero. * * */ public function __construct() { parent::__construct(); $this->verboseErrors = true; $this->files_loaded = array(); $this->headers = array('Content-type: text/html; charset=utf-8'); $this->loadOptions = LIBXML_DTDATTR | LIBXML_DTDLOAD; }
$next_vers_comps = $base_vers_comps; $next_vers_comps[1]++; $next_vers = implode('.', $next_vers_comps); $new_vers_comps = $base_vers_comps; $new_vers_comps[] = '0'; $new_vers = implode('.', $new_vers_comps); $found_modules = array_keys(getAvailableModules()); $always_update = array(); foreach ($found_modules as $module) { $mod_file = false; $storage->setIfIsSet($mod_file, "/config/data/{$module}/file"); if (!$mod_file) { I2CE::raiseError("No file recored for {$module}"); continue; } $template = new I2CE_TemplateMeister(); if (!$template->loadRootFile($mod_file)) { echo "\tCould not load\n"; continue; } if (!($results = $template->query('/I2CEConfiguration/metadata/requirement/lessThan[@version="' . $base_vers . '"]')) instanceof DOMNodeList || $results->length == 0) { continue; } $changed = false; foreach ($results as $ltNode) { $res = $template->query('./atLeast', $ltNode->parentNode); if (!$res instanceof DOMNodeList || $res->length != 1) { echo "{$module} has no atLeast node\n"; continue; } $changed = true;
/** * I2CE_Template constructor method. * * This constructor sets up the basic variables for all I2CE_Template objects. * */ public function __construct() { parent::__construct(); $this->setWorkingDir(realpath(dirname(__FILE__))); $this->merges = array(); }