xoops forums

Mamba

Moderator
Posted on: 2013/3/23 22:22
Mamba
Mamba (Show more)
Moderator
Posts: 10817
Since: 2004/4/23
#1

SmartClone 1.10 Beta 1 ready for testing

SmartClone is a module that will clone with 2 clicks any module that is developed as clonable! It works with a plugin system so any module developer can create a plugin for its module and allow SmartClone to painlessly clone it!

There are certain requirements for a module to be clonable, among them - a consistent way of naming tables, language variables, etc. We'll have soon a guidelines on how to make your module "clonable".

As a test, you can clone the WF-Downloads 3.22 RC1, or some of the Smart modules, like the SmartFAQ .

As a matter of fact, I used SmartClone just recently to clone it into a "Repository" module, that is being now used on www.xoops.org (see this thread)

The goal is to have the most important XOOPS modules that are part of the Module Packs, clonable. We probably will have some kind of voting on this, and use some logic to decide which ones are the best for cloning.

Download: SourceForge File Repository

Please help us with testing of this modul.
Support XOOPS => DONATE
Use 2.5.10 | Docs | Modules | Bugs

sabahan

Quite a regular
Posted on: 2013/3/24 11:09
sabahan
sabahan (Show more)
Quite a regular
Posts: 317
Since: 2006/3/4 5
#2

Re: SmartClone 1.10 Beta 1 ready for testing

Thanks..This is great

is there any list currently clonable module beside wfdownloads and smartfaq ?

publisher is clonable as far as i know

Anonymous

Posted on: 2013/3/24 21:34
Anonymous
Anonymous (Show more)
Posts: 0
Since:
#3

Re: SmartClone 1.10 Beta 1 ready for testing

The Dummy module once made by Trabis would be a nice one for this new cloning module.

Cloning this module is already very simple (rename the module and upload again), cloning it with the cloning module would be suburb.

Next to that it would be nice to have an updated Dummy module with Seo option and admin function for page titles, keywords and submenu items.

irmtfan

Module Developer
Posted on: 2013/3/25 1:08
irmtfan
irmtfan (Show more)
Module Developer
Posts: 3419
Since: 2003/12/7
#4

Re: SmartClone 1.10 Beta 1 ready for testing

huum.
As before i still think Xcube way of cloning modules (eg: in GIJ modules) is a better way. there is a back end (parent) and front end (child) and you just need to rename the folder name of the child to make a clone. you dont need to have 2 completely separate modules but just need to have different front ends like templates, tables, ... in XOOPSROOT/modules folder. the back end will be untouched for all childs (clones) in XOOPS_LIB folder.

this way upgrading all current clones would be as simple as copy pasting one parent folder.

Also only content modules should be clonable. some of them like protector should be unclonable.
eg: I make userlog unclonable so if somebody try to clone it (by mistake) there will not be 2 modules logging user activities at a time.

Mamba

Moderator
Posted on: 2013/3/25 5:24
Mamba
Mamba (Show more)
Moderator
Posts: 10817
Since: 2004/4/23
#5

Re: SmartClone 1.10 Beta 1 ready for testing

@ Irmtfan
Quote:
As before i still think Xcube way of cloning modules (eg: in GIJ modules) is a better way. there is a back end (parent) and front end (child) and you just need to rename the folder name of the child to make a clone.

In this case you'll be sharing the module tables with all the other clones. If this is the purpose, then it's OK. But it won't be useful if you want to keep data separate from each other.
This method would also make separation difficult, e.g. if you want to take one clone and install it on a different Website. You will need to do extraction of data from all the tables.

But if there is a need to have the clones using the same tables of the original, then I believe SmartClone could be modified to do it.

Quote:
this way upgrading all current clones would be as simple as copy pasting one parent folder.

With SmartClone it is only one extra step - you copy the new files to the original module's directory (as you do with the D3 modules), and then re-run the SmartClone.
Quote:
Also only content modules should be clonable. some of them like protector should be unclonable.

Of course. It would be up to the module developer to provide the "clone" plugin for SmartClone.

@ sabahan
Quote:

is there any list currently clonable module beside wfdownloads and smartfaq ?

There few more included in the /plugin directory. It will be up to the module developers to create a "SmartClone plugin" for their modules.

@ Flipse
Quote:
Cloning this module is already very simple (rename the module and upload again), cloning it with the cloning module would be suburb.

There is nothing to clone with the Dummy module. SmartClone would be only creating a new directory and copy the files there.
Support XOOPS => DONATE
Use 2.5.10 | Docs | Modules | Bugs

irmtfan

Module Developer
Posted on: 2013/3/30 3:46
irmtfan
irmtfan (Show more)
Module Developer
Posts: 3419
Since: 2003/12/7
#6

Re: SmartClone 1.10 Beta 1 ready for testing

@Mamba:
do you test 2 or 3 clones of WF-Downloads 3.22 in a test website ?
then please activate a same block of each clone in the home page to see if there is no conflict in all clones.

Quote:

In this case you'll be sharing the module tables with all the other clones.


we can change it so that every clone has its own table that follows the new protocol.
eg:
PARENT_CLONE1_tablename
PARENT_CLONE2_tablename
PARENT_CLONE3_tablename

I will take a look in Xcube way of cloning modules to see how it is possible.

Mamba

Moderator
Posted on: 2013/3/30 16:01
Mamba
Mamba (Show more)
Moderator
Posts: 10817
Since: 2004/4/23
#7

Re: SmartClone 1.10 Beta 1 ready for testing

Quote:
do you test 2 or 3 clones of WF-Downloads 3.22 in a test website ?
then please activate a same block of each clone in the home page to see if there is no conflict in all clones.

Seems to be OK

Quote:
we can change it so that every clone has its own table that follows the new protocol.

Right now they already have separate tables. We just might update SmartClone to check if the module has already the new structure of tables with "mod_" prefix, and if not, then add it
Support XOOPS => DONATE
Use 2.5.10 | Docs | Modules | Bugs

irmtfan

Module Developer
Posted on: 2013/5/3 4:07
irmtfan
irmtfan (Show more)
Module Developer
Posts: 3419
Since: 2003/12/7
#8

Re: SmartClone 1.10 Beta 1 ready for testing

Is cloning possible by simple renaming of the directory?

That is the interesting question.

One of the main obstacles is function and class naming.

you have class names like
class MY_MODULE_classname extends XoopsObject
{

and it will cause issues when you have 2 blocks of the all 2 clones in one page:
Fatal errorCannot redeclare class MY_MODULE_classname


IMO if we could find a way for this cloning is possible by a simple renaming.

Mamba

Moderator
Posted on: 2013/5/3 6:41
Mamba
Mamba (Show more)
Moderator
Posts: 10817
Since: 2004/4/23
#9

Re: SmartClone 1.10 Beta 1 ready for testing

Quote:
IMO if we could find a way for this cloning is possible by a simple renaming.

I think, one way to do it would be by utilizing PHP "namespaces". This way we would avoid any name collisions. And since in XOOPS 2.6.0 the minimum PHP version is 5.3, then this could be possible.
Support XOOPS => DONATE
Use 2.5.10 | Docs | Modules | Bugs

zyspec

Module Developer
Posted on: 2013/5/3 15:33
zyspec
zyspec (Show more)
Module Developer
Posts: 1053
Since: 2004/9/21
#10

Re: SmartClone 1.10 Beta 1 ready for testing

@irmtfan

All the SmartClone module does is automates the manual process of going through every file in the module and replacing instances of the current module name with the new (cloned) name and then renaming any file with the current module name with the new name. This all needs to be done prior to installation. Once it's completed the module is installed just as if it were a "different" module, it no longer has anything (name, db tables, blocks, templates, etc) in common with the original module. This renaming and installation process has to be done every time an upgrade is performed on each instance.

It seems to me the best way to do this might be to use namespaces, as Mamba suggests, to isolate the code - although more investigation clearly needs to be done. With a little "pre-processing" the module should be able to correctly create "clones" of itself that use tables created specifically for that instance of the module so they would not be shared.