Advertisement:

Author Topic: Java SMF automated database backup  (Read 170155 times)

Offline RoarinRow

  • Full Member
  • ***
  • Posts: 662
  • Gender: Male
  • Ride my AV!
    • Avalanche Style
Re: Java SMF automated database backup
« Reply #20 on: May 19, 2007, 12:35:54 PM »
Is there a way it could back up to a directory on my server instead of my PC? 

SMF 2.0
TP 1.0 RC1.1
Wordpress 3.1.3

Offline viulian

  • Jr. Member
  • **
  • Posts: 235
    • Hex.ro
Re: Java SMF automated database backup
« Reply #21 on: May 19, 2007, 12:58:50 PM »
Yep, it works, even if I didn't test it before with this scenario :)

You should go to Forums -> Settings... and in the "Backup Directory" text box type something like:

\\192.168.2.103\Share\BKForums

Of course you need to have write access, otherwise you'll end up with a FileNotFoundException/IOException or something Java would throw.

Offline Ken.

  • Full Member
  • ***
  • Posts: 496
  • Gender: Male
  • TinyPortal Rocks!
    • Our FamilyForum
Re: Java SMF automated database backup
« Reply #22 on: May 19, 2007, 03:02:48 PM »
Ps. as a feature request i would like to see the possibility to restore the database using this tool.. Is that even possible.. the reason why i ask this is because i get all sweaty and nerveous when i go to phpmyadmin or whatever you call that bloody thing.. i want something simple when it comes to my database.. like the roll-back-feature that is buildt into my Windows OS.

And thanks to the Dude who posted the link over at TinyPortal :D

You are welcome!  ;)

Just a thought here based on the feature request by Tanks;
At this point this b/u script looks at the SMF built-in backup utility and executes it to get the backup, is this correct???

If so heres my thought/question... we also have two php backup/restore files available that might be worth a look to see if they could be used to add a restore feature to Java SMF Backup.
Those two files are in this thread posted by [Unknown];
http://www.simplemachines.org/community/index.php?topic=18350.msg168327#msg168327
"If you don't have a stack of failures in your shop, you aren't trying hard enough". --Richard Raffin.


Offline viulian

  • Jr. Member
  • **
  • Posts: 235
    • Hex.ro
Re: Java SMF automated database backup
« Reply #23 on: May 19, 2007, 03:39:18 PM »
Thanks for the links :)

I have to describe why I have created the application, and my vision about it - and thus explain why I wouldn't like anything related to additional scripts uploaded on the servers.

My main drive when creating this application was to avoid any manual patching/hacking/uploading of helper scripts on the forums.
I mean you need ftp/rights/make sure they work standalone, and only then install the application and pray it works :)... And then maybe loose data when trying a restore, etc.
I have 2 live forums + some test ones and doing that much manual labor on them would amount to.... i don't even want to think about it.

I was so lasy I haven't tried any of that above - I kinda felt how shaky that would be.
I was content with manually making backup with PhpMyAdmin/SMF built in utility, till my hosting provider started failing from time to time, and I needed a way to know that each day I have a fresh backup.

And the rest is history :)
Never touched cron/fakecron/etc, I aimed for something that was painless even for me the lazy one to use :D
Took me a couple of weeks to do (worked from time to time) then with Grudge's help published it here, and now, after >3000 downloads, everyone likes it :)

Why ? No pain to run it + it works.

-

Those being said, here's how I think its best for the app to be extended:
It will be in fact a wrapper for phpmyadmin.
It will do the 'clicks' for you and intercept the download which will be saved on the filesystem. You will be able to specify all the databases you want to be backed up, such as they appear in the phpmyadmin dropdowns, specify the user/pass for each one, and then the program will take care of downloading them.
This will solve the coppermine bk issue (directly backing up the database), and will also let you restore the databases using phpmyadmin.

I'll also keep the current functionality - so if people are not that keen on restoring their db will still find the application very easy to use. I mean, I never needed a restore - I just want to feel safe that I have a backup :)

