Compare commits

..

No commits in common. "a3f8768828c01c989c852bc08a7566ee303f1aaa" and "8041adf413f5500b630a104bf62472693516b8aa" have entirely different histories.

2 changed files with 16 additions and 25 deletions

View File

@ -1,13 +1,6 @@
<?php
$last_rev = exec('git log -1 --pretty=format:"%H" '.$this_file);
$mtime = exec('LANG="fr_FR.UTF-8" git log -1 --pretty="format:%ct" '.$this_file);
$fmt = datefmt_create(
'fr-FR',
IntlDateFormatter::FULL,
IntlDateFormatter::FULL,
'Europe/Paris',
IntlDateFormatter::GREGORIAN,
'd MMMM Y à HH:mm:ss O'
);
date_default_timezone_set('Europe/Paris');
$mtime = date("d M Y H:i:s", filemtime($this_file));
setlocale(LC_TIME, 'fr_FR.utf8','fra');
?>
<p style="text-align:right;">Mis à jour le <a href="https://git.gnous.fr/gnous/main_website/commit/<?php echo $last_rev;?>" target="_blank"><?php echo datefmt_format($fmt, $mtime); ?></a></p>
<p style="text-align:right;">Mis à jour le <?php echo strftime("%d %B %Y à %H:%M:%S UTC%z", strtotime($mtime)); ?></p>

View File

@ -1,28 +1,26 @@
<?php
$this_file = basename($_SERVER["SCRIPT_FILENAME"]); //contient le nom de ce fichier (lui-même)
setlocale (LC_TIME, 'fr_FR.utf8','fra');
$rev_long = exec('git rev-parse HEAD'); // contient le hash du commit sélectionné
$rev_short = substr($rev_long, 0, 7); // contient le hash du commit sélectionné
/*
Petit script pour afficher la dernière date de modification (toute page confondue) sur la page d'accueil (index.php)
*/
$mtime_max = exec('git log -1 --pretty="format:%ct" '.$this_file); //récupération de la date de modification de ce fichier et institution comme maximum
$last_rev = exec('git log -1 --pretty=format:"%H" '.$this_file); //récupération du hash du commit associé
date_default_timezone_set('Europe/Paris');
$mtime_this_file = filemtime($this_file); //récupération de la date de modification de ce fichier
$mtime_max = $mtime_this_file; //elle est instituée comme un maximum
foreach (glob("*.php") as $filename) { //récupération de la liste de tous les fichiers .php du répertoire courant (les pages en somme)
$mtime = exec('git log -1 --pretty="format:%ct" '.$filename);
$mtime = filemtime($filename);
if($mtime_max < $mtime) { //si une date de modification est supérieure au max (donc celle de index.php), alors on conserve sa valeur
$mtime_max = $mtime;
$last_rev = exec('git log -1 --pretty=format:"%H" '.$filename); //récupération du hash du commit associé
}
}
$fmt = datefmt_create(
'fr-FR',
IntlDateFormatter::FULL,
IntlDateFormatter::FULL,
'Europe/Paris',
IntlDateFormatter::GREGORIAN,
'd MMMM Y à HH:mm:ss O'
);
if($mtime_max > $mtime_this_file) { //si la date maximum n'est pas celle de cette page (index.php), alors cela veut dire qu'une page a été modifiée plus récemment
$mtime_this_file = $mtime_max;
}
$mtime_this_file = date("d M Y H:i:s", $mtime_this_file); //formatage de la date retenue
?>
<!DOCTYPE HTML>
@ -36,7 +34,7 @@
<?php include 'includes/titre.php'; ?>
<br>
<?php include 'includes/menu.php'; ?>
<p style="text-align:right;">Dernière mise à jour du site le <?php echo datefmt_format($fmt, $mtime_max); ?><br>git revision: <a href="https://git.gnous.fr/gnous/main_website/commit/<?php echo $last_rev;?>" target="_blank"><?php echo substr($last_rev, 0, 7);?></a></p>
<p style="text-align:right;">Dernière mise à jour du site le <?php echo strftime("%d %B %Y à %H:%M:%S UTC%z", strtotime($mtime_this_file)); ?><br>git revision: <a href="https://git.gnous.fr/gnous/main_website/commit/<?php echo $rev_long;?>" target="_blank"><?php echo $rev_short;?></a></p>
<div style="width:40%;">
<p style="text-align: right;">