function WT_ResetStatus() { if (!WT_IPC_CheckLogin()) { return; } db_update('tester_solutions', array('status' => 0), '`status`=1'); }
/** * Implements Drupal\configuration\Config\Configuration::saveToActiveStore(). */ public function saveToActiveStore(ConfigIteratorSettings &$settings) { ctools_include('export'); $object = ctools_export_crud_load($this->getComponent(), $this->getIdentifier()); if ($object) { ctools_export_crud_delete($this->getComponent(), $object); } $data = $this->getData(); $data->export_type = NULL; // get title_pane key if configured. if (isset($data->conf['display']->title_pane)) { $title_pane = $data->conf['display']->title_pane; } $display = panels_save_display($data->conf['display']); // title_pane configuration workaround. if (isset($display->content[$title_pane])) { $pid = $display->content[$title_pane]->pid; $display->{$title_pane} = $pid; db_update('panels_display')->fields(array('title_pane' => $pid))->condition('did', $display->did)->execute(); } $data->conf['did'] = $data->conf['display']->did; unset($data->conf['display']); ctools_export_crud_save($this->getComponent(), $data); $settings->addInfo('imported', $this->getUniqueId()); }
/** * Actually removes the record IF there are no records referencing this user. * If records do reference it, then only marks it inactive. */ function updateDatabase($myvalues) { $bHasReferences = UserInfo::userIsReferenced($this->m_nUID); $feedback = NULL; if ($bHasReferences) { $updated_dt = date("Y-m-d H:i", time()); $nUpdated = db_update('raptor_user_profile')->fields(array('accountactive_yn' => 0, 'updated_dt' => $updated_dt))->condition('uid', $this->m_nUID, '=')->execute(); if ($nUpdated !== 1) { error_log("Failed to edit user back to database!\n" . var_dump($myvalues)); die("Failed to edit user back to database!\n" . var_dump($myvalues)); } $feedback = 'Marked user as inactive instead of deleted because referenced by other records.'; } else { //Delete all the child records first. $num_deleted = db_delete('raptor_user_modality')->condition('uid', $this->m_nUID, '=')->execute(); $num_deleted = db_delete('raptor_user_anatomy')->condition('uid', $this->m_nUID, '=')->execute(); $num_deleted = db_delete('raptor_user_group_membership')->condition('uid', $this->m_nUID, '=')->execute(); //Now delete the profile. $num_deleted = db_delete('raptor_user_profile')->condition('uid', $this->m_nUID, '=')->execute(); if ($this->m_nUID == 1) { //Do NOT delete this drupal user or will be very unhappy! error_log('Removed user 1 from RAPTOR but left it alone in Drupal users table.'); $feedback = 'Removed user from RAPTOR system.'; } else { //Now delete the Drupal user. $num_deleted = db_delete('users')->condition('uid', $this->m_nUID, '=')->execute(); $feedback = 'Removed the ADMIN user from RAPTOR system.'; } } drupal_set_message($feedback); return 1; }
public function release($item_id) { // @TODO - try... catch... drupal_set_message("Released queue item " . $item_id); db_update('queue')->condition('item_id', $item_id)->fields(array('expire' => 0))->execute(); return TRUE; }
public function put($id = false) { $result = jsonSrc(); if ($id) { $updatePage['author'] = false; $updatePage['update'] = time(); $updatePage['url'] = $this->input->post('url'); $updatePage['title'] = $this->input->post('title'); $updatePage['title_en'] = $this->input->post('title_en'); $updatePage['excerpt'] = $this->input->post('excerpt'); $updatePage['excerpt_en'] = $this->input->post('excerpt_en'); $updatePage['content'] = $this->input->post('content'); $updatePage['content_en'] = $this->input->post('content_en'); $updatePage['meta_key'] = $this->input->post('meta_key'); $updatePage['meta_key_en'] = $this->input->post('meta_key_en'); $updatePage['meta_desc'] = $this->input->post('meta_desc'); $updatePage['meta_desc_en'] = $this->input->post('meta_desc_en'); $updatePage['template'] = $this->input->post('template'); $updatePage['image'] = $this->input->post('image'); $updatePage['image2'] = $this->input->post('image2'); $updatePage['status'] = $this->input->post('status'); $updatePage['tag'] = $this->input->post('tag'); if ($this->input->post('pengumuman')) { $updatePage['catid'] = 9; } else { $updatePage['catid'] = 0; } $updatePage['type'] = 'news'; db_update('page', array('id' => $id), $updatePage); $result['resultCode'] = 1000; $result['resultMsg'] = "Success !!"; } return $result; }
function edit($id = false) { if (empty($_POST)) { $category = db_read('category'); if (!$category) { redirect(base_url('admin/category/add')); } if (!$id) { $id = $category->id; } $view['blogs'] = db_reads('page', array('type' => 'blog', 'catid' => $id)); $view['categories'] = db_reads('category', array('type' => 'blog')); $view['category'] = db_read('category', array('id' => $id, 'type' => 'blog')); $this->load->view(tpldir('admin/category/edit_view'), $view); } else { $result = jsonSrc(); $id = $this->input->post('id'); $updatecat['name'] = $this->input->post('name'); db_update('category', array('id' => $id), $updatecat); $result['resultCode'] = 1000; $result['resultMsg'] = "Success!!"; $result['resultData']['openUrl'] = base_url('admin/category/edit/' . $id); echo json_encode($result); } }
/** * Tests that the table sorting works on the content admin pages. */ function testContentAdminSort() { $this->drupalLogin($this->adminUser); $changed = REQUEST_TIME; foreach (array('dd', 'aa', 'DD', 'bb', 'cc', 'CC', 'AA', 'BB') as $prefix) { $changed += 1000; $node = $this->drupalCreateNode(array('title' => $prefix . $this->randomMachineName(6))); db_update('node_field_data')->fields(array('changed' => $changed))->condition('nid', $node->id())->execute(); } // Test that the default sort by node.changed DESC actually fires properly. $nodes_query = db_select('node_field_data', 'n')->fields('n', array('title'))->orderBy('changed', 'DESC')->execute()->fetchCol(); $this->drupalGet('admin/content'); foreach ($nodes_query as $delta => $string) { $elements = $this->xpath('//table[contains(@class, :class)]/tbody/tr[' . ($delta + 1) . ']/td[2]/a[normalize-space(text())=:label]', array(':class' => 'views-table', ':label' => $string)); $this->assertTrue(!empty($elements), 'The node was found in the correct order.'); } // Compare the rendered HTML node list to a query for the nodes ordered by // title to account for possible database-dependent sort order. $nodes_query = db_select('node_field_data', 'n')->fields('n', array('title'))->orderBy('title')->execute()->fetchCol(); $this->drupalGet('admin/content', array('query' => array('sort' => 'asc', 'order' => 'title'))); foreach ($nodes_query as $delta => $string) { $elements = $this->xpath('//table[contains(@class, :class)]/tbody/tr[' . ($delta + 1) . ']/td[2]/a[normalize-space(text())=:label]', array(':class' => 'views-table', ':label' => $string)); $this->assertTrue(!empty($elements), 'The node was found in the correct order.'); } }
static function ajax_store_vote($folder, $votes) { self::_require_access($folder, "read"); if (empty($votes) or !is_array($votes)) { return ""; } foreach ($votes as $qid => $vote_elems) { if (!is_array($vote_elems) or implode("", $vote_elems) == "") { continue; } $row = db_select_first("simple_surveys", "answers,votedby", "id=@id@", "", array("id" => $qid)); if (empty($row)) { continue; } $answers = json_decode($row["answers"], true); $votedby = json_decode($row["votedby"], true); $id = self::_get_voter_id(); if (isset($votedby[$id])) { exit("{t}Already voted.{/t} (" . $qid . ")"); } foreach ($vote_elems as $vote_elem) { if ($vote_elem == "") { continue; } if (!isset($answers[$vote_elem])) { $answers[$vote_elem] = 0; } $answers[$vote_elem]++; } $votedby[$id] = 0; db_update("simple_surveys", array("votedby" => json_encode($votedby), "answers" => json_encode($answers)), array("id=@id@"), array("id" => $qid)); } return $folder; }
/** * Act on user account cancellations. * * The user account is being canceled. Depending on the account cancellation * method, the module should either do nothing, unpublish content, anonymize * content, or delete content and data belonging to the canceled user account. * * Expensive operations should be added to the global batch with batch_set(). * * @param $edit * The array of form values submitted by the user. * @param $account * The user object on which the operation is being performed. * @param $method * The account cancellation method. * * @see user_cancel_methods() * @see hook_user_cancel_methods_alter() * @see user_cancel() */ function hook_user_cancel($edit, $account, $method) { switch ($method) { case 'user_cancel_block_unpublish': // Unpublish nodes (current revisions). module_load_include('inc', 'node', 'node.admin'); $nodes = db_select('node', 'n')->fields('n', array('nid'))->condition('uid', $account->uid)->execute()->fetchCol(); node_mass_update($nodes, array('status' => 0)); break; case 'user_cancel_reassign': // Anonymize nodes (current revisions). module_load_include('inc', 'node', 'node.admin'); $nodes = db_select('node', 'n')->fields('n', array('nid'))->condition('uid', $account->uid)->execute()->fetchCol(); node_mass_update($nodes, array('uid' => 0)); // Anonymize old revisions. db_update('node_revision')->fields(array('uid' => 0))->condition('uid', $account->uid)->execute(); // Clean history. db_delete('history')->condition('uid', $account->uid)->execute(); break; case 'user_cancel_delete': // Delete nodes (current revisions). $nodes = db_select('node', 'n')->fields('n', array('nid'))->condition('uid', $account->uid)->execute()->fetchCol(); foreach ($nodes as $nid) { node_delete($nid); } // Delete old revisions. db_delete('node_revision')->condition('uid', $account->uid)->execute(); // Clean history. db_delete('history')->condition('uid', $account->uid)->execute(); break; } }
function send() { global $keystring, $login, $email; $hash = md5('#RANDOM_PREFIX#' . mtime() . '#RANDOM_SEPARATOR#' . $login . '#WITH#' . $email . '#RANDOM_SUFFIX#'); if ($_SESSION['CAPTCHA_Keystring'] == '' || strtolower($keystring) != $_SESSION['CAPTCHA_Keystring']) { add_info('Вы не прошли тест Тьюринга на подтверждение того, что вы не бот.'); return false; } $r = db_row_value('user', "(`login` =\"{$login}\") AND (`email`=\"{$email}\") AND (`authorized`=1)"); if ($r['id'] == '') { add_info('Неверное сочетание login <-> email'); return false; } $s = unserialize($r['settings']); if ($s['restore_timestamp'] && time() - $s['restore_timestamp'] < config_get('restore-timeout')) { add_info('Вы не можете просить восстановку пароля так часто'); return false; } $s['restore_hash'] = $hash; $s['restore_timestamp'] = time(); db_update('user', array('settings' => db_string(serialize($s))), '`id`=' . $r['id']); $link = config_get('http-document-root') . '/login/restore/confirm/?id=' . $r['id'] . '&hash=' . $hash; sendmail_tpl(stripslashes($email), 'Восстановление пароля в системе ' . config_get('site-name'), 'restore', array('login' => stripslashes($login), 'email' => stripslashes($email), 'link' => $link)); return true; }
public function put($id = false) { $result = jsonSrc(); if ($id) { $updatePage['date'] = strtotime($this->input->post('date')); $updatePage['url'] = $this->input->post('url'); $updatePage['title'] = $this->input->post('title'); $updatePage['title_en'] = $this->input->post('title_en'); $updatePage['excerpt'] = $this->input->post('excerpt'); $updatePage['excerpt_en'] = $this->input->post('excerpt_en'); $updatePage['content'] = $this->input->post('content'); $updatePage['content_en'] = $this->input->post('content_en'); $updatePage['meta_key'] = $this->input->post('meta_key'); $updatePage['meta_key_en'] = $this->input->post('meta_key_en'); $updatePage['meta_desc'] = $this->input->post('meta_desc'); $updatePage['meta_desc_en'] = $this->input->post('meta_desc_en'); $updatePage['template'] = $this->input->post('template'); $updatePage['image'] = $this->input->post('image'); $updatePage['status'] = $this->input->post('status'); $updatePage['type'] = 'event'; db_update('page', array('id' => $id), $updatePage); $result['resultCode'] = 1000; $result['resultMsg'] = "Success !!"; } return $result; }
/** * Tests running "update items" from 'admin/config/services/aggregator' page. */ public function testUpdateFeedItem() { $this->createSampleNodes(); // Create a feed and test updating feed items if possible. $feed = $this->createFeed(); if (!empty($feed)) { $this->updateFeedItems($feed, $this->getDefaultFeedItemCount()); $this->deleteFeedItems($feed); } // Delete feed. $this->deleteFeed($feed); // Test updating feed items without valid timestamp information. $edit = array('title[0][value]' => "Feed without publish timestamp", 'url[0][value]' => $this->getRSS091Sample()); $this->drupalGet($edit['url[0][value]']); $this->assertResponse(200); $this->drupalPostForm('aggregator/sources/add', $edit, t('Save')); $this->assertRaw(t('The feed %name has been added.', array('%name' => $edit['title[0][value]'])), format_string('The feed @name has been added.', array('@name' => $edit['title[0][value]']))); $fid = db_query("SELECT fid FROM {aggregator_feed} WHERE url = :url", array(':url' => $edit['url[0][value]']))->fetchField(); $feed = Feed::load($fid); $feed->refreshItems(); $before = db_query('SELECT timestamp FROM {aggregator_item} WHERE fid = :fid', array(':fid' => $feed->id()))->fetchField(); // Sleep for 3 second. sleep(3); db_update('aggregator_feed')->condition('fid', $feed->id())->fields(array('checked' => 0, 'hash' => '', 'etag' => '', 'modified' => 0))->execute(); $feed->refreshItems(); $after = db_query('SELECT timestamp FROM {aggregator_item} WHERE fid = :fid', array(':fid' => $feed->id()))->fetchField(); $this->assertTrue($before === $after, format_string('Publish timestamp of feed item was not updated (@before === @after)', array('@before' => $before, '@after' => $after))); // Make sure updating items works even after uninstalling a module // that provides the selected plugins. $this->enableTestPlugins(); $this->container->get('module_installer')->uninstall(array('aggregator_test')); $this->updateFeedItems($feed); $this->assertResponse(200); }
function api_graph_template_suggested_values_save($graph_template_id, $_fields_suggested_values) { require_once(CACTI_BASE_PATH . "/lib/sys/sequence.php"); /* sanity checks */ validate_id_die($graph_template_id, "graph_template_id"); /* insert the new custom field values */ if (is_array($_fields_suggested_values) > 0) { foreach ($_fields_suggested_values as $field_name => $field_array) { foreach ($field_array as $field_item) { if (empty($field_item["id"])) { db_insert("graph_template_suggested_value", array( "id" => array("type" => DB_TYPE_INTEGER, "value" => "0"), "graph_template_id" => array("type" => DB_TYPE_INTEGER, "value" => $graph_template_id), "field_name" => array("type" => DB_TYPE_STRING, "value" => $field_name), "value" => array("type" => DB_TYPE_STRING, "value" => $field_item["value"]), "sequence" => array("type" => DB_TYPE_INTEGER, "value" => seq_get_current(0, "sequence", "graph_template_suggested_value", "graph_template_id = " . sql_sanitize($graph_template_id) . " and field_name = '" . sql_sanitize($field_name) . "'")) ), array("id")); }else{ db_update("graph_template_suggested_value", array( "id" => array("type" => DB_TYPE_INTEGER, "value" => $field_item["id"]), "value" => array("type" => DB_TYPE_STRING, "value" => $field_item["value"]) ), array("id")); } } } } }
function bill_detail() { $data = array(); $user = adminLogged(); if (!adminLogged()) { redirect('/index.php?c=admin&m=login'); } else { $bill_detail = model('bill')->getBillDetails($_GET['id']); $data['total'] = 0; foreach ($bill_detail as $key => $b) { $book = model('book')->getSingle($b['book_id']); $bill_detail[$key]['name'] = $book['name']; $bill_detail[$key]['price'] = intval($book['price']); $bill_detail[$key]['total'] = $book['price'] * $b['quantity']; $bill_detail[$key]['image'] = $book['image']; $data['total'] += $book['price'] * $b['quantity']; } $data['bill_detail'] = $bill_detail; } $data['statuses'] = array('Chờ duyệt', 'Đang giao hàng', 'Đã giao hàng', 'Hủy'); $data['stt'] = model('bill')->getOneBy($_GET['id'], null)['status']; if (isPostRequest()) { $postData = postData(); db_update('bills', $postData, 'id=' . $_GET['id']); $data['stt'] = $postData['status']; $data['error'] = 'Tình trạng đơn hàng update thành công.'; } $data['user'] = model('user')->getOneBy(model('bill')->getOneBy($_GET['id'], null)['user_id'], null); $data['template_file'] = 'bill/detail.php'; render('layout.php', $data); }
function update_db_user_projects($user, $project, $is_frozen) { if (!$is_frozen) { $is_frozen = '0'; } db_update('flat_deposit_ui_project_info')->fields(array('is_frozen' => $is_frozen))->condition('user_id', $user)->condition('pname', $project)->execute(); }
/** * Write the values into the database. * @param type associative array where 'username' MUST be one of the values so we know what record to update. */ function updateDatabase($form, $myvalues) { $bHappy = TRUE; //Assume no problems. $protocol_shortname = $this->m_protocol_shortname; try { //First copy values for the existing record into the raptor_protocol_lib_replaced table $this->m_oPageHelper->copyProtocolLibToReplacedTable($protocol_shortname); //Now prepare the change the existing record. $yn_attribs = isset($myvalues['yn_attribs']) ? $myvalues['yn_attribs'] : array(); $contrast_yn = isset($yn_attribs['C']) && $yn_attribs['C'] === 'C' ? 1 : 0; $image_guided_yn = isset($yn_attribs['IG']) && $yn_attribs['IG'] === 'IG' ? 1 : 0; $radioisotope_yn = isset($yn_attribs['RI']) && $yn_attribs['RI'] === 'RI' ? 1 : 0; $sedation_yn = isset($yn_attribs['S']) && $yn_attribs['S'] === 'S' ? 1 : 0; $active_yn = 1; $multievent_yn = 0; $updated_dt = date("Y-m-d H:i", time()); $nUpdated = db_update('raptor_protocol_lib')->fields(array('name' => $myvalues['name'], 'version' => $myvalues['version'], 'modality_abbr' => $myvalues['modality_abbr'], 'service_nm' => '', 'lowerbound_weight' => $myvalues['lowerbound_weight'], 'upperbound_weight' => $myvalues['upperbound_weight'], 'image_guided_yn' => $image_guided_yn, 'contrast_yn' => $contrast_yn, 'radioisotope_yn' => $radioisotope_yn, 'sedation_yn' => $sedation_yn, 'multievent_yn' => $multievent_yn, 'filename' => $myvalues['filename'], 'active_yn' => $active_yn, 'updated_dt' => $updated_dt))->condition('protocol_shortname', $protocol_shortname, '=')->execute(); } catch (\Exception $ex) { error_log("Failed to save protocol into database!\n" . print_r($myvalues, TRUE) . '>>>' . print_r($ex, TRUE)); drupal_set_message('Failed to save the new protocol because ' . $ex, 'error'); return 0; } //Now write all the child records $bHappy = $this->m_oPageHelper->writeChildRecords($protocol_shortname, $myvalues, TRUE); //Returns 1 if everything was okay drupal_set_message('Saved changes to protocol ' . $protocol_shortname); return $bHappy; }
/** * {@inheritdoc} */ public function submitForm(array &$form, FormStateInterface $form_state) { foreach ($form_state->getValue('options') as $oid => $option) { db_update('uc_attribute_options')->fields(array('ordering' => $option['ordering']))->condition('oid', $oid)->execute(); } drupal_set_message($this->t('The changes have been saved.')); }
/** * Refresh global user data following the actual session state. */ protected function updateUser() { global $user; $uid = $this->getSessionUid(); if (!empty($uid)) { $user = db_query("SELECT u.* FROM {users} u WHERE u.uid = :uid", array(':uid' => $uid))->fetchObject(); if (1 == $user->status) { $user->data = unserialize($user->data); $user->roles = array(); $user->roles[DRUPAL_AUTHENTICATED_RID] = 'authenticated user'; $user->roles += db_query("SELECT r.rid, r.name FROM {role} r INNER JOIN {users_roles} ur ON ur.rid = r.rid WHERE ur.uid = :uid", array(':uid' => $user->uid))->fetchAllKeyed(0, 1); } else { $user = drupal_anonymous_user(); } } else { $user = drupal_anonymous_user(); } // The 'session' attribute is an insanity and should be removed. $user->session = ''; $user->timestamp = REQUEST_TIME; // Avoid some PHP warnings with backends using it (mongodb module does // check it). Some backends may set this variable, if they keep it, some // other won't. if (!isset($user->cache)) { $user->cache = 0; } // Do not update access time more than once per 180 seconds. Also check // for an active database connection: actual core will have one, but in // the late future we may have session handling without database at all. if (!$this->userAccessUpdated && Database::isActiveConnection() && $user->uid && REQUEST_TIME - $user->access > variable_get('session_write_interval', 180)) { db_update('users')->fields(array('access' => REQUEST_TIME))->condition('uid', $user->uid)->execute(); $this->userAccessUpdated = TRUE; } }
/** * Tries deleting a file that is in use. */ function testInUse() { $file = $this->createFile(); $file_usage = $this->container->get('file.usage'); $file_usage->add($file, 'testing', 'test', 1); $file_usage->add($file, 'testing', 'test', 1); $file_usage->delete($file, 'testing', 'test', 1); $usage = $file_usage->listUsage($file); $this->assertEqual($usage['testing']['test'], array(1 => 1), 'Test file is still in use.'); $this->assertTrue(file_exists($file->getFileUri()), 'File still exists on the disk.'); $this->assertTrue(File::load($file->id()), 'File still exists in the database.'); // Clear out the call to hook_file_load(). file_test_reset(); $file_usage->delete($file, 'testing', 'test', 1); $usage = $file_usage->listUsage($file); $this->assertFileHooksCalled(array('load', 'update')); $this->assertTrue(empty($usage), 'File usage data was removed.'); $this->assertTrue(file_exists($file->getFileUri()), 'File still exists on the disk.'); $file = File::load($file->id()); $this->assertTrue($file, 'File still exists in the database.'); $this->assertTrue($file->isTemporary(), 'File is temporary.'); file_test_reset(); // Call file_cron() to clean up the file. Make sure the changed timestamp // of the file is older than the system.file.temporary_maximum_age // configuration value. db_update('file_managed')->fields(array('changed' => REQUEST_TIME - ($this->config('system.file')->get('temporary_maximum_age') + 1)))->condition('fid', $file->id())->execute(); \Drupal::service('cron')->run(); // file_cron() loads $this->assertFileHooksCalled(array('delete')); $this->assertFalse(file_exists($file->getFileUri()), 'File has been deleted after its last usage was removed.'); $this->assertFalse(File::load($file->id()), 'File was removed from the database.'); }
/** * Confirms that we can update two blob columns in the same table. */ function testUpdateMultipleBlob() { $id = db_insert('test_two_blobs')->fields(array('blob1' => 'This is', 'blob2' => 'a test'))->execute(); db_update('test_two_blobs')->condition('id', $id)->fields(array('blob1' => 'and so', 'blob2' => 'is this'))->execute(); $r = db_query('SELECT * FROM {test_two_blobs} WHERE id = :id', array(':id' => $id))->fetchAssoc(); $this->assertTrue($r['blob1'] === 'and so' && $r['blob2'] === 'is this', 'Can update multiple blobs per row.'); }
function update($table = NULL) { if (!$table) { $table = $GLOBALS['table']; } $id = format_int($_REQUEST['id']); db_update($table, fields($table), values($table), "where id={$id}"); }
/** * Function to update records in the checkbook_api table * * @param CheckbookAPIEntity $checkbookAPI * @return \DatabaseStatementInterface */ public function updateCheckbookAPI(CheckbookAPIEntity $checkbookAPI) { // Remove any null properties $fields = array_filter((array) $checkbookAPI); $db_update_query = db_update("checkbook_api")->fields($fields)->condition('api_id', $checkbookAPI->api_id); $rows_affected = $db_update_query->execute(); return $rows_affected; }
protected function update() { $stmt = db_update(static::$table); foreach (static::$key as $key) { $stmt->condition($key, $this->{$key}); } $stmt->fields($this->values(static::$values))->execute(); }
public function submit($form, &$form_state) { foreach ($form_state['values']['remotes'] as $id => $data) { if (is_array($data) && isset($data['weight'])) { \db_update('publisher_remotes')->fields(array('weight' => $data['weight']))->condition('rid', $id)->execute(); } } \drupal_set_message(t('The order of the remotes has been saved.')); }
protected function backendUpdate($options) { if (empty($this->blob_hash)) { // blob hash is empty at deleting a file db_delete('versioncontrol_git_item_revisions')->condition('item_revision_id', $this->item_revision_id)->execute(); return; } db_update('versioncontrol_git_item_revisions')->fields(array('blob_hash' => $this->blob_hash))->condition('item_revision_id', $this->item_revision_id)->execute(); }
function churchwiki_setShowonstartpage($params) { $i = new CTInterface(); $i->setParam("doc_id"); $i->setParam("version_no"); $i->setParam("wikicategory_id"); $i->setParam("auf_startseite_yn"); db_update("cc_wiki")->fields($i->getDBInsertArrayFromParams($params))->condition("doc_id", $params["doc_id"], "=")->condition("version_no", $params["version_no"], "=")->condition("wikicategory_id", $params["wikicategory_id"], "=")->execute(false); }
/** * Update an entry in the database. * */ public static function update($entry = array()) { try { $count = db_update('ea_contact_method_values')->fields($entry)->condition('cmvid', $entry['cmvid'])->execute(); } catch (\Exception $e) { drupal_set_message(t('db_update failed. Message = %message, query= %query', array('%message' => $e->getMessage(), '%query' => $e->query_string)), 'error'); } return $count; }
public function update($data) { $fields = $this->arrayFields($data); $tuples = array(); foreach ($fields as $key => $value) { $tuples[] = $key . "='" . $value . "'"; } return db_update(TBL_PREFIX . TBL_HYPERNOTES, implode(",", $tuples), "record_id='" . $this->id . "'"); }
function insert_node(&$h) { global $glob; $h['nid'] = db_insert('node')->fields(array('type' => 'data_catalog', 'language' => 'und', 'title' => $h['title'], 'uid' => $glob['uid'], 'created' => $glob['time'], 'changed' => $glob['time'], 'comment' => 1, 'promote' => 1))->execute(); record_massupload_data('node', 'nid=' . $h['nid']); $h['vid'] = db_insert('node_revision')->fields(array('nid' => $h['nid'], 'uid' => $glob['uid'], 'title' => $h['title'], 'log' => '', 'timestamp' => $glob['time'], 'comment' => 1, 'promote' => 1))->execute(); record_massupload_data('node_revision', 'nid=' . $h['nid']); db_update('node')->fields(array('vid' => $h['vid']))->condition('nid', $h['nid'])->execute(); }
function session_touch($length = false) { if (!$length) { $length = db_get_value('wfpl_sessions', 'length', 'where id=%i', $GLOBALS['session_id']); } $expires = time() + $length; header('Set-Cookie: session_key=' . $GLOBALS['session_key']); db_update('wfpl_sessions', 'expires', $expires, 'where id=%i', $GLOBALS['session_id']); }