Security update to Drupal 8.4.6
[yaffs-website] / vendor / ezyang / htmlpurifier / maintenance / update-config.php
1 #!/usr/bin/php
2 <?php
3
4 chdir(dirname(__FILE__));
5 require_once 'common.php';
6 assertCli();
7
8 /**
9  * @file
10  * Converts all instances of $config->set and $config->get to the new
11  * format, as described by docs/dev-config-bcbreaks.txt
12  */
13
14 $FS = new FSTools();
15 chdir(dirname(__FILE__) . '/..');
16 $raw_files = $FS->globr('.', '*.php');
17 foreach ($raw_files as $file) {
18     $file = substr($file, 2); // rm leading './'
19     if (strpos($file, 'library/standalone/') === 0) continue;
20     if (strpos($file, 'maintenance/update-config.php') === 0) continue;
21     if (strpos($file, 'test-settings.php') === 0) continue;
22     if (substr_count($file, '.') > 1) continue; // rm meta files
23     // process the file
24     $contents = file_get_contents($file);
25     $contents = preg_replace(
26         "#config->(set|get)\('(.+?)', '(.+?)'#",
27         "config->\\1('\\2.\\3'",
28         $contents
29     );
30     if ($contents === '') continue;
31     file_put_contents($file, $contents);
32 }
33
34 // vim: et sw=4 sts=4