Skip to content
GitLab
Explorer
Connexion
S'inscrire
Navigation principale
Rechercher ou aller à…
Projet
S
stats-facil
Gestion
Activité
Membres
Labels
Programmation
Tickets
Tableaux des tickets
Jalons
Wiki
Code
Requêtes de fusion
Dépôt
Branches
Validations
Étiquettes
Graphe du dépôt
Comparer les révisions
Extraits de code
Compilation
Pipelines
Jobs
Planifications de pipeline
Artéfacts
Déploiement
Releases
Registre de paquets
Registre de conteneur
Registre de modèles
Opération
Environnements
Modules Terraform
Surveillance
Incidents
Analyse
Données d'analyse des chaînes de valeur
Analyse des contributeurs
Données d'analyse CI/CD
Données d'analyse du dépôt
Expériences du modèle
Aide
Aide
Support
Documentation de GitLab
Comparer les forfaits GitLab
Forum de la communauté
Contribuer à GitLab
Donner votre avis
Raccourcis clavier
?
Extraits de code
Groupes
Projets
Afficher davantage de fils d'Ariane
facil
stats-facil
Validations
4af22dfd
Valider
4af22dfd
rédigé
10 years ago
par
sgiehl
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
fix problem in api for fallback to old browser/os archives
parent
4e2205e9
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Modifications
3
Masquer les modifications d'espaces
En ligne
Côte à côte
Affichage de
3 fichiers modifiés
core/Updates/2.10.0-b5.php
+1
-1
1 ajout, 1 suppression
core/Updates/2.10.0-b5.php
core/Version.php
+1
-1
1 ajout, 1 suppression
core/Version.php
plugins/DevicesDetection/API.php
+33
-68
33 ajouts, 68 suppressions
plugins/DevicesDetection/API.php
avec
35 ajouts
et
70 suppressions
core/Updates/2.10.0-b
1
.php
→
core/Updates/2.10.0-b
5
.php
+
1
−
1
Voir le fichier @
4af22dfd
...
@@ -40,7 +40,7 @@ use Piwik\Plugins\Dashboard\Model AS DashboardModel;
...
@@ -40,7 +40,7 @@ use Piwik\Plugins\Dashboard\Model AS DashboardModel;
* contains DevicesDetection data. Day archives will always contain full data, but week/month/year archives may not.
* contains DevicesDetection data. Day archives will always contain full data, but week/month/year archives may not.
* So we need to recreate those week/month/year archives.
* So we need to recreate those week/month/year archives.
*/
*/
class
Updates_2_10_0_b
1
extends
Updates
class
Updates_2_10_0_b
5
extends
Updates
{
{
static
function
getSql
()
static
function
getSql
()
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
core/Version.php
+
1
−
1
Voir le fichier @
4af22dfd
...
@@ -20,5 +20,5 @@ final class Version
...
@@ -20,5 +20,5 @@ final class Version
* The current Piwik version.
* The current Piwik version.
* @var string
* @var string
*/
*/
const
VERSION
=
'2.10.0-b
4
'
;
const
VERSION
=
'2.10.0-b
5
'
;
}
}
Ce diff est replié.
Cliquez pour l'agrandir.
plugins/DevicesDetection/API.php
+
33
−
68
Voir le fichier @
4af22dfd
...
@@ -125,7 +125,10 @@ class API extends \Piwik\Plugin\API
...
@@ -125,7 +125,10 @@ class API extends \Piwik\Plugin\API
$dataTable
=
$this
->
getDataTable
(
'DevicesDetection_os'
,
$idSite
,
$period
,
$date
,
$segment
);
$dataTable
=
$this
->
getDataTable
(
'DevicesDetection_os'
,
$idSite
,
$period
,
$date
,
$segment
);
// handle legacy archives
// handle legacy archives
$this
->
checkForFallbackToOsVersions
(
$dataTable
,
$idSite
,
$period
,
$date
,
$segment
);
if
(
$dataTable
instanceof
DataTable\Map
||
!
$dataTable
->
getRowsCount
())
{
$versionDataTable
=
$this
->
getDataTable
(
'DevicesDetection_osVersions'
,
$idSite
,
$period
,
$date
,
$segment
);
$dataTable
=
$this
->
mergeDataTables
(
$dataTable
,
$versionDataTable
);
}
$dataTable
->
filter
(
'GroupBy'
,
array
(
'label'
,
__NAMESPACE__
.
'\getOSFamilyFullName'
));
$dataTable
->
filter
(
'GroupBy'
,
array
(
'label'
,
__NAMESPACE__
.
'\getOSFamilyFullName'
));
$dataTable
->
filter
(
'ColumnCallbackAddMetadata'
,
array
(
'label'
,
'logo'
,
__NAMESPACE__
.
'\getOsFamilyLogo'
));
$dataTable
->
filter
(
'ColumnCallbackAddMetadata'
,
array
(
'label'
,
'logo'
,
__NAMESPACE__
.
'\getOsFamilyLogo'
));
...
@@ -134,7 +137,7 @@ class API extends \Piwik\Plugin\API
...
@@ -134,7 +137,7 @@ class API extends \Piwik\Plugin\API
/**
/**
* That methods handles t
e
h fallback to
os
version datatables to calculate those without versions.
* That methods handles th
e
fallback to version datatables to calculate those without versions.
*
*
* Unlike DevicesDetection plugin now, the UserSettings plugin did not store archives holding the os and browser data without
* Unlike DevicesDetection plugin now, the UserSettings plugin did not store archives holding the os and browser data without
* their version number. The "version-less" reports were always generated out of the "version-containing" archives .
* their version number. The "version-less" reports were always generated out of the "version-containing" archives .
...
@@ -144,37 +147,40 @@ class API extends \Piwik\Plugin\API
...
@@ -144,37 +147,40 @@ class API extends \Piwik\Plugin\API
* them here from the "version-containing" reports if possible.
* them here from the "version-containing" reports if possible.
*
*
* @param DataTable\DataTableInterface $dataTable
* @param DataTable\DataTableInterface $dataTable
* @param $idSite
* @param DataTable\DataTableInterface $dataTable2
* @param $period
* @return DataTable\DataTableInterface
* @param $date
* @param $segment
*/
*/
protected
function
checkForFallbackToOsVersion
s
(
DataTable
\DataTableInterface
&
$dataTable
,
$idSite
,
$period
,
$date
,
$segment
)
protected
function
mergeDataTable
s
(
DataTable
\DataTableInterface
$dataTable
,
DataTable
\DataTableInterface
$dataTable2
)
{
{
if
(
$dataTable
instanceof
DataTable\Map
)
{
if
(
$dataTable
instanceof
DataTable\Map
)
{
$dataTables
=
$dataTable
->
getDataTables
();
$dataTables
=
$dataTable
->
getDataTables
();
foreach
(
$dataTables
as
$date
=>
&
$table
)
{
if
(
!
$table
->
getRowsCount
())
{
foreach
(
$dataTables
as
$label
=>
$table
)
{
$subTable
=
$this
->
getDataTable
(
'DevicesDetection_osVersions'
,
$idSite
,
$period
,
$date
,
$segment
);
$subTable
->
filter
(
'GroupBy'
,
array
(
'label'
,
function
(
$osWithVersion
)
{
$versionDataTables
=
$dataTable2
->
getDataTables
();
if
(
strpos
(
$osWithVersion
,
';'
))
{
return
substr
(
$osWithVersion
,
0
,
3
);
if
(
!
array_key_exists
(
$label
,
$versionDataTables
))
{
}
continue
;
return
$osWithVersion
;
}));
$dataTable
->
addTable
(
$subTable
,
$date
);
}
}
$newDataTable
=
$this
->
mergeDataTables
(
$table
,
$versionDataTables
[
$label
]);
$dataTable
->
addTable
(
$newDataTable
,
$label
);
}
}
}
else
if
(
!
$dataTable
->
getRowsCount
())
{
}
else
if
(
!
$dataTable
->
getRowsCount
()
&&
$dataTable2
->
getRowsCount
())
{
$dataTable
=
$this
->
getDataTable
(
'DevicesDetection_osVersions'
,
$idSite
,
$period
,
$date
,
$segment
);
$dataTable2
->
filter
(
'GroupBy'
,
array
(
'label'
,
function
(
$label
)
{
$dataTable
->
filter
(
'GroupBy'
,
array
(
'label'
,
function
(
$osWithVersion
)
{
if
(
preg_match
(
"/(.+) [0-9]+(?:\.[0-9]+)?$/"
,
$label
,
$matches
))
{
if
(
strpos
(
$osWithVersion
,
';'
))
{
return
$matches
[
1
];
// should match for browsers
return
substr
(
$osWithVersion
,
0
,
3
);
}
if
(
strpos
(
$label
,
';'
))
{
return
substr
(
$label
,
0
,
3
);
// should match for os
}
}
return
$
osWithVersion
;
return
$
label
;
}));
}));
echo
'replaced'
;
return
$dataTable2
;
}
}
return
$dataTable
;
}
}
/**
/**
...
@@ -222,57 +228,16 @@ class API extends \Piwik\Plugin\API
...
@@ -222,57 +228,16 @@ class API extends \Piwik\Plugin\API
$dataTable
=
$this
->
getDataTable
(
'DevicesDetection_browsers'
,
$idSite
,
$period
,
$date
,
$segment
);
$dataTable
=
$this
->
getDataTable
(
'DevicesDetection_browsers'
,
$idSite
,
$period
,
$date
,
$segment
);
// handle legacy archives
// handle legacy archives
$this
->
checkForFallbackToBrowserVersions
(
$dataTable
,
$idSite
,
$period
,
$date
,
$segment
);
if
(
$dataTable
instanceof
DataTable\Map
||
!
$dataTable
->
getRowsCount
())
{
$versionDataTable
=
$this
->
getDataTable
(
'DevicesDetection_browserVersions'
,
$idSite
,
$period
,
$date
,
$segment
);
$dataTable
=
$this
->
mergeDataTables
(
$dataTable
,
$versionDataTable
);
}
$dataTable
->
filter
(
'GroupBy'
,
array
(
'label'
,
__NAMESPACE__
.
'\getBrowserName'
));
$dataTable
->
filter
(
'GroupBy'
,
array
(
'label'
,
__NAMESPACE__
.
'\getBrowserName'
));
$dataTable
->
filter
(
'ColumnCallbackAddMetadata'
,
array
(
'label'
,
'logo'
,
__NAMESPACE__
.
'\getBrowserFamilyLogo'
));
$dataTable
->
filter
(
'ColumnCallbackAddMetadata'
,
array
(
'label'
,
'logo'
,
__NAMESPACE__
.
'\getBrowserFamilyLogo'
));
return
$dataTable
;
return
$dataTable
;
}
}
/**
* That methods handles teh fallback to browser version datatables to calculate those without versions.
*
* Unlike DevicesDetection plugin now, the UserSettings plugin did not store archives holding the os and browser data without
* their version number. The "version-less" reports were always generated out of the "version-containing" archives .
* For big archives (month/year) that ment that some of the data was truncated, due to the datatable entry limit.
* To avoid that data loss / inaccuracy in the future, DevicesDetection plugin will also store archives without the version.
* For data archived before DevicesDetection plugin was enabled, those archives do not exist, so we try to calculate
* them here from the "version-containing" reports if possible.
*
* @param DataTable\DataTableInterface $dataTable
* @param $idSite
* @param $period
* @param $date
* @param $segment
*/
protected
function
checkForFallbackToBrowserVersions
(
DataTable
\DataTableInterface
&
$dataTable
,
$idSite
,
$period
,
$date
,
$segment
)
{
if
(
$dataTable
instanceof
DataTable\Map
)
{
$dataTables
=
$dataTable
->
getDataTables
();
foreach
(
$dataTables
as
$date
=>
&
$table
)
{
if
(
!
$table
->
getRowsCount
())
{
$subTable
=
$this
->
getDataTable
(
'DevicesDetection_browserVersions'
,
$idSite
,
$period
,
$date
,
$segment
);
$subTable
->
filter
(
'GroupBy'
,
array
(
'label'
,
function
(
$browserWithVersion
)
{
if
(
preg_match
(
"/(.+) [0-9]+(?:\.[0-9]+)?$/"
,
$browserWithVersion
,
$matches
)
===
0
)
{
return
$browserWithVersion
;
}
return
$matches
[
1
];
}));
$dataTable
->
addTable
(
$subTable
,
$date
);
}
}
}
else
if
(
!
$dataTable
->
getRowsCount
())
{
$dataTable
=
$this
->
getDataTable
(
'DevicesDetection_browserVersions'
,
$idSite
,
$period
,
$date
,
$segment
);
$dataTable
->
filter
(
'GroupBy'
,
array
(
'label'
,
function
(
$browserWithVersion
)
{
if
(
preg_match
(
"/(.+) [0-9]+(?:\.[0-9]+)?$/"
,
$browserWithVersion
,
$matches
)
===
0
)
{
return
$browserWithVersion
;
}
return
$matches
[
1
];
}));
}
}
/**
/**
* Gets datatable displaying number of visits by Browser version (eg. Firefox 20, Safari 6.0)
* Gets datatable displaying number of visits by Browser version (eg. Firefox 20, Safari 6.0)
* @param int $idSite
* @param int $idSite
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
Aperçu
0%
Chargement en cours
Veuillez réessayer
ou
joindre un nouveau fichier
.
Annuler
You are about to add
0
people
to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Enregistrer le commentaire
Annuler
Veuillez vous
inscrire
ou vous
se connecter
pour commenter