Overview
Comment:Bloquer le process d'upgrade dès que possible pour empêcher les race conditions
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | stable | 0.8.0
Files: files | file ages | folders
SHA1: c50d47ae10e00e37259f59fcf3a29ed3c1377c24
User & Date: bohwaz on 2017-10-18 11:32:47
Other Links: manifest | tags
Context
2017-10-18
11:41
Envoi sur fossil de la release check-in: bed8afe000 user: bohwaz tags: trunk
11:32
Bloquer le process d'upgrade dès que possible pour empêcher les race conditions check-in: c50d47ae10 user: bohwaz tags: trunk, stable, 0.8.0
11:22
Corrige accès fichier check-in: b870d9bf30 user: bohwaz tags: trunk, stable, 0.8.0
Changes

Modified src/templates/error.tpl from [a16bde0e90] to [f1a21eb4e1].

30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
</head>

<body>

<h1>Erreur</h1>

<p class="error">
    {$error}
</p>

<p>
    <a href="{$www_url}" onclick="history.back(); return false;">&larr; Retour</a>
</p>

</body>
</html>







|








30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
</head>

<body>

<h1>Erreur</h1>

<p class="error">
    {$error|escape|nl2br}
</p>

<p>
    <a href="{$www_url}" onclick="history.back(); return false;">&larr; Retour</a>
</p>

</body>
</html>

Modified src/www/admin/upgrade.php from [8f7b8df203] to [82ce8b560d].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18












19
20
21
22
23
24
25
<?php
namespace Garradin;

const UPGRADE_PROCESS = true;

require_once __DIR__ . '/../../include/init.php';

Install::checkAndCreateDirectories();

$config = Config::getInstance();

$v = $config->getVersion();

if (version_compare($v, garradin_version(), '>='))
{
    throw new UserException("Pas de mise à jour à faire.");
}













$db = DB::getInstance();
$redirect = true;

// Créer une sauvegarde automatique
(new Sauvegarde)->create('pre-upgrade-' . garradin_version());

echo '<!DOCTYPE html>







<
<









>
>
>
>
>
>
>
>
>
>
>
>







1
2
3
4
5
6
7


8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
namespace Garradin;

const UPGRADE_PROCESS = true;

require_once __DIR__ . '/../../include/init.php';



$config = Config::getInstance();

$v = $config->getVersion();

if (version_compare($v, garradin_version(), '>='))
{
    throw new UserException("Pas de mise à jour à faire.");
}

Install::checkAndCreateDirectories();

if (Static_Cache::exists('upgrade'))
{
    $path = Static_Cache::getPath('upgrade');
    throw new UserException('Une mise à jour est déjà en cours.'
        . PHP_EOL . 'Si celle-ci a échouée et que vous voulez ré-essayer, supprimez le fichier suivant:'
        . PHP_EOL . $path);
}

Static_Cache::store('upgrade', 'Mise à jour en cours.');

$db = DB::getInstance();
$redirect = true;

// Créer une sauvegarde automatique
(new Sauvegarde)->create('pre-upgrade-' . garradin_version());

echo '<!DOCTYPE html>
297
298
299
300
301
302
303


304
305
306
307
308
309
310
    $comptes = new Compta\Comptes;
    $comptes->importPlan();
}

Utils::clearCaches();

$config->setVersion(garradin_version());



echo '<h2>Mise à jour terminée.</h2>
<p><a href="'.WWW_URL.'admin/">Retour</a></p>';

if ($redirect)
{
    echo '







>
>







307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
    $comptes = new Compta\Comptes;
    $comptes->importPlan();
}

Utils::clearCaches();

$config->setVersion(garradin_version());

Static_Cache::remove('upgrade');

echo '<h2>Mise à jour terminée.</h2>
<p><a href="'.WWW_URL.'admin/">Retour</a></p>';

if ($redirect)
{
    echo '