Compare module statuses of different Drupal sites

Compare module statuses of different Drupal sites

تعلم الحقائق هنا الآن Recently I have had a problem that occurred on one of a suite of multilingual Drupal sites all based form the same code base, this was reasonably annoying as I knew it must be something to do with the configuration of modules in the database and that I would have to manually check the differences. 

توصيبات الفوركس

الإنترنت To make this job easier and to provide myself with a useful tool in case this ever happens again I decided to make a script that did all the work of comparing the differences for me.    

الضرائب خيار ثنائي

http://aitram.pt/?rybish=%D9%85%D8%B3%D8%A7%D8%B1-%D9%81%D9%88%D8%B1%D9%83%D8%B3&7fd=22 مسار فوركس This is at this time by no means a finished or perfect solution to the issue of how to compare the status of different modules across different sites, just a first step to what if I need can become a useful tool for comparing the differences between the status of modules on different sites. 

http://skylarkstudios.co.uk/?pomulyyko=%D8%A7%D9%84%D8%AE%D9%8A%D8%A7%D8%B1%D8%A7%D8%AA-%D8%A7%D9%84%D8%AB%D9%86%D8%A7%D8%A6%D9%8A%D8%A9-%D9%8A%D9%88%D9%85%D9%8A%D8%A7&c68=d4 This can be useful if you have many sites all using similar modules or multilingual sites where you have a different database for each site. 

valutahandel investeringssparkonto If I get the time and if I have the need I would make this a lot more useful by making this basic code in to a class with some useful methods for restricting the results to those I deem relevant for any given situation and perhaps adding in some spreadsheet functions to the end of each row. 

http://cantabsrowing.org.uk/?semecko=%D8%B3%D8%B9%D8%B1-%D8%A7%D9%84%D8%B0%D9%87%D8%A8-%D8%A7%D9%84%D9%8A%D9%88%D9%85-%D9%81%D9%8A-%D8%A7%D9%84%D8%B3%D8%B9%D9%88%D8%AF%D9%8A%D9%87&ab3=b0 The spreadsheet this generates is a CSV but this really became useful to me after I manually added some spreadsheet function to the outputted CSV. 

عرب فوركس Anyway I imagine there would be other people in a similar situation so I have published the result on my GitHub

http://focusedfm.com.au/?santas=%D8%A7%D9%84%D8%AD%D9%8A%D9%84-%D9%88%D8%B3%D9%8A%D8%B7-%D8%A7%D9%84%D8%AE%D9%8A%D8%A7%D8%B1%D8%A7%D8%AA-%D8%A7%D9%84%D8%AB%D9%86%D8%A7%D8%A6%D9%8A%D8%A9&76f=85 The basis for this comparison is the drush pml output for each site. To use this tool all you have to do at the moment is pipe this output to a file for each site and then edit the file locations array to match the output files you want to scan. 

http://scsmarketing.co.uk/?yayco=%D9%84%D9%85%D8%A7%D8%B0%D8%A7-%D8%AA%D8%AA%D8%AF%D8%A7%D9%88%D9%84-%D8%A8%D8%A7%D9%84%D8%AE%D9%8A%D8%A7%D8%B1%D8%A7%D8%AA-%D8%A7%D9%84%D8%AB%D9%86%D8%A7%D8%A6%D9%8A%D8%A9&1d9=8f If you are a PHP or Drupal developer then this will all make sense and if you are not then I would be interested as to how you came across this page ;) 

الخيارات الثنائية خالية أستراليا Contact me if you would like to know anything about this script and how to use it and I hope it helps someone. 

انظر هذا الموقع For access to the full codebase go to Tom Gould GitHub profile and more specifically to the pml_compare repo. 

انتقل إلى الموقع Here's a sample from the main worker.

