Index: modules/system/system.install =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.install,v retrieving revision 1.524 diff -u -p -r1.524 system.install --- modules/system/system.install 13 Nov 2010 17:40:09 -0000 1.524 +++ modules/system/system.install 19 Nov 2010 03:16:11 -0000 @@ -474,6 +474,51 @@ function system_requirements($phase) { } } + // Check if an opcode cache is not re-compiling modified files. + if ($phase == 'install') { + + // Create a test PHP file and see if it can be immediately executed. + // Then modify the file and see if the changes are visible. + drupal_static_reset('conf_path'); + $test_file = conf_path(FALSE) . '/test.php'; + $test_url = url($test_file, array('absolute' => TRUE)); + $test_script_1 = ''; + $test_script_2 = ''; + if (file_put_contents($test_file, $test_script_1)) { + + // Attempt the first request. + $result = drupal_http_request($test_url); + if (isset($result->code) && $result->code >= 200 && $result->code < 400) { + $test_output_1 = $result->data; + + // Modify the contents of the test script and re-request. + file_put_contents($test_file, $test_script_2); + $result = drupal_http_request($test_url); + if (isset($result->code) && $result->code >= 200 && $result->code < 400) { + $test_output_2 = $result->data; + + // If script 1 worked, but script 2 did not, then we know there is an + // opcode configuration problem. + if ($test_output_1 == 'Hello' && $test_output_2 != 'Hello World') { + $requirements['opcode'] = array( + 'title' => $t('Code modification test'), + 'value' => $t('Fail'), + 'severity' => REQUIREMENT_ERROR, + 'description' => $t('Drupal is unable to change code files and immediately see those changes. Your system is likely using a PHP opcode cache configured in a way that prevents code changes from being immediately visible. For the duration of the installation it is recommended to either disable the opcode cache, or reconfigure it to allow code changes to be seen immediately.'), + ); + } + + } + } + + // Remove the test file. + if (file_exists($test_file)) { + unlink($test_file); + } + + } + } + return $requirements; }