backend/controllers/HashfilesController.php
/**
     * Updates an existing Hashfiles model.
     * If update is successful, the browser will be redirected to the 'view' page.
     * @param integer $id
     * @return mixed
     */
Updates an existing Hashfiles model.
If update is successful, the browser will be redirected to the 'view' page.
@param integer $id
@return mixed
Updates an existing Hashfiles model . If update is successful the browser will be redirected to the ' view ' page . @param integer $id @return mixed
public function actionUpdate($id)
    {
        $model = $this->findModel($id);
        if ($model->load(Yii::$app->request->post()) && $model->save()) {
            return $this->redirect(['view', 'id' => $model->hashfile_id]);
        } else {
            if($model->hashfile_usestatus=='unused'){
                $res=$this->findProjectName($model->hashfile_project_id);
                $path=$res->project_path;
                $repo=new Git($path);
                $param="-1 Dev";
                $results=$repo->getHash($begin=null,$end=null,$author=null,$n=null,$param);
                foreach ($results as $result){
                    if($model->hashfile_newhash<>$result[0]){
                        $model->hashfile_newhash=$result[0];
                    }
                }
            }
            return $this->render('update', [
                'model' => $model,
            ]);
        }
    }
public function actionUpdate ( $ id ) { $ model = $ this -> findModel ( $ id ) ; if ( $ model -> load ( Yii :: $ app -> request -> post ( ) ) && $ model -> save ( ) ) { return $ this -> redirect ( [ 'view' , 'id' => $ model -> hashfile_id ] ) ; } else { if ( $ model -> hashfile_usestatus == 'unused' ) { $ res = $ this -> findProjectName ( $ model -> hashfile_project_id ) ; $ path = $ res -> project_path ; $ repo = new Git ( $ path ) ; $ param = " -1 Dev " ; $ results = $ repo -> getHash ( $ begin = null , $ end = null , $ author = null , $ n = null , $ param ) ; foreach ( $ results as $ result ) { if ( $ model -> hashfile_newhash <> $ result [ 0 ] ) { $ model -> hashfile_newhash = $ result [ 0 ] ; } } } return $ this -> render ( 'update' , [ 'model' => $ model , ] ) ; } }
Updates an existing Hashfiles model.
Updates an existing Hashfiles model .
//鑾峰彇椤圭洰绔鍛�鐨勮矾寰� //鏇村姞璺緞鑾峰彇鏈�鏂扮殑Dev浠ｇ爜 //26001d71d88983410545cda7f02d7f73f39523f1