--

So please bare with me, till I get around and extend this application. It will probably take a month but it will work - but you won't ever need to touch FTP again :)


Offline Tanks

  • Full Member
  • ***
  • Posts: 583
  • Gender: Male
  • Danish Dude
Re: Java SMF automated database backup
« Reply #24 on: May 20, 2007, 12:35:57 PM »
This sounds great  :)

Offline viulian

  • Jr. Member
  • **
  • Posts: 235
    • Hex.ro
Re: Java SMF automated database backup
« Reply #25 on: May 20, 2007, 12:54:13 PM »
Thanks for support!

Just found out there are some heavy usage users who have SQL files that get up to 250Mb :D and that surpasses over any normal limit phpmyadmin (or any php script in fact) might accept via a POST.

So... I guess I might do it with some generic scripts which the application will upload via FTP, call them via HTTP to create backup SQL files and then the application downloads them back to the computer via FTP too. The same for restore.

But I'm a bit overwhelmed as there are only a few users which such huge requirements and all sort of things can make the whole FTP/HTTP/FTP chain to break, rendering the application a failure for anyone expecting it just to work.

I'll see..

Offline Ken.

  • Full Member
  • ***
  • Posts: 496
  • Gender: Male
  • TinyPortal Rocks!
    • Our FamilyForum
Re: Java SMF automated database backup
« Reply #26 on: May 21, 2007, 11:40:39 AM »
If there are only a few who have the large file issue would it be reasonable to have a 'regular' version for smaller sized db's and then write some kind of add-on feature so that folks with those large file requirements could use the utility as well?

Quote
But I'm a bit overwhelmed as there are only a few users which such huge requirements and all sort of things can make the whole FTP/HTTP/FTP chain to break, rendering the application a failure for anyone expecting it just to work.
"If you don't have a stack of failures in your shop, you aren't trying hard enough". --Richard Raffin.


Offline dyota

  • Semi-Newbie
  • *
  • Posts: 69
Re: Java SMF automated database backup
« Reply #27 on: May 22, 2007, 09:24:52 AM »
is it ok for smf 1.1.2 and other mods?

Offline viulian

  • Jr. Member
  • **
  • Posts: 235
    • Hex.ro
Re: Java SMF automated database backup
« Reply #28 on: May 22, 2007, 09:33:14 AM »
Sure! As long as none of the mods will take over the index.php of the forum.

Here are the mods I have installed:

1.     Merge Double Posts      1.0.6      [ List Files ]  [ Delete ]
2.    Invite    1.13    [ Uninstall ] [ List Files ] [ Delete ]
3.    AvatarSelect    1.1.2    [ Uninstall ] [ List Files ] [ Delete ]
4.    Karma Description Mod    2.2    [ Uninstall ] [ List Files ] [ Delete ]
5.    Personality Tests    1.0.1    [ Uninstall ] [ List Files ] [ Delete ]
6.    Rename Topic    1.0.2    [ Uninstall ] [ List Files ] [ Delete ]
7.    require-dir Tag fix.    1.0    [ Uninstall ] [ List Files ] [ Delete ]
8.    YouTube BBC Tag (XHTML Compliant)    1.0    [ Uninstall ] [ List Files ] [ Delete ]
9.    Pligg Bridge Integration Mod    1.1.0    [ Uninstall ] [ List Files ] [ Delete ]
10.    SMF File Manager    1.0.3    [ Uninstall ] [ List Files ] [ Delete ]
11.    SMF 1.1.2 Update Package    1.1.2    [ Uninstall ] [ List Files ] [ Delete ]

Offline dyota

  • Semi-Newbie
  • *
  • Posts: 69
