PrestaShop Forum

The best place in the world to ask questions about PrestaShop and get advice from our passionate community!

PrestaShop Forum

Jump to content

Easy Module Delivery

15 replies to this topic
#1
whitelighter

    PrestaShop Addict

  • Members
  • PipPipPip
  • 589 posts
I made a simple module that exports/imports other modules into a single file. I find it easier this way.
It automatically replaces the old module if the new file has a higher version.

It uses the PHP serialize/unserialize to combine files and module info into one file. It is not compressed, not for now. And it only works file under the modules directory. I have plans to add a way to add other files in the Presta installation.

UPDATED: 28/01/2009 Changed the module name/tab. Added access to an online repository.

Attached Files



#2
Ox40

    PrestaShop Addict

  • Members
  • PipPipPip
  • 500 posts
Make a repository of modules and updates... I can provide webspace for that. Then the module can look for new module versions and update accordingly. This is an exciting feature!

A header for the .mdl file would be nice...
something that defines minimum prestashop version for the module, etc...

PM or email me to discuss. I would like to be involved in this.

--Kevin Klika
Pursuant Solutions, programmers dedicated to the pursuit.

#3
whitelighter

    PrestaShop Addict

  • Members
  • PipPipPip
  • 589 posts
I have plans for that that as well. Thanks for the offer, but I already have webspace.

#4
Ox40

    PrestaShop Addict

  • Members
  • PipPipPip
  • 500 posts
The only challenge will be keeping the repository up to date... maybe prestashop should host the modules? www.prestashop.com/modules or w/e. I dunno, but I am going to watch this thread closely, I am very interested. :) I like how your .mdl files look too, with the serialized files - image files, php, everything. Does it support sub-directories? Such as my Creditcard module (it has subdirectories for javascript and images).

--Kevin
Pursuant Solutions, programmers dedicated to the pursuit.

#5
Ox40

    PrestaShop Addict

  • Members
  • PipPipPip
  • 500 posts
Problem: I tried to export some modules, they do not work. I get redirected to the .mdl file, but all it has is this:

O:9:"ModuleSet":3:{s:4:"name";s:10:"blockinfos";s:8:"filelist";a:0:{}s:7:"version";d:1;}

Pursuant Solutions, programmers dedicated to the pursuit.

#6
whitelighter

    PrestaShop Addict

  • Members
  • PipPipPip
  • 589 posts
It supports sub directories. I have tested it with a few modules.

I forgot to mention the redirection issue. Some modules do that. Save the page from your browser window just like saving any other web page, and it will work.
I will play with the default extension later, maybe that will solve this issue.

#7
Ehinarr

    Sir

  • Members
  • PipPipPipPip
  • 1134 posts
I have collected the modules that I find and listed on my blog. I always place one link for this fórum, but would be better if we had an only repository for all. What it means only one link.
My Blog
PS v1.4.7.0

#8
Ox40

    PrestaShop Addict

  • Members
  • PipPipPip
  • 500 posts
No, I only get a snippet of code... This is all I get for the info block:

O:9:"ModuleSet":3:{s:4:"name";s:10:"Info block";s:8:"filelist";a:0:{}s:7:"version";N;}


Ok, Edit. I fixed my problem. I also cleaned up all of the code, commented it, templated the admin form, and added some error handling. Should I post what I have or... do you not want it? :P

-Kevin
Pursuant Solutions, programmers dedicated to the pursuit.

#9
whitelighter

    PrestaShop Addict

  • Members
  • PipPipPip
  • 589 posts

From 1232812360:

No, I only get a snippet of code... This is all I get for the info block:

O:9:"ModuleSet":3:{s:4:"name";s:10:"Info block";s:8:"filelist";a:0:{}s:7:"version";N;}


Ok, Edit. I fixed my problem. I also cleaned up all of the code, commented it, templated the admin form, and added some error handling. Should I post what I have or... do you not want it? :P

-Kevin


Weird, I get the whole file in the browser.
Anyway, cool work. Sure I want it. I planning to work on a module repository with web services - so you can see a list of available modules directly from the BO. I also plan to add a download from a URL, check for updates from the repository etc.
It would be better to work on your version, that is if you want to share it.

This will require developers to register with the repository, but I don't think people will mind that. Users won't have to register.

#10
whitelighter

    PrestaShop Addict

  • Members
  • PipPipPip
  • 589 posts

From 1232760692:

I have collected the modules that I find and listed on my blog. I always place one link for this fórum, but would be better if we had an only repository for all. What it means only one link.


Thanks, I am working on the repository. I will post the link here as soon as the first protoype is ready.

#11
Ox40

    PrestaShop Addict

  • Members
  • PipPipPip
  • 500 posts
Here is what I have. Check it out, do what you want. It should be easier to read / work on now. I restructured some stuff so it will be a little odd to get used to, but it should work out for the better.
The only problem is that I can not get the version number to work on the .mdl file, mine always gets 'birthdaypresent-.mdl' because otherwise I get a 'Hack Attempt'. I dunno, ...
--Kevin

Attached Files


Pursuant Solutions, programmers dedicated to the pursuit.

#12
Ox40

    PrestaShop Addict

  • Members
  • PipPipPip
  • 500 posts
I have started to design & program the automatic updates part of the module - if you can work on the repository, I can work on this and we can get it done doubly quick :).

A MySQL Database of modules and .mdl contents would be the best... if you want, I have a simple PHP framework that would make it really easy for you.



What I need:
1.) version.php which accepts a module name and returns the latest version number of the module.
2.) update.php which accepts a module name and returns the .mdl contents for the module.

(With my framework, you would do version.php as echo Module::getLatestVersion(Tools::getvalue('module')); )

What do you think?

--Kevin
Pursuant Solutions, programmers dedicated to the pursuit.

#13
whitelighter

    PrestaShop Addict

  • Members
  • PipPipPip
  • 589 posts
I have my own framework that I use. I plan to have added functionality for other developers, so that they can manage their modules themselves.

I have done a simple admin page that helps me upload modules. I will first create a simple query system where you can get the list of available modules, latest versions and module file. I am working on a few other projects so this may take a few days. I plan to put it in one central file.

#14
Ox40

    PrestaShop Addict

  • Members
  • PipPipPip
  • 500 posts
whitelighter: how is it going so far?

I thought maybe renaming the module "updates" would be better, based on the direction of this project.

On my local copy, I renamed it "updates" and updated the contents of it to reflect that, as well as the directory. I also made it go under it's own group in the modules page called "Automatic-Updates".

--Kevin
Pursuant Solutions, programmers dedicated to the pursuit.

#15
whitelighter

    PrestaShop Addict

  • Members
  • PipPipPip
  • 589 posts
I just finished setting up a repository in my server. I renamed the module name to Module Repository and put it under Module Management, because I plan to have a wider scope. The next step is to add developer membership so that people can upload their own modules.

Now it has access to the modules on my server. You can check the code and see it. I use curl, so it requires curl support. I hope it works well on your shop as well.

I added another section at the bottom, a list of letters. Clicking on any of them will return the list of modules starting with that letter. You can install them by clicking on the link next to each module.

The repository is here:
http://www.agait.com...sta_repository/

There are two files here:
modules.php
This file gives a list of available modules, as a serialized array. The arguments you can use are:
letter: The first letter of the module title. This is used to see and alphabetic list of all modules. 20 modules at a time.
page: Page number, starting from 1, in increments of 1. Modules from 40 to 60 would have the page number 3.
module: The class name of the module. If provided returns only information on the latest version of this module.
The returned data is in the following format:
array(
array('module_name', 'module_title', 'module_version')
array('module_name', 'module_title', 'module_version')
)

module.php
This file returns the serialized module data. The contents of the mdl file. Parameters:
module: The class name of the module. If provided returns only the latest version of this module.
version: Version number of the module. If empty the latest version will be returned.

I did not follow your convention, but this is just as easy. Hopefully you will be able to add any functionality you made with ease.

I am attaching the latest files. I have not done a lot of testing.

Attached Files



#16
Tito

    PrestaShop Apprentice

  • Members
  • PipPip
  • 97 posts
any updates on this ?
Looks like a feature the PS dev team should further develop/buy