Translated using Weblate (German)
[phpmyadmin.git] / bin / match-twig-cache
blob803107927a6d060d2786abaad9500c92f68c8d41
1 #!/usr/bin/env php
2 <?php
3 /* vim: set expandtab sw=4 ts=4 sts=4 ft=php: */
5 declare(strict_types=1);
7 if (! defined('ROOT_PATH')) {
8 define('ROOT_PATH', dirname(__DIR__) . DIRECTORY_SEPARATOR);
11 $tmpDir = ROOT_PATH . 'twig-templates';
13 /* Read replacements file */
14 $replacements = json_decode(file_get_contents($tmpDir . '/replace.json'), true);
16 /* Read files list */
17 $filesList = file_get_contents($tmpDir . '/filesList');
19 $options = getopt('', ['reverse::']);
21 foreach ($replacements as $templateName => $data) {
22 if (isset($options['reverse'])) {
23 $filesList = str_replace($data[0], $templateName, $filesList);
24 } else {
25 $filesList = str_replace($templateName, $data[0], $filesList);
29 /* Write back files list */
30 file_put_contents($tmpDir . '/filesList', $filesList);