Re: Java SMF automated database backup
« Reply #29 on: May 22, 2007, 11:04:11 AM »
Quote
1.     SMF 1.1.2 Update Package      1.1.2      [ List Files ]  [ Delete ]
2.    Gender On Registration    1.0    [ Uninstall ] [ List Files ] [ Delete ]
3.    Users Online Today Mod    1.4.0    [ Uninstall ] [ List Files ] [ Delete ]
4.    TinyPortal    0.983    [ Apply Mod ] [ List Files ] [ Delete ]
5.    MessagePreviewOnHover    1.5    [ Uninstall ] [ List Files ] [ Delete ]
6.    Invite a Friend    1.0    [ Uninstall ] [ List Files ] [ Delete ]
7.    Member Awards    1.0.2    [ Uninstall ] [ List Files ] [ Delete ]
8.    Frequency Bar    1.1    [ Uninstall ] [ List Files ] [ Delete ]
9.    PFCChatroom    1.0.9    [ Uninstall ] [ List Files ] [ Delete ]
10.    SMF Gallery Lite    1.7.1    [ Uninstall ] [ List Files ] [ Delete ]
11.    Welcome Topic Mod    1.0    [ Uninstall ] [ List Files ] [ Delete ]
12.    SMFShop    3.0    [ Uninstall ] [ List Files ] [ Delete ]
13.    Password Protect Boards    0.1    [ Uninstall ] [ List Files ] [ Delete ]
14.    Karma Description Mod    2.3    [ Uninstall ] [ List Files ] [ Delete ]
15.    Subject Statistics In Subject 2.2    2.2    [ Uninstall ] [ List Files ] [ Delete ]
16.    Ad Managment    2.3    [ Uninstall ] [ List Files ] [ Delete ]
17.    cbi, 1.0    1.0    [ Uninstall ] [ List Files ] [ Delete ]
18.    SMF Trader System    1.0.1    [ Uninstall ] [ List Files ] [ Delete ]
19.    View Only Boards    1.0    [ Uninstall ] [ List Files ] [ Delete ]
20.    Global Announcements    1.0    [ Uninstall ] [ List Files ] [ Delete ]
21.    Board Viewers Mod

these are my mods...hehehhe lot of..just to make sure

Offline viulian

  • Jr. Member
  • **
  • Posts: 235
    • Hex.ro
Re: Java SMF automated database backup
« Reply #30 on: May 22, 2007, 01:01:43 PM »
[I just edited this post as it is flawed. Please check the next two answers for explanations]

My post was:
I don't know how TinyPortal works - that might use SMF Integration API.. making my module useless.

« Last Edit: May 22, 2007, 05:04:38 PM by viulian »

Offline Ken.

  • Full Member
  • ***
  • Posts: 496
  • Gender: Male
  • TinyPortal Rocks!
    • Our FamilyForum
Re: Java SMF automated database backup
« Reply #31 on: May 22, 2007, 01:27:18 PM »
You would need to ask over on the TP forum to be sure, but I don't think that it would have any effect at all... I have TP installed on both of the forums that I'm using your current version of Java SMF Backup to do my b/u's and its no problem that I can see.

Several times in the past I've completely wiped my site clean and started over with a fresh database and then fresh installs of SMF, TP and my html pages and after its all up and running then simply import the last saved mySQL database backup into the d/b and its all back to like before. So, I don't see that this would be any different, but then I'm not a coder so my opinion may be wrong.

EDIT: This is just IMHO and keep in mind that I'm not a coder but whether you use the SMF built-in backup or wrap the phpmyadmin as you mentioned in the one post I just don't see it making any difference what mods are installed because the backup will just collect up the required data from the d/b and send a copy without having any direct effect on any mods because its not changing anything, just collecting data. 
« Last Edit: May 22, 2007, 01:37:19 PM by Ken. »
"If you don't have a stack of failures in your shop, you aren't trying hard enough". --Richard Raffin.


Offline viulian

  • Jr. Member
  • **
  • Posts: 235
    • Hex.ro
Re: Java SMF automated database backup
« Reply #32 on: May 22, 2007, 01:47:02 PM »
Darn.

I'm confused - sorry guys :)

I just published a integration mod for SMF to Pligg (open source social bookmarking tool) and being busy at work somehow I confused the threads and of course, the answers  >:(

Thanks Ken. for waking me up to it gently :)

