When I run versioncontrol_git_update_6207() on my d.o testing site, I get this exception:

Exception: Plugin 'reposync' of type 'reposync' does not contain a valid class name in handler slot 'worker' in VersioncontrolRepository->getPluginClass() (line 528 of /var/www/dev/vcs-git-drupal.redesign.devdrupal.org/htdocs/sites/all/modules/versioncontrol/includes/VersioncontrolRepository.php).

The function with some debugging info:

  protected function getPluginClass($plugin_slot, $plugin_type, $class_type) {
    // plugin slot: reposync
    // plugin type: reposync
    // class type: worker

    $plugin = $this->getPlugin($plugin_slot, $plugin_type);
    /*
Array
(
    [git_default] => Array
        (
            [title] => Default Git history synchronizer
            [worker] => Array
                (
                    [class] => VersioncontrolGitRepositoryHistorySynchronizerDefault
                )

            [module] => versioncontrol_git
            [name] => git_default
            [path] => sites/all/modules/versioncontrol_git/includes/plugins/reposync
            [file] => git_default.inc
            [plugin module] => versioncontrol
            [plugin type] => reposync
        )

)
*/

    $class_name = ctools_plugin_get_class($plugin, $class_type); // <-- $class_name was empty
    if (!class_exists($class_name)) {
      throw new Exception("Plugin '$plugin_slot' of type '$plugin_type' does not contain a valid class name in handler slot '$class_type'", E_WARNING);
      return FALSE;
    }

    $plugin_object = new $class_name();
    $this->getBackend()->verifyPluginInterface($this, $plugin_slot, $plugin_object);
    return $plugin_object;
  }

Any idea what's wrong here or how a valid reposync plugin is supposed to get in?

Comments

Niklas Fiekas’s picture

Project: Version Control API -- Git backend » Version Control API
Issue summary: View changes

fix markup

Niklas Fiekas’s picture

Issue summary: View changes

add space before protected

Niklas Fiekas’s picture

Project: Version Control API » Version Control API -- Git backend
Issue tags: +blocking versioncontrol 6.x-2.x deployment

Adding to my list.

Niklas Fiekas’s picture

I see the problem now:

  /**
   * Get a ctools plugin based on plugin slot passed.
   */
  protected function getPlugin($plugin_slot, $plugin_type) {
    ctools_include('plugins');

    if (empty($this->plugins[$plugin_slot])) {
      // handle special case for two slots using the same plugin type
      if ($plugin_slot == 'committer_mapper' || $plugin_slot == 'author_mapper') {
        $variable = 'versioncontrol_repository_plugin_default_user_mapping_methods';
      }
      else {
        $variable = 'versioncontrol_repository_plugin_default_' . $plugin_slot;
      }
      $plugin_name = variable_get($variable, ''); // <-- Because the variable is not set, $plugin_name == '' after this !!!
    }
    else {
      $plugin_name = $this->plugins[$plugin_slot];
    }

    // !!! Here we call this function with an empty third paramater.
    // That means a list of plugins instead of a single plugin is returned.
    $plugin = ctools_get_plugins('versioncontrol', $plugin_type, $plugin_name);
    if (!is_array($plugin)) {
      throw new Exception("Attempted to get a plugin of type '$plugin_type' named '$plugin_name', but no such plugin could be found.", E_WARNING);
      return FALSE;
    }

    return $plugin;
  }

Solutions:

  • Set the versioncontrol_repository_plugin_default_reposync variable in the update function?
  • Default to the first returned plugin, if $plugin_name is empty?
Niklas Fiekas’s picture

Project: Version Control API -- Git backend » Version Control API
Component: Code » API module

Moving to Versioncontrol API.

Niklas Fiekas’s picture

Commushed (nice term, taking that from now on :D) http://drupalcode.org/project/versioncontrol.git/commitdiff/34faf9e.

sdboyer’s picture

Status: Active » Fixed
Niklas Fiekas’s picture

:)

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

Anonymous’s picture

Issue summary: View changes

additional debugging info

  • Commit 34faf9e on 6.x-2.x, repository-families, drush-vc-sync-unlock by Niklas Fiekas:
    Issue #1335742 by Niklas Fiekas: Fixed Exception: Plugin 'reposync' of...

  • Commit 34faf9e on 6.x-2.x, repository-families by Niklas Fiekas:
    Issue #1335742 by Niklas Fiekas: Fixed Exception: Plugin 'reposync' of...