public function exportActivity(string $appname):Renderer
    {
        $appconfig = null;
        $file = JL::open(FEnv::get("framework.config.core.apps.file"));
        foreach ($file as $one => $val) {
            if ($val->name == $appname) {
                $appconfig = $val;
                break;
            }
        }
        if ($appconfig == null) {
            throw new Server500(new \ArrayObject(array("The application $appname does not exist.",
                "Please check your app configuration")));
        }
        unset($appconfig->enabled);

        try {
            $date = new \DateTime();
            $datefull = $date;
            $date = $date->format('YmdHi');
            $dirbase = FEnv::get("framework.bin").'exports/';
            $dirapp = $dirbase.($appname).'/';
            $dirappexp  = $dirapp.($appname)."_".$date.'/';
            Server::create($dirbase, 'directory');
            Server::create($dirapp, 'directory');
            Server::create($dirappexp, 'directory');
            JL::put($dirappexp."register.json", json_encode($appconfig, JSON_PRETTY_PRINT));
            $zip = new ZipEngine($dirapp.($appname)."_".$date.".zip");
            $zip->setSource(FEnv::get("framework.apps").$appname);
            $zip->addFile($dirappexp."register.json", "register.json");
            $zip->setArchiveComment("$appname - Export date :".$datefull->format('g:ia \o\n l jS F Y'));
            $zip->recursiveCompress();
            if ($zip->close()) {
                Server::delete($dirappexp, 'directory');
                return ((new Renderer())->jsonRenderer(array("code" => 200, "msg" => "OK")));
            } else {
                return ((new Renderer())->jsonRenderer(array("code" => 500,
                    "msg" => "Error on archive creation process")));
            }
        } catch (\Exception $e) {
            return ((new Renderer())->jsonRenderer(array("code" => 500,
                "msg" => "Error on archive creation process : ".$e->getMessage())));
        }
    }
public function exportActivity(string $appname):Renderer
    {
        $appconfig = null;
        $file = JL::open(FEnv::get("framework.config.core.apps.file"));
        foreach ($file as $one => $val) {
            if ($val->name == $appname) {
                $appconfig = $val;
                break;
            }
        }
        if ($appconfig == null) {
            throw new Server500(new \ArrayObject(array("The application $appname does not exist.",
                "Please check your app configuration")));
        }
        unset($appconfig->enabled);

        try {
            $date = new \DateTime();
            $datefull = $date;
            $date = $date->format('YmdHi');
            $dirbase = FEnv::get("framework.bin").'exports/';
            $dirapp = $dirbase.($appname).'/';
            $dirappexp  = $dirapp.($appname)."_".$date.'/';
            Server::create($dirbase, 'directory');
            Server::create($dirapp, 'directory');
            Server::create($dirappexp, 'directory');
            JL::put($dirappexp."register.json", json_encode($appconfig, JSON_PRETTY_PRINT));
            $zip = new ZipEngine($dirapp.($appname)."_".$date.".zip");
            $zip->setSource(FEnv::get("framework.apps").$appname);
            $zip->addFile($dirappexp."register.json", "register.json");
            $zip->setArchiveComment("$appname - Export date :".$datefull->format('g:ia \o\n l jS F Y'));
            $zip->recursiveCompress();
            if ($zip->close()) {
                Server::delete($dirappexp, 'directory');
                return ((new Renderer())->jsonRenderer(array("code" => 200, "msg" => "OK")));
            } else {
                return ((new Renderer())->jsonRenderer(array("code" => 500,
                    "msg" => "Error on archive creation process")));
            }
        } catch (\Exception $e) {
            return ((new Renderer())->jsonRenderer(array("code" => 500,
                "msg" => "Error on archive creation process : ".$e->getMessage())));
        }
    }
public function exportActivity ( string $ appname ) : Renderer { $ appconfig = null ; $ file = JL :: open ( FEnv :: get ( "framework.config.core.apps.file" ) ) ; foreach ( $ file as $ one => $ val ) { if ( $ val -> name == $ appname ) { $ appconfig = $ val ; break ; } } if ( $ appconfig == null ) { throw new Server500 ( new \ ArrayObject ( array ( "The application $appname does not exist." , "Please check your app configuration" ) ) ) ; } unset ( $ appconfig -> enabled ) ; try { $ date = new \ DateTime ( ) ; $ datefull = $ date ; $ date = $ date -> format ( 'YmdHi' ) ; $ dirbase = FEnv :: get ( "framework.bin" ) . 'exports/' ; $ dirapp = $ dirbase . ( $ appname ) . '/' ; $ dirappexp = $ dirapp . ( $ appname ) . "_" . $ date . '/' ; Server :: create ( $ dirbase , 'directory' ) ; Server :: create ( $ dirapp , 'directory' ) ; Server :: create ( $ dirappexp , 'directory' ) ; JL :: put ( $ dirappexp . "register.json" , json_encode ( $ appconfig , JSON_PRETTY_PRINT ) ) ; $ zip = new ZipEngine ( $ dirapp . ( $ appname ) . "_" . $ date . ".zip" ) ; $ zip -> setSource ( FEnv :: get ( "framework.apps" ) . $ appname ) ; $ zip -> addFile ( $ dirappexp . "register.json" , "register.json" ) ; $ zip -> setArchiveComment ( "$appname - Export date :" . $ datefull -> format ( 'g:ia \o\n l jS F Y' ) ) ; $ zip -> recursiveCompress ( ) ; if ( $ zip -> close ( ) ) { Server :: delete ( $ dirappexp , 'directory' ) ; return ( ( new Renderer ( ) ) -> jsonRenderer ( array ( "code" => 200 , "msg" => "OK" ) ) ) ; } else { return ( ( new Renderer ( ) ) -> jsonRenderer ( array ( "code" => 500 , "msg" => "Error on archive creation process" ) ) ) ; } } catch ( \ Exception $ e ) { return ( ( new Renderer ( ) ) -> jsonRenderer ( array ( "code" => 500 , "msg" => "Error on archive creation process : " . $ e -> getMessage ( ) ) ) ) ; } }
export one app
@param string $appname App name
@return Renderer
@throws Server500
export one app