twig_debugger.install in Twig Debugger 1.0.x
Same filename and directory in other branches
Twig Debugger.
File
twig_debugger.installView source
<?php
/**
* @file
* Twig Debugger.
*/
/**
* Implements hook_install().
*/
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();
}
/**
* Implements hook_uninstall().
*/
function twig_debugger_uninstall() {
$source = DRUPAL_ROOT . '/sites/default/services.yml';
chmod(DRUPAL_ROOT . '/sites/default', 0777);
file_put_contents($source, str_replace('debug: true', 'debug: false', file_get_contents($source)));
file_put_contents($source, str_replace('auto_reload: false', 'auto_reload: null', file_get_contents($source)));
file_put_contents($source, str_replace('cache: false', 'cache: true', file_get_contents($source)));
unlink($source);
chmod(DRUPAL_ROOT . '/sites/default', 0555);
drupal_flush_all_caches();
}
Functions
Name![]() |
Description |
---|---|
twig_debugger_install | Implements hook_install(). |
twig_debugger_uninstall | Implements hook_uninstall(). |