Index: pifr.slave.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/project_issue_file_review/pifr.slave.inc,v retrieving revision 1.4 diff -u -p -r1.4 pifr.slave.inc --- pifr.slave.inc 12 Dec 2008 04:14:45 -0000 1.4 +++ pifr.slave.inc 20 Dec 2008 17:01:41 -0000 @@ -9,6 +9,8 @@ // This needs to be the same as the DRUPAL_MINIMUM_MYSQL in Drupal HEAD. define('PIFR_MINIMUM_MYSQL', '5.0'); +// Recommended PHP memory limit. +define('PIFR_RECOMMENDED_MEMORY', '128M'); /** * Test the server configuration and display the results. @@ -24,7 +26,7 @@ function pifr_slave_check_configuration( $output .= '

' . t('Firewall/connection') . '

'; $output .= '
'; // Test the firewall rules to make sure that the server can - // communicate with itself (localhost), drupal.org, testing.drupal.org, + // communicate with itself ($base_url), drupal.org, testing.drupal.org, // and cvs.drupal.org as required. $connections = array( 'required' => array( @@ -40,15 +42,11 @@ function pifr_slave_check_configuration( 'port' => 80, ), array( - 'hostname' => '88.208.239.81', - 'port' => 80, - ), - array( 'hostname' => 'cvs.drupal.org', 'port' => 2401, ), array( - 'hostname' => 'localhost', + 'hostname' => parse_url(url('', array('absolute' => TRUE)), PHP_URL_HOST), 'port' => 80, ), ), @@ -88,40 +86,46 @@ function pifr_slave_check_configuration( $output .= '
'; // Check for required command line tools. + $commands = array( + array( + 'title' => 'patch', + 'cmd' => 'patch -v', + ), + array( + 'title' => 'gawk', + 'cmd' => 'gawk --version', + ), + array( + 'title' => 'cvs', + 'cmd' => 'cvs -v', + ), + array( + 'title' => 'curl', + 'cmd' => 'curl --version', + ), + array( + 'title' => 'php (cli)', + 'cmd' => 'php -v', + ), + array( + 'title' => 'grep', + 'cmd' => 'grep --version', + ), + array( + 'title' => 'mysql', + 'cmd' => 'mysql --version', + ), + ); + $output .= '

' . t('Command line tools') . '

'; $output .= '
'; $header = array(t('Name'), t('Shell command'), t('Output')); $rows = array(); - // Check for patch. - $cmd = 'patch -v'; - $cmd_output = shell_exec($cmd); - $rows[] = array('patch', $cmd, '' . check_plain($cmd_output) . ''); - - // Check for gawk. - $cmd = 'gawk --version'; - $cmd_output = shell_exec($cmd); - $rows[] = array('gawk', $cmd, '' . check_plain($cmd_output) . ''); - - // Check for cvs. - $cmd = 'cvs -v'; - $cmd_output = shell_exec($cmd); - $rows[] = array('cvs', $cmd, '' . check_plain($cmd_output) . ''); - - // Check for curl. - $cmd = 'curl --version'; - $cmd_output = shell_exec($cmd); - $rows[] = array('curl', $cmd, '' . check_plain($cmd_output) . ''); - - // Check for php cli. - $cmd = 'php -v'; - $cmd_output = shell_exec($cmd); - $rows[] = array('php (cli)', $cmd, '' . check_plain($cmd_output) . ''); - - // Check for grep. - $cmd = 'grep --version'; - $cmd_output = shell_exec($cmd); - $rows[] = array('grep', $cmd, '' . check_plain($cmd_output) . ''); + foreach ($commands as $command) { + $cmd_output = shell_exec($command['cmd']); + $rows[] = array($command['title'], check_plain($command['cmd']), '' . check_plain($cmd_output) . ''); + } $output .= theme('table', $header, $rows); $output .= '
'; @@ -186,6 +190,32 @@ function pifr_slave_check_configuration( $output .= theme('table', $header, $rows); $output .= ''; + + // Check for recommended PHP configuration. + $output .= '

' . t('PHP Configuration') . '

'; + $output .= '
'; + $header = array(t('Setting'), t('Recommended value'), t('Value found'), t('Result')); + $rows = array(); + + // test memory limit (Apache). + $result = FALSE; + $memory_limit = ini_get('memory_limit'); + if (parse_size($memory_limit) >= PIFR_RECOMMENDED_MEMORY) { + $result = TRUE; + } + $rows[] = array(l('memory_limit', 'http://www.php.net/manual/en/ini.core.php#ini.memory-limit', array('absolute' => TRUE)), PIFR_RECOMMENDED_MEMORY, $memory_limit, $result ? t('Passed') : t('Failed')); + + // test memory limit (cli). + $result = FALSE; + $memory_limit = `php -r "echo ini_get('memory_limit');"`; + if (parse_size($memory_limit) >= PIFR_RECOMMENDED_MEMORY) { + $result = TRUE; + } + $rows[] = array(l('memory_limit (cli)', 'http://www.php.net/manual/en/ini.core.php#ini.memory-limit', array('absolute' => TRUE)), PIFR_RECOMMENDED_MEMORY, $memory_limit, $result ? t('Passed') : t('Failed')); + + $output .= theme('table', $header, $rows); + $output .= '
'; + return $output; }