MDL-42668 portfolio_boxnet: Migration to APIv2
This commit is contained in:
+83
-4
@@ -41,6 +41,9 @@ class boxnet_client extends oauth2_client {
|
||||
/** @const API URL */
|
||||
const API = 'https://api.box.com/2.0';
|
||||
|
||||
/** @const UPLOAD_API URL */
|
||||
const UPLOAD_API = 'https://upload.box.com/api/2.0';
|
||||
|
||||
/**
|
||||
* Return authorize URL.
|
||||
*
|
||||
@@ -50,6 +53,21 @@ class boxnet_client extends oauth2_client {
|
||||
return 'https://www.box.com/api/oauth2/authorize';
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a folder.
|
||||
*
|
||||
* @param string $foldername The folder name.
|
||||
* @param int $parentid The ID of the parent folder.
|
||||
* @return array Information about the new folder.
|
||||
*/
|
||||
public function create_folder($foldername, $parentid = 0) {
|
||||
$params = array('name' => $foldername, 'parent' => array('id' => (string) $parentid));
|
||||
$this->reset_state();
|
||||
$result = $this->post($this->make_url("/folders"), json_encode($params));
|
||||
$result = json_decode($result);
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Download the file.
|
||||
*
|
||||
@@ -58,6 +76,7 @@ class boxnet_client extends oauth2_client {
|
||||
* @return bool Success or not.
|
||||
*/
|
||||
public function download_file($fileid, $path) {
|
||||
$this->reset_state();
|
||||
$result = $this->download_one($this->make_url("/files/$fileid/content"), array(),
|
||||
array('filepath' => $path, 'CURLOPT_FOLLOWLOCATION' => true));
|
||||
return ($result === true && $this->info['http_code'] === 200);
|
||||
@@ -70,6 +89,7 @@ class boxnet_client extends oauth2_client {
|
||||
* @return object
|
||||
*/
|
||||
public function get_file_info($fileid) {
|
||||
$this->reset_state();
|
||||
$result = $this->request($this->make_url("/files/$fileid"));
|
||||
return json_decode($result);
|
||||
}
|
||||
@@ -81,6 +101,7 @@ class boxnet_client extends oauth2_client {
|
||||
* @return object
|
||||
*/
|
||||
public function get_folder_items($folderid = 0) {
|
||||
$this->reset_state();
|
||||
$result = $this->request($this->make_url("/folders/$folderid/items",
|
||||
array('fields' => 'id,name,type,modified_at,size,owned_by')));
|
||||
return json_decode($result);
|
||||
@@ -98,6 +119,7 @@ class boxnet_client extends oauth2_client {
|
||||
'client_secret' => $this->get_clientsecret(),
|
||||
'token' => $accesstoken->token
|
||||
);
|
||||
$this->reset_state();
|
||||
$this->post($this->revoke_url(), $params);
|
||||
}
|
||||
parent::log_out();
|
||||
@@ -108,13 +130,47 @@ class boxnet_client extends oauth2_client {
|
||||
*
|
||||
* @param string $uri The URI to request.
|
||||
* @param array $params Query string parameters.
|
||||
* @param bool $uploadapi Whether this works with the upload API or not.
|
||||
* @return string
|
||||
*/
|
||||
protected function make_url($uri, $params = array()) {
|
||||
$url = new moodle_url(self::API . '/' . ltrim($uri, '/'), $params);
|
||||
protected function make_url($uri, $params = array(), $uploadapi = false) {
|
||||
$api = $uploadapi ? self::UPLOAD_API : self::API;
|
||||
$url = new moodle_url($api . '/' . ltrim($uri, '/'), $params);
|
||||
return $url->out(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Rename a file.
|
||||
*
|
||||
* @param int $fileid The file ID.
|
||||
* @param string $newname The new file name.
|
||||
* @return object Box.net file object.
|
||||
*/
|
||||
public function rename_file($fileid, $newname) {
|
||||
// This requires a PUT request with data within it. We cannot use
|
||||
// the standard PUT request 'CURLOPT_PUT' because it expects a file.
|
||||
$data = array('name' => $newname);
|
||||
$options = array(
|
||||
'CURLOPT_CUSTOMREQUEST' => 'PUT',
|
||||
'CURLOPT_POSTFIELDS' => json_encode($data)
|
||||
);
|
||||
$url = $this->make_url("/files/$fileid");
|
||||
$this->reset_state();
|
||||
$result = $this->request($url, $options);
|
||||
$result = json_decode($result);
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets curl for multiple requests.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function reset_state() {
|
||||
$this->cleanopt();
|
||||
$this->resetHeader();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the revoke URL.
|
||||
*
|
||||
@@ -140,13 +196,13 @@ class boxnet_client extends oauth2_client {
|
||||
'CURLOPT_CUSTOMREQUEST' => 'PUT',
|
||||
'CURLOPT_POSTFIELDS' => json_encode($data)
|
||||
);
|
||||
$this->reset_state();
|
||||
$result = $this->request($this->make_url("/files/$fileid"), $options);
|
||||
$result = json_decode($result);
|
||||
|
||||
if ($businesscheck) {
|
||||
// Checks that the user has the right to share the file. If not, throw an exception.
|
||||
$this->resetopt();
|
||||
$this->resetHeader();
|
||||
$this->reset_state();
|
||||
$this->head($result->shared_link->download_url);
|
||||
$info = $this->get_info();
|
||||
if ($info['http_code'] == 403) {
|
||||
@@ -163,6 +219,7 @@ class boxnet_client extends oauth2_client {
|
||||
* @return object
|
||||
*/
|
||||
public function search($query) {
|
||||
$this->reset_state();
|
||||
$result = $this->request($this->make_url('/search', array('query' => $query, 'limit' => 50, 'offset' => 0)));
|
||||
return json_decode($result);
|
||||
}
|
||||
@@ -176,6 +233,28 @@ class boxnet_client extends oauth2_client {
|
||||
return 'https://www.box.com/api/oauth2/token';
|
||||
}
|
||||
|
||||
/**
|
||||
* Upload a file.
|
||||
*
|
||||
* Please note that the file is named on Box.net using the path we are providing, and so
|
||||
* the file has the name of the stored_file hash.
|
||||
*
|
||||
* @param stored_file $storedfile A stored_file.
|
||||
* @param integer $parentid The ID of the parent folder.
|
||||
* @return object Box.net file object.
|
||||
*/
|
||||
public function upload_file(stored_file $storedfile, $parentid = 0) {
|
||||
$url = $this->make_url('/files/content', array(), true);
|
||||
$options = array(
|
||||
'filename' => $storedfile,
|
||||
'parent_id' => $parentid
|
||||
);
|
||||
$this->reset_state();
|
||||
$result = $this->post($url, $options);
|
||||
$result = json_decode($result);
|
||||
return $result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -23,13 +23,14 @@
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
$string['apikey'] = 'API key';
|
||||
$string['err_noapikey'] = 'No API key';
|
||||
$string['err_noapikey_help'] = 'There is no API key configured for this plugin. You can get one of these from OpenBox development page.';
|
||||
$string['clientid'] = 'Client ID';
|
||||
$string['clientsecret'] = 'Client secret';
|
||||
$string['existingfolder'] = 'Existing folder to put file(s) into';
|
||||
$string['folderclash'] = 'The folder you asked to create already exists!';
|
||||
$string['foldercreatefailed'] = 'Failed to create your target folder on box.net';
|
||||
$string['folderlistfailed'] = 'Failed to retrieve a folder listing from box.net';
|
||||
$string['missingoauthkeys'] = 'Missing client ID and secret';
|
||||
$string['missingoauthkeys_help'] = 'There is no client ID or secret configured for this plugin. You can get one of these from Box.net development page.';
|
||||
$string['newfolder'] = 'New folder to put file(s) into';
|
||||
$string['noauthtoken'] = 'Could not retrieve an authentication token for use in this session';
|
||||
$string['notarget'] = 'You must specify either an existing folder or a new folder to upload into';
|
||||
@@ -38,10 +39,11 @@ $string['password'] = 'Your box.net password (will not be stored)';
|
||||
$string['pluginname'] = 'Box.net';
|
||||
$string['sendfailed'] = 'Failed to send content to box.net: {$a}';
|
||||
$string['setupinfo'] = 'Setup instructions';
|
||||
$string['setupinfodetails'] = 'To obtain API key, log in to Box.net and visit their <a href="{$a->servicesurl}">OpenBox development page</a>. In \'Developer Tools\', follow \'Create new application\' and create new application for your Moodle site. API key is displayed in \'Backend parameters\' section of the application edit form. In that form, fill \'Redirect URL\' field to:<br /><code>{$a->callbackurl}</code><br />Optionally, you can also provide other information about your Moodle site. These values can be edited later at \'View my applications\' page.';
|
||||
$string['setupinfodetails'] = 'To obtain a client ID and secret, log in to Box.net and visit their <a href="{$a->servicesurl}">developers page</a>. Follow \'Create new application\' and create new application for your Moodle site. The client ID ans secret are displayed in \'OAuth2 parameters\' section of the application edit form. Optionally, you can also provide other information about your Moodle site.';
|
||||
$string['sharedfolder'] = 'Shared';
|
||||
$string['sharefile'] = 'Share this file?';
|
||||
$string['sharefolder'] = 'Share this new folder?';
|
||||
$string['targetfolder'] = 'Target folder';
|
||||
$string['tobecreated'] = 'To be created';
|
||||
$string['username'] = 'Your box.net username (will not be stored)';
|
||||
$string['warninghttps'] = 'Box.net requires your website to be using HTTPS in order for the portfolio to work.';
|
||||
|
||||
+99
-131
@@ -22,29 +22,23 @@ class portfolio_plugin_boxnet extends portfolio_plugin_push_base {
|
||||
public function send_package() {
|
||||
// if we need to create the folder, do it now
|
||||
if ($newfolder = $this->get_export_config('newfolder')) {
|
||||
if (!$created = $this->boxclient->createFolder($newfolder, array('share' => (int)$this->get_export_config('sharefolder')))) {
|
||||
$created = $this->boxclient->create_folder($newfolder);
|
||||
if (empty($created->id)) {
|
||||
throw new portfolio_plugin_exception('foldercreatefailed', 'portfolio_boxnet');
|
||||
}
|
||||
$this->folders[$created['folder_id']] = $created['folder_name'];
|
||||
$this->set_export_config(array('folder' => $created['folder_id']));
|
||||
$this->folders[$created->id] = $created->name;
|
||||
$this->set_export_config(array('folder' => $created->id));
|
||||
}
|
||||
foreach ($this->exporter->get_tempfiles() as $file) {
|
||||
$return = $this->boxclient->uploadFile(
|
||||
array(
|
||||
'file' => $file,
|
||||
'folder_id' => $this->get_export_config('folder'),
|
||||
'share' => $this->get_export_config('sharefile'),
|
||||
)
|
||||
);
|
||||
if (array_key_exists('status', $return) && $return['status'] == 'upload_ok'
|
||||
&& array_key_exists('id', $return) && count($return['id']) == 1) {
|
||||
$returnid = array_keys($return['id']);
|
||||
$this->rename_file($return['id'][array_pop($returnid)], $file->get_filename());
|
||||
// if this fails, the file was sent but not renamed - this triggers a warning but is not fatal.
|
||||
$return = $this->boxclient->upload_file($file, $this->get_export_config('folder'));
|
||||
if (!empty($result->type) && $result->type == 'error') {
|
||||
throw new portfolio_plugin_exception('sendfailed', 'portfolio_boxnet', $result->message);
|
||||
}
|
||||
$createdfile = reset($return->entries);
|
||||
if (!empty($createdfile->id)) {
|
||||
$result = $this->rename_file($createdfile->id, $file->get_filename());
|
||||
// If this fails, the file was sent but not renamed.
|
||||
}
|
||||
}
|
||||
if ($this->boxclient->isError()) {
|
||||
throw new portfolio_plugin_exception('sendfailed', 'portfolio_boxnet', $this->boxclient->getErrorMsg());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,22 +46,24 @@ class portfolio_plugin_boxnet extends portfolio_plugin_push_base {
|
||||
$allfolders = $this->get_folder_list();
|
||||
if ($newfolder = $this->get_export_config('newfolder')) {
|
||||
$foldername = $newfolder . ' (' . get_string('tobecreated', 'portfolio_boxnet') . ')';
|
||||
} elseif ($this->get_export_config('folder')) {
|
||||
} else if ($this->get_export_config('folder')) {
|
||||
$foldername = $allfolders[$this->get_export_config('folder')];
|
||||
} else {
|
||||
$foldername = '';
|
||||
$foldername = '/';
|
||||
}
|
||||
return array(
|
||||
get_string('targetfolder', 'portfolio_boxnet') => $foldername
|
||||
get_string('targetfolder', 'portfolio_boxnet') => s($foldername)
|
||||
);
|
||||
}
|
||||
|
||||
public function get_interactive_continue_url() {
|
||||
return 'http://box.net/files#0:f:' . $this->get_export_config('folder');
|
||||
return 'https://app.box.net/files/0/f/' . $this->get_export_config('folder') . '/';
|
||||
}
|
||||
|
||||
public function expected_time($callertime) {
|
||||
return $callertime;
|
||||
// We're forcing this to be run 'interactively' because the plugin
|
||||
// does not support running in cron.
|
||||
return PORTFOLIO_TIME_LOW;
|
||||
}
|
||||
|
||||
public static function has_admin_config() {
|
||||
@@ -75,28 +71,22 @@ class portfolio_plugin_boxnet extends portfolio_plugin_push_base {
|
||||
}
|
||||
|
||||
public static function get_allowed_config() {
|
||||
return array('apikey');
|
||||
return array('clientid', 'clientsecret');
|
||||
}
|
||||
|
||||
public function has_export_config() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public function get_allowed_user_config() {
|
||||
return array('authtoken', 'authtokenctime');
|
||||
}
|
||||
|
||||
public function get_allowed_export_config() {
|
||||
return array('folder', 'newfolder', 'sharefile', 'sharefolder');
|
||||
return array('folder', 'newfolder');
|
||||
}
|
||||
|
||||
public function export_config_form(&$mform) {
|
||||
$folders = $this->get_folder_list();
|
||||
$mform->addElement('checkbox', 'plugin_sharefile', get_string('sharefile', 'portfolio_boxnet'));
|
||||
$mform->addElement('text', 'plugin_newfolder', get_string('newfolder', 'portfolio_boxnet'));
|
||||
$mform->setType('plugin_newfolder', PARAM_RAW);
|
||||
$mform->addElement('checkbox', 'plugin_sharefolder', get_string('sharefolder', 'portfolio_boxnet'));
|
||||
$folders[0] = '----';
|
||||
$folders[0] = '/';
|
||||
ksort($folders);
|
||||
$mform->addElement('select', 'plugin_folder', get_string('existingfolder', 'portfolio_boxnet'), $folders);
|
||||
}
|
||||
@@ -111,134 +101,112 @@ class portfolio_plugin_boxnet extends portfolio_plugin_push_base {
|
||||
public static function admin_config_form(&$mform) {
|
||||
global $CFG;
|
||||
|
||||
$mform->addElement('text', 'apikey', get_string('apikey', 'portfolio_boxnet'));
|
||||
$mform->addRule('apikey', get_string('required'), 'required', null, 'client');
|
||||
$mform->setType('apikey', PARAM_RAW_TRIMMED);
|
||||
$mform->addElement('text', 'clientid', get_string('clientid', 'portfolio_boxnet'));
|
||||
$mform->addRule('clientid', get_string('required'), 'required', null, 'client');
|
||||
$mform->setType('clientid', PARAM_RAW_TRIMMED);
|
||||
|
||||
$mform->addElement('text', 'clientsecret', get_string('clientsecret', 'portfolio_boxnet'));
|
||||
$mform->addRule('clientsecret', get_string('required'), 'required', null, 'client');
|
||||
$mform->setType('clientsecret', PARAM_RAW_TRIMMED);
|
||||
|
||||
$a = new stdClass();
|
||||
$a->servicesurl = 'http://www.box.net/developers/services';
|
||||
$a->callbackurl = $CFG->wwwroot . '/portfolio/add.php?postcontrol=1&type=boxnet';
|
||||
$a->servicesurl = 'https://app.box.com/developers/services';
|
||||
$mform->addElement('static', 'setupinfo', get_string('setupinfo', 'portfolio_boxnet'),
|
||||
get_string('setupinfodetails', 'portfolio_boxnet', $a));
|
||||
|
||||
if (strpos($CFG->wwwroot, 'https') !== 0) {
|
||||
$mform->addElement('static', 'warninghttps', '', get_string('warninghttps', 'portfolio_boxnet'));
|
||||
}
|
||||
}
|
||||
|
||||
public function steal_control($stage) {
|
||||
if ($stage != PORTFOLIO_STAGE_CONFIG) {
|
||||
return false;
|
||||
}
|
||||
if ($this->authtoken) {
|
||||
if (empty($this->boxclient)) {
|
||||
$returnurl = new moodle_url('/portfolio/add.php', array('postcontrol' => 1, 'type' => 'boxnet',
|
||||
'sesskey' => sesskey()));
|
||||
$this->boxclient = new boxnet_client($this->get_config('clientid'), $this->get_config('clientsecret'), $returnurl, '');
|
||||
}
|
||||
if ($this->boxclient->is_logged_in()) {
|
||||
return false;
|
||||
}
|
||||
if (!$this->ensure_ticket()) {
|
||||
throw new portfolio_plugin_exception('noticket', 'portfolio_boxnet');
|
||||
}
|
||||
$token = $this->get_user_config('authtoken', $this->get('user')->id);
|
||||
$ctime= $this->get_user_config('authtokenctime', $this->get('user')->id);
|
||||
if (!empty($token) && (($ctime + 60*60*20) > time())) {
|
||||
$this->authtoken = $token;
|
||||
$this->boxclient->auth_token = $token;
|
||||
return false;
|
||||
}
|
||||
return 'http://www.box.net/api/1.0/auth/'.$this->ticket;
|
||||
return $this->boxclient->get_login_url();
|
||||
}
|
||||
|
||||
public function post_control($stage, $params) {
|
||||
if ($stage != PORTFOLIO_STAGE_CONFIG) {
|
||||
return;
|
||||
}
|
||||
if (!array_key_exists('auth_token', $params) || empty($params['auth_token'])) {
|
||||
if (!$this->boxclient->is_logged_in()) {
|
||||
throw new portfolio_plugin_exception('noauthtoken', 'portfolio_boxnet');
|
||||
}
|
||||
$this->authtoken = $params['auth_token'];
|
||||
$this->boxclient->auth_token = $this->authtoken;
|
||||
$this->set_user_config(array('authtoken' => $this->authtoken, 'authtokenctime' => time()), $this->get('user')->id);
|
||||
}
|
||||
|
||||
private function ensure_ticket() {
|
||||
if (!empty($this->boxclient)) {
|
||||
return true;
|
||||
}
|
||||
$this->boxclient = new boxclient($this->get_config('apikey'), '');
|
||||
$ticket_return = $this->boxclient->getTicket();
|
||||
if ($this->boxclient->isError() || empty($ticket_return)) {
|
||||
throw new portfolio_plugin_exception('noticket', 'portfolio_boxnet');
|
||||
}
|
||||
$this->ticket = $ticket_return['ticket'];
|
||||
return $this->ticket;
|
||||
}
|
||||
|
||||
private function ensure_account_tree() {
|
||||
if (!empty($this->accounttree)) {
|
||||
return;
|
||||
}
|
||||
if (empty($this->ticket)
|
||||
|| empty($this->authtoken)
|
||||
|| empty($this->boxclient)) {
|
||||
// if we don't have these we're pretty much screwed
|
||||
throw new portfolio_plugin_exception('folderlistfailed', 'portfolio_boxnet');
|
||||
return false;
|
||||
}
|
||||
$this->accounttree = $this->boxclient->getAccountTree();
|
||||
if ($this->boxclient->isError()) {
|
||||
throw new portfolio_plugin_exception('folderlistfailed', 'portfolio_boxnet');
|
||||
}
|
||||
if (!is_array($this->accounttree)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private function get_folder_list() {
|
||||
if (!empty($this->folders)) {
|
||||
return $this->folders;
|
||||
}
|
||||
$this->ensure_account_tree();
|
||||
$folders = array();
|
||||
foreach ($this->accounttree['folder_id'] as $key => $id) {
|
||||
if (empty($id)) {
|
||||
continue;
|
||||
}
|
||||
$name = $this->accounttree['folder_name'][$key];
|
||||
if (!empty($this->accounttree['shared'][$key])) {
|
||||
$name .= ' (' . get_string('sharedfolder', 'portfolio_boxnet') . ')';
|
||||
}
|
||||
$folders[$id] = $name;
|
||||
}
|
||||
$this->folders = $folders;
|
||||
return $folders;
|
||||
}
|
||||
|
||||
private function rename_file($fileid, $newname) {
|
||||
// look at moving this to the boxnet client class
|
||||
$this->ensure_account_tree();
|
||||
$count = 1;
|
||||
$bits = explode('.', $newname);
|
||||
$suffix = '';
|
||||
if (count($bits) == 1) {
|
||||
$prefix = $newname;
|
||||
} else {
|
||||
$suffix = '.' . array_pop($bits);
|
||||
$prefix = implode('.', $bits);
|
||||
}
|
||||
while (true) {
|
||||
if (!array_key_exists('file_name', $this->accounttree) || !in_array($newname, $this->accounttree['file_name'])) {
|
||||
for ($i = 0; $i < 2; $i++) {
|
||||
if ($this->boxclient->renameFile($fileid, $newname)) {
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* Get the folder list.
|
||||
*
|
||||
* This is limited to the folders in the root folder.
|
||||
*
|
||||
* @return array of folders.
|
||||
*/
|
||||
protected function get_folder_list() {
|
||||
if (empty($this->folders)) {
|
||||
$folders = array();
|
||||
$result = $this->boxclient->get_folder_items();
|
||||
foreach ($result->entries as $item) {
|
||||
if ($item->type != 'folder') {
|
||||
continue;
|
||||
}
|
||||
$folders[$item->id] = $item->name;
|
||||
if (!empty($item->shared)) {
|
||||
$folders[$item->id] .= ' (' . get_string('sharedfolder', 'portfolio_boxnet') . ')';
|
||||
}
|
||||
debugging("tried three times to rename file and failed");
|
||||
return false;
|
||||
}
|
||||
$newname = $prefix . '(' . $count . ')' . $suffix;
|
||||
$count++;
|
||||
$this->folders = $folders;
|
||||
}
|
||||
return $this->folders;
|
||||
}
|
||||
|
||||
/**
|
||||
* Rename a file.
|
||||
*
|
||||
* If the name is already taken, we append the current date to the file
|
||||
* to prevent name conflicts.
|
||||
*
|
||||
* @param int $fileid The file ID.
|
||||
* @param string $newname The new name.
|
||||
* @return bool Whether it succeeded or not.
|
||||
*/
|
||||
protected function rename_file($fileid, $newname) {
|
||||
$result = $this->boxclient->rename_file($fileid, $newname);
|
||||
if (!empty($result->type) && $result->type == 'error') {
|
||||
$bits = explode('.', $newname);
|
||||
$suffix = '';
|
||||
if (count($bits) == 1) {
|
||||
$prefix = $newname;
|
||||
} else {
|
||||
$suffix = '.' . array_pop($bits);
|
||||
$prefix = implode('.', $bits);
|
||||
}
|
||||
$newname = $prefix . ' (' . date('Y-m-d H-i-s') . ')' . $suffix;
|
||||
$result = $this->boxclient->rename_file($fileid, $newname);
|
||||
if (empty($result->type) || $result->type != 'error') {
|
||||
return true;
|
||||
} else {
|
||||
// We could not rename the file for some reason...
|
||||
debugging('Error while renaming the file on Box.net', DEBUG_DEVELOPER);
|
||||
}
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function instance_sanity_check() {
|
||||
if (!$this->get_config('apikey')) {
|
||||
return 'err_noapikey';
|
||||
if (!$this->get_config('clientid') || !$this->get_config('clientsecret')) {
|
||||
return 'missingoauthkeys';
|
||||
}
|
||||
//@TODO see if we can verify the api key without actually getting an authentication token
|
||||
}
|
||||
|
||||
public static function allows_multiple_instances() {
|
||||
|
||||
Reference in New Issue
Block a user