<commit_before>namespace :database do
  desc 'Remote database download'
  task :download do
    on roles(:all) do |host|
      dbuser, dbpass, dbname = nil, nil, nil
      file = capture "cat #{shared_path}/wp-config-custom.php"
      file.each_line do |line|
        line.split("\t").each do |item|
          if item.include? "DB_USER"
            dbuser = item.gsub(/(define|\(|\'|\,|\)\;|\ |\n|DB_USER)/, '')
          end
          if item.include? "DB_PASSWORD"
            dbpass = item.gsub(/(define|\(|\'|\,|\)\;|\ |\n|DB_PASSWORD)/, '')
          end
          if item.include? "DB_NAME"
            dbname = item.gsub(/(define|\(|\'|\,|\)\;|\ |\n|DB_NAME)/, '')
          end
        end
      end
      if dbuser != nil and dbpass != nil and dbname != nil
        execute "cd #{shared_path};mysqldump -u#{dbuser} -p#{dbpass} #{dbname} > #{dbname}_cap.sql"
        download! "#{shared_path}/#{dbname}_cap.sql", "."
        execute :rm, "-f", "#{shared_path}/#{dbname}_cap.sql"<commit_msg>Fixed user and pass with weird chars<commit_after>namespace :database do
  desc 'Remote database download'
  task :download do
    on roles(:all) do |host|
      dbuser, dbpass, dbname = nil, nil, nil
      file = capture "cat #{shared_path}/wp-config-custom.php"
      file.each_line do |line|
        line.split("\t").each do |item|
          if item.include? "DB_USER"
            dbuser = item.gsub(/(define|\(|\'|\,|\)\;|\ |\n|DB_USER)/, '')
          end
          if item.include? "DB_PASSWORD"
            dbpass = item.gsub(/(define|\(|\'|\,|\)\;|\ |\n|DB_PASSWORD)/, '')
          end
          if item.include? "DB_NAME"
            dbname = item.gsub(/(define|\(|\'|\,|\)\;|\ |\n|DB_NAME)/, '')
          end
        end
      end
      if dbuser != nil and dbpass != nil and dbname != nil
        execute "cd #{shared_path};mysqldump -u'#{dbuser}' -p'#{dbpass}' #{dbname} > #{dbname}_cap.sql"
        download! "#{shared_path}/#{dbname}_cap.sql", "."
        execute :rm, "-f", "#{shared_path}/#{dbname}_cap.sql"
{'fraction_non_alphanumeric': 0.19970341077607515, 'fraction_numerical': 0.0, 'mean_word_length': 2.2178060413354532, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3610956', 'n_tokens_mistral': 694, 'n_tokens_neox': 698, 'n_words': 155}