Jump to content
Latest News: (loading..)
piernas

Addon installer concept

Recommended Posts

Now that oscommerce community version allows more an more addons with no core code changes I feel an uploader/installer would make things simpler and also help a lot those newcomers that does not have the knowledge to ftp files.

We don't have a repository adapted to it, but we could ideate a simple system that allows to upload a zip file by browser, uncomprees it, do some preliminar checks like if the addon is currently installed and is compatible with the system and with copying files/making registry entries when user press "install".

Been playing with the idea of something like the paypal app updater and came up with this:

installer.thumb.jpg.097fb801ed5c650b6dfe4db9a09b2ac4.jpg

Would like to get feedback from developers about it. It would need, of course, that developers agree with packaging the addons with a certain structure and provide with a file that performs the tasks.

Do you consider interesting to make a similar system?

 

Share this post


Link to post
Share on other sites

Hola JUanma.

For those of us with scarce abilities in coding it would be a dream come true. I liked Contribution Tracker for osCommerce 2.3      At least you had an easy way to track for updates of your installed addons. I had it on my Gold versions, but it doesn't work in the newest EDGE shops.


Shopowner, not coder, experienced copypaster  :D

Share this post


Link to post
Share on other sites

Hola @TITO4,

I didn't know abut that contribution; Will take a look at it when I find some time.

PS. porting it to edge should be pretty simple.

Share this post


Link to post
Share on other sites

It's a nice idea.  I think you'll find it difficult to convince addon makers to make addons in the way required...


This is a signature that appears on all my posts.  
IF YOU MAKE A POST REQUESTING HELP...please state the exact version
of osCommerce that you are using. THANKS

 
Get the latest current code (community-supported responsive 2.3.4.1BS Edge) here

 

Share this post


Link to post
Share on other sites

@ burt that's why I opened the thread. If there's no interest there's no point on working more on it.

What I had planned was simple: A zip containing a php file on its root and the files to be uploaded already placed on a folder called "catalog" with their paths. The system does some checks based on the php file and does the magic. Tried to keep it simple but powerful.

This is an example of the file:

<?php
  namespace test_app2;

  class app_installer {
    var $groups;
    function __construct () {
      $this->required_installer_version = "1.3";
      $this->required_osc_version = "2.3.4.1";
      $this->app_version = "1.1";
      $this->name = "The greatest test addon of all times";
      $this->description = "It's just another addon that does things...";
      $this->type = "Content module";
      
      $this->prefix = "MODULE_CONTENT_TEST_APP_2_";
      // files to remove
      $this->remove_files = array("unneededfile.php","unneededfile2.php");
      // directories to remove
      $this->remove_dirs = array("unneeded_dir");
      // configuration keys to create (if not exists)
      // modules to install
      $this->add_to_groups = array('MODULE_CONTENT_INSTALLED' =>'test/cm_test_test_app', 'MODULE_PAYMENT_INSTALLED' => 'test.php');
      // todo: Maybe it's easier to do $module->install() instead?
      $this->db_keys = array('SORT_ORDER' =>0,
                                            'ENABLED' => 'True');

      $this->remove_from_groups = array();
    }

    function install() {
      // copy files:
      $this->copy_files(DIR_FS_ADMIN . '/temp/test_app/catalog', DIR_FS_CATALOG);
      // remove old files:
      foreach ($this->remove_files as $file) {
        unlink (DIR_FS_CATALOG . $file);
      }
      // remove old dirs:
      foreach ($this->remove_dirs as $dir) {
        $this->delTree (DIR_FS_CATALOG . $dir);
      }

      // Create module constants:
      foreach ($this->db_keys as $key => $value) {
        $key = $this->prefix . $key;
        if (!defined ($key)) {
          echo "no está";
        }
      }

      // TODO check if already exists and reorder:
      foreach ($this->add_to_groups as $group_key => $group_value) {
        tep_db_query("update " . TABLE_CONFIGURATION . " set configuration_value='" . constant($group_key) . ";$group_value', last_modified =now() where configuration_key = '$group_key'");
      }
      return "All ok";
    }

    function copy_files($src,$dst) {
        $dir = opendir($src);
        if (!is_dir($dst)) {
          mkdir($dst);
        }
        @mkdir($dst);
        while(false !== ( $file = readdir($dir)) ) {
            if (( $file != '.' ) && ( $file != '..' )) {
                if ( is_dir($src . '/' . $file) ) {
                    $this->copy_files($src . '/' . $file,$dst . '/' . $file);
                }
                else {
                    copy($src . '/' . $file,$dst . '/' . $file);
                }
            }
        }

        closedir($dir);
    }
    function delTree($dir) {
      $files = array_diff(scandir($dir), array('.','..'));
      foreach ($files as $file) {
        (is_dir("$dir/$file")) ? $this->delTree("$dir/$file") : unlink("$dir/$file");
      }
      return rmdir($dir);
    }
  }

