To keep the file sizes down, can you...

This is a forum to suggest new features for mojoPortal. 

This thread is closed to new posts. You must sign in to post in the forums.
2/28/2011 10:55:13 PM
Gravatar
Total Posts 165

To keep the file sizes down, can you...

Hey Joe,

To keep the files sizes down for uploading to the server, it would be nice to have a US (English) only code set.

Thanks,

Mark

3/1/2011 8:54:38 AM
Gravatar
Total Posts 18439

Re: To keep the file sizes down, can you...

What I would like to see is if someone in the community can write a script to delete other language files from the package after unzipping it on your local machine. If someone in the community would like to tackle that and share it please do.

Then we could create a document on this site with instructions for using the script and with a download link for the script.

Maybe I will get to it at some point myself but it isn't a top priority, I have a long list of much higher priorities, so I'm hoping someone in the community will step up and do this.

Best,

Joe

 

3/11/2011 2:21:22 PM
Gravatar
Total Posts 74

Re: To keep the file sizes down, can you...

Is this just in regards to the non-English files in the wwwroot\data\helpfiles folder? I've got a small vbscript that deletes those.

Thanks,

Joe

3/11/2011 3:43:06 PM
Gravatar
Total Posts 74

Re: To keep the file sizes down, can you...

I altered my script to delete all of the non-english file in the wwwroot\data\helpfiles, wwwroot\data\messagetemplates, and wwwroot\app_globalresources folders based on the information I found in the FAQ section of this site.

It took the total number of files from 7,754 to 7,276. It only shaved about 0.3MB off the total size. But hey, less is more right?

If someone would like to test it for me that would be greatly appreciated. It could easily be modified to also delete any of the setup files for the database platforms that you don't plan on using.

Any volunteers?

Thanks,

Joe

3/12/2011 7:38:47 AM
Gravatar
Total Posts 18439

Re: To keep the file sizes down, can you...

Hi Joe,

Thanks for working on this!

I would have thought the size would be reduced by more than that.

Did you verify that your script actually got rid of all the non English .resx files, ie files that end with .**.resx rather than just .resx from App_GlobalResources?

and from the /Data/HelpFiles and /Data/MessageTemplates folders?

If your script works and does remove the files I'd be glad to test it and make it available to others as a download.

Best,

Joe

 

3/13/2011 3:49:59 PM
Gravatar
Total Posts 74

Re: To keep the file sizes down, can you...

Happy to help. It's about time I contributed something to the community. I think that it does remove all of the files from the 3 main locations. The way I had it do the App_GlobalResources folder is kind of lame though. I don't know how to do a 'if like' statement in vbscript. My code is copied below. Just paste it into notepad and name it something.vbs. When you double click on it, select your wwwroot folder from the browser. It takes about 30 seconds to complete. If anyone has any ideas on how to improve please share.

Thanks,

Joe

'Select the wwwroot folder
Dim Path

Path = BrowseForFolder( _
        "Select a file or folder to copy", _
        BIF_returnonlyfsdirs + BIF_browseincludefiles, _
        "")
If Path = "-5" Then
    WScript.Echo "Not possible to select files in root folder"
Else
    If Path = "-1" Then
        WScript.Echo "No object selected; Cancel clicked"
    Else
        WScript.Echo "Folder selected: ", Path
    End If
End If
 

Function BrowseForFolder(title, flag, dir)
    On Error Resume Next

    Dim oShell, oItem, tmp

    ' Create WshShell object.
    Set oShell = WScript.CreateObject("Shell.Application")

    ' Invoke Browse For Folder dialog box.
    Set oItem = oShell.BrowseForFolder(&H0, title, flag, dir)
    If Err.Number <> 0 Then
        If Err.Number = 5 Then
            BrowseForFolder= "-5"
            Err.Clear
            Set oShell = Nothing
            Set oItem = Nothing
            Exit Function
        End If
    End If

    ' Now we try to retrieve the full path.
    BrowseForFolder = oItem.ParentFolder.ParseName(oItem.Title).Path

    ' Handling: Cancel button and selecting a drive
    If Err<> 0 Then
        If Err.Number = 424 Then           ' Handle Cancel button.
            BrowseForFolder = "-1"
        Else
            Err.Clear
            ' Handle situation in which user selects a drive.
            ' Extract drive letter from the title--first search
            ' for a colon (:).
            tmp = InStr(1, oItem.Title, ":")
            If tmp > 0 Then           ' A : is found; use two
                                      ' characters and add \.
                BrowseForFolder = _  
                    Mid(oItem.Title, (tmp - 1), 2) & "\"
            End If
        End If
    End If

    Set oShell = Nothing
    Set oItem = Nothing
    On Error GoTo 0
End Function

'Start deleting non-english files
Set fso=CreateObject("Scripting.FileSystemObject")
Helpfiles= Path & "\data\HelpFiles"
MessageTemplates= Path & "\data\MessageTemplates"
GlobalResources= Path & "\App_GlobalResources"

'Delete non-english Help Files
For Each file In fso.GetFolder(HelpFiles).Files
                If Left(File.Name,2) <> "en" AND Left(File.Name,6) <> "flickr" then
                                On Error Resume Next
                file.delete
                end if
Next

'Delete non-english Message Templates
For Each file In fso.GetFolder(MessageTemplates).Files
                If Left(File.Name,2) <> "en" then
                                On Error Resume Next
                file.delete
                end if
Next

'Delete non-english Global Resources
For Each file In fso.GetFolder(GlobalResources).Files
                If InStr(File.Name,".ar") OR InStr(File.Name,".da") OR InStr(File.Name,".de") OR InStr(File.Name,".el") OR InStr

(File.Name,".es") OR InStr(File.Name,".fa") OR InStr(File.Name,".it") OR InStr(File.Name,".nl") OR InStr(File.Name,".pl") OR

InStr(File.Name,".tr") OR InStr(File.Name,".cs") OR InStr(File.Name,".da") OR InStr(File.Name,".fo") OR InStr(File.Name,".fr") OR

InStr(File.Name,".he") OR InStr(File.Name,".hr") OR InStr(File.Name,".ja") OR InStr(File.Name,".pt") OR InStr(File.Name,".ru") OR

InStr(File.Name,".sv") OR InStr(File.Name,".zh") then
                                On Error Resume Next
                file.delete
                end if
Next 

You must sign in to post in the forums. This thread is closed to new posts.