本文整理汇总了PHP中Mage_Index_Model_Process::getId方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Index_Model_Process::getId方法的具体用法?PHP Mage_Index_Model_Process::getId怎么用?PHP Mage_Index_Model_Process::getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Index_Model_Process
的用法示例。
在下文中一共展示了Mage_Index_Model_Process::getId方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
protected function setUp()
{
$this->_objectManager = Mage::getObjectManager();
// get existing indexer process
$this->_model = $this->_objectManager->create('Mage_Index_Model_Process');
$this->_model->load(self::INDEXER_CODE, 'indexer_code');
if ($this->_model->isObjectNew()) {
$this->markTestIncomplete('Can\'t run test without ' . self::INDEXER_CODE . ' indexer.');
}
// get new process file instance for current indexer
/** @var $lockStorage Mage_Index_Model_Lock_Storage */
$lockStorage = $this->_objectManager->create('Mage_Index_Model_Lock_Storage');
$this->_processFile = $lockStorage->getFile($this->_model->getId());
}
示例2: setDataFromProcess
/**
* Set start time and end time based on current process data
*
* @param Mage_Index_Model_Process $process
* @return $this
*/
public function setDataFromProcess(Mage_Index_Model_Process $process)
{
$startTime = new DateTime($process->getStartedAt());
$endTime = new DateTime($process->getEndedAt());
$runningTime = $endTime->getTimestamp() - $startTime->getTimestamp();
$this->setData(array('process_id' => $process->getId(), 'started_at' => $process->getStartedAt(), 'ended_at' => $process->getEndedAt(), 'running_time' => $runningTime));
return $this;
}
示例3: addProcessFilter
/**
* Add filter by process and status to events collection
*
* @param int|array|Mage_Index_Model_Process $process
* @param string $status
* @return Mage_Index_Model_Resource_Event_Collection
*/
public function addProcessFilter($process, $status = null)
{
$this->_joinProcessEventTable();
if ($process instanceof Mage_Index_Model_Process) {
$this->addFieldToFilter('process_event.process_id', $process->getId());
} elseif (is_array($process) && !empty($process)) {
$this->addFieldToFilter('process_event.process_id', array('in' => $process));
} else {
$this->addFieldToFilter('process_event.process_id', $process);
}
if ($status !== null) {
$this->addFieldToFilter('process_event.status', $status);
}
return $this;
}
示例4: updateProcessEndDate
/**
* Update process end date
*
* @param Mage_Index_Model_Process $process
* @return Mage_Index_Model_Resource_Process
*/
public function updateProcessEndDate(Mage_Index_Model_Process $process)
{
$this->_updateProcessData($process->getId(), array('ended_at' => $this->formatDate(time())));
return $this;
}
示例5: startProcess
/**
* Register process start
*
* @param Mage_Index_Model_Process $process
* @return Mage_Index_Model_Mysql4_Process
*/
public function startProcess(Mage_Index_Model_Process $process)
{
$data = array('status' => Mage_Index_Model_Process::STATUS_RUNNING, 'started_at' => $this->formatDate(time()));
$this->_getWriteAdapter()->update($this->getMainTable(), $data, $this->_getWriteAdapter()->quoteInto('process_id=?', $process->getId()));
return $this;
}
示例6: updateStatus
/**
* Update process status field
*
*
* @param Mage_Index_Model_Process $process
* @param string $status
* @return Mage_Index_Model_Resource_Process
*/
public function updateStatus($process, $status)
{
$data = array('status' => $status);
$this->_updateProcessData($process->getId(), $data);
return $this;
}
示例7: getUnprocessedEvents
/**
* Retrieve unprocessed events list by specified process
*
* @param Mage_Index_Model_Process $process
* @return array
*/
public function getUnprocessedEvents($process)
{
$select = $this->_getReadAdapter()->select()->from($this->getTable('index/process_event'))->where('process_id = ?', $process->getId())->where('status = ?', Mage_Index_Model_Process::EVENT_STATUS_NEW);
return $this->_getReadAdapter()->fetchAll($select);
}
示例8: getRowUrl
/**
* Get row edit url
*
* @param Mage_Index_Model_Process $row
*
* @return string
*/
public function getRowUrl($row)
{
return $this->getUrl('*/*/edit', array('process' => $row->getId()));
}
示例9: getRowUrl
/**
* Get row edit url
*
* @param Mage_Index_Model_Process $row
*
* @return string
*/
public function getRowUrl($row)
{
if (!$row->isEnterpriseProcess()) {
return $this->getUrl('*/*/edit', array('process' => $row->getId()));
}
return '';
}
示例10: getProgress
public function getProgress(Mage_Index_Model_Process $process)
{
$avgTime = Mage::getModel('hackathon_indexerstats_resource/history')->getAvg($process->getId());
$currentTime = new DateTime();
$startTime = new DateTime($process->getStartedAt());
$estimatedEndTime = new DateTime($process->getStartedAt());
$estimatedEndTime->add(new DateInterval('PT' . $avgTime . 'S'));
$processDiff = $currentTime->getTimestamp() - $startTime->getTimestamp();
if ($avgTime == 0) {
return 1;
}
return $processDiff / $avgTime;
}