/** * * @param type $options array ('profile' => 'default', 'clone_only' => false) */ function upgrade_from_profile($options) { $pro = new profile(); $pro->setProfileInfo($options['profile']); // Upgrade modules foreach ($pro->profileModules as $key => $val) { $val['repo'] = $val['public_clone_url']; $val['version'] = $val['module_version']; if (isset(conf::$vars['profile_use_master'])) { $val['version'] = 'master'; } $val['module'] = $val['module_name']; $module = new moduleinstaller(); $module->setInstallInfo($val); if ($module->isInstalled($val['module_name'])) { cos_git_upgrade($val, $val['version'], 'module'); } else { if (isset($options['clone_only'])) { cos_git_clone($val, 'module'); } else { cos_git_install($val, 'module'); } } } // install templates foreach ($pro->profileTemplates as $key => $val) { $val['repo'] = $val['public_clone_url']; $val['version'] = $val['module_version']; if (isset(conf::$vars['profile_use_master'])) { $val['version'] = 'master'; } // No DB operations. Only clone to specific version. if (isset($options['clone_only'])) { cos_git_clone($val, 'template'); } else { cos_git_install($val, 'template'); } } }
/** * upgrade a template * @param type $val */ function cos_git_upgrade_template($val) { if (isset(conf::$vars['git_use_master'])) { $tag = 'master'; } else { $tag = git::getTagsRemoteLatest($val['public_clone_url'], true); } if ($tag == 'master' or $tag != $val['module_version']) { cos_git_upgrade($val, $tag, 'template'); } else { common::echoStatus('NOTICE', 'y', "Nothing to upgrade: Version is: {$tag}"); } }