Translated using Weblate (Slovenian)
[phpmyadmin.git] / scripts / match-twig-cache
blobf7e416d097ab7be09c91e56bd1060762b80fafe6
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4 ft=php: */
4 declare(strict_types=1);
6 if (! defined('ROOT_PATH')) {
7     define('ROOT_PATH', dirname(__DIR__) . DIRECTORY_SEPARATOR);
10 $tmpDir = ROOT_PATH . 'twig-templates';
12 /* Read replacements file */
13 $replacements = json_decode(file_get_contents($tmpDir . '/replace.json'), true);
15 /* Read files list */
16 $filesList = file_get_contents($tmpDir . '/filesList');
18 $options = getopt('', ['reverse::']);
20 foreach ($replacements as $templateName => $data) {
21     if (isset($options['reverse'])) {
22         $filesList = str_replace($data[0], $templateName, $filesList);
23     } else {
24         $filesList = str_replace($templateName, $data[0], $filesList);
25     }
28 /* Write back files list */
29 file_put_contents($tmpDir . '/filesList', $filesList);