http://wilsonrelocation.com/?q=%D9%85%D9%88%D9%82%D8%B9-%D8%AA%D9%88%D8%B5%D9%8A%D8%A7%D8%AA-%D9%81%D9%88%D8%B1%D9%83%D8%B3 <?php   /** * @file * Compare output from pml from different sites in a CSV * * This is very rough as I wrote it quickly to do a specific job ;) * * To use this tol you need to write the output for the sites you want to compare * to files by using drush pml eg: * * drush --uri=demo.com pml > demo.com.txt * * Do this for all the sites you want to compare then put these files somewhere * readable like the pml_output directory * * When you have the files edit the pml_compare.php file to include these * file locations and the execute the script with PHP on the CLI eg: * * $ cd /var/www/pml_compare * $ php pml_compare.php * * This will then write a CSV to the ./csv folder * */   $sites = array( 'TomGould' => parse_pml('pml_output/tom-gould.txt'), 'site1' => parse_pml('pml_output/site1.com.pml.txt'), 'site2' => parse_pml('pml_output/site2.com.pml.txt'), 'site3' => parse_pml('pml_output/site3.com.pml.txt'), );   // Make the container for the CSV and the first column data (module name) $container = array('Headings' => array('Module')); foreach ($sites as $site => $array) { foreach ($array as $module_key => $module_values) { $container[$module_key] = array($module_key); } } ksort($container);   // Foreach site add the sites' module data to the CSV array foreach ($sites as $site => $array) { $container['Headings'][] = $site . ' Status'; $container['Headings'][] = $site . ' Version'; foreach ($container as $key => $value) { if (!empty($array[$key]) && $key !== 'Headings') { $container[$key][] = $array[$key]['Status']; $container[$key][] = $array[$key]['Version']; } else { if ($key !== 'Headings') { $container[$key][] = 'Empty'; $container[$key][] = 'Empty'; } } } }   // Make a CSV $fp = fopen('csv/module_differences.csv', 'w'); foreach ($container as $fields) { fputcsv($fp, $fields); } fclose($fp);   /** * Parses the PML Output read form a file into a usable array * * @param type $array * @return type */ function parse_pml($file_path) { // Get the PML statuses of the sitesl $pml = file_get_contents($file_path);   // Explode to array of lines $array = explode("\n", $pml);   // Empty arrays to hold more detialed info $response = array();   // Parse the array of lines foreach ($array as $line) { $key = string_get_last($line, '(', ')'); if ($key !== FALSE) { $tmp = array_filter(explode(' ', $line)); $columns = array( 'Package' => trim(array_shift($tmp)), 'Name' => trim(array_shift($tmp)), 'Type' => trim(array_shift($tmp)), 'Status' => trim(array_shift($tmp)), 'Version' => trim(array_shift($tmp)), ); $response[$key] = $columns; } }   return $response; }   /** * Returns text by specifying a start and end point * @param str $str * The text to search * @param str $start * The beginning identifier * @param str $end * The ending identifier */ function string_get_last($str, $start, $end) { $str = "|" . $str . "|"; $len = mb_strlen($start); if (mb_strpos($str, $start) > 0) { // Check to make sire that this is the last occurance if (mb_strpos( right($str, mb_strlen($str) - mb_strpos($str, $end) ), $start) > 0 ) { return string_get_last( right($str, mb_strlen($str) - mb_strpos($str, $end) - 1), $start, $end ); } $int_start = mb_strpos($str, $start) + $len; $temp = right($str, (mb_strlen($str) - $int_start)); $int_end = mb_strpos($temp, $end); $return = trim(left($temp, $int_end)); return $return; } else { return FALSE; } }   /** * Replacement for ASP right function * @param str $str * the string to cut * @param int $count * the length to cut */ function right($str, $count) { return mb_substr($str, ($count * -1)); }   /** * Replacement for ASP left function * @param str $str * the string to cut * @param int $count * the length to cut */ function left($str, $count) { return mb_substr($str, 0, $count); }   <code>

Comment

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.