/** * Import a new site * @package 2.0 * * ## OPTIONS * * [--url=<url>] * : URL of archive to import * * [--name=<name>] * : (deprecated) use --site instead * * [--site=<site>] * : Name of the site to create (machine-readable) * * [--label=<label>] * : Label for the site * * [--org=<org>] * : UUID of organization to add this site to; or "None" * * @subcommand create-from-import */ public function import($args, $assoc_args) { $url = Input::string($assoc_args, 'url', "URL of archive to import"); if (!$url) { Terminus::error("Please enter a URL."); } $assoc_args['import'] = $url; Terminus::launch_self('sites', array('create'), $assoc_args); }
/** * [Deprecated] Delete a site from pantheon; use `site delete` instead * * ## OPTIONS * [--site=<site>] * : ID of the site you want to delete * * [--force] * : to skip the confirmations */ function delete($args, $assoc_args) { Terminus::launch_self('site', array('delete'), $assoc_args); }
/** * Import a new site * @package 2.0 * * ## OPTIONS * * [--url=<url>] * : Url of archive to import * * [--name=<name>] * : Name of the site to create (machine-readable) * * [--label=<label>] * : Label for the site * * [--org=<org>] * : UUID of organization to add this site to * * @subcommand create-from-import */ public function import($args, $assoc_args) { $url = Input::string($assoc_args, 'url', "Url of archive to import"); $label = Input::string($assoc_args, 'label', "Human readable label for the site"); $slug = Utils\sanitize_name($label); $name = Input::string($assoc_args, 'name', "Machine name of the site; used as part of the default URL [ if left blank will be {$slug}]"); $name = $name ? $name : $slug; $organization = Terminus::menu(Input::orglist(), false, "Choose organization"); if (!$url) { Terminus::error("Please enter a url."); } Terminus::launch_self('sites', array('create'), array('label' => $label, 'name' => $name, 'org' => $organization)); Terminus::launch_self('site', array('import'), array('url' => $url, 'site' => $name, 'nocache' => True)); }
private function _checkSession() { if (!property_exists($this, "session") || !property_exists($this->session, "user_uuid")) { return false; } $results = $this->terminus_request("user", $this->session->user_uuid, "profile", "GET"); if ($results['info']['http_code'] >= 400) { $this->log()->error("Expired Session, please re-authenticate."); $this->cache->remove('session'); Terminus::launch_self("auth", array("login")); $this->whoami(); return true; } else { return $results['info']['http_code'] <= 199 || $results['info']['http_code'] >= 300 ? false : true; } }
/** * Import a new site * @package 2.0 * * ## OPTIONS * * [--url=<url>] * : URL of archive to import * * [--name=<name>] * : (deprecated) use --site instead * * [--site=<site>] * : Name of the site to create (machine-readable) * * [--label=<label>] * : Label for the site * * [--org=<id>] * : UUID of organization into which to add this site * * @subcommand import */ public function import($args, $assoc_args) { $options = Sites_Command::getSiteCreateOptions($assoc_args); $url = Input::string($assoc_args, 'url', "URL of archive to import"); if (!$url) { throw new TerminusException("Please enter a URL."); } $workflow = $this->sites->addSite($options); $workflow->wait(); $this->workflowOutput($workflow); // Add Site to SitesCache $final_task = $workflow->get('final_task'); $this->sites->addSiteToCache($final_task->site_id); sleep(10); //To stop erroneous site-DNE errors Terminus::launch_self('site', array('import'), array('url' => $assoc_args['url'], 'site' => $options['name'], 'element' => 'all')); }