src/Slashworks/AppBundle/Controller/RemoteAppController.php
public function initInstallCallAction($id)
        {

            $oRemoteApp = RemoteAppQuery::create()->findOneById($id);
            $sResult    = array(
                "success" => false,
                "message" => ""
            );
            try {
                $this->get("API");
                Api::$_container = $this->container;
                $mResult = Api::call("doInstall", array(), $oRemoteApp->getUpdateUrl(), $oRemoteApp->getPublicKey(), $oRemoteApp);
                if (!empty($mResult)) {
                    if (!isset($mResult['result']['result'])) {
                        $this->get('logger')->error("[INIT ERROR] ".print_r($mResult,true));
                        throw new \Exception($this->get("translator")->trans("remote_app.api.init.error"));
                    }

                    if ($mResult['result']['result'] == true) {

                        $sResult['success'] = true;
                        $sResult['message'] = $this->get("translator")->trans("remote_app.api.update.successful");

                        $this->get('logger')->info("Api-Call successful", array("Method" => __METHOD__, "RemoteApp" => $oRemoteApp->getName()));

                        $oRemoteApp->setWebsiteHash($mResult['result']['website_hash']);
                        $oRemoteApp->save();
                    } else {
                        $this->get('logger')->error("Unknown error in ".__FILE__." on line ".__LINE__." - Result: ".json_encode($mResult), array("Method" => __METHOD__, "RemoteApp" => $oRemoteApp->getName(), "RemoteURL" => $oRemoteApp->getFullApiUrl()));
                        throw new \Exception("error in " . __FILE__ . " on line " . __LINE__);
                    }
                }
            } catch (\Exception $e) {
                $this->get('logger')->error($e->getMessage(), array("Method" => __METHOD__, "RemoteApp" => $oRemoteApp->getName(), "RemoteURL" => $oRemoteApp->getFullApiUrl()));
                $sResult['success'] = false;
                $sResult['message'] = $e->getMessage();
            }

            $response = new Response(json_encode($sResult));
            $response->headers->set('Content-Type', 'application/json');

            return $response;
        }
public function initInstallCallAction($id)
        {

            $oRemoteApp = RemoteAppQuery::create()->findOneById($id);
            $sResult    = array(
                "success" => false,
                "message" => ""
            );
            try {
                $this->get("API");
                Api::$_container = $this->container;
                $mResult = Api::call("doInstall", array(), $oRemoteApp->getUpdateUrl(), $oRemoteApp->getPublicKey(), $oRemoteApp);
                if (!empty($mResult)) {
                    if (!isset($mResult['result']['result'])) {
                        $this->get('logger')->error("[INIT ERROR] ".print_r($mResult,true));
                        throw new \Exception($this->get("translator")->trans("remote_app.api.init.error"));
                    }

                    if ($mResult['result']['result'] == true) {

                        $sResult['success'] = true;
                        $sResult['message'] = $this->get("translator")->trans("remote_app.api.update.successful");

                        $this->get('logger')->info("Api-Call successful", array("Method" => __METHOD__, "RemoteApp" => $oRemoteApp->getName()));

                        $oRemoteApp->setWebsiteHash($mResult['result']['website_hash']);
                        $oRemoteApp->save();
                    } else {
                        $this->get('logger')->error("Unknown error in ".__FILE__." on line ".__LINE__." - Result: ".json_encode($mResult), array("Method" => __METHOD__, "RemoteApp" => $oRemoteApp->getName(), "RemoteURL" => $oRemoteApp->getFullApiUrl()));
                        throw new \Exception("error in " . __FILE__ . " on line " . __LINE__);
                    }
                }
            } catch (\Exception $e) {
                $this->get('logger')->error($e->getMessage(), array("Method" => __METHOD__, "RemoteApp" => $oRemoteApp->getName(), "RemoteURL" => $oRemoteApp->getFullApiUrl()));
                $sResult['success'] = false;
                $sResult['message'] = $e->getMessage();
            }

            $response = new Response(json_encode($sResult));
            $response->headers->set('Content-Type', 'application/json');

            return $response;
        }
public function initInstallCallAction ( $ id ) { $ oRemoteApp = RemoteAppQuery :: create ( ) -> findOneById ( $ id ) ; $ sResult = array ( "success" => false , "message" => "" ) ; try { $ this -> get ( "API" ) ; Api :: $ _container = $ this -> container ; $ mResult = Api :: call ( "doInstall" , array ( ) , $ oRemoteApp -> getUpdateUrl ( ) , $ oRemoteApp -> getPublicKey ( ) , $ oRemoteApp ) ; if ( ! empty ( $ mResult ) ) { if ( ! isset ( $ mResult [ 'result' ] [ 'result' ] ) ) { $ this -> get ( 'logger' ) -> error ( "[INIT ERROR] " . print_r ( $ mResult , true ) ) ; throw new \ Exception ( $ this -> get ( "translator" ) -> trans ( "remote_app.api.init.error" ) ) ; } if ( $ mResult [ 'result' ] [ 'result' ] == true ) { $ sResult [ 'success' ] = true ; $ sResult [ 'message' ] = $ this -> get ( "translator" ) -> trans ( "remote_app.api.update.successful" ) ; $ this -> get ( 'logger' ) -> info ( "Api-Call successful" , array ( "Method" => __METHOD__ , "RemoteApp" => $ oRemoteApp -> getName ( ) ) ) ; $ oRemoteApp -> setWebsiteHash ( $ mResult [ 'result' ] [ 'website_hash' ] ) ; $ oRemoteApp -> save ( ) ; } else { $ this -> get ( 'logger' ) -> error ( "Unknown error in " . __FILE__ . " on line " . __LINE__ . " - Result: " . json_encode ( $ mResult ) , array ( "Method" => __METHOD__ , "RemoteApp" => $ oRemoteApp -> getName ( ) , "RemoteURL" => $ oRemoteApp -> getFullApiUrl ( ) ) ) ; throw new \ Exception ( "error in " . __FILE__ . " on line " . __LINE__ ) ; } } } catch ( \ Exception $ e ) { $ this -> get ( 'logger' ) -> error ( $ e -> getMessage ( ) , array ( "Method" => __METHOD__ , "RemoteApp" => $ oRemoteApp -> getName ( ) , "RemoteURL" => $ oRemoteApp -> getFullApiUrl ( ) ) ) ; $ sResult [ 'success' ] = false ; $ sResult [ 'message' ] = $ e -> getMessage ( ) ; } $ response = new Response ( json_encode ( $ sResult ) ) ; $ response -> headers -> set ( 'Content-Type' , 'application/json' ) ; return $ response ; }
initiate installation of complete monitoring module

@param $id

@return \Symfony\Component\HttpFoundation\Response
@throws \Exception
initiate installation of complete monitoring module