You are here

function drush_lockr_register in Lockr 7.2

Same name and namespace in other branches
  1. 8.4 lockr.drush.inc \drush_lockr_register()
  2. 8.2 lockr.drush.inc \drush_lockr_register()
  3. 8.3 lockr.drush.inc \drush_lockr_register()
  4. 7.3 lockr.drush.inc \drush_lockr_register()
  5. 4.x lockr.drush.inc \drush_lockr_register()

Registers the site with lockr.

File

./lockr.drush.inc, line 41
Hooks and callbacks for drush.

Code

function drush_lockr_register($email) {
  $name = variable_get('site_name');
  $client = lockr_site_client();
  $password = drush_get_option('password');
  try {
    $client
      ->register($email, $password, $name);
  } catch (LockrClientException $e) {
    if ($e->title === 'Site exists') {
      drush_log('This site is already registered.', 'warning');
      return;
    }
    elseif ($password) {
      drush_log('Email and password did not match.', 'error');
    }
    else {
      drush_log('Email is already registered, please provide a password', 'error');
    }
  } catch (LockrServerException $e) {
    drush_log('An unknown error occurred, please try again.', 'error');
  }
  drush_log('Site has been registered.', 'success');
}