19 declare(strict_types=1);
    31         return 'Migration of style images to the resource storage service.';
    54         $r = $this->helper->getDatabase()->query(
    55             "SELECT id FROM style_data WHERE rid IS NULL OR rid = '' LIMIT 1;"    58         $d = $this->helper->getDatabase()->fetchObject(
$r);
    59         $object_id = (
int) (
$d->id ?? null);
    61         $resource_owner_id = (
int) (
$d->owner_id ?? 6); 
    65         $rid = $this->helper->moveDirectoryToContainerResource(
    71             $this->helper->getDatabase()->update(
    73                 [
'rid' => [
'text', $rid->serialize()]],
    74                 [
'id' => [
'integer', $object_id],]
    91         $files = array_diff(scandir($path), [
'.', 
'..']);
    92         foreach ($files as $file) {
    93             (is_dir(
"$path/$file")) ? $this->
recursiveRmDir(
"$path/$file") : unlink(
"$path/$file");
    99         $r = $this->helper->getDatabase()->query(
   100             "SELECT COUNT(id) AS amount FROM style_data WHERE rid IS NULL OR rid = ''"   102         $d = $this->helper->getDatabase()->fetchObject(
$r) ?? 
new stdClass();
   104         return (
int) (
$d->amount ?? 0);
   114         return static function (
string $file_name) use ($pattern): 
string {
   115             if (preg_match($pattern, $file_name, $matches)) {
   116                 return $matches[1] ?? $file_name;
   124         return static function (
string $file_name): 
string {
   125             return md5($file_name);
 
A migration is a potentially long lasting operation that can be broken into discrete steps...
 
An environment holds resources to be used in the setup process. 
 
static getPreconditions()