当前位置: 首页>>代码示例>>PHP>>正文


PHP JDatabaseQuery::update方法代码示例

本文整理汇总了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();
 }
开发者ID:jfquestiaux,项目名称:fabrik,代码行数:46,代码来源:fabrikcron.php

示例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.'
		);
	}
开发者ID:realityking,项目名称:joomla-platform,代码行数:28,代码来源:JDatabaseQueryTest.php


注:本文中的JDatabaseQuery::update方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。