/** * Tests provision request */ public function testStoragePaths() { $_instance = $this->_findInstance('dfe-test-case'); $_instanceId = $_instance->instance_id_text; $_private = config('provisioning.private-path-name', ConsoleDefaults::PRIVATE_PATH_NAME); $_snapshot = config('provisioning.snapshot-path-name', ConsoleDefaults::SNAPSHOT_PATH_NAME); $this->assertEquals(static::STORAGE_ROOT . DIRECTORY_SEPARATOR . $_instanceId, InstanceStorage::getStoragePath($_instance)); $this->assertEquals(static::STORAGE_ROOT . DIRECTORY_SEPARATOR . $_instanceId . DIRECTORY_SEPARATOR . $_private, InstanceStorage::getPrivatePath($_instance)); $this->assertEquals(static::STORAGE_ROOT . DIRECTORY_SEPARATOR . $_private, InstanceStorage::getOwnerPrivatePath($_instance)); $this->assertEquals(static::STORAGE_ROOT . DIRECTORY_SEPARATOR . $_private . DIRECTORY_SEPARATOR . $_snapshot, InstanceStorage::getSnapshotPath($_instance)); }
/** * Create capsule symlinks * * @param string $source The instance source * @param string $destination The destination * @param string $storage The storage path to link * * @return bool */ protected function createCapsuleLinks($source, $destination, $storage) { $_links = config('capsule.instance.symlinks', []); // Create symlinks foreach ($_links as $_link) { $_linkTarget = 'storage' == $_link ? Disk::path([$storage, InstanceStorage::getStoragePath($this->instance)]) : Disk::path([$source, $_link]); $_linkName = Disk::path([$destination, $_link]); if (!file_exists($_linkName) || $_linkTarget != readlink($_linkName)) { if (false === symlink($_linkTarget, $_linkName)) { $this->error('Error symlinking target "' . $_linkTarget . '"'); return false; } } } // Create the bootstrap[/cache] directory $_sourcePath = Disk::path([$source, 'bootstrap']); $_bootstrapPath = Disk::path([$destination, 'bootstrap'], true); // Ensure the cache directory is there as well... Disk::path([$_bootstrapPath, 'cache'], true); $_files = Disk::glob($_sourcePath . DIRECTORY_SEPARATOR . '*', GlobFlags::GLOB_NODIR | GlobFlags::GLOB_NODOTS); foreach ($_files as $_file) { if (false === copy($_sourcePath . DIRECTORY_SEPARATOR . $_file, $_bootstrapPath . DIRECTORY_SEPARATOR . $_file)) { $this->error('Failure copying bootstrap file "' . $_file . '" to "' . $_bootstrapPath . '"'); return false; } } return true; }
/** * @param string|null $append * @param bool $create * * @return string */ public function getStoragePath($append = null, $create = false) { return InstanceStorage::getStoragePath($this, $append, $create); }