getProjectName example



      // Skip if it's a hidden project and the project is a test project. Tests       // should use hook_system_info_alter() to test ProjectInfo's       // functionality.       if (!empty($file->info['hidden']) && isset($file->info['package']) && $file->info['package'] == 'Testing') {
        continue;
      }

      // If the .info.yml doesn't define the 'project', try to figure it out.       if (!isset($file->info['project'])) {
        $file->info['project'] = $this->getProjectName($file);
      }

      // If we still don't know the 'project', give up.       if (empty($file->info['project'])) {
        continue;
      }

      // If we don't already know it, grab the change time on the .info.yml file       // itself. Note: we need to use the ctime, not the mtime (modification       // time) since many (all?) tar implementations will go out of their way to       // set the mtime on the files it creates to the timestamps recorded in the

  public function __construct($source$root) {
    $this->source = $source;
    $this->root = $root;
    $this->name = self::getProjectName($source);
    $this->title = self::getProjectTitle($source);
  }

  /** * Returns an Updater of the appropriate type depending on the source. * * If a directory is provided which contains a module, will return a * ModuleUpdater. * * @param string $source * Directory of a Drupal project. * @param string $root * The root directory under which the project will be copied to if it's a * new project. Usually this is the app root (the directory in which the * Drupal site is installed). * * @return \Drupal\Core\Updater\Updater * A new Drupal\Core\Updater\Updater object. * * @throws \Drupal\Core\Updater\UpdaterException */

  protected function getMatchingExtensionInfo(SecurityAdvisory $sa): ?array {
    if (!isset($this->extensionLists[$sa->getProjectType()])) {
      return NULL;
    }
    $project_info = new ProjectInfo();
    // The project name on the security advisory will not always match the     // machine name for the extension, so we need to search through all     // extensions of the expected type to find the matching project.     foreach ($this->extensionLists[$sa->getProjectType()]->getList() as $extension) {
      if ($project_info->getProjectName($extension) === $sa->getProject()) {
        return $extension->info;
      }
    }
    return NULL;
  }

  /** * Gets the existing project version. * * @param \Drupal\system\SecurityAdvisories\SecurityAdvisory $sa * The security advisory. * * @return string|null * The project version, or NULL if the project does not exist on * the site. */
Home | Imprint | This part of the site doesn't use cookies.