Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Addon installer concept


piernas

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?

 

Link to comment
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

Link to comment
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.

Link to comment
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      

Link to comment
Share on other sites

@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
Link to comment
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?

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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

Get the latest Responsive osCommerce CE (community edition) here .

Link to comment
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.

 

Link to comment
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

Link to comment
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.

Link to comment
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

Link to comment
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. :)

 

 

Link to comment
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.

Link to comment
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.

 

 

Link to comment
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.

 

Link to comment
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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...