/** * Check what files is being used */ protected function checkFiles() { $configsObject = EcommerceConfig::create(); DB::alteration_message("<h2>Files Used</h2>"); $files = implode(", ", $configsObject->fileLocations()); global $project; $baseFolder = Director::baseFolder(); $projectFolder = $project . "/_config"; $baseAndProjectFolder = $baseFolder . "/" . $projectFolder; $file = "ecommerce.yml"; $projectFolderAndFile = $projectFolder . "/" . $file; $fullFilePath = $baseFolder . "/" . $projectFolderAndFile; $defaultFileFullPath = Director::baseFolder() . "/" . $this->defaultLocation; DB::alteration_message("\r\n\t\t\tCurrent files used: <strong style=\"color: darkRed\">" . $files . "</strong>,\r\n\t\t\tunless stated otherwise, all settings can be edited in these file(s).", "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.yml file:\r\n<pre>\r\nEcommerceConfig:\r\n folder_and_file_locations:\r\n - \"{$projectFolderAndFile}\"\r\n</pre>", "created"); } } }