code: def restore_extension_config(config):
      print("* Restoring extension state...")
  
      if "extensions" not in config:
          print("Error: No extension data saved to config")
          return
  
      ext_config = config["extensions"]
  
      results = []
      disabled = []
  
      for ext in tqdm.tqdm(extensions.extensions):
          if ext.is_builtin:
              continue
  
          ext.read_info_from_repo()
          current_commit = ext.commit_hash
  
          if ext.name not in ext_config:
              ext.disabled = True
              disabled.append(ext.name)
              results.append(
                  (
                      ext,
                      current_commit[:8],
                      False,
                      "Saved extension state not found in config, marking as disabled",
                  )
              )
              continue
  
          entry = ext_config[ext.name]
  
          if "commit_hash" in entry and entry["commit_hash"]:
              try:
                  ext.fetch_and_reset_hard(entry["commit_hash"])
                  ext.read_info_from_repo()
                  if current_commit != entry["commit_hash"]:
                      results.append(
                          (
                              ext,
                              current_commit[:8],
                              True,
                              entry["commit_hash"][:8],
                          )
                      )
              except Exception as ex:
                  results.append((ext, current_commit[:8], False, ex))
          else:
              results.append(
                  (
                      ext,
                      current_commit[:8],
                      False,
                      "No commit hash found in config",
                  )
              )
  
          if not entry.get("enabled", False):
              ext.disabled = True
              disabled.append(ext.name)
          else:
              ext.disabled = False
  
      shared.opts.disabled_extensions = disabled
      shared.opts.save(shared.config_filename)
  
      print("* Finished restoring extensions. Results:")
      for ext, prev_commit, success, result in results:
          if success:
              print(f"  + {ext.name}: {prev_commit} -> {result}")
          else:
              print(f"  ! {ext.name}: FAILURE ({result})")
  
file_path: stable-diffusion-webui/modules/config_states.py
imports: import os
  import json
  import tqdm
  from datetime import datetime
  import git
  from modules import shared, extensions, errors
  from modules.paths_internal import script_path, config_states_dir
label_desc: Use image node_id 6 for calling a global function with example usage: restore_extension_config(config) without return types