Author Topic: Bash Script to clone SOBI2 and Plugins (Cloning Tool)  (Read 100899 times)

0 Members and 3 Guests are viewing this topic.

Offline neo

  • Sobi Team
  • Development
  • Sobi Hero
  • *
  • Posts: 8088
  • Reviews:

    What is it?

    • Sobi Team Member
Re: Bash Script to clone SOBI2 and Plugins (Cloning Tool)
« Reply #20 on: 06. September 2008, 10:35:09 »
In my case the script didn't handle "report" (Report_listing plugin)...

As I said:

I used this script to create the extensions clone for the demo site and as You can see it works perfectly.

See self: http://joomla.sigsiu.net/extensions/report_listing/sid/1.html
Support SobiPro - Submit a review on JED
If you want ongoing development for SobiPro and new applications being developed we need your review for SobiPro in the Joomla Extensions Directory.
Thank you very much :w00t:
Country: Germany Germany |  OS: Unknown Unknown Browser: Unknown Unknown | View Profile 


Offline Poffen

  • SOBI Team
  • Moderator
  • Sobi Hero
  • *
  • Posts: 2296
  • Reviews:

    What is it?

Re: Bash Script to clone SOBI2 and Plugins (Cloning Tool)
« Reply #21 on: 06. September 2008, 14:00:10 »
Yes I see that this plugin is working, and I don't have a clue why I couldn't get the script to translate the plugin correctly. I tried the script on the latest version of the component, using the same procedure, and it installed smoothly and worked right out of the box!

I also noticed that you have retained the name of the plugin (i.e. "SOBI Report Listing") and the name of the report_init.php file. Does this mean that it's not necessary to change the name of the plugin or any of the files containing the "report-phrase"?   :wassat:

Poffen
Joomla - 1.5.7, Sobi2 - 2.9.0.1
PHP - 5.2.4, MySQL - 5.0.51a, Apache - 2.2.8, Firefox - 3.0.3
Country: Norway Norway |  OS: Unknown Unknown Browser: Unknown Unknown | View Profile

Do you want continued ongoing development, new features and active support?
Please write a review or just vote for SOBI on JED.

Offline neo

  • Sobi Team
  • Development
  • Sobi Hero
  • *
  • Posts: 8088
  • Reviews:

    What is it?

    • Sobi Team Member
Re: Bash Script to clone SOBI2 and Plugins (Cloning Tool)
« Reply #22 on: 08. September 2008, 07:17:20 »
Does this mean that it's not necessary to change the name of the plugin or any of the files containing the "report-phrase"? 

No it is not  ;)

Regards,
Neo
Support SobiPro - Submit a review on JED
If you want ongoing development for SobiPro and new applications being developed we need your review for SobiPro in the Joomla Extensions Directory.
Thank you very much :w00t:
Country: Germany Germany |  OS: Unknown Unknown Browser: Unknown Unknown | View Profile 

Offline Basil Fawlty

Re: Bash Script to clone SOBI2 and Plugins (Cloning Tool)
« Reply #23 on: 10. September 2008, 03:15:55 »
I am thinking it's down to what Linux distro and then what is installed. I performed this on Linux webserver to which I have shell access but it wouldn't surprise me if they don't strip out a lot of stuff, partly because they don't want you running shell scripts.

In the end I found a couple of useful tools to do the cloning work locally. I can now do a whole clone including all modules and plugins within 5 minutes per directory.

http://www.filerenamer.net/ - can mass rename files within subdirectories
http://www.ultraedit.com/ - Can search/replace fully within subdirectories
« Last Edit: 10. September 2008, 03:21:06 by yorweb »
Country: United Kingdom United Kingdom |  OS: Unknown Unknown Browser: Unknown Unknown | View Profile

Offline eviltodd

Re: Bash Script to clone SOBI2 and Plugins (Cloning Tool)
« Reply #24 on: 16. September 2008, 15:30:14 »
Ok so I installed your test script (becasue i dont have shelll access to my linux host so cant make my own copies) and it seemed to work fine (using Joomla 1.56 in legacy mode) was able to link to the script and make changes etc.  But when i went to do an entry either from the front end or the backend I get this error. 

Fatal error: Cannot redeclare class directory in /njafterdark/components/com_directory/directory.class.php on line 22

I saw someone earlier had the same issue but didnt see any ideas on how to fix it. 

So ideas?
Country: United States United States |  OS: Unknown Unknown Browser: Unknown Unknown | View Profile

Offline neo

  • Sobi Team
  • Development
  • Sobi Hero
  • *
  • Posts: 8088
  • Reviews:

    What is it?

    • Sobi Team Member
