I'm getting two PHP notices when I go to the status report page (/admin/reports/status) on sites using Lightning for the install profile:

Notice: Undefined index: name in system_requirements() (line 46 of core/modules/system/system.install).
system_requirements('runtime')
call_user_func_array('system_requirements', Array) (Line: 402)
Drupal\Core\Extension\ModuleHandler->invokeAll('requirements', Array) (Line: 112)
...
Notice: Undefined index: version in system_requirements() (line 48 of core/modules/system/system.install).
system_requirements('runtime')
call_user_func_array('system_requirements', Array) (Line: 402)
Drupal\Core\Extension\ModuleHandler->invokeAll('requirements', Array) (Line: 112)
...

It looks like the problem is that system_get_info() is looking for a module name and version to put in the "Installation profile" display (it currently reads as (lightning-)).

Currently the profile has the following inside lightning.info.yml:

name: Lightning
type: profile
description: 'A fast and feature-rich Drupal distribution.'
core: 8.x
distribution:
  name: Lightning

Is there a way to get system_get_info to be happy with the install profile?

Possibly related, but old: #1810258: PHP notices thrown in interactive installer, #1810258: PHP notices thrown in interactive installer.

Comments

geerlingguy created an issue. See original summary.

balsama’s picture

Are you actually running Lightning as your install profile? Specifically, I don't understand why the value for name is unset. The value for name _is_ set when I run system_get_info('module', 'lightning');

Interestingly though, the value for version is not. Drupal.org's packaging script adds that value to lightning's info file when it creates the tarball. But we don't use the tarball - and, indeed, don't even use Drupal.org to download lightning at all, because its endpoints don't process dependencies for distributions. So the `version` value is missing from the lightning.info.yml file. (Along with core, project, and datestamp)

The fix for that problem is to add the version key and value to to the lightning.info.yml file. But I'm hesitant to commit that change because I'm not sure what that would mean for the D.O packaging script without testing it.

Either way, the missing value for `version` doesn't throw a notice for me which leads me to believe you have a different problem. (Although the version is missing from the report just like you reported so we should fix that. I.e. lightning-)

geerlingguy’s picture

Are you actually running Lightning as your install profile?

On this project, we actually started the project on the minimal profile, then 'adopted' the lightning profile (by adding it to the codebase then setting it in settings.php like below):

$settings['install_profile'] = 'lightning';

In my digging, I can't see any other way of switching install profiles in D8—in D7 there was a variable to switch/set, but in D8, I don't see anything in key_value or elsewhere that sets the install profile :/

If I run system_get_info('module', 'lightning');, I get:

Array
(
)

On a separate site I set up via BLT's defaults using Lightning as the install profile from the start, I get information for the profile (e.g. themes, an empty version, name, etc.) when I check that function's output. So there must be something telling Drupal which active profile to use :/

geerlingguy’s picture

If I run drush ev "print_r(\Drupal\Core\Site\Settings::get('install_profile'));", it returns lightning... but I can't find any other place where the install profile would be defined :/

naveenvalecha’s picture

The install profile is saved in the key_value. I used the following steps while switching from custom profile to lightning

naveenvalecha’s picture

I have also checked on my personal blog where I used the lightning from start and not switched from any version. I'm also getting the similar issue.

Cause of this issue:
1) After upgrading the lightning from 1.14 to 2.01 the information added by drupal.org packaging script is not in the lightning.info.yml file.See the information below.
2) Also this information is not in .info.yml file for lightning modules.

# Information added by Drupal.org packaging script on 2016-12-16
version: '8.x-2.01'
core: '8.x'
project: 'lightning'
datestamp: 1481918335 

@Jeff,
Could you check are you getting this due to similar cause ? if yes then could you update the issue title and summary accordingly

// Naveen

naveenvalecha’s picture

Priority: Normal » Minor

Steps to Reproduce:

  1. Setup a new project with these instructions composer create-project acquia/lightning-project:^8.1.0 MYPROJECT --no-interaction
  2. Check the lightning.info.yml and .info.yml files of lightning_features

Steps to fix:

  1. Add version & required keys to the lightning.info.yml file & .info.yml files of lightning_features

Reason for issue:
After move of lightning from packagist facade from packagist.org i.e from drupal/lightning to acquia/lightning. The packagist.org is not adding the information that drupal.org packagist were adding.

Few Notes/observations:
1) We have to make sure to add the proper keys so that Update Manager would also work fine.

Bumping its priority to minor as there's not any breakage of functionality.Feel free to change it.

// Naveen

geerlingguy’s picture

Before: If I run drush @local ev "print_r(system_get_info('module', 'lightning'));", I get:

Array
(
)

After: I ran drush @site sqlq "INSERT INTO key_value (collection, name, value) VALUES ('system.schema','lightning','i:8004;');", and then drush @local ev "print_r(system_get_info('module', 'lightning'));" again (as suggested in @naveenvalecha's blog post), and still get the empty array.

I did notice the profile was missing from the system.schema key_value collection, so maybe it's a bug in an update somewhere causing this conversion to not happen? (I did switch from Lightning 8.x-1.06 to 8.x-2.01).

I also noticed some values for system.schema are strings, others integers (ugh, PHP typing)—but that's a whole different core issue.

phenaproxima’s picture

Status: Active » Fixed

As of this commit, all info files within Lightning have a version string, which should fix this issue forever. I have confirmed under manual testing that the status report now displays "lightning-8.x-2.01".

phenaproxima’s picture

Status: Fixed » Closed (fixed)