/** * Check what files is being used */ protected function checkFiles() { $configsObject = new EcommerceConfig(); DB::alteration_message("<h2>Files Used</h2>"); $files = implode(", ", $configsObject->fileLocations()); global $project; $baseFolder = Director::baseFolder(); $projectFolder = $project . "/_config"; $baseAndProjectFolder = $baseFolder . "/" . $projectFolder; $file = "ecommerce.yaml"; $projectFolderAndFile = $projectFolder . "/" . $file; $fullFilePath = $baseFolder . "/" . $projectFolderAndFile; $defaultFileFullPath = Director::baseFolder() . "/" . $this->defaultLocation; DB::alteration_message("Current files used: <strong style=\"color: darkRed\">" . $files . "</strong>, unless stated otherwise, all settings can be edited in these files (or file).", "created"); if (!file_exists($baseAndProjectFolder)) { mkdir($baseAndProjectFolder); } if (!file_exists($fullFilePath)) { copy($defaultFileFullPath, $fullFilePath); DB::alteration_message("We have created a new configuration file for you.", "created"); } if ($files == $this->defaultLocation) { if (file_exists($fullFilePath)) { DB::alteration_message("A customisable configuration file exists here: {$projectFolderAndFile}, you should add the following to your _config.php file:\r\n\t\t\t\t<pre>EcommerceConfig::set_folder_and_file_locations(array(\"{$projectFolderAndFile}\"));</pre>\r\n\t\t\t\t ", "created"); } } }