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
8cf610d7
Valider
8cf610d7
rédigé
11 years ago
par
mattab
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
Reverting broken commit
parent
13f2d745
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Modifications
2
Masquer les modifications d'espaces
En ligne
Côte à côte
Affichage de
2 fichiers modifiés
core/DataAccess/ArchiveSelector.php
+0
-33
0 ajout, 33 suppressions
core/DataAccess/ArchiveSelector.php
plugins/CoreAdminHome/API.php
+32
-8
32 ajouts, 8 suppressions
plugins/CoreAdminHome/API.php
avec
32 ajouts
et
41 suppressions
core/DataAccess/ArchiveSelector.php
+
0
−
33
Voir le fichier @
8cf610d7
...
@@ -282,39 +282,6 @@ class Piwik_DataAccess_ArchiveSelector
...
@@ -282,39 +282,6 @@ class Piwik_DataAccess_ArchiveSelector
.
$dateStart
->
toString
(
"Y-m"
)
.
" ] [Deleted IDs: "
.
implode
(
','
,
$idArchivesToDelete
)
.
"]"
);
.
$dateStart
->
toString
(
"Y-m"
)
.
" ] [Deleted IDs: "
.
implode
(
','
,
$idArchivesToDelete
)
.
"]"
);
}
}
public
function
deleteArchives
(
$idSites
,
$datesByYearMonth
)
{
// In each table, invalidate day/week/month/year containing this date
$sqlIdSites
=
implode
(
","
,
$idSites
);
$archiveTables
=
Piwik_DataAccess_ArchiveTableCreator
::
getTablesArchivesInstalled
();
foreach
(
$archiveTables
as
$table
)
{
// Extract Y_m from table name
$monthYear
=
Piwik_DataAccess_ArchiveTableCreator
::
getDateFromTableName
(
$table
);
if
(
!
isset
(
$datesByYearMonth
[
$monthYear
]))
{
continue
;
}
// Dates which are to be deleted from this table
$datesToDeleteInTable
=
$datesByYearMonth
[
$monthYear
];
// Build one statement to delete all dates from the given table
$sql
=
$bind
=
array
();
$datesToDeleteInTable
=
array_unique
(
$datesToDeleteInTable
);
foreach
(
$datesToDeleteInTable
as
$dateToDelete
)
{
$sql
[]
=
'(date1 <= ? AND ? <= date2)'
;
$bind
[]
=
$dateToDelete
;
$bind
[]
=
$dateToDelete
;
}
$sql
=
implode
(
" OR "
,
$sql
);
$query
=
"DELETE FROM
$table
"
.
" WHERE (
$sql
) "
.
" AND idsite IN ("
.
$sqlIdSites
.
")"
;
Piwik_Query
(
$query
,
$bind
);
}
return
true
;
}
/*
/*
* Deleting "Custom Date Range" reports after 1 day, since they can be re-processed and would take up un-necessary space
* Deleting "Custom Date Range" reports after 1 day, since they can be re-processed and would take up un-necessary space
*/
*/
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
plugins/CoreAdminHome/API.php
+
32
−
8
Voir le fichier @
8cf610d7
...
@@ -119,17 +119,17 @@ class Piwik_CoreAdminHome_API
...
@@ -119,17 +119,17 @@ class Piwik_CoreAdminHome_API
$month
=
$date
->
toString
(
'Y_m'
);
$month
=
$date
->
toString
(
'Y_m'
);
// For a given date, we must invalidate in the monthly archive table
// For a given date, we must invalidate in the monthly archive table
$datesBy
Year
Month
[
$month
][]
=
$date
->
toString
();
$datesByMonth
[
$month
][]
=
$date
->
toString
();
// But also the year stored in January
// But also the year stored in January
$year
=
$date
->
toString
(
'Y_01'
);
$year
=
$date
->
toString
(
'Y_01'
);
$datesBy
Year
Month
[
$year
][]
=
$date
->
toString
();
$datesByMonth
[
$year
][]
=
$date
->
toString
();
// but also weeks overlapping several months stored in the month where the week is starting
// but also weeks overlapping several months stored in the month where the week is starting
/* @var $week Piwik_Period_Week */
/* @var $week Piwik_Period_Week */
$week
=
Piwik_Period
::
factory
(
'week'
,
$date
);
$week
=
Piwik_Period
::
factory
(
'week'
,
$date
);
$week
=
$week
->
getDateStart
()
->
toString
(
'Y_m'
);
$week
=
$week
->
getDateStart
()
->
toString
(
'Y_m'
);
$datesBy
Year
Month
[
$week
][]
=
$date
->
toString
();
$datesByMonth
[
$week
][]
=
$date
->
toString
();
// Keep track of the minimum date for each website
// Keep track of the minimum date for each website
if
(
$minDate
===
false
if
(
$minDate
===
false
...
@@ -138,18 +138,42 @@ class Piwik_CoreAdminHome_API
...
@@ -138,18 +138,42 @@ class Piwik_CoreAdminHome_API
$minDate
=
$date
;
$minDate
=
$date
;
}
}
}
}
$deleteArchivesOlderThan
=
$minDate
->
subDay
(
1
);
Piwik_DataAccess_ArchiveSelector
::
deleteArchives
(
$idSites
,
$datesByYearMonth
);
// In each table, invalidate day/week/month/year containing this date
$sqlIdSites
=
implode
(
","
,
$idSites
);
$sqlIdSites
=
implode
(
","
,
$idSites
);
$archiveTables
=
Piwik_DataAccess_ArchiveTableCreator
::
getTablesArchivesInstalled
();
foreach
(
$archiveTables
as
$table
)
{
// Extract Y_m from table name
$suffix
=
Piwik_DataAccess_ArchiveTableCreator
::
getDateFromTableName
(
$table
);
if
(
!
isset
(
$datesByMonth
[
$suffix
]))
{
continue
;
}
// Dates which are to be deleted from this table
$datesToDeleteInTable
=
$datesByMonth
[
$suffix
];
// Build one statement to delete all dates from the given table
$sql
=
$bind
=
array
();
$datesToDeleteInTable
=
array_unique
(
$datesToDeleteInTable
);
foreach
(
$datesToDeleteInTable
as
$dateToDelete
)
{
$sql
[]
=
'(date1 <= ? AND ? <= date2)'
;
$bind
[]
=
$dateToDelete
;
$bind
[]
=
$dateToDelete
;
}
$sql
=
implode
(
" OR "
,
$sql
);
$query
=
"DELETE FROM
$table
"
.
" WHERE (
$sql
) "
.
" AND idsite IN ("
.
$sqlIdSites
.
")"
;
Piwik_Query
(
$query
,
$bind
);
}
// Update piwik_site.ts_created
// Update piwik_site.ts_created
$query
=
"UPDATE "
.
Piwik_Common
::
prefixTable
(
"site"
)
.
$query
=
"UPDATE "
.
Piwik_Common
::
prefixTable
(
"site"
)
.
" SET ts_created = ?"
.
" SET ts_created = ?"
.
" WHERE idsite IN (
$sqlIdSites
)
" WHERE idsite IN (
$sqlIdSites
)
AND ts_created > ?"
;
AND ts_created > ?"
;
$
datetime
=
$deleteArchivesOlderThan
->
getDatetime
();
$
minDateSql
=
$minDate
->
subDay
(
1
)
->
getDatetime
();
$bind
=
array
(
$
datetime
,
$datetime
);
$bind
=
array
(
$
minDateSql
,
$minDateSql
);
Piwik_Query
(
$query
,
$bind
);
Piwik_Query
(
$query
,
$bind
);
// Force to re-process data for these websites in the next archive.php cron run
// Force to re-process data for these websites in the next archive.php cron run
...
...
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