private function updatecheck() { // Check for required Plugin Database Updates $this->core_updates = $this->UpdateCheck->UpdateBadge('uc_coreupdate_available', true); $this->extension_updates = $this->UpdateCheck->UpdateBadge('uc_update_available'); //new plugin-update-check (only minor, without db-updates) $this->pm->plugin_update_check(); //game-update-check if (compareVersion($this->game->gameVersion(), $this->config->get('game_version')) == 1) { //check for game-task $found = false; if (!isset($tasks)) { $tasks = registry::register('mmtaskmanager')->get_task_list(true); } foreach ($tasks as $task => $file) { if (strpos($task, 'update_' . $this->config->get('default_game')) === 0) { include_once $file; if (compareVersion(registry::register($task)->version, $this->config->get('game_version')) == 1) { $found = true; } } } //no update: reinstall the game if (!$found) { $this->game->ChangeGame($this->config->get('default_game'), $this->config->get('game_language')); } } }
function matchVersion($version, $required, $type) { switch ($type) { case JNLP_VER_EXACT: return matchExactVersion($version, $required); case JNLP_VER_MINIMUM: return compareVersion($version, $required) >= 0; case JNLP_VER_PREFIX: return matchPrefixVersion($version, $required); } }
public function is_necessary() { $version = $this->config->get('plus_version'); if ($this->plugin_path) { $data = $this->db->fetch_record($this->db->query("SELECT version, status FROM __plugins WHERE code = '" . $this->plugin_path . "';")); if ($data['status'] != 1) { return false; } $version = $data['version']; } if (compareVersion($version, $this->version) == -1 and $version) { return true; } return false; }
public function is_necessary() { $version = $this->config->get('plus_version'); if ($this->plugin_path) { $objQuery = $this->db->prepare("SELECT version, status FROM __plugins WHERE code =?")->execute($this->plugin_path); if ($objQuery) { $data = $objQuery->fetchAssoc(); if ($data['status'] != 1) { return false; } $version = $data['version']; } else { $version = false; } } if (compareVersion($version, $this->version) == -1 and $version) { return true; } return false; }
public function BuildUpdateArray($only_installed = true) { $pluginscheck = array(); if (!$only_installed) { $arrUninstalledStyles = $this->objStyles->getUninstalledStyles(); } $arrExtensions = $this->getExtensionList(); if (is_array($arrExtensions)) { foreach ($arrExtensions as $categoryid => $categorycontent) { if (is_array($categorycontent)) { foreach ($categorycontent as $id => $value) { $blnUpdateAvailable = false; switch ((int) $value['category']) { //Plugins case 1: $status = $only_installed ? PLUGIN_INSTALLED : PLUGIN_REGISTERED; $blnUpdateAvailable = $this->pm->check($value['plugin'], $status) && !$this->pm->check($value['plugin'], PLUGIN_DISABLED) && compareVersion(trim($value['version']), $this->pm->get_data($value['plugin'], 'version')) == 1 || $value['plugin'] == 'pluskernel' && compareVersion(trim($value['version']), $this->plusversion) == 1; if ($blnUpdateAvailable) { $recent_version = $value['plugin'] != 'pluskernel' ? $this->pm->get_data($value['plugin'], 'version') : $this->plusversion; } break; //Templates //Templates case 2: $arrStylesList = $this->pdh->aget('styles', 'templatepath', 0, array($this->pdh->get('styles', 'id_list')), false); if (in_array($value['plugin'], $arrStylesList)) { $styleid = array_search($value['plugin'], $arrStylesList); $blnUpdateAvailable = compareVersion(trim($value['version']), $this->pdh->get('styles', 'version', array($styleid))) == 1; if ($blnUpdateAvailable) { $recent_version = $this->pdh->get('styles', 'version', array($styleid)); } } if (!$only_installed) { if (isset($arrUninstalledStyles[$value['plugin']])) { $blnUpdateAvailable = compareVersion(trim($value['version']), $arrUninstalledStyles[$value['plugin']]->version) == 1; if ($blnUpdateAvailable) { $recent_version = $arrUninstalledStyles[$value['plugin']]->version; } } } break; //Portal modules //Portal modules case 3: $arrPortalList = $this->pdh->aget('portal', 'path', 0, array($this->pdh->get('portal', 'id_list')), false); if (in_array($value['plugin'], $arrPortalList)) { //Module belongs to an plugin $moduleid = array_search($value['plugin'], $arrPortalList); if (strlen($this->pdh->get('portal', 'plugin', array($moduleid)))) { break; } if ($only_installed) { $status = (int) $this->pdh->get('portal', 'enabled', array($moduleid)); if ($status != 1) { break; } } if ($blnUpdateAvailable) { $recent_version = $this->pdh->get('portal', 'version', array($moduleid)); } } break; //Games //Games case 7: if ($only_installed) { if ($value['plugin'] == $this->config->get('default_game')) { $blnUpdateAvailable = compareVersion(trim($value['version']), $this->game->gameVersion()) == 1; if ($blnUpdateAvailable) { $recent_version = $this->game->gameVersion(); } } } else { $arrGames = $this->game->get_versions(); if (isset($arrGames[$value['plugin']])) { $blnUpdateAvailable = compareVersion(trim($value['version']), $arrGames[$value['plugin']]) == 1; if ($blnUpdateAvailable) { $recent_version = $arrGames[$value['plugin']]; } } } break; //Languages //Languages case 11: $arrLanguages = $arrLanguageVersions = array(); // Build language array if ($dir = @opendir($this->root_path . 'language/')) { while ($file = @readdir($dir)) { if (!is_file($this->root_path . 'language/' . $file) && !is_link($this->root_path . 'language/' . $file) && valid_folder($file)) { include $this->root_path . 'language/' . $file . '/lang_main.php'; $lang_name_tp = $lang['ISO_LANG_NAME'] ? $lang['ISO_LANG_NAME'] . ' (' . $lang['ISO_LANG_SHORT'] . ')' : ucfirst($file); $arrLanguages[$file] = $lang_name_tp; $arrLanguageVersions[$file] = $lang['LANG_VERSION']; } } } if (isset($arrLanguages[$value['plugin']])) { $blnUpdateAvailable = compareVersion(trim($value['version']), $arrLanguageVersions[$value['plugin']]) == 1; if ($blnUpdateAvailable) { $recent_version = $arrLanguageVersions[$value['plugin']]; } } break; } if ($blnUpdateAvailable) { $pluginscheck[$value['plugin']] = array('plugin' => $value['plugin'], 'name' => $value['name'], 'version' => $value['version_ext'], 'version_int' => $value['version'], 'recent_version' => $recent_version, 'changelog' => $value['changelog'], 'level' => $value['level'], 'release' => $this->time->user_date($value['date']), 'dep_php' => $value['dep_php']); $this->update_count++; } } } } } //local Style Updates $arrStyleUpdates = $this->objStyles->getLocalStyleUpdates(); if (count($arrStyleUpdates) > 0) { $pluginscheck = array_merge($pluginscheck, $this->objStyles->getLocalStyleUpdates()); $this->update_count += count($arrStyleUpdates); } return $pluginscheck; }
public function plugin_update_check() { foreach ($this->get_plugins() as $plugin_code) { $plugin_obj = $this->get_plugin($plugin_code); $plugin_db_version = $this->pdh->get('plugins', 'data', array($plugin_code, 'version')); if (compareVersion($plugin_obj->version, $plugin_db_version) == 1) { $found = false; if (!isset($tasks)) { $tasks = registry::register('mmtaskmanager')->get_task_list(true); } foreach ($tasks as $task => $file) { if (strpos($task, 'update_' . $plugin_code) === 0) { include_once $file; if (compareVersion(registry::register($task)->version, $plugin_db_version) == 1) { $found = true; break; } } } if (!$found) { $this->pdh->put('plugins', 'update_version', array($plugin_obj->version, $plugin_code)); $this->pdh->process_hook_queue(); } } } return true; }
function sort_tasks($a, $b) { $ret = strcmp($a['type'], $b['type']); if ($ret == 0) { return compareVersion($a['version'], $b['version']); } return $ret; }
public function check_dependency($dependency) { $deps = $this->get_dependency($dependency); //dependency not set if ($deps == false) { return true; } switch ($dependency) { case 'plus_version': $check_result = compareVersion($this->config->get('plus_version'), $deps, '>='); $check_result = $check_result >= 0 ? true : false; break; case 'games': $check_result = in_array($this->config->get('default_game'), $deps); break; case 'php_functions': foreach ($deps as $function) { $check_result = function_exists($function); if ($check_result == false) { break; } } break; default: $check_result = true; } return $check_result; }
public function getLocalStyleUpdates() { foreach ($this->pdh->get('styles', 'styles', array()) as $row) { $tpl_index = $this->root_path . 'templates/' . $row['template_path'] . '/package.xml'; if (file_exists($tpl_index)) { $xml = simplexml_load_file($tpl_index); $result = compareVersion($xml->version, $row['style_version']); if ($result == 1) { $this->update_styles[$row['template_path']] = array('plugin' => $row['template_path'], 'name' => $row['style_name'], 'version' => $xml->version, 'recent_version' => $row['style_version'], 'changelog' => '', 'level' => '', 'release' => $this->time->user_date($xml->creationDate)); } } } if (count($this->update_styles) > 0) { return $this->update_styles; } return array(); }