Permalink
Browse files

Android devices have 16 character IDs, not 40.

This fixes stats collection on Android.
  • Loading branch information...
1 parent 7591bee commit cf2b32989ece823380a922feb6c362460415e48f @FabianFrank FabianFrank committed Mar 7, 2013
Showing with 10 additions and 4 deletions.
  1. +10 −4 server/php/includes/main.php
@@ -211,15 +211,21 @@ protected function validateDir($dir)
protected function addStats($bundleidentifier, $format)
{
// did we get any user data?
- $udid = Router::arg_match(self::PARAM_2_UDID, '/^[0-9a-f]{40}$/i');
+ $osname = Router::arg(self::PARAM_2_OS, 'iOS');
+
+ if ($osname == "Android") {
+ $udid = Router::arg_match(self::PARAM_2_UDID, '/^[0-9a-f]{16}$/i');
+ }
+ else {
+ $udid = Router::arg_match(self::PARAM_2_UDID, '/^[0-9a-f]{40}$/i');
+ }
if (!$udid || !is_dir($this->appDirectory.'stats/')) {
return;
}
-
+
$appversion = Router::arg_variants(array(self::PARAM_2_APP_VERSION, self::PARAM_1_APP_VERSION));
$osversion = Router::arg_variants(array(self::PARAM_2_OS_VERSION, self::PARAM_1_OS_VERSION));
- $osname = Router::arg(self::PARAM_2_OS, 'iOS');
$device = Router::arg_variants(array(self::PARAM_2_DEVICE, self::PARAM_1_DEVICE));
$language = Router::arg(self::PARAM_2_LANGUAGE, '');
$firststartdate = Router::arg(self::PARAM_2_FIRST_START, '');
@@ -649,4 +655,4 @@ protected function sort_versions($a, $b)
}
-?>
+?>

0 comments on commit cf2b329

Please sign in to comment.