Upload a zf2 module from user interface (similar to wordpress plugin upload/installation)

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Upload a zf2 module from user interface (similar to wordpress plugin upload/installation)

Brieuc
I need to upload a ZF2 module from a form upload on the admin panel interface.

Ex :

(It basically should work like a wordpress plugin upload/installation).

I have a module Blog using a default template. we would like the user to be able to upload a ZF2 module that will give access to a new template (with its own form/fields, actions, js, img etc). Module already created and working (db need to be manually created for now, and the module need to be manually registered in application.config.php)

When the user is uploading the module, it should :

- initialize a script that will create the table proper to its module (i guess no problem for that).

- Register the module in application.config.php (modules array). Is it possible?

It should also be able to drop the table (no problem for that) and remove the module from application.config.php when deleted.

So would it be possible ? How can i register dynamically the module in the application.config.php? Should i upload the module from a .rar or else?

Another thing wished is that the module should be encrypted (as the full website) so the user have no access to its content (for confidentiality reasons). So i guess i will have to manage that later and hopefully it will not be a big deal! but let's focus first on the first part ...

Any hints are welcome!

I hope i've been clear enough.
Reply | Threaded
Open this post in threaded view
|

Re: Upload a zf2 module from user interface (similar to wordpress plugin upload/installation)

Julian Vidal
My 2 cents (though by no means a thorough answer):

application.config.php contains just an array. You can load it and modify
at will. One thing that I use over and over to manage separating config
files is this:

    public function getConfig()
    {
        $config      = array();
        $configFiles = array(
            __DIR__ . '/config/module.config.php',
            __DIR__ . '/config/routes.config.php',
            __DIR__ . '/config/app.config.php',
        );

        foreach ($configFiles as $configFile) {
            $config = \Zend\Stdlib\ArrayUtils::merge($config, include
$configFile);
        }

        return $config;
    }

This is just an example that handles the module config. You could do this
with the app config somewhere in your code, modify $config['modules] and
then save the file again so that you the framework can parse it in the next
request.

As far as encryption goes, I think the easiest (not cheapest) way would be
to go for something like Zend Guard.

It goes without saying that allowing the user to add modules would imply a
whole lot of security issues that you would need to take care of. With Zend
Guard you can add licenses to encrypted code so I guess you could only
allow your own licensed modules to run or something like that.

Sounds like an interesting, albeit risky, project. Good luck!


On Fri, Apr 4, 2014 at 1:50 AM, Brieuc <[hidden email]> wrote:

> I need to upload a ZF2 module from a form upload on the admin panel
> interface.
>
> Ex :
>
> (It basically should work like a wordpress plugin upload/installation).
>
> I have a module Blog using a default template. we would like the user to be
> able to upload a ZF2 module that will give access to a new template (with
> its own form/fields, actions, js, img etc). Module already created and
> working (db need to be manually created for now, and the module need to be
> manually registered in application.config.php)
>
> When the user is uploading the module, it should :
>
> - initialize a script that will create the table proper to its module (i
> guess no problem for that).
>
> - Register the module in application.config.php (modules array). Is it
> possible?
>
> It should also be able to drop the table (no problem for that) and remove
> the module from application.config.php when deleted.
>
> So would it be possible ? How can i register dynamically the module in the
> application.config.php? Should i upload the module from a .rar or else?
>
> Another thing wished is that the module should be encrypted (as the full
> website) so the user have no access to its content (for confidentiality
> reasons). So i guess i will have to manage that later and hopefully it will
> not be a big deal! but let's focus first on the first part ...
>
> Any hints are welcome!
>
> I hope i've been clear enough.
>
>
>
>
> --
> View this message in context:
> http://zend-framework-community.634137.n4.nabble.com/Upload-a-zf2-module-from-user-interface-similar-to-wordpress-plugin-upload-installation-tp4661953.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
> --
> List: [hidden email]
> Info: http://framework.zend.com/archives
> Unsubscribe: [hidden email]
>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Upload a zf2 module from user interface (similar to wordpress plugin upload/installation)

Brieuc
Okay thank you very much for your fast and complete answer. It is indeed a very interesting project ;) .