From: <an...@us...> - 2006-11-29 16:48:29
|
Revision: 15317 http://svn.sourceforge.net/gallery/?rev=15317&view=rev Author: andy_st Date: 2006-11-29 08:48:26 -0800 (Wed, 29 Nov 2006) Log Message: ----------- - Verify essential filesystem functions are available - Don't allow to continue the installation/upgrade if PCRE isn't available Modified Paths: -------------- trunk/gallery2/install/steps/SystemChecksStep.class trunk/gallery2/upgrade/steps/SystemChecksStep.class Modified: trunk/gallery2/install/steps/SystemChecksStep.class =================================================================== --- trunk/gallery2/install/steps/SystemChecksStep.class 2006-11-29 01:17:41 UTC (rev 15316) +++ trunk/gallery2/install/steps/SystemChecksStep.class 2006-11-29 16:48:26 UTC (rev 15317) @@ -130,6 +130,7 @@ _('Error: Your PHP is configured without support for %sPerl Compatible ' . 'Regular Expressions%s. You must enable these functions before ' . 'Gallery will run.'), '<a href="http://php.net/pcre">', '</a>')); + $failCount++; } /* skip showing 'success' for this one */ /* Warning when exec() is disabled */ @@ -167,13 +168,36 @@ $templateData['check'][] = array('title' => _('set_time_limit() allowed'), 'success' => true); - /* Set the time limit large enoguh for the remaining checks (slow systems) */ + /* Set the time limit large enough for the remaining checks (slow systems) */ set_time_limit(180); $setTimeLimitAvailable = true; } $template->renderStatusMessage(_('Performing system checks'), '', 0.02); + /* Make sure filesystem operations are allowed */ + $missingFilesystemFunctions = array(); + foreach (array('fopen', 'fclose', 'fread', 'fwrite', 'file', 'copy', 'rename', 'readfile', + 'file_get_contents', 'copy', 'move_uploaded_file', 'file_exists', 'tempnam', 'glob', + 'closedir', 'stat', 'unlink', 'rmdir', 'mkdir', 'getcwd', 'chdir', 'opendir', + 'readdir', 'chmod') as $function) { + if (!function_exists($function)) { + $missingFilesystemFunctions[] = $function; + } + } + if (!empty($missingFilesystemFunctions)) { + $templateData['check'][] = + array('title' => _('Filesystem Operations'), + 'error' => true, + 'notice' => sprintf( + _('Error: Essential filesystem operations are disabled in your PHP by ' . + 'the <b>disabled_functions</b> parameter in php.ini. You must allow ' . + 'these functions before Gallery will run. These functions are ' . + 'missing: %s.'), + implode(', ', $missingFilesystemFunctions))); + $failCount++; + } /* skip showing 'success' for this one */ + /* Warning if memory_limit is set and is too low */ $memoryLimit = ini_get('memory_limit'); $title = sprintf('%s (%s)', _('Memory limit'), @@ -344,7 +368,7 @@ /* Check all files against MANIFEST */ $title = _('Gallery file integrity'); - if (!SystemChecksStep::CheckFileDirective()) { + if (!SystemChecksStep::CheckFileDirective() || !empty($missingFilesystemFunctions)) { $templateData['check'][] = array('title' => $title, 'warning' => true, Modified: trunk/gallery2/upgrade/steps/SystemChecksStep.class =================================================================== --- trunk/gallery2/upgrade/steps/SystemChecksStep.class 2006-11-29 01:17:41 UTC (rev 15316) +++ trunk/gallery2/upgrade/steps/SystemChecksStep.class 2006-11-29 16:48:26 UTC (rev 15317) @@ -147,6 +147,7 @@ 'Regular Expressions%s. You must enable these functions before ' . 'Gallery will run.'), '<a href="http://php.net/pcre">', '</a>')); + $failCount++; } /* skip showing 'success' for this one */ /* Warning when exec() is disabled */ @@ -188,6 +189,29 @@ set_time_limit(180); } + /* Make sure filesystem operations are allowed */ + $missingFilesystemFunctions = array(); + foreach (array('fopen', 'fclose', 'fread', 'fwrite', 'file', 'copy', 'rename', 'readfile', + 'file_get_contents', 'copy', 'move_uploaded_file', 'file_exists', 'tempnam', 'glob', + 'closedir', 'stat', 'unlink', 'rmdir', 'mkdir', 'getcwd', 'chdir', 'opendir', + 'readdir', 'chmod') as $function) { + if (!function_exists($function)) { + $missingFilesystemFunctions[] = $function; + } + } + if (!empty($missingFilesystemFunctions)) { + $templateData['check'][] = + array('title' => _('Filesystem Operations'), + 'error' => true, + 'notice' => sprintf( + _('Error: Essential filesystem operations are disabled in your PHP by ' . + 'the <b>disabled_functions</b> parameter in php.ini. You must allow ' . + 'these functions before Gallery will run. These functions are ' . + 'missing: %s.'), + implode(', ', $missingFilesystemFunctions))); + $failCount++; + } /* skip showing 'success' for this one */ + /* Warning if memory_limit is set and is too low */ $memoryLimit = ini_get('memory_limit'); $title = sprintf('%s (%s)', _('Memory limit'), @@ -357,7 +381,7 @@ /* Check if the files and dirs in the storage dir are (still) writeable */ $title = _('Storage Directory Permissions'); - if (!SystemChecksStep::CheckFileDirective()) { + if (!SystemChecksStep::CheckFileDirective() || !empty($missingFilesystemFunctions)) { $templateData['check'][] = array('title' => $title, 'warning' => true, @@ -381,7 +405,7 @@ /* Check all files against MANIFEST */ $title = _('Gallery file integrity'); - if (!SystemChecksStep::CheckFileDirective()) { + if (!SystemChecksStep::CheckFileDirective() || !empty($missingFilesystemFunctions)) { $templateData['check'][] = array('title' => $title, 'warning' => true, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |