That variable is not set and the update fails either because of this or some other reason.

Notice: Undefined variable: optional_install_path in varbase_core_optional_update_8701() (line 360 of modules/contrib/varbase_core/varbase_core.install).
varbase_core_optional_update_8701() (Line: 70)
varbase_update_helper_checklistapi_form_submit(Array, Object)
call_user_func_array('varbase_update_helper_checklistapi_form_submit', Array) (Line: 111)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 51)
Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 590)
Drupal\Core\Form\FormBuilder->processForm('checklistapi_checklist_form', Array, Object) (Line: 319)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 93)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 582)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 151)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 67)
Drupal\simple_oauth\HttpMiddleware\BasicAuthSwap->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 693)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Comments

durum created an issue. See original summary.

durum’s picture

Issue summary: View changes
Rajab Natshah’s picture

Thank you Durum for reporting,

Have you had a run for "drush updb" or "/update.php" before you try to do the optional updates?

  • Step #1 : Normal forced Drupal updates first
  • Step #2 : Optional Drupal updates from the UI or the command
  • Step #3 : If you like to force any optional Drupal updates from the UI or the command

Have you had a look at Handling Configuration Updates ?

Please, have a backup for the site, and do the test update on a local development environment.
It's very important to restore your database if you are testing the update for number of times.
And not to run the optional update twice on the same database

durum’s picture

Thank you for the answer.

Have you had a run for "drush updb" or "/update.php" before you try to do the optional updates?

Yes, several times. Just to be sure it tells me that there are no pending updates.

Step #1 : ...

Read the documentation several times. Went through the code before running the updates. Also before doing the update, I saw that $optional_install_path wasn't declared. I thought "maybe it is something with php 7 and Drupal 8. And maybe it is declared somewhere else as a constant that I can't be sure of right now". Then I run the update. Snippet below. $optional_install_path not declared.

/**
 * Add [Gallery] media type.
 */
