Skip to content
Snippets Groups Projects
Select Git revision
  • d91a8dd3f3fafe10c3195077d1bc1ddb597f4d88
  • main default protected
  • renovate/lock-file-maintenance
  • demo protected
  • person-select-custom
  • dbp-translation-component
  • icon-set-mapping
  • port-i18next-parser
  • remove-sentry
  • favorites-and-recent-files
  • revert-6c632dc6
  • lit2
  • advertisement
  • wc-part
  • automagic
  • publish
  • wip-cleanup
  • demo-file-handling
18 results

utils.js

Blame
  • disable-database-url.php 899 B
    #!/usr/bin/env php
    <?php
    
    //########################################################################################################
    // Disables the DATABASE_URL env variable in `.env` when its default value is used to prevent confusion.
    //########################################################################################################
    
    // read the entire string
    $str = file_get_contents('.env');
    
    $pattern = '/^(DATABASE_URL=\"postgresql:\/\/symfony:ChangeMe@127.0.0.1:5432\/app)/im';
    $replacement = '# $1';
    
    $strAfter = preg_replace($pattern, $replacement, $str);
    
    if ($strAfter !== $str) {
        // write the entire string
        file_put_contents('.env', $strAfter);
    
        // move config/packages/doctrine.yaml so nothing depends on DATABASE_URL
        if (is_file('config/packages/doctrine.yaml')) {
            rename('config/packages/doctrine.yaml', 'config/packages/doctrine.yaml.bak');
        }
    }