The answer to the initial question dyota had remains as I gave it. It doesn't matter as long as the given URL is the forum URL (i mean it points to the SMF's index.php and not some other entry page).
« Last Edit: May 22, 2007, 02:07:27 PM by viulian »

Offline Ken.

  • Full Member
  • ***
  • Posts: 496
  • Gender: Male
  • TinyPortal Rocks!
    • Our FamilyForum
Re: Java SMF automated database backup
« Reply #33 on: May 22, 2007, 04:24:19 PM »
Hey you had me confused too... but then I'm easy!  ;D
"If you don't have a stack of failures in your shop, you aren't trying hard enough". --Richard Raffin.


Offline CrayZ

  • Jr. Member
  • **
  • Posts: 115
  • Gender: Male
    • Takime Network
Re: Java SMF automated database backup
« Reply #34 on: May 27, 2007, 07:02:10 PM »
It is a good program, but unfortunately on Yahoo server is not working. :(

Offline philwojo

  • Semi-Newbie
  • *
  • Posts: 20
Re: Java SMF automated database backup
« Reply #35 on: June 01, 2007, 11:35:44 AM »
I am getting the following when I try to run this now.  It was working, but not it has stopped.

[01/06 10:33:28] Backup request received.
[01/06 10:33:28] Connection starting.
[01/06 10:33:28] Connecting to http://www.aaaaaa.com/forum/index.php?action=admin [nofollow]
[01/06 10:33:28] class java.lang.NullPointerException: null
[01/06 10:33:28] Next run at: Jun 2, 2007 1:45:00 AM

The "aaaaaa" is where my domain name is at (removed by me to post here). 

Any ideas of what might be wrong on my end?

thanks,
Phil


Offline viulian

  • Jr. Member
  • **
  • Posts: 235
    • Hex.ro
Re: Java SMF automated database backup
« Reply #36 on: June 01, 2007, 12:11:36 PM »
I can help if you enable Debug mode inside the application, and you can copy/paste the log around the exception you'll see there..

Thanks!

Offline philwojo

  • Semi-Newbie
  • *
  • Posts: 20
Re: Java SMF automated database backup
« Reply #37 on: June 01, 2007, 12:20:47 PM »
I am not sure if you need more or less than this, but here it is:

Jun 1, 2007 11:15:58 AM org.apache.commons.httpclient.HttpParser parseHeaders
FINEST: enter HeaderParser.parseHeaders(InputStream, String)
Jun 1, 2007 11:15:58 AM org.apache.commons.httpclient.HttpParser readLine
FINEST: enter HttpParser.readLine(InputStream, String)
Jun 1, 2007 11:15:58 AM org.apache.commons.httpclient.HttpParser readRawLine
FINEST: enter HttpParser.readRawLine()
Jun 1, 2007 11:15:58 AM org.apache.commons.httpclient.Wire wire
FINE: << "[\r]"
Jun 1, 2007 11:15:58 AM org.apache.commons.httpclient.Wire wire
FINE: << "[\n]"
Jun 1, 2007 11:15:58 AM org.apache.commons.httpclient.HttpMethodBase shouldCloseConnection
FINE: Should NOT close connection in response to directive: Keep-Alive
Jun 1, 2007 11:15:58 AM org.apache.commons.httpclient.HttpConnection isResponseAvailable
FINEST: enter HttpConnection.isResponseAvailable()
Jun 1, 2007 11:15:58 AM org.apache.commons.httpclient.HttpConnection releaseConnection
FINEST: enter HttpConnection.releaseConnection()
Jun 1, 2007 11:15:58 AM org.apache.commons.httpclient.HttpConnection releaseConnection
FINE: Releasing connection back to connection manager.
Jun 1, 2007 11:15:58 AM smfbackup.conf.Forum updateStatus
FINE: xxx: about to firelogupdate
Jun 1, 2007 11:15:58 AM smfbackup.conf.Forum updateStatus
FINE: AAAAAAA: class java.lang.NullPointerException: null
Jun 1, 2007 11:15:58 AM smfbackup.http.SMFConnection doJob
SEVERE: java.lang.NullPointerException
Jun 1, 2007 11:15:58 AM smfbackup.conf.Forum updateStatus
FINE: xxx: about to firelogupdate
Jun 1, 2007 11:15:58 AM smfbackup.conf.Forum updateStatus
FINE: Philwojo: Next run at: Jun 2, 2007 1:45:00 AM
Jun 1, 2007 11:16:01 AM java.awt.KeyboardFocusManager retargetFocusEvent
FINE: >>> java.awt.event.WindowEvent[WINDOW_LOST_FOCUS,opposite=null,oldState=0,newState=0] on frame0
Jun 1, 2007 11:16:01 AM java.awt.DefaultKeyboardFocusManager dispatchEvent
FINE: java.awt.event.WindowEvent[WINDOW_LOST_FOCUS,opposite=null,oldState=0,newState=0] on frame0
Jun 1, 2007 11:16:01 AM java.awt.DefaultKeyboardFocusManager dispatchEvent
FINE: Active smfbackup.MainWindow[frame0,314,232,653x520,invalid,layout=java.awt.BorderLayout,title=SMF Backup,resizable,normal,defaultCloseOperation=DISPOSE_ON_CLOSE,rootPane=javax.swing.JRootPane[,4,30,645x486,invalid,layout=javax.swing.JRootPane$RootLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=16777673,maximumSize=,minimumSize=,preferredSize=],rootPaneCheckingEnabled=true], Current focused smfbackup.MainWindow[frame0,314,232,653x520,invalid,layout=java.awt.BorderLayout,title=SMF Backup,resizable,normal,defaultCloseOperation=DISPOSE_ON_CLOSE,rootPane=javax.swing.JRootPane[,4,30,645x486,invalid,layout=javax.swing.JRootPane$RootLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=16777673,maximumSize=,minimumSize=,preferredSize=],rootPaneCheckingEnabled=true], losing focus smfbackup.MainWindow[frame0,314,232,653x520,invalid,layout=java.awt.BorderLayout,title=SMF Backup,resizable,normal,defaultCloseOperation=DISPOSE_ON_CLOSE,rootPane=javax.swing.JRootPane[,4,30,645x486,invalid,layout=javax.swing.JRootPane$RootLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=16777673,maximumSize=,minimumSize=,preferredSize=],rootPaneCheckingEnabled=true] opposite null
Jun 1, 2007 11:16:01 AM java.awt.KeyboardFocusManager retargetFocusEvent
FINE: >>> java.awt.event.FocusEvent[FOCUS_LOST,temporary,opposite=null] on javax.swing.JTree[,0,0,146x415,alignmentX=0.0,alignmentY=0.0,border=,flags=16777576,maximumSize=,minimumSize=,preferredSize=,editable=false,invokesStopCellEditing=false,largeModel=false,rootVisible=true,rowHeight=0,scrollsOnExpand=true,showsRootHandles=false,toggleClickCount=2,visibleRowCount=20]
Jun 1, 2007 11:16:01 AM java.awt.DefaultKeyboardFocusManager dispatchEvent
FINE: java.awt.event.FocusEvent[FOCUS_LOST,temporary,opposite=null] on javax.swing.JTree[,0,0,146x415,alignmentX=0.0,alignmentY=0.0,border=,flags=16777576,maximumSize=,minimumSize=,preferredSize=,editable=false,invokesStopCellEditing=false,largeModel=false,rootVisible=true,rowHeight=0,scrollsOnExpand=true,showsRootHandles=false,toggleClickCount=2,visibleRowCount=20]
Jun 1, 2007 11:16:01 AM java.awt.KeyboardFocusManager setNativeFocusOwner
FINEST: Calling peer sun.awt.KeyboardFocusManagerPeerImpl@b85c17 setCurrentFocusOwner for null
Jun 1, 2007 11:16:01 AM java.awt.Component dispatchEventImpl
FINE: java.awt.event.FocusEvent[FOCUS_LOST,temporary,opposite=null] on javax.swing.JTree[,0,0,146x415,alignmentX=0.0,alignmentY=0.0,border=,flags=16777576,maximumSize=,minimumSize=,preferredSize=,editable=false,invokesStopCellEditing=false,largeModel=false,rootVisible=true,rowHeight=0,scrollsOnExpand=true,showsRootHandles=false,toggleClickCount=2,visibleRowCount=20]
Jun 1, 2007 11:16:01 AM java.awt.KeyboardFocusManager retargetFocusEvent
FINE: >>> java.awt.event.WindowEvent[WINDOW_DEACTIVATED,opposite=null,oldState=0,newState=0] on frame0
Jun 1, 2007 11:16:01 AM java.awt.DefaultKeyboardFocusManager dispatchEvent
FINE: java.awt.event.WindowEvent[WINDOW_DEACTIVATED,opposite=null,oldState=0,newState=0] on frame0
Jun 1, 2007 11:16:01 AM java.awt.KeyboardFocusManager setGlobalActiveWindow
FINER: Setting global active window to null, old active smfbackup.MainWindow[frame0,314,232,653x520,invalid,layout=java.awt.BorderLayout,title=SMF Backup,resizable,normal,defaultCloseOperation=DISPOSE_ON_CLOSE,rootPane=javax.swing.JRootPane[,4,30,645x486,invalid,layout=javax.swing.JRootPane$RootLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=16777673,maximumSize=,minimumSize=,preferredSize=],rootPaneCheckingEnabled=true]
Jun 1, 2007 11:16:01 AM java.awt.KeyboardFocusManager retargetFocusEvent
FINE: >>> java.awt.event.FocusEvent[FOCUS_LOST,permanent,opposite=null] on frame0
Jun 1, 2007 11:16:01 AM java.awt.DefaultKeyboardFocusManager dispatchEvent
FINE: java.awt.event.FocusEvent[FOCUS_LOST,permanent,opposite=null] on frame0
Jun 1, 2007 11:16:01 AM java.awt.DefaultKeyboardFocusManager dispatchEvent
FINE: Skipping java.awt.event.FocusEvent[FOCUS_LOST,permanent,opposite=null] on frame0 because focus owner is null


I am trying to run this from work and I have tried it both with and without a proxy.  If it could be that I can try it from home also, but it did work from work previously, and I made no changes.

Thanks,
Phil

Offline viulian

  • Jr. Member
  • **
  • Posts: 235
    • Hex.ro
Re: Java SMF automated database backup
« Reply #38 on: June 01, 2007, 01:02:48 PM »
It looks indeed to be a problem on the doLogin() method.

There can be to explanations:

a)

Have you installed some firewall/antivirus that intercepts the IP messages and maybe alters the headers that pass through it ?

b)

A mod installed on SMF which added a <form> tag without an 'action' specified.

Basically you should try and open http://www.aaaaaa.com/forum/index.php?action=admin in your browser (make sure you're not logged in; nor having the passwords saved, etc). Basically try and open the page just as the application would do, like it would connect for the first time to the site, having no cookies, no password saved, etc.

Search for all the <form> tags and find if there is one which doesn't have an 'action' attribute specified. If there is one, that's where the NullPointerException is generated.


I am positive one of these is the cause of your problems - and I incline towards the latter. Please check it and let me know..

Offline philwojo

  • Semi-Newbie
  • *
  • Posts: 20
Re: Java SMF automated database backup
« Reply #39 on: June 01, 2007, 02:07:53 PM »
I am able to get a login screen from that link.

I am not sure if there are any <form> tags, where would be the best place to look, I am very new to this, but have a solid idea of what is going on, at least I think I do.

Being I am at work I have not installed any firewall/antivirus programs at all, and I don't think that corporate has done any that I am aware of.

Thanks for the quick replies,
Phil