You are here

function twig_debugger_install in Twig Debugger 1.1.x

Same name and namespace in other branches
  1. 1.0.x twig_debugger.install \twig_debugger_install()

Implements hook_install().

File

./twig_debugger.install, line 11
Twig Debugger.

Code

function twig_debugger_install() {
  $source = DRUPAL_ROOT . '/sites/default/default.services.yml';
  $destination = DRUPAL_ROOT . '/sites/default/services.yml';
  chmod(DRUPAL_ROOT . '/sites/default', 0777);
  touch($destination);
  copy($source, $destination);
  chmod(DRUPAL_ROOT . '/sites/default', 0555);
  file_put_contents($destination, str_replace('debug: false', 'debug: true', file_get_contents($destination)));
  file_put_contents($destination, str_replace('auto_reload: null', 'auto_reload: false', file_get_contents($destination)));
  file_put_contents($destination, str_replace('cache: true', 'cache: false', file_get_contents($destination)));
  drupal_flush_all_caches();
}