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
65ac550d
Valider
65ac550d
rédigé
10 years ago
par
mattab
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
refs #6508 add some comments
parent
6c1a90ff
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/ArchiveProcessor/Rules.php
+5
-3
5 ajouts, 3 suppressions
core/ArchiveProcessor/Rules.php
core/DataAccess/ArchivePurger.php
+21
-8
21 ajouts, 8 suppressions
core/DataAccess/ArchivePurger.php
core/DataAccess/Model.php
+2
-5
2 ajouts, 5 suppressions
core/DataAccess/Model.php
avec
28 ajouts
et
16 suppressions
core/ArchiveProcessor/Rules.php
+
5
−
3
Voir le fichier @
65ac550d
...
...
@@ -128,11 +128,13 @@ class Rules
}
/**
* Given a monthly archive table, will delete all reports that are now outdated,
* or reports that ended with an error
* Returns false if we should not purge data for this month,
* or returns a timestamp indicating outdated archives older than this timestamp (processed before) can be purged.
*
* Note: when calling this function it is assumed that the callee will purge the outdated archives afterwards.
*
* @param \Piwik\Date $date
* @return int|bool
False, or timestamp indicating which archives to delete
* @return int|bool
Outdated archives older than this timestamp should be purged
*/
public
static
function
shouldPurgeOutdatedArchives
(
Date
$date
)
{
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
core/DataAccess/ArchivePurger.php
+
21
−
8
Voir le fichier @
65ac550d
...
...
@@ -24,7 +24,6 @@ class ArchivePurger
{
public
static
function
purgeInvalidatedArchives
()
{
$archiveTables
=
ArchiveTableCreator
::
getTablesArchivesInstalled
();
foreach
(
$archiveTables
as
$archiveTable
)
{
...
...
@@ -56,6 +55,12 @@ class ArchivePurger
return
new
Model
();
}
/**
* Removes the outdated archives for the given month.
* (meaning they are marked with a done flag of ArchiveWriter::DONE_OK_TEMPORARY or ArchiveWriter::DONE_ERROR)
*
* @param Date $dateStart Only the month will be used
*/
public
static
function
purgeOutdatedArchives
(
Date
$dateStart
)
{
$purgeArchivesOlderThan
=
Rules
::
shouldPurgeOutdatedArchives
(
$dateStart
);
...
...
@@ -64,7 +69,7 @@ class ArchivePurger
return
;
}
$idArchivesToDelete
=
self
::
get
Temporary
ArchiveIds
OlderThan
(
$dateStart
,
$purgeArchivesOlderThan
);
$idArchivesToDelete
=
self
::
get
Outdated
ArchiveIds
(
$dateStart
,
$purgeArchivesOlderThan
);
if
(
!
empty
(
$idArchivesToDelete
))
{
self
::
deleteArchiveIds
(
$dateStart
,
$idArchivesToDelete
);
...
...
@@ -78,7 +83,7 @@ class ArchivePurger
implode
(
','
,
$idArchivesToDelete
));
}
protected
static
function
get
Temporary
ArchiveIds
OlderThan
(
Date
$date
,
$purgeArchivesOlderThan
)
protected
static
function
get
Outdated
ArchiveIds
(
Date
$date
,
$purgeArchivesOlderThan
)
{
$archiveTable
=
ArchiveTableCreator
::
getNumericTable
(
$date
);
...
...
@@ -94,8 +99,10 @@ class ArchivePurger
return
$idArchivesToDelete
;
}
/*
* 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.
*
* @param $date Date
*/
protected
static
function
deleteArchivesWithPeriodRange
(
Date
$date
)
{
...
...
@@ -103,12 +110,18 @@ class ArchivePurger
$blobTable
=
ArchiveTableCreator
::
getBlobTable
(
$date
);
$yesterday
=
Date
::
factory
(
'yesterday'
)
->
getDateTime
();
Log
::
debug
(
"Purging Custom Range archives: done [ purged archives older than %s from %s / blob ]"
,
$yesterday
,
$numericTable
);
self
::
getModel
()
->
deleteArchivesWithPeriod
(
$numericTable
,
$blobTable
,
Piwik
::
$idPeriods
[
'range'
],
$yesterday
);
self
::
getModel
()
->
deleteArchivesWithPeriodRange
(
$numericTable
,
$blobTable
,
Piwik
::
$idPeriods
[
'range'
],
$yesterday
);
Log
::
debug
(
"Purging Custom Range archives: done [ purged archives older than %s from %s / blob ]"
,
$yesterday
,
$numericTable
);
}
/**
* Deletes by batches Archive IDs in the specified month,
*
* @param Date $date
* @param $idArchivesToDelete
*/
protected
static
function
deleteArchiveIds
(
Date
$date
,
$idArchivesToDelete
)
{
$batches
=
array_chunk
(
$idArchivesToDelete
,
1000
);
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
core/DataAccess/Model.php
+
2
−
5
Voir le fichier @
65ac550d
...
...
@@ -55,13 +55,10 @@ class Model
return
Db
::
fetchAll
(
$query
,
array
(
$purgeArchivesOlderThan
));
}
/*
* Deleting "Custom Date Range" reports, since they can be re-processed and would take up un-necessary space
*/
public
function
deleteArchivesWithPeriodRange
(
$numericTable
,
$blobTable
,
$range
,
$date
)
public
function
deleteArchivesWithPeriod
(
$numericTable
,
$blobTable
,
$period
,
$date
)
{
$query
=
"DELETE FROM %s WHERE period = ? AND ts_archived < ?"
;
$bind
=
array
(
$
range
,
$date
);
$bind
=
array
(
$
period
,
$date
);
Db
::
query
(
sprintf
(
$query
,
$numericTable
),
$bind
);
...
...
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