本文整理汇总了PHP中JDatabaseQuery::update方法的典型用法代码示例。如果您正苦于以下问题:PHP JDatabaseQuery::update方法的具体用法?PHP JDatabaseQuery::update怎么用?PHP JDatabaseQuery::update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JDatabaseQuery
的用法示例。
在下文中一共展示了JDatabaseQuery::update方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: reschedule
/**
* Reschedule the plugin for next run, and republish
*
*
* @return void
*/
protected function reschedule()
{
$now = JFactory::getDate();
$now = $now->toUnix();
$new = JFactory::getDate($this->row->nextrun);
$tmp = $new->toUnix();
switch ($this->row->unit) {
case 'second':
$inc = 1;
break;
case 'minute':
$inc = 60;
break;
case 'hour':
$inc = 60 * 60;
break;
default:
case 'day':
$inc = 60 * 60 * 24;
break;
}
while ($tmp + $inc * $this->row->frequency < $now) {
$tmp = $tmp + $inc * $this->row->frequency;
}
// Mark them as being run
$nextRun = JFactory::getDate($tmp);
$this->query->clear();
$this->query->update('#__{package}_cron');
$this->query->set('lastrun = ' . $this->db->quote($nextRun->toSql()));
if ($this->pluginModel->shouldReschedule() && $this->pluginModel->doRunGating()) {
$this->query->set("published = '1'");
}
if (!$this->pluginModel->shouldReschedule()) {
$this->query->set("published = '0'");
$this->log->message .= "\nPlugin has unpublished itself";
}
$this->query->where('id = ' . $this->row->id);
$this->db->setQuery($this->query);
$this->db->execute();
}
示例2: testUpdate
/**
* Tests the JDatabaseQuery::update method.
*
* @return void
*
* @covers JDatabaseQuery::update
* @since 11.3
*/
public function testUpdate()
{
$this->assertThat(
$this->_instance->update('#__foo'),
$this->identicalTo($this->_instance),
'Tests chaining.'
);
$this->assertThat(
$this->_instance->type,
$this->equalTo('update'),
'Tests the type property is set correctly.'
);
$this->assertThat(
trim($this->_instance->update),
$this->equalTo('UPDATE #__foo'),
'Tests the update element is set correctly.'
);
}