// Try and make one
$tempcat = new object();
$tempcat->name = get_string('miscellaneous');
- if (!$tempcat->id = $DB->insert_record('course_categories', $tempcat)) {
- print_error('cannotsetupcategory');
- }
+ $tempcat->id = $DB->insert_record('course_categories', $tempcat);
$tempcat->context = get_context_instance(CONTEXT_COURSECAT, $tempcat->id);
mark_context_dirty('/'.SYSCONTEXTID);
fix_course_sortorder(); // Required to build course_categories.depth and .path.
/// Record the request.
$data->requester = $USER->id;
- if (!$DB->insert_record('course_request', $data)) {
- print_error('errorsavingrequest', '', $returnurl);
- }
+ $DB->insert_record('course_request', $data);
/// Notify the admin if required.
if ($CFG->courserequestnotify) {
$string['cannotinsertgrade'] = 'Cannot insert grade item without course id!';
$string['cannotinsertrate'] = 'Could not insert a new rating ($a->id = $a->rating)';
$string['cannotinsertrecord'] = 'Could not insert new record ID $a';
-$string['cannotinsertkey'] = 'Cannot insert new key';
$string['cannotmailconfirm'] = 'Error sending password change confirmation email';
$string['cannotmanualctrack'] = 'Activity does not provide manual completion tracking';
$string['cannotmapfield'] = 'Mapping collision detected - two fields maps to the same grade item $a';
$string['cannotsetprefgrade'] = 'Could not set preference aggregationview to $a for this grade category';
$string['cannotsettheme'] = 'Could not set the theme!';
$string['cannotsetupblock'] = 'Blocks tables could NOT be set up successfully!';
-$string['cannotsetupcategory'] = 'Serious error! Could not set up a default course category!';
$string['cannotsetupcapforplugin'] = 'Could not set up the capabilities for $a';
$string['cannotsetupcapformod'] = 'Could not set up the capabilities for $a';
$string['cannotshowhidecoursesincategory'] = 'Cannot show/hide the courses in category $a.';
$string['cannotsplit'] = 'Discussions from this forum cannot be split';
$string['cannotunsubscribe'] = 'Could not unsubscribe you from that forum';
$string['cannotupdatecoursemoudle'] = 'Could not update course module with section id';
-$string['cannotupdatediscussion'] = 'Could not update the discussion';
-$string['cannotupdateforum'] = 'Can not update forum';
-$string['cannotupdatefirstpost'] = 'Could not update the first post';
$string['cannotupdatepost'] = 'You can not update this post';
$string['cannotremovesubscriber'] = 'Could not remove subscriber with id $a from this forum!';
$string['cannotreply'] = 'You cannot reply to this post';
$cat->depth = 1;
$cat->sortorder = MAX_COURSES_IN_CATEGORY;
$cat->timemodified = time();
- if (!$catid = $DB->insert_record('course_categories', $cat)) {
- print_error('cannotsetupcategory', 'error');
- }
+ $catid = $DB->insert_record('course_categories', $cat);
// make sure category context exists
get_context_instance(CONTEXT_COURSECAT, $catid);
mark_context_dirty('/'.SYSCONTEXTID);
// must be unique
$key->value = md5($userid.'_'.time().random_string(40));
}
-
- if (!$DB->insert_record('user_private_key', $key)) {
- print_error('cannotinsertkey');
- }
-
+ $DB->insert_record('user_private_key', $key);
return $key->value;
}
$attempt = new stdClass;
$attempt->modulename = $modulename;
- if (!$id = $DB->insert_record('question_attempts', $attempt)) {
- print_error('cannotcreate', 'question');
- }
+ $id = $DB->insert_record('question_attempts', $attempt);
return $id;
}
$post->message = $forum->intro;
$post->modified = $forum->timemodified;
- if (! $DB->update_record('forum_posts', ($post))) {
- print_error('cannotupdatefirstpost', 'forum');
- }
-
+ $DB->update_record('forum_posts', $post);
$discussion->name = $forum->name;
-
- if (! $DB->update_record('forum_discussions', ($discussion))) {
- print_error('cannotupdatediscussion', 'forum');
- }
+ $DB->update_record('forum_discussions', $discussion);
}
- if (!$DB->update_record('forum', $forum)) {
- print_error('cannotupdateforum', 'forum');
- }
+ $DB->update_record('forum', $forum);
forum_grade_item_update($forum);
$newpost->parent = 0;
$newpost->subject = $name;
- if (!$DB->update_record("forum_posts", $newpost)) {
- print_error('cannotupdatediscussion', 'forum');
- }
+ $DB->update_record("forum_posts", $newpost);
forum_change_discussionid($post->id, $newid);