Re: Bash Script to clone SOBI2 and Plugins (Cloning Tool)
« Reply #25 on: 17. September 2008, 08:02:56 »
Fatal error: Cannot redeclare class directory in /njafterdark/components/com_directory/directory.class.php on line 22

I guess You have something (component/module/...) which declaring class called "directory" (the name was maybe to simple)

Ok so I installed your test script (becasue i dont have shelll access to my linux host so cant make my own copies) ...

My deal: for a review for SOBI2 in JED I'm ready to create SOBI2 clone (component only) for You  ;)

 
Support SobiPro - Submit a review on JED
If you want ongoing development for SobiPro and new applications being developed we need your review for SobiPro in the Joomla Extensions Directory.
Thank you very much :w00t:
Country: Germany Germany |  OS: Unknown Unknown Browser: Unknown Unknown | View Profile 

Offline RussellEngland

Re: Bash Script to clone SOBI2 and Plugins (Cloning Tool)
« Reply #26 on: 22. September 2008, 18:42:02 »
I wrote this little clone in vbscript which I run in excel - don't all shout, I'm slowly converting to linux :)

It seems to work *most* of the time - sometimes I get an error when writing a file which seems to resolve itself the second time around.

Go to excel/word/access - create a new module via the visual basic editor - insert the code - reference the scripting library (in tools->references)

Unzip the original copy of SOBI2 into the folder of your choice.

Then change the constants at the top for your folder / clone name / clone menu name and click run.


Code: [Select]
Const strFolder = "C:\Downloads\Joomla\SobiClone\Rentalz"
Const strClone = "Rentalz"
Const strMenuName = "Villa Rentals"

Sub SobiClone()
    ' References "Microsoft Scripting Runtime" c:\windows\system32\scrrun.dll
    Dim oFSO As New FileSystemObject
    Dim oFolder As Folder
   
   
    Set oFolder = oFSO.GetFolder(strFolder)
   
    JustDoit oFolder
   
    Set oFolder = Nothing
    Set oFSO = Nothing
   
    Debug.Print "Finished"
End Sub

Sub JustDoit(oFolder As Folder)
    Dim oFile As File
    Dim oText As TextStream
    Dim strText As String
    Dim oSubFolder As Folder
    Dim strFileName As String
   
    For Each oFile In oFolder.Files
        ' Look for a required extension
        If InStr("php|txt|css|xml|ini", LCase(Right(oFile.Name, 3))) > 0 Or LCase(Right(oFile.Name, 4)) = "html" Or LCase(Right(oFile.Name, 2)) = "js" Then
            ' Open file and put into a string
            strText = ""
            Set oText = oFile.OpenAsTextStream(ForReading)
            If Not oText.AtEndOfStream Then
                strText = oText.ReadAll
            End If
            oText.Close
           
            If strText > "" Then
                ' The string has content
                strText = Replace(strText, "sobi@sigsiu.net", "xzxz@sigsiu.net")
                strText = Replace(strText, "sobi2", LCase(strClone) & "2", , , vbBinaryCompare)
                strText = Replace(strText, "Sobi2", UCase(Left(strClone, 1)) & LCase(Mid(strClone, 2, Len(strClone))) & "2", , , vbBinaryCompare)
                strText = Replace(strText, "SOBI2", UCase(strClone) & "2", , , vbBinaryCompare)
                strText = Replace(strText, "sobi", LCase(strClone), , , vbBinaryCompare)
                strText = Replace(strText, "Sobi", UCase(Left(strClone, 1)) & LCase(Mid(strClone, 2, Len(strClone))), , , vbBinaryCompare)
                strText = Replace(strText, "SOBI", UCase(strClone), , , vbBinaryCompare)
                strText = Replace(strText, "Sigsiu Online Business Index 2", strMenuName)
                strText = Replace(strText, "xzxz@sigsiu.net", "sobi@sigsiu.net")
               
                ' Open the file and write the string
                Set oText = oFile.OpenAsTextStream(ForWriting)
                oText.Write (strText)
                oText.Close
            End If
           
        End If
       
        If InStr(LCase(oFile.Name), "sobi") > 0 Then
            ' File name has "sobi" in it, so rename the file
            strFileName = oFile.Name
            strFileName = Replace(strFileName, "sobi", LCase(strClone), , , vbBinaryCompare)
            strFileName = Replace(strFileName, "Sobi", UCase(Left(strClone, 1)) & LCase(Mid(strClone, 2, Len(strClone))), , , vbBinaryCompare)
            strFileName = Replace(strFileName, "SOBI", UCase(strClone), , , vbBinaryCompare)
            oFile.Move oFile.ParentFolder & "\" & strFileName
        End If
       
        ' Give windows a chance to catch up
        DoEvents
    Next
   
    ' Recurse the folders
    For Each oSubFolder In oFolder.SubFolders
        JustDoit oSubFolder
    Next
       
