Skip to content

Commit

Permalink
Merged main into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] authored Dec 19, 2022
2 parents ff1f9ec + bbb2b56 commit b829793
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions src/Factory/SeederFixtureFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use SilverStripe\AssetAdmin\Controller\AssetAdmin;
use SilverStripe\Core\Environment;
use SilverStripe\Assets\Folder;
use SilverStripe\Assets\File;
use SilverStripe\Assets\Image;
use SilverStripe\Dev\FixtureBlueprint;
use SilverStripe\Dev\FixtureFactory;
Expand Down Expand Up @@ -37,7 +38,7 @@ public function __construct($createObjectCallback = null, $seedObject = null)
public function createObject($name, $identifier, $data = null)
{
// Create a Folder for any seeder images generated
$folder = Folder::find_or_make("SeederImages");
$folder = Folder::find_or_make("SeederFiles");
//
if (!isset($this->blueprints[$name])) {
$this->blueprints[$name] = new FixtureBlueprint($name);
Expand All @@ -51,8 +52,8 @@ public function createObject($name, $identifier, $data = null)
}
$this->fixtures[$class][$identifier] = $obj->ID;

// For any images, lets store the image
if ($class == Image::class) {
// For any images and videos, store the file
if ($class == File::class || $class == Image::class) {
$contents = @file_get_contents($data['URL']);
$obj->setFromString($contents, $data['Name']);
$obj->ParentID = $folder->ID;
Expand Down Expand Up @@ -85,4 +86,4 @@ public function createObject($name, $identifier, $data = null)

return $obj;
}
}
}
2 changes: 1 addition & 1 deletion src/Tasks/SeederBuildTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,4 +138,4 @@ public function run($request)
echo 'Must run in development or test environment';
}
}
}
}

0 comments on commit b829793

Please sign in to comment.