ENHANCEMENT #6206 Installer additional checks for module existence by checking _config.php exists, in addition to the directory

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/phpinstaller/branches/2.4@113961 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
sharvey 2010-11-20 03:43:42 +00:00 committed by Sam Minnee
parent a0f92459eb
commit 0e1f485dc1

View File

@ -325,9 +325,9 @@ class InstallRequirements {
$this->getBaseDir() $this->getBaseDir()
)); ));
$this->requireFile('mysite', array("File permissions", "mysite/ folder exists?", "There's no mysite folder.")); $this->requireModule('mysite', array("File permissions", "mysite/ directory exists?"));
$this->requireFile('sapphire', array("File permissions", "sapphire/ folder exists?", "There's no sapphire folder.")); $this->requireModule('sapphire', array("File permissions", "sapphire/ directory exists?"));
$this->requireFile('cms', array("File permissions", "cms/ folder exists?", "There's no cms folder.")); $this->requireModule('cms', array("File permissions", "cms/ directory exists?"));
if($isApache) { if($isApache) {
$this->requireWriteable('.htaccess', array("File permissions", "Is the .htaccess file writeable?", null)); $this->requireWriteable('.htaccess', array("File permissions", "Is the .htaccess file writeable?", null));
@ -338,7 +338,7 @@ class InstallRequirements {
$this->requireWriteable('mysite/_config.php', array("File permissions", "Is the mysite/_config.php file writeable?", null)); $this->requireWriteable('mysite/_config.php', array("File permissions", "Is the mysite/_config.php file writeable?", null));
$this->requireWriteable('assets', array("File permissions", "Is the assets/ folder writeable?", null)); $this->requireWriteable('assets', array("File permissions", "Is the assets/ folder writeable?", null));
$this->requireTempFolder(array('File permissions', 'Is the temporary folder writeable?', null)); $this->requireTempFolder(array('File permissions', 'Is the temporary directory writeable?', null));
$this->isRunningWebServer(array("Webserver Configuration", "Server software", "Unknown", $webserver)); $this->isRunningWebServer(array("Webserver Configuration", "Server software", "Unknown", $webserver));
@ -545,7 +545,23 @@ class InstallRequirements {
return true; return true;
} }
/**
* The same as {@link requireFile()} but does additional checks
* to ensure the module directory is intact.
*/
function requireModule($dirname, $testDetails) {
$this->testing($testDetails);
$path = $this->getBaseDir() . $dirname;
if(!file_exists($path)) {
$testDetails[2] .= " Directory '$path' not found. Please make sure you have uploaded the SilverStripe files to your webserver correctly.";
$this->error($testDetails);
} elseif(!file_exists($path . '/_config.php')) {
$testDetails[2] .= " Directory '$path' exists, but is missing files. Please make sure you have uploaded the SilverStripe files to your webserver correctly.";
$this->error($testDetails);
}
}
function requireFile($filename, $testDetails) { function requireFile($filename, $testDetails) {
$this->testing($testDetails); $this->testing($testDetails);
$filename = $this->getBaseDir() . $filename; $filename = $this->getBaseDir() . $filename;
@ -623,8 +639,8 @@ class InstallRequirements {
@$worked = mkdir($ssTmp); @$worked = mkdir($ssTmp);
} }
if(!$worked) { if(!$worked) {
$testDetails[2] = "Permission problem gaining access to a temp folder. " . $testDetails[2] = "Permission problem gaining access to a temp directory. " .
"Please create a folder named silverstripe-cache in the base folder " . "Please create a folder named silverstripe-cache in the base directory " .
"of the installation and ensure it has the adequate permissions"; "of the installation and ensure it has the adequate permissions";
$this->error($testDetails); $this->error($testDetails);
} }