/** * Upgrade this module if necessary * @param string $old_vers * @param string $new_vers * @return boolean */ public function upgrade($old_vers, $new_vers) { /* * In 3.2.3 we moved some lists from entry to magicdata storage so we need to get the * old data from entry and save them to the new form storage. */ if (I2CE_Validate::checkVersion($old_vers, '<', '3.2.3')) { $user = new I2CE_User(1, false, false, false); $class_config = I2CE::getConfig()->modules->forms->formClasses; $migrate_path = "/I2CE/formsData/migrate_data/3.2.3"; if (!I2CE_FormStorage::migrateField("training_course_competency_evaluation", array("competency_evaluation" => "competency_evaluation", "competency" => "competency"), $migrate_path, $user)) { return false; } if (!I2CE_FormStorage::migrateField("training_course", array("competency" => "competency"), $migrate_path, $user)) { return false; } // If everything migrated correctly, then remove the unused fields. unset($class_config->iHRIS_Training_Course_Competency_Evaluation->fields->competency_type); } if (I2CE_Validate::checkVersion($old_vers, '<', '3.2.6')) { $evals = array('not_evaluated' => 'Not Evaluated'); if (!I2CE_Module_Lists::remapFields('competency_evaluation', $evals, 'training_course_competency_evaluation')) { return false; } } if (I2CE_Validate::checkVersion($old_vers, '<', '3.2.7')) { // if (!I2CE_Module_Lists::deleteMappedValues('training_course_evaluation', $evals)) { // return false; // } } return parent::upgrade($old_vers, $new_vers); }
/** * Upgrade this module if necessary * @param string $old_vers * @param string $new_vers * @return boolean */ public function upgrade($old_vers, $new_vers) { /* * In 3.2.3 we moved some lists from entry to magicdata storage so we need to get the * old data from entry and save them to the new form storage. */ if (I2CE_Validate::checkVersion($old_vers, '<', '3.2.3')) { $user = new I2CE_User(1, false, false, false); $class_config = I2CE::getConfig()->modules->forms->formClasses; $migrate_path = "/I2CE/formsData/migrate_data/3.2.3"; if (!I2CE_FormStorage::migrateForm("facility_type", "entry", $user, $migrate_path, false, array("type"))) { return false; } if (I2CE_FormStorage::migrateForm("facility", "entry", $user, $migrate_path, false, array("type"), array("facility_type" => "facility_type", "location" => array("county" => "county", "district" => "district", "country" => "country")))) { unset($class_config->iHRIS_Facility->fields->country); unset($class_config->iHRIS_Facility->fields->district); unset($class_config->iHRIS_Facility->fields->county); unset($class_config->iHRIS_Facility->fields->type); } else { return false; } } elseif (I2CE_Validate::checkVersion($old_vers, '<', '3.2.4')) { $user = new I2CE_User(1, false, false, false); $class_config = I2CE::getConfig()->modules->forms->formClasses; $migrate_path = "/I2CE/formsData/migrate_data/3.2.3"; if (!I2CE_FormStorage::migrateForm("facility", "entry", $user, $migrate_path, false, array("type"))) { return false; } unset($class_config->iHRIS_Facility->fields->type); } return parent::upgrade($old_vers, $new_vers); }
/** * Upgrades the modules * @param string $old_vers * @param string $new_vers * @returns boolean */ public function upgrade($old_vers, $new_vers) { if (I2CE_Validate::checkVersion($old_vers, '<', '3.2.12')) { I2CE::raiseError("Changing contact child forms of training_institution to training_institution_contact"); if (!iHRIS_Module_Contact::changeContactForm('training_institution', 'contact_type|facility', 'training_institution_contact', true)) { I2CE::raiseError("Could not upgrade training instituion contacts"); return false; } } if (I2CE_Validate::checkVersion($old_vers, '=', '3.2.12')) { //the changeContactForm did not remvoe the contact form before if (!iHRIS_Module_Contact::removeContactForm('training_institution')) { return false; } } if (I2CE_Validate::checkVersion($old_vers, '<', '3.2.19')) { I2CE::raiseError("Changing contact child forms of training_funder to training_funder_contact"); if (!iHRIS_Module_Contact::changeContactForm('training_funder', 'contact_type|facility', 'training_funder_contact', true)) { I2CE::raiseError("Could not upgrade training funder contacts"); return false; } } if (I2CE_Validate::checkVersion($old_vers, '<', '3.2.20')) { $user = new I2CE_User(1, false, false, false); $class_config = I2CE::getConfig()->modules->forms->formClasses; $migrate_path = "/I2CE/formsData/migrate_data/3.2.3"; if (!I2CE_FormStorage::migrateField("training_institution", array("location" => array("county" => "county", "district" => "district", "country" => "country")), $migrate_path, $user)) { return false; } if (!I2CE_FormStorage::migrateField("training_funder", array("location" => array("county" => "county", "district" => "district", "country" => "country")), $migrate_path, $user)) { return false; } } return true; }
/** * Run the upgrade for this module. * @param string $old_vers * @param string $new_vers * @return boolean */ public function upgrade($old_vers, $new_vers) { if (I2CE_Validate::checkVersion($old_vers, '<', '3.2.5')) { I2CE::raiseError("Disabling training module."); I2CE_ModuleFactory::instance()->disable(array("manage-training-simple-competency", "manage-training-institution", "manage-training-course", "training-simple-competency", "training-institution", "training-course")); } return parent::upgrade($old_vers, $new_vers); }
public function upgrade($old_vers, $new_vers) { if (I2CE_Validate::checkVersion($old_vers, '<', '4.0.6')) { if (!$this->createTempUploadTable()) { return false; } } return true; }
/** * Upgrade this module if necessary * @param string $old_vers * @param string $new_vers * @return boolean */ public function upgrade($old_vers, $new_vers) { if (I2CE_Validate::checkVersion($old_vers, '<', '4.0.6.1')) { if (!$this->addLastModifiedColumn()) { return false; } } return true; }
public function upgrade($old_vers, $new_vers) { if (I2CE_Validate::checkVersion($old_vers, '<', '4.1.12.3')) { //CHECK THAT THIS IS CORRECT VERSION if (!$this->resaveTrainings()) { return false; } } return true; }
public function post_update($old_vers, $new_vers) { if (I2CE_Validate::checkVersion($old_vers, '=', '0')) { //this module is new to 3.2, we may need to update contacts from 3.1 //only fixup contact on a new installation if (!$this->updateContacts()) { return false; } } return true; }
function vers_compare($vers1, $vers2) { if (I2CE_Validate::checkVersion($vers1, '=', $vers2)) { return 0; } if (I2CE_Validate::checkVersion($vers1, "<", $vers2)) { return 1; } else { return -1; } }
/** * Upgrade this module if necessary * @param string $old_vers * @param string $new_vers * @return boolean */ public function upgrade($old_vers, $new_vers) { /* * In 3.2.3 we moved some lists from entry to magicdata storage so we need to get the * old data from entry and save them to the new form storage. */ if (I2CE_Validate::checkVersion($old_vers, '<', '3.2.3')) { $class_config = I2CE::getConfig()->modules->forms->formClasses; unset($class_config->iHRIS_ContinuingEducationCourse->fields->type); } return parent::upgrade($old_vers, $new_vers); }
public function upgrade($old_vers, $new_vers) { if (I2CE_Validate::checkVersion($old_vers, '<', '3.0.1000')) { if (!$this->updatePersonFormFields()) { return false; } if (!$this->ensureFormsAndPages()) { return false; } } return true; }
/** * Upgrade this module if necessary * @param string $old_vers * @param string $new_vers * @return boolean */ public function upgrade($old_vers, $new_vers) { if (I2CE_Validate::checkVersion($old_vers, '<', '4.1.12.0')) { if (!I2CE_Util::runSQLScript('initialize_user_statistics.sql')) { I2CE::raiseError("Could not initialize user statistics cache table."); return false; } if (!$this->cacheUserStatistics()) { I2CE::raiseError("Failed to cache user statistics so must be done manually."); } } return true; }
public function post_update($old_vers, $new_vers) { if (I2CE_Validate::checkVersion($old_vers, '<', '4.2.0.3')) { if (!$this->intialize_csd_cache_metadata()) { return false; } } if (I2CE_Validate::checkVersion($old_vers, '<', '4.2.0.12')) { if (!$this->update_uuids()) { return false; } } return true; }
public function post_update($old_vers, $new_vers) { if (I2CE_Validate::checkVersion($old_vers, '<', '4.2.0.35')) { if (!$this->intialize_csd_cache_metadata()) { return false; } } if (I2CE_Validate::checkVersion($old_vers, '<', '4.2.0.35')) { if (!$this->intialize_csd_cache_metadata_health_facility()) { return false; } } return true; }
/** * Upgrade module method * @param string $old_vers * @param string $new_vers */ public function upgrade($old_vers, $new_vers) { if (I2CE_Validate::checkVersion($old_vers, '<', '4.0.11.1')) { if (!I2CE_Util::runSQLScript('initialize_form_store.sql')) { I2CE::raiseError("Could not initialize I2CE form history storage tables"); return false; } } if (I2CE_Validate::checkVersion($old_vers, '<', '4.1.4.1') && !$this->upgradeFormStore()) { I2CE::raiseError("Could not upgrade I2CE form history storage tables"); return false; } return true; }
public function upgrade($old_vers, $new_vers) { if (I2CE_Validate::checkVersion($old_vers, '<', '4.2.0.4')) { if (!$this->update_keys()) { return false; } } if (I2CE_Validate::checkVersion($old_vers, '<', '4.2.0.6')) { if (!$this->fixup_svs_oids()) { return false; } } return true; }
/** * post updates the modules * @param string $old_vers * @param string $new_vers * @returns boolean * @returns boolean */ public function post_update($old_vers, $new_vers) { if (I2CE_Validate::checkVersion($old_vers, '=', '0')) { //only fixup contact on a new installation if (!$this->fixupContact()) { return false; } // After fixing up the contact, we need to migrate // the data to magic data storage. if (!$this->migrate()) { return false; } } return true; }
/** * Method called before the module is enabled for the first time. * @param boolean -- returns true on success. false on error. */ public function action_initialize() { /* * This module was split off from Custom Reports. * If Custom Reports has been used previously then we should assume the methods * are defined there so they need to be turned off until CustomReports can be * upgraded when it is required. */ $cr_vers = null; I2CE::getConfig()->setIfIsSet($cr_vers, "/config/data/CustomReports/version"); if ($cr_vers !== null && I2CE_Validate::checkVersion($cr_vers, '<', '3.2')) { I2CE::raiseError("Removing hooks from CustomReports because they were moved to form-limits."); I2CE_ModuleFactory::instance()->removeHooks("CustomReports"); } return true; }
/** * Upgrade this module if necessary * @param string $old_vers * @param string $new_vers * @return boolean */ public function upgrade($old_vers, $new_vers) { /* * In 3.2.3 we moved some lists from entry to magicdata storage so we need to get the * old data from entry and save them to the new form storage. */ if (I2CE_Validate::checkVersion($old_vers, '<', '3.2.3')) { $user = new I2CE_User(1, false, false, false); //$class_config = I2CE::getConfig()->modules->forms->formClasses; $migrate_path = "/I2CE/formsData/migrate_data/3.2.3"; $migrate_node = I2CE::getConfig()->traverse($migrate_path, true, false); foreach (self::$constant_migrate as $old_id => $new_id) { $migrate_node->forms->contact_type->{$old_id} = $new_id; } if (!I2CE_FormStorage::migrateField("contact", array("contact_type" => "contact_type"), $migrate_path, $user)) { return false; } } return true; }
/** * Upgrade this module if necessary * @param string $old_vers * @param string $new_vers * @return boolean */ public function upgrade($old_vers, $new_vers) { /* * In 3.2.3 we moved some lists from entry to magicdata storage so we need to get the * old data from entry and save them to the new form storage. */ if (I2CE_Validate::checkVersion($old_vers, '<', '3.2.6')) { $user = new I2CE_User(1, false, false, false); $class_config = I2CE::getConfig()->modules->forms->formClasses; $migrate_path = "/I2CE/formsData/migrate_data/3.2.3"; if (!I2CE_FormStorage::migrateForm("competency_type", "entry", $user, $migrate_path, false, array("type"))) { return false; } if (!I2CE_FormStorage::migrateForm("competency", "entry", $user, $migrate_path, false, array("type"), array("competency_type" => "competency_type"))) { return false; } // If everything migrated correctly, then remove the unused fields. unset($class_config->iHRIS_Competency->fields->type); } return parent::upgrade($old_vers, $new_vers); }
/** * Run the upgrade for this module. * @param string $old_vers * @param string $new_vers * @return boolean */ public function upgrade($old_vers, $new_vers) { if (I2CE_Validate::checkVersion($old_vers, '<', '4.0.3.2')) { I2CE::raiseError("Upgrading sample data for license end_date"); $db = MDB2::singleton(); $updated = $db->exec("UPDATE last_entry SET date = NOW(), date_value = '2015-01-01 00:00:00' WHERE form_field = 75 AND date_value = '2010-01-01 00:00:00'"); if (!I2CE::pearError($updated, "Unable to update license end_date for Qualify Sample Data.")) { I2CE::raiseError("Update {$updated} entries."); $last_mod = $db->exec("UPDATE record SET last_modified = NOW() WHERE form = 16"); if (!I2CE::pearError($last_mod, "Unable to update license end_date for Qualify Sample Data record last modified.")) { I2CE::raiseError("Updated {$last_mod} records."); } else { return false; } } else { return false; } I2CE::getConfig()->modules->CachedForms->dirty->license = time(); } return parent::upgrade($old_vers, $new_vers); }
/** * Run the upgrade function for this module. * @param string $old_vers * @param string $new_vers * @return boolean */ public function upgrade($old_vers, $new_vers) { if (I2CE_Validate::checkVersion($old_vers, '<', '3.2.22')) { I2CE::getConfig()->__unset("/I2CE/page/position"); } if (!$this->do_migrate && I2CE_Validate::checkVersion($old_vers, '<', '3.2.24')) { $user = new I2CE_User(1, false, false, false); $class_config = I2CE::getConfig()->modules->forms->formClasses; $migrate_path = "/I2CE/formsData/migrate_data/3.2.3"; if (!I2CE_FormStorage::migrateField("position", array("facility" => "facility"), $migrate_path, $user)) { return false; } } return parent::upgrade($old_vers, $new_vers); }
/** * Run the pre upgrade for this module. This can use the old config data before it * has been changed from the config. * @param string $old_vers * @param string $new_vers * @param I2CE_MagicDataNode $new_storage * @return boolean */ public function pre_upgrade($old_vers, $new_vers, $new_storage) { if (I2CE_Validate::checkVersion($old_vers, '<', '3.2.8')) { /** * In 3.2.3 some lists were moved to magicdata storage so we need to save * any old record ids for the old lists for later reference before any field * types get changed in magic data. */ if (!$this->pre_migrate()) { return false; } } elseif (I2CE_Validate::checkVersion($old_vers, '<', '3.2.9')) { /** * In 3.2.9 currency was updated so the benefit amount needs to be migrated. * This only needs to happen if the previous upgrade to 3.2.8 has * already happened. Otherwise that upgrade will include the currency info. */ if (!$this->pre_migrate329()) { return false; } } return parent::pre_upgrade($old_vers, $new_vers, $new_storage); }
/** * Run the pre upgrade for this module. This can use the old config data before it * has been changed from the config. * @param string $old_vers * @param string $new_vers * @param I2CE_MagicDataNode $new_storage * @return boolean */ public function pre_upgrade($old_vers, $new_vers, $new_storage) { if (I2CE_Validate::checkVersion($old_vers, '<', '3.2.5')) { /** * In 3.2.3 some lists were moved to magicdata storage so we need to save * any old record ids for the old lists for later reference before any field * types get changed in magic data. */ if (!$this->pre_migrate()) { return false; } } elseif (I2CE_Validate::checkVersion($old_vers, '<', '3.2.6')) { /** * In 3.2.6 currency was updated so the salary_grade fields * need to be migrated. This only needs to happen when going from * 3.2.5 to 3.2.6 otherwise the standard migrate for pre3.2.5 handles it. */ if (!$this->pre_migrate326()) { return false; } } return parent::pre_upgrade($old_vers, $new_vers, $new_storage); }
/** * Checks to see if a module is intialized. Returns true either * 1) there is a class associated to the module and the aciton_initialize() method has been called succesfuuly * 2) there is no class associated with the module but the config data has been processed * @param string $shortname * @returns boolean */ public function isInitialized($shortname) { if (!(is_string($shortname) && strlen($shortname) > 0)) { I2CE::raiseError("Trying to check status of invalid module shortname: (" . print_r($shortname, true) . ")"); return; } if (is_string($this->getClassName($shortname))) { return $this->config->__isset("status/initialized/{$shortname}"); } else { $vers = null; $mod_vers = null; $this->config->setIfIsSet($vers, "status/config_processed/{$shortname}"); $this->config->setIfIsSet($mod_vers, "data/{$shortname}/version"); if ($vers === null || $mod_vers === null) { return false; } return I2CE_Validate::checkVersion($vers, '>=', $mod_vers); } }
/** * Run the pre upgrade for this module. This can use the old config data before it * has been changed from the config. * @param string $old_vers * @param string $new_vers * @param I2CE_MagicDataNode $new_storage * @return boolean */ public function pre_upgrade($old_vers, $new_vers, $new_storage) { if (I2CE_Validate::checkVersion($old_vers, '<', '3.2.5')) { /** * In 3.2.3 some lists were moved to magicdata storage so we need to save * any old record ids for the old lists for later reference before any field * types get changed in magic data. */ if (!$this->pre_migrate()) { return false; } } return parent::pre_upgrade($old_vers, $new_vers, $new_storage); }
/** * Upgrades the modules * @param string $old_vers * @param string $new_vers * @returns boolean */ public function upgrade($old_vers, $new_vers) { I2CE::raiseError("upgrade {$old_vers} -- {$new_vers}"); if (I2CE_Validate::checkVersion($old_vers, '<', '4.1.5.1')) { if (!$this->updateConfigAltToLong()) { return false; } } if (I2CE_Validate::checkVersion($old_vers, '<', '3.0.1')) { if (!$this->updateConfigStatus()) { return false; } } if (I2CE_Validate::checkVersion($old_vers, '<', '3.1')) { if (!$this->dropOldCaches()) { return false; } if (!$this->updateToInnoDB()) { return false; } } if (I2CE_Validate::checkVersion($old_vers, '<', '3.2')) { if (!$this->updateConfigProcessed()) { return false; } } if (I2CE_Validate::checkVersion($old_vers, '>=', '3.2') && I2CE_Validate::checkVersion($old_vers, '<', '3.2.5')) { I2CE::raiseError("Clearing magic data cache for upgrade of I2CE"); if (!I2CE::getConfig()->clearCache()) { return false; } } if (I2CE_Validate::checkVersion($old_vers, '<', '4.0.2')) { if (!$this->addConfigPathIndex()) { return false; } } if (I2CE_Validate::checkVersion($old_vers, '<', '4.0.3.6')) { if (!$this->createAltConfig(true)) { return false; } } $config_protocol = strtolower(I2CE::getRuntimeVariable('I2CE_CONFIG_PROTOCOL', 'config_alt')); if ($config_protocol == 'mongodb' && I2CE_Validate::checkVersion($old_vers, '<', '4.1.4.0')) { if (!$this->createMongoDBConfig(true)) { return false; } } return true; }
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); $vers = trim($versNode->textContent); $vers_comps = explode('.', $vers); //first we check to see if the major/minor/fanastic versions match. if not,we don't update. $exis_vers = implode('.', array_slice(array_pad($vers_comps, $bump_type + 1, 0), 0, $bump_type + 1)); if ($exis_vers != $check_vers) { //if the base versions and e if ($check_short_vers && I2CE_Validate::checkVersion($vers, 'greaterThan', $check_short_vers) && I2CE_Validate::checkVersion($vers, 'lessThan', $base_vers)) { if (!array_key_exists($module, $always_update)) { $always_update[$module] = null; } if (!prompt("Would you like to update {$module} from {$vers} to {$new_vers}?", $always_update[$module])) { continue; } } else { continue; } } if ($file == $mod_file) { echo "{$red}BUMPING{$black}: {$module} from " . trim($versNode->textContent) . " to {$new_vers}\n"; } else { $locale = basename(dirname($file)); echo "{$red}BUMPING{$black}: {$module} localized to {$blue}{$locale}{$black} from " . trim($versNode->textContent) . " to {$new_vers}\n";
/** * Upgrade this module if necessary * @param string $old_vers * @param string $new_vers * @return boolean */ public function upgrade($old_vers, $new_vers) { if (I2CE_Validate::checkVersion($old_vers, '<', '4.0.0')) { //we have stored the INT accident type field no we can store it as a map if (!$this->postUpdateAccidentTypeFields()) { return false; } } return true; }
/** * Upgrade module method */ public function upgrade($old_vers, $new_vers) { if (I2CE_Validate::checkVersion($old_vers, '<', '3.0.1001')) { if (!$this->createDateIndexOnLastEntry()) { return false; } } return true; }