} else {
// Create a new category.
$newcategory->sortorder = 999;
- if (!$newcategory->id = $DB->insert_record('course_categories', $newcategory)) {
- print_error('cannotcreatecategory', '', '', format_string($newcategory->name));
- }
+ $newcategory->id = $DB->insert_record('course_categories', $newcategory);
$newcategory->context = get_context_instance(CONTEXT_COURSECAT, $newcategory->id);
mark_context_dirty($newcategory->context->path);
fix_course_sortorder(); // Required to build course_categories.depth and .path.
$fromform->instance = $returnfromfunc;
- if (!$DB->set_field('course_modules', 'instance', $returnfromfunc, array('id'=>$fromform->coursemodule))) {
- print_error('cannotaddcoursemodule');
- }
+ $DB->set_field('course_modules', 'instance', $returnfromfunc, array('id'=>$fromform->coursemodule));
// course_modules and course_sections each contain a reference
// to each other, so we have to update one of them twice.
- if (!$sectionid = add_mod_to_section($fromform)) {
- print_error('cannotaddcmtosection');
- }
+ $sectionid = add_mod_to_section($fromform);
- if (!$DB->set_field('course_modules', 'section', $sectionid, array('id'=>$fromform->coursemodule))) {
- print_error('cannotupdatecm');
- }
+ $DB->set_field('course_modules', 'section', $sectionid, array('id'=>$fromform->coursemodule));
// make sure visibility is set correctly (in particular in calendar)
set_coursemodule_visible($fromform->coursemodule, $fromform->visible);
$string['blocknameconflict'] = 'Naming conflict: block $a->name has the same title with an existing block: $a->conflict!';
$string['backupcontainexternal'] = 'This backup file contains external Moodle Network Hosts that are not configured locally';
$string['backuptablefail'] = 'Backup tables could NOT be set up successfully!';
-$string['cannotaddblock'] = '$a block could not be added to the block list!';
$string['cannotaddcoursemodule'] = 'Could not add a new course module';
$string['cannotaddcoursemoduletosection'] = 'Could not add the new course module to that section';
-$string['cannotaddcmtosection'] = 'Could not add the new course module to that section';
$string['cannotaddrss'] = 'You do not have permission to add rss feeds';
$string['cannotaddmembergroupiddoesntexist'] = 'Cannot add member group: the group id doesn\'t exist';
$string['cannotaddmodule'] = '$a module could not be added to the module list!';
$string['cannotaddnewmodule'] = 'Could not add a new module of $a';
-$string['cannotaddnewinstance'] = 'Could not add a new instance of $a';
$string['cannotassignanthing'] = 'Cannot assign moodle/site:doanything';
$string['cannotassignrole'] = 'Cannot assign role in course';
$string['cannotassignrolehere'] = 'You are not allowed to assign this role (id = $a->roleid) in this context ($a->context)';
$string['cannotcallscript'] = 'You cannot call this script in that way';
$string['cannotcreatebackupdir'] = 'Could not create backupdata folder. The site administrator needs to fix the file permissions';
$string['cannotcreatecategory'] = 'The category was not inserted';
-$string['cannotcreatedefaultcat'] = 'Error creating a default category for context $a';
$string['cannotcreategroup'] = 'Error creating group';
$string['cannotcreatelangdir'] = 'Cannot create lang directory';
$string['cannotcreatelangbase'] = 'Error: Could not create base lang directory';
-$string['cannotcreatefield'] = 'Error creating new field';
$string['cannotcreatetempdir'] = 'Cannot create temp directory';
$string['cannotcreatesitedir'] = 'Cannot create site folder. The site administrator needs to fix the file permissions.';
$string['cannotcreateuploaddir'] = 'Cannot create upload folder. The site administrator needs to fix the file permissions.';
$string['cannotcustomizelocallang'] = 'You do not have permission to customize the strings translation. This permission is controlled by the capability \"moodle/site:langeditlocal\". Set this capability to allow you to edit local language packages in case you want to modify translations for your site.';
$string['cannotdeletelangcache'] = 'Language cache cannot be deleted, please fix permissions in dataroot/cache/languages!';
$string['cannotdeletebackupids'] = 'Couldn\'t delete previous backup ids';
-$string['cannotdeletecap'] = 'Could not delete deprecated capability $a';
-$string['cannotdeletecate'] = 'Error while deleting category';
$string['cannotdeletecategorycourse'] = 'Course \'$a\' failed to be deleted.';
$string['cannotdeletecategoryquestions'] = 'Could not delete questions from category \'$a\'';
$string['cannotdeletecourse'] = 'You do not have the permission to delete this course';
$string['cannotsetupcapformod'] = 'Could not set up the capabilities for $a';
$string['cannotshowhidecoursesincategory'] = 'Cannot show/hide the courses in category $a.';
$string['cannotunzipfile'] = 'Cannot unzip file';
-$string['cannotupdatecm'] = 'Could not update the course module with the correct section';
-$string['cannotupdategroup'] = 'Error updating group';
-$string['cannotupdaterate'] = 'Could not update an old rating ($a->id = $a->rating)';
$string['cannotupdaterecord'] = 'Could not update record ID $a';
-$string['cannotupdaterole'] = 'Cannot update role!';
$string['cannotupdatemod'] = 'Could not update $a';
-$string['cannotupdatemodcap'] = 'Could not update $a capabilities!';
$string['cannotupdateuser'] = 'Updating user failed';
$string['cannotupdateusermsgpref'] = 'Cannot update user message preferences';
$string['cannotupdateuseronexauth'] = 'Failed to update user data on external auth: $a. See the server logs for more details.';
$string['cannotupdatepasswordonextauth'] = 'Failed to update password on external auth: $a. See the server logs for more details.';
-$string['cannotupdateplugincap'] = 'Could not update $a capabilities!';
$string['cannotupdateprofile'] = 'Error updating user record';
-$string['cannotupdatecustomprofile'] = 'Error updating user custom record';
$string['cannotupdaterss'] = 'Cannot update RSS';
$string['cannotupdatesecret'] = 'Error resetting user secret string';
$string['cannotupdatesubcate'] = 'Could not update a child category!';
array_key_exists($cachedcap->name, $newcapdef) === false) {
// Remove from capabilities cache.
- if (!$DB->delete_records('capabilities', array('name'=>$cachedcap->name))) {
- print_error('cannotdeletecap', '', '', $cachedcap->name);
- } else {
- $removedcount++;
- }
+ $DB->delete_records('capabilities', array('name'=>$cachedcap->name));
+ $removedcount++;
// Delete from roles.
if ($roles = get_roles_with_capability($cachedcap->name)) {
foreach($roles as $role) {
$category->parent = 0;
$category->sortorder = 999; // By default, all categories get this number, and are sorted alphabetically.
$category->stamp = make_unique_id_code();
- if (!$category->id = $DB->insert_record('question_categories', $category)) {
- print_error('cannotcreatedefaultcat', '', '', print_context_name($context));
- }
+ $category->id = $DB->insert_record('question_categories', $category);
} else {
$category = question_get_default_category($context->id);
}
$newcategory = new stdClass();
$newcategory->name = 'test category';
$newcategory->sortorder = 999;
- if (!$newcategory->id = $DB->insert_record('course_categories', $newcategory)) {
- print_error('cannotcreatecategory', '', '', format_string($newcategory->name));
- }
+ $newcategory->id = $DB->insert_record('course_categories', $newcategory);
$newcategory->context = get_context_instance(CONTEXT_COURSECAT, $newcategory->id);
mark_context_dirty($newcategory->context->path);
} else if ($rating != $oldrating->rating) {
$oldrating->rating = $rating;
- if (!$DB->update_record('data_ratings', $oldrating)) {
- print_error('cannotupdaterate', 'error', '', (object)array('id'=>$record->id, 'rating'=>$rating));
- }
+ $DB->update_record('data_ratings', $oldrating);
data_update_grades($data, $record->userid);
}
if ($rating != $oldrating->rating) {
$oldrating->rating = $rating;
$oldrating->time = time();
- if (!$DB->update_record('forum_ratings', $oldrating)) {
- print_error('cannotupdaterate', 'error', '', (object)array('id'=>$post->id, 'rating'=>$rating));
- }
+ $DB->update_record('forum_ratings', $oldrating);
forum_update_grades($forum, $post->userid);
}
hotpot_set_name_summary_reference($hotpot, $i);
$hotpot->reference = $hotpot->reference;
- if (!$hotpot->instance = $DB->insert_record("hotpot", $hotpot)) {
- print_error('cannotaddnewinstance', '', 'view.php?id='.$hotpot->course, $hotpot->modulename);
- }
+ $hotpot->instance = $DB->insert_record("hotpot", $hotpot);
// store (hotpot table) id of start of chain
if ($i==0) {
}
/// update course module record - from now on this instance properly exists and all function may be used
- if (!$DB->set_field('course_modules', 'instance', $id, array('id'=>$cmid))) {
- print_error('cannotaddcoursemodule');
- }
+ $DB->set_field('course_modules', 'instance', $id, array('id'=>$cmid));
/// reload scorm instance
$scorm = $DB->get_record('scorm', array('id'=>$id));
$category->parent = $parent;
$category->sortorder = 999;
$category->stamp = make_unique_id_code();
- if (!($id = $DB->insert_record('question_categories', $category))) {
- print_error("cannotcreatecategory");
- }
+ $id = $DB->insert_record('question_categories', $category);
$category->id = $id;
$parent = $id;
}
$usernew->timemodified = time();
- if (!$DB->update_record('user', $usernew)) {
- print_error('cannotupdateprofile');
- }
+ $DB->update_record('user', $usernew);
// pass a true $userold here
if (! $authplugin->user_update($user, $userform->get_data())) {
}
/// Finally we get to delete the category
- if (!$DB->delete_records('user_info_category', array('id'=>$category->id))) {
- print_error('cannotdeletecate');
- }
+ $DB->delete_records('user_info_category', array('id'=>$category->id));
profile_reorder_categories();
return true;
}
if ($dataid = $DB->get_field('user_info_data', 'id', array('userid'=>$data->userid, 'fieldid'=>$data->fieldid))) {
$data->id = $dataid;
- if (!$DB->update_record('user_info_data', $data)) {
- print_error('cannotupdatecustomprofile');
- }
+ $DB->update_record('user_info_data', $data);
} else {
$DB->insert_record('user_info_data', $data);
}