I'd appreciate any comment from developers; even if they are not interested at all - that would make me continue or stop with it.

Share this post


Link to post
Share on other sites

I think this is a great idea and probably something that needs to/should be built into the add-ons area to ensure all new add-ons have the basic information required to simplify the install/removal process. 

If you can get other developers on board beforehand that would definitely help in determining what is needed and how it can be improved.  Good idea @piernas :thumbsup:

Dan      

Share this post


Link to post
Share on other sites
Posted (edited)

@wHiTeHaT Yes it would be simpler, but I like the file for providing information about the addon and for performing actions like deleting unneeded files, installing constants without user interaction... and most important, for letting know the system this is an actual addon that's ready to be uncompressed. If not, you could accidentaly upload an addon or another zip file that's not ready for the installer and copy files in weird places.

This is the basic content of the file (posted fully above:

      $this->required_installer_version = "1.3";
      $this->required_osc_version = "2.3.4.1";
      $this->app_version = "1.1";
      $this->name = "The greatest test addon of all times";
      $this->description = "It's just another addon that does things...";
      $this->type = "Content module";

 

If the addon does not need extra stuff to be done the file will be much simple.

Edited by piernas

Share this post


Link to post
Share on other sites

@wHiTeHaT yes if you're installing a module, but the installer is meant to install any type of files, it could install just one new admin standard page, a report, a header tag... or all these at the same time. I think providing a single configuration file you can give useful information to the installer easily, don't you think so?

Share this post


Link to post
Share on other sites
Posted (edited)

I wasn't thinking on an apps' server - at least yet. Just wanted to talk about a sandard way to install files - could be language files, modules, admin pages... whatever - so if the file is ready for this system you just download it and upload to you website. That way a developer could share their files on their respective websites and/or in the addons area - just noting that it uses the system in the download comments. And the user could install/track versions/uninstall the addons easily. If, once done, burt considers it good for the community version I'd be glad as there's no better way to spread its use.

A new app market added to the core might be a great thing, but I think it depends heavily on what kind of release it is: for an unofficial build it's ok, but for an official one I believe the official repository is still the place to get addons.

PS. if the amateuristic comment was about my idea I don't take any offence - I don't pretend to be a professional at all - but I think I have a cler idea of how to do it easily, with few lines of code and it's currently done and working for the most part.

Anyway, this thread has only a few comments so maybe the idea is not good for developers.

 

Edited by piernas

Share this post


Link to post
Share on other sites
Posted (edited)

It's good idea, but the installing any addon it should not overwrite any existing files (oscommerce stock files )..  just the new files or overwrite the addons existing files

example   :  A addon installed and overwrite any existing  file (application_top.php) and after that I want to install B addon and it  need  overwrite same  file .. 
so I will loss the A addon. or I have to change it manually. 
@piernasThats mean the addons NEED to be ready for your addon (install  addons).

 

Omar

Edited by Omar_one

Share this post


Link to post
Share on other sites

@Omar_one the idea I have is that the installer page only lets you upload the file and checks if it's compatible with the core version and if the addon is already installed. The rest should be done by the php file (example posted above) by user interaction and calling the install() method on the class file. There, the addon maker defines the actions to perform - from copying a file, removing old - unneeded ones or whatever you want to do - so it could potentially modify core files, altough it's not the intention.

Yes the addon needs to be ready. It's up to the developer to follow the schema (basically include all the files with the structure needed under catalog/ directory and make the install file where information and install routine is placed. In fact any addon maker could do his propietary, own installer just by placing an "install.php", I think I've seen it before.

 

Share this post


Link to post
Share on other sites
4 minutes ago, wHiTeHaT said:

Exactly THAT

Obvously it's his decision. Personally I would not make a propietary market at this point.

Share this post


Link to post
Share on other sites
34 minutes ago, piernas said:

A new app market added to the core might be a great thing, but I think it depends heavily on what kind of release it is: for an unofficial build it's ok, but for an official one I believe the official repository is still the place to get addons.

Does it need to be in the core....I was thinking an add-on to manage add-ons.  :biggrin:

Dan

Share this post


Link to post
Share on other sites
1 minute ago, wHiTeHaT said:

 

ok.... en-light me on that part?

It's pretty obvious, no? He is the person who decides what to do and what not in the current community version.

 

Share this post


Link to post
Share on other sites
2 minutes ago, Dan Cole said:

Does it need to be in the core....I was thinking an add-on to manage add-ons.  :biggrin:

Dan

Of course. The difficult part, as @burt mentioned, is to convince developers to use the system.

Share this post


Link to post
Share on other sites
1 minute ago, piernas said:

Of course. The difficult part, as @burt mentioned, is to convince developers to use the system.

That would be ideal of course but if you get a few key developers agreeing to use it... say @Jack_mcs and @kymation for example and the users liked it, it would likely become a standard.  No?

Dan

Share this post


Link to post
Share on other sites

Is there an issue with instaling addons? I personaly have never had problems installing and dont see  hundreds of posts saying addons are hard to install? In fact with the new version with the push to make addons core free its even simpler than ever.

So personaly I dont see it as a high priorty but as ever nothing stopping it beeing another addon for addons. :)

 


 

