public function createAction(Request $request)
    {
        $em = $this->getDoctrine()->getManager();
        $entity  = new WPSetup();

        $form = $this->createForm(new WPSetupType($this->container), $entity);
        $form->bind($request);

        if ($form->isValid()) {

            $user = $this->get('security.context')->getToken()->getUser();

            $domain = $form['domain']->getData();
            if(isset($form['user']))
                $domain->setUser($form['user']->getData());

            $em->persist($domain);

            $httpdhost = new HttpdHost();
            $httpdhost->setDomain($domain);

            // Add open_basedir wordpress directory
            $configuration = "
                <Directory '/home/$user/web/$domain/httpdocs'>
                    php_admin_value open_basedir '/home/$user/web/$domain:/srv/httpd/error:/tmp:/var/www/source'
                </Directory>";
            $httpdhost->setConfiguration($configuration);
            $em->persist($httpdhost);

            $validator = $this->get('validator');
            // Add database and user
            $wpdb = new DB();
            $wpdb->setName($user->getUsername().'_wp_'.$httpdhost->getId());
            $em->persist($wpdb);

            $dbuser = new DatabaseUser();
            $dbuser->setUsername($user->getId().'_wp_'.$httpdhost->getId());
            $dbuser->setDb($wpdb);
            $dbuser->setPassword('');
            $em->persist($dbuser);

            $entity->setHttpdHost($httpdhost);
            $entity->setDatabaseUser($dbuser);
            $entity->setEnabled(true);
            $em->persist($entity);

            $em->flush();

            return $this->redirect($this->generateUrl('wpsetup_show', array('id' => $entity->getId())));
        }

        return $this->render('ACSACSPanelWordpressBundle:WPSetup:new.html.twig', array(
            'entity' => $entity,
            'form'   => $form->createView(),
        ));
    }
public function createAction(Request $request)
    {
        $em = $this->getDoctrine()->getManager();
        $entity  = new WPSetup();

        $form = $this->createForm(new WPSetupType($this->container), $entity);
        $form->bind($request);

        if ($form->isValid()) {

            $user = $this->get('security.context')->getToken()->getUser();

            $domain = $form['domain']->getData();
            if(isset($form['user']))
                $domain->setUser($form['user']->getData());

            $em->persist($domain);

            $httpdhost = new HttpdHost();
            $httpdhost->setDomain($domain);

            // Add open_basedir wordpress directory
            $configuration = "
                <Directory '/home/$user/web/$domain/httpdocs'>
                    php_admin_value open_basedir '/home/$user/web/$domain:/srv/httpd/error:/tmp:/var/www/source'
                </Directory>";
            $httpdhost->setConfiguration($configuration);
            $em->persist($httpdhost);

            $validator = $this->get('validator');
            // Add database and user
            $wpdb = new DB();
            $wpdb->setName($user->getUsername().'_wp_'.$httpdhost->getId());
            $em->persist($wpdb);

            $dbuser = new DatabaseUser();
            $dbuser->setUsername($user->getId().'_wp_'.$httpdhost->getId());
            $dbuser->setDb($wpdb);
            $dbuser->setPassword('');
            $em->persist($dbuser);

            $entity->setHttpdHost($httpdhost);
            $entity->setDatabaseUser($dbuser);
            $entity->setEnabled(true);
            $em->persist($entity);

            $em->flush();

            return $this->redirect($this->generateUrl('wpsetup_show', array('id' => $entity->getId())));
        }

        return $this->render('ACSACSPanelWordpressBundle:WPSetup:new.html.twig', array(
            'entity' => $entity,
            'form'   => $form->createView(),
        ));
    }
public function createAction ( Request $ request ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ entity = new WPSetup ( ) ; $ form = $ this -> createForm ( new WPSetupType ( $ this -> container ) , $ entity ) ; $ form -> bind ( $ request ) ; if ( $ form -> isValid ( ) ) { $ user = $ this -> get ( 'security.context' ) -> getToken ( ) -> getUser ( ) ; $ domain = $ form [ 'domain' ] -> getData ( ) ; if ( isset ( $ form [ 'user' ] ) ) $ domain -> setUser ( $ form [ 'user' ] -> getData ( ) ) ; $ em -> persist ( $ domain ) ; $ httpdhost = new HttpdHost ( ) ; $ httpdhost -> setDomain ( $ domain ) ; // Add open_basedir wordpress directory $ configuration = "
                <Directory '/home/$user/web/$domain/httpdocs'>
                    php_admin_value open_basedir '/home/$user/web/$domain:/srv/httpd/error:/tmp:/var/www/source'
                </Directory>" ; $ httpdhost -> setConfiguration ( $ configuration ) ; $ em -> persist ( $ httpdhost ) ; $ validator = $ this -> get ( 'validator' ) ; // Add database and user $ wpdb = new DB ( ) ; $ wpdb -> setName ( $ user -> getUsername ( ) . '_wp_' . $ httpdhost -> getId ( ) ) ; $ em -> persist ( $ wpdb ) ; $ dbuser = new DatabaseUser ( ) ; $ dbuser -> setUsername ( $ user -> getId ( ) . '_wp_' . $ httpdhost -> getId ( ) ) ; $ dbuser -> setDb ( $ wpdb ) ; $ dbuser -> setPassword ( '' ) ; $ em -> persist ( $ dbuser ) ; $ entity -> setHttpdHost ( $ httpdhost ) ; $ entity -> setDatabaseUser ( $ dbuser ) ; $ entity -> setEnabled ( true ) ; $ em -> persist ( $ entity ) ; $ em -> flush ( ) ; return $ this -> redirect ( $ this -> generateUrl ( 'wpsetup_show' , array ( 'id' => $ entity -> getId ( ) ) ) ) ; } return $ this -> render ( 'ACSACSPanelWordpressBundle:WPSetup:new.html.twig' , array ( 'entity' => $ entity , 'form' => $ form -> createView ( ) , ) ) ; }
Creates a new WPSetup entity.
Creates a new WPSetup entity .