_locale_translation_source_compare($source1, $source2)
Compare two update sources, looking for the newer one.
The timestamp property of the source objects are used to determine which is the newer one.
object $source1: Source object of the first translation source.
object $source2: Source object of available update.
int
function _locale_translation_source_compare($source1, $source2) { if (isset($source1->timestamp) && isset($source2->timestamp)) { if ($source1->timestamp == $source2->timestamp) { return LOCALE_TRANSLATION_SOURCE_COMPARE_EQ; } else { return $source1->timestamp > $source2->timestamp ? LOCALE_TRANSLATION_SOURCE_COMPARE_GT : LOCALE_TRANSLATION_SOURCE_COMPARE_LT; } } elseif (isset($source1->timestamp) && !isset($source2->timestamp)) { return LOCALE_TRANSLATION_SOURCE_COMPARE_GT; } elseif (!isset($source1->timestamp) && isset($source2->timestamp)) { return LOCALE_TRANSLATION_SOURCE_COMPARE_LT; } else { return LOCALE_TRANSLATION_SOURCE_COMPARE_EQ; } }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!modules!locale!locale.translation.inc/function/_locale_translation_source_compare/8.1.x