Skip to content

Commit 55e20bd

Browse files
authored
Merge pull request #377 from symfony-cmf/reset-on-platform
reset demo on platform.sh every night
2 parents 26992b2 + 258f6d1 commit 55e20bd

File tree

2 files changed

+19
-7
lines changed

2 files changed

+19
-7
lines changed

.platform.app.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ web:
4242
# robots.txt.
4343
- /robots\.txt$
4444

45+
crons:
46+
reset:
47+
# reset the demo every night to avoid overflowing disks and data leftovers
48+
spec: 2 30 * * *
49+
cmd: 'bin/console cache:clear --env=prod && bin/console doctrine:phpcr:init:dbal --drop --force -n && bin/console doctrine:phpcr:repository:init -n && bin/console doctrine:phpcr:fixtures:load -n && bin/console --env=prod cache:warmup -n --no-debug'
50+
4551
# The size of the persistent disk of the application (in MB).
4652
disk: 2048
4753

web/reload-fixtures.php

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
11
<pre>
22
<?php
33

4-
$output = $return_var = null;
5-
$command = __DIR__.'/../bin/console -v doctrine:phpcr:fixtures:load -e=prod';
6-
echo "Running: $command\n";
7-
exec($command, $output, $return_var);
4+
function runCommand($command)
5+
{
6+
$output = $return_var = null;
7+
echo "Running: $command\n";
8+
exec($command, $output, $return_var);
9+
10+
if (empty($output) || !is_array($output)) {
11+
echo 'Fixtures could not be loaded: '.var_export($return_var, true);
12+
exit(1);
13+
}
814

9-
if (!empty($output) && is_array($output)) {
1015
echo "Output:\n";
1116
foreach ($output as $line) {
1217
echo $line."\n";
1318
}
14-
} else {
15-
echo 'Fixtures could not be loaded: '.var_export($return_var, true);
1619
}
20+
21+
runCommand(__DIR__.'/../bin/console cache:clear -e=prod');
22+
runCommand(__DIR__.'/../bin/console -v doctrine:phpcr:fixtures:load -e=prod');

0 commit comments

Comments
 (0)