public function getTaskInfo($taskName) { Yii::import('site.common.components.cron.*'); /** @var CActiveRecord $owner */ $owner = $this->getOwner(); $modelName = get_class($owner); return CronTask::model()->findByAttributes(array('ownerModel' => $modelName, 'ownerId' => $owner->primaryKey, 'taskName' => $taskName)); }
function __shutdown() { $outStr = ob_get_contents(); ob_end_clean(); if (CronTask::$uniqKey) { $cronTask = CronTask::model()->findByAttributes(array('uniqKey' => CronTask::$uniqKey)); if ($cronTask) { $cronTask->executeTimestamp = date('Y-m-d H:i:s', CronTask::$executeTimestamp); $cronTask->executeOut = $outStr; $cronTask->save(); } } echo 'all out string:' . $outStr; }