<commit_before><?php
// (c) Copyright 2002-2013 by authors of the Tiki Wiki CMS Groupware Project
//
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
// $Id$

class Tiki_Version_Upgrade
{
	private $old;
	private $new;
	private $isRequired;

	function __construct($old, $new, $isRequired)
	{
		$this->old = Tiki_Version_Version::get($old);
		$this->new = Tiki_Version_Version::get($new);
		$this->isRequired = $isRequired;
	}

	function getMessage()
	{
		$parts = array();
		if ($this->isRequired) {
			$parts[] = tr('Version %0 is no longer supported.', (string) $this->old);

			if ($this->isMinor()) {
				$parts[] = tr('A minor upgrade to %0 is required.', (string) $this->new);
			} else {
				$parts[] = tr('A major upgrade to %0 is required.', (string) $this->new);
			}
		} else {
			$parts[] = tr('Version %0 is still supported. However, a major upgrade to %1 is available.', (string) $this->old, (string) $this->new);
		}

		return implode(' ', $parts);
	}

	private function isMinor()
	{
		return $this->old->getMajor() === $this->new->getMajor();
	}
}
<commit_msg>[FIX] Poor wording was encouraging people to leave an LTS for a developper release. Wording improved<commit_after><?php
// (c) Copyright 2002-2013 by authors of the Tiki Wiki CMS Groupware Project
//
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
// $Id$

class Tiki_Version_Upgrade
{
	// old actually means current
	private $old;
	private $new;
	private $isRequired;

	function __construct($old, $new, $isRequired)
	{
		$this->old = Tiki_Version_Version::get($old);
		$this->new = Tiki_Version_Version::get($new);
		$this->isRequired = $isRequired;
	}

	function getMessage()
	{
		$parts = array();
		if ($this->isRequired) {
			$parts[] = tr('Version %0 is no longer supported.', (string) $this->old);

			if ($this->isMinor()) {
				$parts[] = tr('A minor upgrade to %0 is required.', (string) $this->new);
			} else {
				$parts[] = tr('A major upgrade to %0 is required.', (string) $this->new);
			}
		} else {
			// Do not encourage people to leave an LTS which is still supported. Just inform them
			$current = $this->old;
			$current_major = (strstr($current,'.',true) != false)?strstr($current,'.',true):$current;
			if (in_array($current_major,array('9','12','15'))) {	// Keep list of LTS up to date or write method isLTS, whichever is less work
				$current = "$current LTS";
				$parts[] = tr('Version %0 is still supported. However, an upgrade to %1 is available.', $current, (string) $this->new);
			} else {
				$parts[] = tr('Version %0 is still supported. However, a major upgrade to %1 is available.', (string) $this->old, (string) $this->new);
			}
		}

		return implode(' ', $parts);
	}

	private function isMinor()
	{
		return $this->old->getMajor() === $this->new->getMajor();
	}
}

{'fraction_non_alphanumeric': 0.16479524438573315, 'fraction_numerical': 0.010898282694848084, 'mean_word_length': 3.8155802861685215, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7568252', 'n_tokens_mistral': 1088, 'n_tokens_neox': 978, 'n_words': 322}