Skip to content

Commit

Permalink
IAM: Remove all the checks for September release being complete #409278
Browse files Browse the repository at this point in the history
  • Loading branch information
sammarshallou authored and Jason.Platts committed Nov 23, 2020
1 parent a132ff7 commit b34c266
Showing 1 changed file with 22 additions and 60 deletions.
82 changes: 22 additions & 60 deletions import.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,8 @@ function mod_oublog_import_get_identifier($user): array {
}
$blogs = oublog_import_getblogs($USER->id, $cm->id, $excludedlist);
try {
if ($isou && \local_oudataload\util::is_september_2020_release_complete()) {
$remoteblogs = oublog_import_remote_call('mod_oublog_get_user_blogs2',
['identifier' => mod_oublog_import_get_identifier($USER)]);
} else {
$remoteblogs = oublog_import_remote_call('mod_oublog_get_user_blogs',
['username' => $USER->username]);
}
$remoteblogs = oublog_import_remote_call('mod_oublog_get_user_blogs2',
['identifier' => mod_oublog_import_get_identifier($USER)]);
if ($remoteblogs) {
$blogs = array_merge($remoteblogs, $blogs);
}
Expand Down Expand Up @@ -221,15 +216,9 @@ function mod_oublog_import_get_identifier($user): array {
if ($remote = optional_param('remote', false, PARAM_BOOL)) {
$stepinfo['remote'] = true;
// Blog on remote server, use WS to get info.
if ($isou && \local_oudataload\util::is_september_2020_release_complete()) {
$result = oublog_import_remote_call('mod_oublog_get_blog_info2',
['identifier' => mod_oublog_import_get_identifier($USER),
'cmid' => $bid, 'sharedblogcmid' => (int)$sharedblogcmid]);
} else {
$result = oublog_import_remote_call('mod_oublog_get_blog_info',
['username' => $USER->username,
'cmid' => $bid, 'sharedblogcmid' => (int)$sharedblogcmid]);
}
$result = oublog_import_remote_call('mod_oublog_get_blog_info2',
['identifier' => mod_oublog_import_get_identifier($USER),
'cmid' => $bid, 'sharedblogcmid' => (int)$sharedblogcmid]);
if (!$result) {
throw new moodle_exception('invalidcoursemodule', 'error');
}
Expand Down Expand Up @@ -269,16 +258,10 @@ function mod_oublog_import_get_identifier($user): array {
$stepinfo['preselected'] = $preselected;
$preselected = array_filter(array_unique(explode(',', $preselected)));
if ($remote) {
if ($isou && \local_oudataload\util::is_september_2020_release_complete()) {
$result = oublog_import_remote_call('mod_oublog_get_blog_allposts2', [
'blogid' => $boublogid,
'identifier' => mod_oublog_import_get_identifier($USER),
'sort' => $sort, 'page' => $page, 'tags' => $tags]);
} else {
$result = oublog_import_remote_call('mod_oublog_get_blog_allposts', [
'blogid' => $boublogid, 'username' => $USER->username, 'sort' => $sort,
'page' => $page, 'tags' => $tags]);
}
$result = oublog_import_remote_call('mod_oublog_get_blog_allposts2', [
'blogid' => $boublogid,
'identifier' => mod_oublog_import_get_identifier($USER),
'sort' => $sort, 'page' => $page, 'tags' => $tags]);
$posts = $result->posts;
$total = $result->total;
$tagnames = $result->tagnames;
Expand Down Expand Up @@ -373,15 +356,9 @@ function mod_oublog_import_get_identifier($user): array {
$importall = optional_param('importall', false, PARAM_BOOL);
if ($remote = optional_param('remote', false, PARAM_BOOL)) {
// Blog on remote server, use WS to get info.
if ($isou && \local_oudataload\util::is_september_2020_release_complete()) {
$result = oublog_import_remote_call('mod_oublog_get_blog_info2',
['identifier' => mod_oublog_import_get_identifier($USER),
'cmid' => $bid, 'sharedblogcmid' => (int)$sharedblogcmid]);
} else {
$result = oublog_import_remote_call('mod_oublog_get_blog_info',
['username' => $USER->username, 'cmid' => $bid,
'sharedblogcmid' => (int)$sharedblogcmid]);
}
$result = oublog_import_remote_call('mod_oublog_get_blog_info2',
['identifier' => mod_oublog_import_get_identifier($USER),
'cmid' => $bid, 'sharedblogcmid' => (int)$sharedblogcmid]);
if (!$result) {
throw new moodle_exception('invalidcoursemodule', 'error');
}
Expand Down Expand Up @@ -416,32 +393,17 @@ function mod_oublog_import_get_identifier($user): array {
}
if ($remote) {
if ($importall) {
if ($isou && \local_oudataload\util::is_september_2020_release_complete()) {
$posts = oublog_import_remote_call('mod_oublog_get_blog_posts2',
['identifier' => mod_oublog_import_get_identifier($USER),
'blogid' => $boublogid, 'selected' => '0',
'inccomments' => $currentblog->allowcomments != OUBLOG_COMMENTS_PREVENT,
'bcontextid' => $bcontextid]);
} else {
$posts = oublog_import_remote_call('mod_oublog_get_blog_posts',
['username' => $USER->username, 'blogid' => $boublogid, 'selected' => '0',
'inccomments' => $currentblog->allowcomments != OUBLOG_COMMENTS_PREVENT,
'bcontextid' => $bcontextid]);
}
$posts = oublog_import_remote_call('mod_oublog_get_blog_posts2',
['identifier' => mod_oublog_import_get_identifier($USER),
'blogid' => $boublogid, 'selected' => '0',
'inccomments' => $currentblog->allowcomments != OUBLOG_COMMENTS_PREVENT,
'bcontextid' => $bcontextid]);
} else {
if ($isou && \local_oudataload\util::is_september_2020_release_complete()) {
$posts = oublog_import_remote_call('mod_oublog_get_blog_posts2',
['identifier' => mod_oublog_import_get_identifier($USER),
'blogid' => $boublogid, 'selected' => implode(',', $selected),
'inccomments' => $currentblog->allowcomments != OUBLOG_COMMENTS_PREVENT,
'bcontextid' => $bcontextid]);
} else {
$posts = oublog_import_remote_call('mod_oublog_get_blog_posts',
['username' => $USER->username, 'blogid' => $boublogid,
'selected' => implode(',', $selected),
'inccomments' => $currentblog->allowcomments != OUBLOG_COMMENTS_PREVENT,
'bcontextid' => $bcontextid]);
}
$posts = oublog_import_remote_call('mod_oublog_get_blog_posts2',
['identifier' => mod_oublog_import_get_identifier($USER),
'blogid' => $boublogid, 'selected' => implode(',', $selected),
'inccomments' => $currentblog->allowcomments != OUBLOG_COMMENTS_PREVENT,
'bcontextid' => $bcontextid]);
}

} else {
Expand Down

0 comments on commit b34c266

Please sign in to comment.