{"action":"created","issue":{"url":"https://api.github.com/repos/backdrop/backdrop-issues/issues/47","labels_url":"https://api.github.com/repos/backdrop/backdrop-issues/issues/47/labels{/name}","comments_url":"https://api.github.com/repos/backdrop/backdrop-issues/issues/47/comments","events_url":"https://api.github.com/repos/backdrop/backdrop-issues/issues/47/events","html_url":"https://github.com/backdrop/backdrop-issues/issues/47","id":19344711,"number":47,"title":"Make Backdrop drush-compatible","user":{"login":"rudiedirkx","id":168024,"avatar_url":"https://avatars.githubusercontent.com/u/168024?v=3","gravatar_id":"","url":"https://api.github.com/users/rudiedirkx","html_url":"https://github.com/rudiedirkx","followers_url":"https://api.github.com/users/rudiedirkx/followers","following_url":"https://api.github.com/users/rudiedirkx/following{/other_user}","gists_url":"https://api.github.com/users/rudiedirkx/gists{/gist_id}","starred_url":"https://api.github.com/users/rudiedirkx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rudiedirkx/subscriptions","organizations_url":"https://api.github.com/users/rudiedirkx/orgs","repos_url":"https://api.github.com/users/rudiedirkx/repos","events_url":"https://api.github.com/users/rudiedirkx/events{/privacy}","received_events_url":"https://api.github.com/users/rudiedirkx/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":34,"created_at":"2013-09-11T20:29:57Z","updated_at":"2015-05-18T04:59:42Z","closed_at":null,"body":"Obviously Drush is the best.  Part of Backdrop might be drush compatible, but at least some of it's not.\r\n\r\nI suggest keeping a drush sibling compatible at all times. Shouldn't be too hard. Only small API changes for now, right?"},"comment":{"url":"https://api.github.com/repos/backdrop/backdrop-issues/issues/comments/102923175","html_url":"https://github.com/backdrop/backdrop-issues/issues/47#issuecomment-102923175","issue_url":"https://api.github.com/repos/backdrop/backdrop-issues/issues/47","id":102923175,"user":{"login":"greg-1-anderson","id":612191,"avatar_url":"https://avatars.githubusercontent.com/u/612191?v=3","gravatar_id":"","url":"https://api.github.com/users/greg-1-anderson","html_url":"https://github.com/greg-1-anderson","followers_url":"https://api.github.com/users/greg-1-anderson/followers","following_url":"https://api.github.com/users/greg-1-anderson/following{/other_user}","gists_url":"https://api.github.com/users/greg-1-anderson/gists{/gist_id}","starred_url":"https://api.github.com/users/greg-1-anderson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/greg-1-anderson/subscriptions","organizations_url":"https://api.github.com/users/greg-1-anderson/orgs","repos_url":"https://api.github.com/users/greg-1-anderson/repos","events_url":"https://api.github.com/users/greg-1-anderson/events{/privacy}","received_events_url":"https://api.github.com/users/greg-1-anderson/received_events","type":"User","site_admin":false},"created_at":"2015-05-18T04:59:42Z","updated_at":"2015-05-18T04:59:42Z","body":"I'm a little confused about the current state of your code.  Is there a repository or a PR somewhere to look at and collaborate on?\r\n\r\nI presume you have a function bootstrap_phases() somewhere that defines bootstrap_backdrop_core() and so on, in order to get as far as you currently do.\r\n\r\nDrush calls drush_sql_get_class() from a number of places; not sure where you are hitting it from, but once it gets there, it calls in to drush_get_class(), which still needs to be fixed.  What is happening right now is that drush_get_class() is using drush_drupal_major_version() to look for an appropriate variant of a class, currently Sql6, Sql7 or Sql8.  As mentioned in https://github.com/backdrop/backdrop-issues/issues/47#issuecomment-79829913, this is just one of many places where drush_drupal_major_version() is called; each one indicates a place where Drush has Drupal-specific behavior.  Just returning \"1\" here would not be the right thing to do; each call must be analyzed and fixed appropriately.\r\n\r\nAn interim semi-hack would be to make drush_drupal_major_version() call a \"drupal_major_version\" method of the bootstrap class; BackdropBoot should, in that case, return \"7\", the closest approximation of the version of Drupal that Backdrop emulates.\r\n\r\nFor a \"real\" fix, we'd also want a \"major_version\" method of each Boot class.  This is where the BackdropBoot class would return \"1\" (presuming it is bootstraping a contemporary version of Backdrop).  Then, we'd need to fix the \"drush_get_class\" method to use not only the major version, but also some sort of \"CMS label\" method when composing classnames.  So, in the case of Drupal, this method would return an empty string, and we'd keep searching for Sql6, Sql7 or Sql8.  In the case of Backdrop, though, BackdropBoot would return something like \"Backdrop\" or \"BD\", so we'd look for SqlBackdrop1, or SqlBD1, or whatever.  Then you'd need to provide an implementation of this new class, derived from SqlBase, that new how to get database settings from the bootstrapped CMS.  It might be even better to eliminate the Sql* classes from Drush entirely, and have the Sql code as the Boot object for the database credentials, if they were not explicitly provided to the command.  This would improve the separation of the Drush sql commands from the Drupal-specific code.\r\n\r\nAfter that is done, there are probably more places that will need fixing, but many of the calls to drupal_major_version() are probably in Drupal-specific command implementations, that can just be swapped out by Backdrop-specific implementations.\r\n\r\nThis also implies that it would be handy for more object-oriented Drush commands to exist; this overlaps https://github.com/drush-ops/drush/pull/1337, which may take things in a different direction, long-term.  For now, I'd guess that it's probably better to rely on hook_command_alter here, for the time being."}}