Share this post


Link to post
Share on other sites
Just now, justcatering said:

Is there an issue with instaling addons? I personaly have never had problems installing and dont see  hundreds of posts saying addons are hard to install? In fact with the new version with the push to make addons core free its even simpler than ever.

So personaly I dont see it as a high priorty but as ever nothing stopping it beeing another addon for addons. :)

 

Not for you, not for me. But don't you think it's easier for you and for me to download something and upload it by a web page rather than reading instructions, checking what folder you should use and using ftp?

Now think about someones that comes here by the first time, installs oscommerce (hard if he doesn't have previous knowledge of some basic things) and finds he needs some kind of addon. It will be for sure a  work of a couple of hours, at least. Probably much more before he sees any result.

Share this post


Link to post
Share on other sites

Mine is just an opinion, eople are free to mak any adoon they wish. However from my experiance addons as as easy to install now as they have ever been. But your right if people want a click and install why not.

 


 

Share this post


Link to post
Share on other sites

@wHiTeHaT I don't want to loose my time in something like this if there's no interest. That's the reason I opened this thread, to get some feedback. If you consider it should be done right now and you'll do it beter, just do it.

@justcatering I'd love to. I'm lazy :)

 

Share this post


Link to post
Share on other sites

@wHiTeHaT you have an example above.

About core changes - I wan't thinking on it. My idea was to easily install modern addons with no core changes.

 

Anyway, it could be done just by adding code to the install() section.

Share this post


Link to post
Share on other sites

:) me too but to be ho

5 minutes ago, piernas said:

@wHiTeHaT I don't want to loose my time in something like this if there's no interest. That's the reason I opened this thread, to get some feedback. If you consider it should be done right now and you'll do it beter, just do it.

@justcatering I'd love to. I'm lazy :)

 

:) Me too very lazy! To be honest is the 15years I have been using osc I have never had more that 15-20 addon ever and of those I think I actually use about 12, so for me its never being an issue. But I see from another discussion going on that some people have over 70 addons and for that I can understand it being a good idea. But then me personally would lokk to remove as meany addons as possible.


 

Share this post


Link to post
Share on other sites
Just now, wHiTeHaT said:

I do it better, just i not share it with just anyone.
You think i am crazy?
Put my efforts in vampires?
The people who are in need.... let them contact me.
For them my options are open.
Not for Vampires.
 

That's the main difference, then. I want to make a public addon. Any vampire who wants to improve it is welcome.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×