function varbase_core_optional_update_8701() {
  /** @var \Drupal\update_helper\Updater $updateHelper */
  $updateHelper = \Drupal::service('update_helper.updater');

  // Execute configuration update definitions with logging of success.
  $updateHelper->executeUpdate('varbase_core', 'varbase_core_optional_update_8701');
  
  $module_path = Drupal::service('module_handler')->getModule('varbase_media')->getPath();

  // Load Media types icons for the media libraray table view page.
  $source = $module_path . '/images/icons';
  $destination = \Drupal::config('media.settings')->get('icon_base_uri');
  file_prepare_directory($destination, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS);

  $files = file_scan_directory($source, '/.*\.(svg|png|jpg|jpeg|gif)$/');
  foreach ($files as $file) {
    if (!file_exists($destination . DIRECTORY_SEPARATOR . $file->filename)) {
      file_unmanaged_copy($file->uri, $destination, FILE_EXISTS_ERROR);
    }
  }

  // Configure Entity Embed buttons.
  $embed_button_config_files = file_scan_directory($optional_install_path, '/^embed.button.*\\.(yml)$/i');
  if (isset($embed_button_config_files)
    && is_array($embed_button_config_files)) {
    foreach ($embed_button_config_files as $embed_button_config_file) {
Please, have a backup for the site, and do the test update on a local development environment.

I am on local dev. Not staged yet.

And not to run the optional update twice on the same database

I did run first time and got the folowing output. Then I run it with --force and got the second following output.

$ drush varbase-up varbase_core varbase_core_optional_update_8701
 [ok] Configuration core.entity_form_mode.media.simplified has been successfully imported.
 [ok] Configuration core.entity_form_mode.media.editor has been successfully imported.
 [ok] Configuration media.type.gallery has been successfully imported.
 [ok] Configuration field.storage.media.field_media_gallery has been successfully imported.
 [ok] Configuration field.field.media.gallery.field_media_gallery has been successfully imported.
 [ok] Configuration field.field.media.gallery.field_media_in_library has been successfully imported.
 [ok] Configuration core.entity_view_display.media.gallery.browser_teaser has been successfully imported.
 [ok] Configuration core.entity_view_display.media.gallery.default has been successfully imported.
 [ok] Configuration core.entity_view_display.media.gallery.field_preview has been successfully imported.
 [ok] Configuration core.entity_view_display.media.gallery.full has been successfully imported.
 [ok] Configuration core.entity_view_display.media.gallery.media_library has been successfully imported.
 [ok] Configuration core.entity_form_display.media.gallery.editor has been successfully imported.
 [ok] Configuration core.entity_form_display.media.gallery.default has been successfully imported.
 [ok] Configuration core.entity_form_display.media.gallery.entity_browser has been successfully imported.
 [ok] Configuration core.entity_form_display.media.gallery.media_library has been successfully imported.
 [ok] Configuration core.entity_form_display.media.gallery.simplified has been successfully imported.
 [ok] Configuration slick.optionset.varbase_gallery has been successfully imported.
 [ok] Configuration embed.button.gallery has been successfully imported.
 [ok] Configuration core.entity_form_display.media.audio.simplified has been successfully imported.
 [ok] Configuration core.entity_form_display.media.file.simplified has been successfully imported.
 [ok] Configuration core.entity_form_display.media.image.simplified has been successfully imported.
 [ok] Configuration core.entity_form_display.media.remote_video.simplified has been successfully imported.
 [ok] Configuration core.entity_form_display.media.video.simplified has been successfully imported.
 [ok] Configuration core.entity_form_display.media.audio.editor has been successfully imported.
 [ok] Configuration core.entity_form_display.media.file.editor has been successfully imported.
 [ok] Configuration core.entity_form_display.media.image.editor has been successfully imported.
 [ok] Configuration core.entity_form_display.media.remote_video.editor has been successfully imported.
 [ok] Configuration core.entity_form_display.media.video.editor has been successfully imported.
 [ok] Configuration entity_browser.browser.editor_multiple_image_browser has been successfully imported.
 [ok] Configuration entity_browser.browser.editor_multiple_media_browser has been successfully imported.
 [ok] Configuration entity_browser.browser.multiple_image_browser has been successfully imported.
 [ok] Configuration entity_browser.browser.multiple_media_browser has been successfully imported.
 [warning] Importing of entity_browser_enhanced.widgets.editor_media_browser config will be skipped, because configuration already exists.
 [ok] Configuration entity_browser_enhanced.widgets.editor_multiple_image_browser has been successfully imported.
 [ok] Configuration entity_browser_enhanced.widgets.editor_multiple_media_browser has been successfully imported.
 [warning] Importing of entity_browser_enhanced.widgets.image_browser config will be skipped, because configuration already exists.
 [warning] Importing of entity_browser_enhanced.widgets.media_browser config will be skipped, because configuration already exists.
 [ok] Configuration entity_browser_enhanced.widgets.multiple_image_browser has been successfully imported.
 [ok] Configuration entity_browser_enhanced.widgets.multiple_media_browser has been successfully imported.
 [warning] Importing of entity_browser_enhanced.widgets.video_browser config will be skipped, because configuration already exists.
 [ok] Configuration views.view.media_browsers has been successfully updated.
 [ok] Configuration views.view.media_library has been successfully updated.
 [ok] Configuration core.entity_form_display.media.audio.media_library has been successfully updated.
 [ok] Configuration core.entity_form_display.media.file.media_library has been successfully updated.
 [ok] Configuration core.entity_form_display.media.image.media_library has been successfully updated.
 [ok] Configuration core.entity_form_display.media.remote_video.media_library has been successfully updated.
 [ok] Configuration core.entity_form_display.media.video.media_library has been successfully updated.
 [ok] Configuration core.entity_view_display.media.audio.media_library has been successfully updated.
 [ok] Configuration core.entity_view_display.media.file.media_library has been successfully updated.
 [ok] Configuration core.entity_view_display.media.image.media_library has been successfully updated.
 [ok] Configuration core.entity_view_display.media.remote_video.media_library has been successfully updated.
 [ok] Configuration core.entity_view_display.media.video.media_library has been successfully updated.
 [ok] Configuration core.entity_form_display.media.audio.entity_browser has been successfully updated.
 [warning] Configuration core.entity_form_display.media.file.default is already updated.
 [ok] Configuration core.entity_form_display.media.file.entity_browser has been successfully updated.
 [ok] Configuration core.entity_form_display.media.image.entity_browser has been successfully updated.
 [ok] Configuration core.entity_form_display.media.remote_video.entity_browser has been successfully updated.
 [ok] Configuration core.entity_form_display.media.video.entity_browser has been successfully updated.
 [ok] Configuration core.entity_view_display.media.image.large has been successfully updated.
 [ok] Configuration core.entity_view_display.media.image.medium has been successfully updated.
 [ok] Configuration core.entity_view_display.media.image.original has been successfully updated.
 [ok] Configuration core.entity_view_display.media.image.small has been successfully updated.
 [ok] Configuration core.entity_view_display.media.remote_video.default has been successfully updated.
 [ok] Configuration core.entity_view_display.media.remote_video.field_preview has been successfully updated.
 [ok] Configuration core.entity_view_display.media.remote_video.full has been successfully updated.
 [ok] Configuration core.entity_view_display.media.remote_video.large has been successfully updated.
 [ok] Configuration core.entity_view_display.media.remote_video.medium has been successfully updated.
 [ok] Configuration core.entity_view_display.media.remote_video.original has been successfully updated.
 [ok] Configuration core.entity_view_display.media.remote_video.small has been successfully updated.
 [ok] Configuration core.entity_view_display.media.video.default has been successfully updated.
 [ok] Configuration core.entity_view_display.media.video.field_preview has been successfully updated.
 [ok] Configuration core.entity_view_display.media.video.full has been successfully updated.
 [ok] Configuration core.entity_view_display.media.video.large has been successfully updated.
 [ok] Configuration core.entity_view_display.media.video.medium has been successfully updated.
 [ok] Configuration core.entity_view_display.media.video.original has been successfully updated.
 [ok] Configuration core.entity_view_display.media.video.small has been successfully updated.
 [ok] Configuration field.field.media.audio.field_media_in_library has been successfully updated.
 [ok] Configuration field.field.media.file.field_media_in_library has been successfully updated.
 [ok] Configuration field.field.media.image.field_media_in_library has been successfully updated.
 [ok] Configuration field.field.media.remote_video.field_media_in_library has been successfully updated.
 [ok] Configuration field.field.media.video.field_media_in_library has been successfully updated.
 [ok] Configuration embed.button.media has been successfully updated.
 [ok] Configuration entity_browser.browser.image_browser has been successfully updated.
 [ok] Configuration entity_browser.browser.video_browser has been successfully updated.
 [warning] Configuration entity_browser.browser.media_browser is already updated.
 [ok] Configuration entity_browser.browser.editor_media_browser has been successfully updated.
 [warning] Configuration editor.editor.full_html is already updated.
 [ok] Configuration filter.format.basic_html has been successfully updated.
 [ok] Configuration filter.format.full_html has been successfully updated.

### Here I run the 8702 and 8703. Similar outputs. Then I forced 8703;

$ drush varbase-up --force varbase_core varbase_core_optional_update_8701
 [warning] Importing of core.entity_form_mode.media.simplified config will be skipped, because configuration already exists.
 [warning] Importing of core.entity_form_mode.media.editor config will be skipped, because configuration already exists.
 [warning] Importing of media.type.gallery config will be skipped, because configuration already exists.
 [warning] Importing of field.storage.media.field_media_gallery config will be skipped, because configuration already exists.
 [warning] Importing of field.field.media.gallery.field_media_gallery config will be skipped, because configuration already exists.
 [warning] Importing of field.field.media.gallery.field_media_in_library config will be skipped, because configuration already exists.
 [warning] Importing of core.entity_view_display.media.gallery.browser_teaser config will be skipped, because configuration already exists.
 [warning] Importing of core.entity_view_display.media.gallery.default config will be skipped, because configuration already exists.
 [warning] Importing of core.entity_view_display.media.gallery.field_preview config will be skipped, because configuration already exists.
 [warning] Importing of core.entity_view_display.media.gallery.full config will be skipped, because configuration already exists.
 [warning] Importing of core.entity_view_display.media.gallery.media_library config will be skipped, because configuration already exists.
 [warning] Importing of core.entity_form_display.media.gallery.editor config will be skipped, because configuration already exists.
 [warning] Importing of core.entity_form_display.media.gallery.default config will be skipped, because configuration already exists.
 [warning] Importing of core.entity_form_display.media.gallery.entity_browser config will be skipped, because configuration already exists.
 [warning] Importing of core.entity_form_display.media.gallery.media_library config will be skipped, because configuration already exists.
 [warning] Importing of core.entity_form_display.media.gallery.simplified config will be skipped, because configuration already exists.
 [warning] Importing of slick.optionset.varbase_gallery config will be skipped, because configuration already exists.
 [warning] Importing of embed.button.gallery config will be skipped, because configuration already exists.
 [warning] Importing of core.entity_form_display.media.audio.simplified config will be skipped, because configuration already exists.
 [warning] Importing of core.entity_form_display.media.file.simplified config will be skipped, because configuration already exists.
 [warning] Importing of core.entity_form_display.media.image.simplified config will be skipped, because configuration already exists.
 [warning] Importing of core.entity_form_display.media.remote_video.simplified config will be skipped, because configuration already exists.
 [warning] Importing of core.entity_form_display.media.video.simplified config will be skipped, because configuration already exists.
 [warning] Importing of core.entity_form_display.media.audio.editor config will be skipped, because configuration already exists.
 [warning] Importing of core.entity_form_display.media.file.editor config will be skipped, because configuration already exists.
 [warning] Importing of core.entity_form_display.media.image.editor config will be skipped, because configuration already exists.
 [warning] Importing of core.entity_form_display.media.remote_video.editor config will be skipped, because configuration already exists.
 [warning] Importing of core.entity_form_display.media.video.editor config will be skipped, because configuration already exists.
 [warning] Importing of entity_browser.browser.editor_multiple_image_browser config will be skipped, because configuration already exists.
 [warning] Importing of entity_browser.browser.editor_multiple_media_browser config will be skipped, because configuration already exists.
 [warning] Importing of entity_browser.browser.multiple_image_browser config will be skipped, because configuration already exists.
 [warning] Importing of entity_browser.browser.multiple_media_browser config will be skipped, because configuration already exists.
 [warning] Importing of entity_browser_enhanced.widgets.editor_media_browser config will be skipped, because configuration already exists.
 [warning] Importing of entity_browser_enhanced.widgets.editor_multiple_image_browser config will be skipped, because configuration already exists.
 [warning] Importing of entity_browser_enhanced.widgets.editor_multiple_media_browser config will be skipped, because configuration already exists.
 [warning] Importing of entity_browser_enhanced.widgets.image_browser config will be skipped, because configuration already exists.
 [warning] Importing of entity_browser_enhanced.widgets.media_browser config will be skipped, because configuration already exists.
 [warning] Importing of entity_browser_enhanced.widgets.multiple_image_browser config will be skipped, because configuration already exists.
 [warning] Importing of entity_browser_enhanced.widgets.multiple_media_browser config will be skipped, because configuration already exists.
 [warning] Importing of entity_browser_enhanced.widgets.video_browser config will be skipped, because configuration already exists.
 [warning] Expected current configuration for views.view.media_browsers is not matching. Unable to apply new config.
 [warning] Expected current configuration for views.view.media_library is not matching. Unable to apply new config.
 [warning] Configuration core.entity_form_display.media.audio.media_library is already updated.
 [warning] Configuration core.entity_form_display.media.file.media_library is already updated.
 [warning] Configuration core.entity_form_display.media.image.media_library is already updated.
 [warning] Configuration core.entity_form_display.media.remote_video.media_library is already updated.
 [warning] Configuration core.entity_form_display.media.video.media_library is already updated.
 [warning] Configuration core.entity_view_display.media.audio.media_library is already updated.
 [warning] Configuration core.entity_view_display.media.file.media_library is already updated.
 [warning] Configuration core.entity_view_display.media.image.media_library is already updated.
 [warning] Configuration core.entity_view_display.media.remote_video.media_library is already updated.
 [warning] Configuration core.entity_view_display.media.video.media_library is already updated.
 [warning] Configuration core.entity_form_display.media.audio.entity_browser is already updated.
 [warning] Configuration core.entity_form_display.media.file.default is already updated.
 [warning] Configuration core.entity_form_display.media.file.entity_browser is already updated.
 [warning] Configuration core.entity_form_display.media.image.entity_browser is already updated.
 [warning] Configuration core.entity_form_display.media.remote_video.entity_browser is already updated.
 [warning] Configuration core.entity_form_display.media.video.entity_browser is already updated.
 [warning] Configuration core.entity_view_display.media.image.large is already updated.
 [warning] Configuration core.entity_view_display.media.image.medium is already updated.
 [warning] Configuration core.entity_view_display.media.image.original is already updated.
 [warning] Configuration core.entity_view_display.media.image.small is already updated.
 [warning] Configuration core.entity_view_display.media.remote_video.default is already updated.
 [warning] Configuration core.entity_view_display.media.remote_video.field_preview is already updated.
 [warning] Configuration core.entity_view_display.media.remote_video.full is already updated.
 [warning] Configuration core.entity_view_display.media.remote_video.large is already updated.
 [warning] Configuration core.entity_view_display.media.remote_video.medium is already updated.
 [warning] Configuration core.entity_view_display.media.remote_video.original is already updated.
 [warning] Configuration core.entity_view_display.media.remote_video.small is already updated.
 [warning] Configuration core.entity_view_display.media.video.default is already updated.
 [warning] Configuration core.entity_view_display.media.video.field_preview is already updated.
 [warning] Configuration core.entity_view_display.media.video.full is already updated.
 [warning] Configuration core.entity_view_display.media.video.large is already updated.
 [warning] Configuration core.entity_view_display.media.video.medium is already updated.
 [warning] Configuration core.entity_view_display.media.video.original is already updated.
 [warning] Configuration core.entity_view_display.media.video.small is already updated.
 [ok] Configuration field.field.media.audio.field_media_in_library has been successfully updated.
 [ok] Configuration field.field.media.file.field_media_in_library has been successfully updated.
 [ok] Configuration field.field.media.image.field_media_in_library has been successfully updated.
 [ok] Configuration field.field.media.remote_video.field_media_in_library has been successfully updated.
 [ok] Configuration field.field.media.video.field_media_in_library has been successfully updated.
 [warning] Configuration embed.button.media is already updated.
 [warning] Configuration entity_browser.browser.image_browser is already updated.
 [warning] Configuration entity_browser.browser.video_browser is already updated.
 [warning] Configuration entity_browser.browser.media_browser is already updated.
 [warning] Configuration entity_browser.browser.editor_media_browser is already updated.
 [warning] Expected current configuration for editor.editor.full_html is not matching. Unable to apply new config.
 [warning] Configuration filter.format.basic_html is already updated.
 [warning] Configuration filter.format.full_html is already updated.

These are not related to the OP but providing info since you asked.

Thanks :)

Rajab Natshah’s picture

Project: Varbase - The Ultimate Drupal CMS Starter Kit (Bootstrap Ready) » Varbase Core

Thank you Durum again for following more on the issue :)

I confirm the issue

Moving the issue to Varbase Core
This should be a Quick fix with a Quick fix release

Rajab Natshah’s picture

Title: Notice: Undefined variable: optional_install_path in varbase_core_optional_update_8701() (line 360 of modules/contrib/varbase_core/varbase_core.install). » Fix a Notice for Undefined variable: optional_install_path in varbase_core_optional_update_8701

  • RajabNatshah committed 8f439ec on 8.x-7.x
    Issue #3089257 by durum, RajabNatshah: Fix a Notice for Undefined...
Rajab Natshah’s picture

Assigned: Unassigned » Mohammed J. Razem
Status: Active » Needs review
Issue tags: +varbase-8.7.3
Rajab Natshah’s picture

Assigned: Mohammed J. Razem » Unassigned
Rajab Natshah’s picture

Status: Needs review » Fixed
durum’s picture

Rajab, thank you for acting on such short notice. You guys are the best!

bgprior’s picture

Just tried to update using composer to 8.x-7.4, which (AIUI) exists simply to fix this issue, and got:

drupal/varbase_update_helper 7.3.0 requires drupal/varbase_core 7.3.0 -> satisfiable by drupal/varbase_core[7.3.0] but these conflict with your requirements or minimum-stability.

bgprior’s picture

Minor version upgrade (7.4.0) of varbase_update_helper has allowed upgrade of varbase_core to 7.4 for me. Thanks.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.