Ejemplo n.º 1
0
 public function actionUpdateWinikalog()
 {
     $htmlPath = Yii::getAlias('@app/runtime/ikalog/winikalog.html');
     $list = $this->parseWinikalogHtml($htmlPath);
     $transaction = Yii::$app->db->beginTransaction();
     foreach ($list as $winInfo) {
         $ikalog = IkalogVersion::findOneByRevision($winInfo->revision);
         if (!$ikalog) {
             continue;
         }
         if (!($winikalog = WinikalogVersion::findOne(['revision_id' => $ikalog->id]))) {
             echo "New WinIkaLog " . $winInfo->revision . " found.\n";
             $winikalog = new WinikalogVersion();
             $winikalog->revision_id = $ikalog->id;
             $winikalog->build_at = date('Y-m-d H:i:sO', $winInfo->at);
             $winikalog->save();
         }
     }
     $transaction->commit();
 }
Ejemplo n.º 2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getRevision()
 {
     return $this->hasOne(IkalogVersion::className(), ['id' => 'revision_id']);
 }
Ejemplo n.º 3
0
 private function getIsOldCliIkalogAsAtTheTimeImpl(IkalogVersion $ikalog, $t)
 {
     if (static::$latestIkaLog === null) {
         static::$latestIkaLog = IkalogVersion::find()->andWhere(['<=', '{{ikalog_version}}.[[at]]', date('Y-m-d H:i:sP', $t)])->orderBy('{{ikalog_version}}.[[at]] DESC')->limit(1)->one();
     }
     if (static::$latestIkaLog->id === $ikalog->id) {
         // これより新しいバージョンは存在しない
         return false;
     }
     $diff = $t - strtotime($ikalog->at);
     return $diff >= 21 * 86400;
 }