コード例 #1
0
 /**
  * @param ProjectModel $project
  */
 protected function cleanProjectEnvironment($project)
 {
     // clean out old db if it is present
     $projectDb = MongoStore::connect($project->databaseName());
     foreach ($projectDb->listCollections() as $collectionInfo) {
         if ($collectionInfo->getName() != 'system.indexes') {
             $collection = $projectDb->selectCollection($collectionInfo->getName());
             $collection->drop();
         }
     }
     // clean up assets folder
     $folderPath = $project->getAssetsFolderPath();
     $cleanupFiles = glob($folderPath . '/*');
     foreach ($cleanupFiles as $cleanupFile) {
         @unlink($cleanupFile);
     }
     @rmdir($folderPath);
 }