createDirIfNotExists(pth($root . "frontend/runtime")); createDirIfNotExists(pth($root . "backend/runtime")); createDirIfNotExists(pth($root . "console/runtime")); // permissions chmod(pth($root . "frontend/runtime"), 02777); // permissions with setguid chmod(pth($root . "backend/runtime"), 02777); chmod(pth($root . "console/runtime"), 02777); chmod(pth($root . "frontend/www/assets"), 02777); chmod(pth($root . "backend/www/assets"), 02777); //Copy *-environmnetName.php to *-env.php $directories = array(pth($root . "common/config/"), pth($root . "frontend/config/"), pth($root . "backend/config/"), pth($root . "console/config/")); // console //choose environment specific configs foreach ($directories as $dir) { $files = glob(pth($dir . "environments/" . "*-" . $envType . '.php')); foreach ($files as $srcFile) { $pattern = "/-" . $envType . ".php\$/"; $dstFile = preg_replace($pattern, "-env.php", $srcFile); // remove "env/" or "environments\" from the path $dstFile = preg_replace('/environments\\\\|environments\\//', "", $dstFile); $res = copy($srcFile, $dstFile); if (!$res) { echo "Error. Failed to copy {$srcFile} to {$dstFile}\n"; } // for some reason after copying the permissions are wrong chmod($dstFile, 0644); } } // create empty local configs if these do no exist yet if ($envType == 'private') {
echo $row, "\n"; } } //Create and flush assets directory rmdirRecursive(pth($root . "frontend/www/assets")); createDirIfNotExists(pth($root . "frontend/www/assets")); //Create and flush assets directory rmdirRecursive(pth($root . "backend/www/assets")); createDirIfNotExists(pth($root . "backend/www/assets")); // runtime createDirIfNotExists(pth($root . "frontend/runtime")); createDirIfNotExists(pth($root . "console/runtime")); createDirIfNotExists(pth($root . "backend/runtime")); //Setting permissions if (!$runningOnWindows) { chmod(pth($root . "frontend/runtime"), 02775); //permissions with setguid chmod(pth($root . "console/runtime"), 02775); chmod(pth($root . "backend/runtime"), 02775); chmod(pth($root . "frontend/www/assets"), 02775); chmod(pth($root . "backend/www/assets"), 02775); } //applying migrations //adding in ability to specify to not migrate even when not in local environment. Needed for our newclient script if ($envType != 'private' && !in_array('no-migrate', $argv) || in_array('migrate', $argv)) { runCommand(getPhpPath() . ' ' . $root . "yiic migrate --interactive=0"); if (in_array($envType, array('private', 'int', 'qa'))) { runCommand(getPhpPath() . ' ' . $root . "yiic migrate --interactive=0 --connectionID=testdb"); } } echo "Done.\n";