本文整理汇总了PHP中unknown_type::update方法的典型用法代码示例。如果您正苦于以下问题:PHP unknown_type::update方法的具体用法?PHP unknown_type::update怎么用?PHP unknown_type::update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类unknown_type
的用法示例。
在下文中一共展示了unknown_type::update方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
/**
* Method to save records (insert or update)
* @see application/controllers/ICrudController#save()
*/
public function save(array $data, array $unlockedData)
{
try {
if (isset($this->_post->Insert)) {
$this->_model->insert($data);
} else {
$fieldKey = $this->_model->getFieldKey();
$this->_model->update($data, "{$fieldKey} = {$unlockedData[$fieldKey]}");
}
} catch (Exception $e) {
Fgsl_Session_Namespace::set('exception', $e);
$this->_redirect('error/message');
}
return true;
}
示例2: foreach
/**
* Perform term count update immediately.
*
* @since 2.5.0
*
* @param array $terms The term_taxonomy_id of terms to update.
* @param string $taxonomy The context of the term.
* @return bool Always true when complete.
*/
function update_term_count_now($terms, $taxonomy)
{
$terms = array_map('intval', $terms);
$taxonomy = $this->get_taxonomy($taxonomy);
if (!empty($taxonomy->update_count_callback)) {
call_user_func($taxonomy->update_count_callback, $terms);
} else {
// Default count updater
foreach ((array) $terms as $term) {
$count = $this->db->get_var($this->db->prepare("SELECT COUNT(*) FROM {$this->db->term_relationships} WHERE term_taxonomy_id = %d", $term));
$this->db->update($this->db->term_taxonomy, compact('count'), array('term_taxonomy_id' => $term));
}
}
$this->clean_term_cache($terms);
return true;
}
示例3: addPage
/**
* Add the specified page to the specified tree
* Remember to also call StructuredData::addWatch if you call this function
*
* @param unknown_type $dbw
* @param unknown_type $treeId
* @param unknown_type $title
* @param unknown_type $revid
* @param unknown_type $talkRevid
* @param unknown_type $dataVersion
* @param unknown_type $uid
* @param unknown_type $flags
* @return unknown
*/
public static function addPage($dbw, &$user, $treeId, $title, $revid, $talkRevid, $dataVersion = 0, $uid = '', $flags = 0)
{
$result = true;
// should this be the primary person?
// TODO get rid of this test - the primary person can be set when the user opens the tree for the first time
if ($title->getNamespace() == NS_PERSON) {
$res = $dbw->select('familytree_page', 'fp_title', array('fp_tree_id' => $treeId, 'fp_namespace' => NS_PERSON), 'FamilyTreeUtil::addPage', array('LIMIT' => 1));
if ($res === false || !$dbw->numRows($res)) {
// make this person the primary page if it's the first person
$dbw->update('familytree', array('ft_primary_namespace' => $title->getNamespace(), 'ft_primary_title' => $title->getDBkey()), array('ft_tree_id' => $treeId));
FamilyTreeUtil::deleteFamilyTreesCache($user->getName());
$errno = $dbw->lastErrno();
if ($errno > 0) {
$result = false;
}
}
$dbw->freeResult($res);
}
// insert familytree_page
$record = array('fp_tree_id' => $treeId, 'fp_user_id' => $user->getID(), 'fp_namespace' => $title->getNamespace(), 'fp_title' => $title->getDBkey(), 'fp_oldid' => $revid, 'fp_latest' => $revid, 'fp_talk_oldid' => $talkRevid, 'fp_talk_latest' => $talkRevid, 'fp_data_version' => $dataVersion, 'fp_uid' => $uid, 'fp_flags' => $flags);
$dbw->insert('familytree_page', $record, 'FamilyTreeUtil::addPage', array('ignore'));
$errno = $dbw->lastErrno();
if ($errno != 0 && $errno != 1062) {
// 1062 = duplicate key
$result = false;
}
return $result;
}