End Sub
Joomla newbie since 11-June-08
Joomla version 1.5.21 :: Sobi2 version 2.9.3.2
PHP version 5.2.14 :: MySQL Version 5.1.52
PHP Script Execution Time 30 Seconds :: PHP Memory Limit 64mb
Country: United Kingdom United Kingdom |  OS: Unknown Unknown Browser: Unknown Unknown | View Profile Global Dialysis

Offline Chacapamac

Re: Bash Script to clone SOBI2 and Plugins (Cloning Tool)
« Reply #27 on: 23. September 2008, 15:06:39 »
Sorry to come back on this subject but I like some clarification on the process to make a SOBI2 clone...

The process is:

Use of the bash script to create a clone of SOBI2 directory:

• Extract SOBI2 (or plugin or module etc)
• Copy the attached script (and unpack of course) into the directory where You've unpacked SOBI2 (or plugin or module etc)
• From the console execute sh clone_sobi.sh

Step by step:

1) Using webmin, uploaded the latest SOBI2 component zip file and extracted it on the server.
Question 1a— Use any ftp client to upload to your server, OK. The emplacement and name of the directory have any importance?
Question 1b— the actual SOBI2 component folder, when extracted(unzip) is name com_sobi2-RC2.8.7.2 do I upload this folder with this name to the FTP space choosen?

2) Uploaded your bash script to the same directory as the extracted SOBI2 Component.
Question 2— I upload the clone_sobi.sh file in the already upload (com_sobi2-RC2.8.7.2)?

3) Opened up my SSH client on my mac, and connected to the server.
Question 3a— On mac you use the Terminal Window go to File—> Connect to Server and choose the Protocol Secure Shell (ssh), what do you put in the User field and do you choose SSH (Automatic) or SSH 1 or SSH 2 in the server field do you enter the adress like this: http://www.yourdomainname.com?
Question 3b— To install local, what do you put in the User field and for the Server (http://localhost:8888/pathtoyoursite/?
Question 3c—How do you know that you are connected (Terminal Window)?

4) Changed directories to my directory where the bash script and extracted SOBI2 files were.
Question 4— I don’t understand this one?

5) Executed the bash script with the 'sh clone_sobi.sh' command.
Question 5— Do you just enter where the cursor is sh clone_sobi.sh and press Return (Enter)   

6) Followed the prompts in the script to name my new clone.
Question 6— Just input the choosen new name for the component... ex: SOBI2_clone1?

7) The script completed successfully, verified by observing the renamed files in the directory.

8 ) In Joomla 1.5, went to the component install screen and used the INSTALL DIRECTORY option (the directory where the extracted and now modified SOBI2 files were).

9) Clicked the install button and SUCCESS! Component installed successfully.

Sorry to ask details, but I’m not familiar with the terminal Window......

Country: Canada Canada |  OS: Unknown Unknown Browser: Unknown Unknown | View Profile

Offline kai920

Re: Bash Script to clone SOBI2 and Plugins (Cloning Tool)
« Reply #28 on: 26. September 2008, 02:57:36 »
I think I successfully created the clone using clone_sobi.sh in Mac OS terminal. I archived it, uploaded, and got this:

Code: [Select]
Warning: zip_read() expects parameter 1 to be resource, integer given in /home/mysite/public_html/libraries/joomla/filesystem/archive/zip.php on line 234

Warning: zip_close() expects parameter 1 to be resource, integer given in /home/mysite/public_html/libraries/joomla/filesystem/archive/zip.php on line 250
Unable

I'm using this on Joomla 1.5.7 (legacy enabled), and SOBI2 2.9 SVN 4480.
« Last Edit: 26. September 2008, 03:18:38 by kai920 »
Useful Sobi2 links
1. Template Commands
2. F.A.Q.
   Other useful links
1. Firebug
2. Firebug
3. Firebug
Country: Hong Kong Hong Kong |  OS: Unknown Unknown Browser: Unknown Unknown | View Profile

Offline kram

Re: Bash Script to clone SOBI2 and Plugins (Cloning Tool)
« Reply #29 on: 26. September 2008, 21:14:57 »
Hello All,

I just ran the clone_sobi.sh on RC2.8.7.2

Only had one small issue!

Renaming \033[1m./sobi2.cache.class.php\033[0m to \033[1m./directory.cache.class.php\033[0m
mv: invalid option -- T

This mv: invalid option -- T was the error for all files to be renamed.

I simply edited the clone_sobi.sh file

mv -fT $filename $newname

Removed the T

And everything worked like a charm.
Country: South Africa South Africa |  OS: Unknown Unknown Browser: Unknown Unknown | View Profile

Tags: