postInstall example

$this->customEntityLifecycleService->updatePlugin($plugin->getId()$plugin->getPath() ?? '');

            $this->runMigrations($installContext);

            $installDate = new \DateTime();
            $pluginData['installedAt'] = $installDate->format(Defaults::STORAGE_DATE_TIME_FORMAT);
            $plugin->setInstalledAt($installDate);

            $this->updatePluginData($pluginData$shopwareContext);

            $pluginBaseClass->postInstall($installContext);

            $this->eventDispatcher->dispatch(new PluginPostInstallEvent($plugin$installContext));
        } catch (\Throwable $e) {
            if ($didRunComposerRequire && $plugin->getComposerName()) {
                $this->executor->remove($plugin->getComposerName()$plugin->getName());
            }

            throw $e;
        }

        return $installContext;
    }
// Make sure the installation parent directory exists and is writable.       $this->prepareInstallDirectory($filetransfer$args['install_dir']);

      // Copy the directory in place.       $filetransfer->copyDirectory($this->source, $args['install_dir']);

      // Make sure what we just installed is readable by the web server.       $this->makeWorldReadable($filetransfer$args['install_dir'] . '/' . $this->name);

      // Potentially enable something?       // @todo Decide if we want to implement this.       $this->postInstall();
      // For now, just return a list of links of things to do.       return $this->postInstallTasks();
    }
    catch (FileTransferException $e) {
      throw new UpdaterFileTransferException("File Transfer failed, reason: '" . strtr($e->getMessage()$e->arguments) . "'");
    }
  }

  /** * Makes sure the installation parent directory exists and is writable. * * @param \Drupal\Core\FileTransfer\FileTransfer $filetransfer * Object which is a child of FileTransfer. * @param string $directory * The installation directory to prepare. * * @throws \Drupal\Core\Updater\UpdaterException */
Home | Imprint | This part of the site doesn't use cookies.