Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Future Improvements (https://forums.graalonline.com/forums/forumdisplay.php?f=10)
-   -   copylevel() (https://forums.graalonline.com/forums/showthread.php?t=86767)

cbk1994 07-08-2009 03:40 PM

copylevel()
 
We have movefile (and even copylevel), so why no copyfile? I'd like to use it to automatically back up some files every few hours.

cbk1994 08-09-2009 03:42 AM

Bump because this functionality pretty much already exists for levels. And yes, the title of the thread was supposed to be copyfile().

fowlplay4 08-09-2009 04:25 AM

I concur, as well as some kind of way to monitor how many I/O functions I can use before the I/O spam prevention kicks in.

LoneAngelIbesu 08-22-2009 06:51 PM

Semi-gravedig. But uh.. this seems pretty straightforward to do on your own? Correct me if I'm not understanding something...

PHP Code:

function copyfile(sourceoutput) {
  
temp.contents.loadlines(temp.source);
  
temp.contents.savelines(temp.output0);



Inverness 08-22-2009 07:25 PM

Quote:

Originally Posted by LoneAngelIbesu (Post 1517591)
Semi-gravedig. But uh.. this seems pretty straightforward to do on your own? Correct me if I'm not understanding something...

PHP Code:

function copyfile(sourceoutput) {
  
temp.contents.loadlines(temp.source);
  
temp.contents.savelines(temp.output0);



If you're copying a file like that you'd want to use loadstring() not loadlines(). loadlines() is for text files and stuff, loadstring() loads in a binary format.

LoneAngelIbesu 08-22-2009 08:01 PM

Quote:

Originally Posted by Inverness (Post 1517603)
If you're copying a file like that you'd want to use loadstring() not loadlines(). loadlines() is for text files and stuff, loadstring() loads in a binary format.

I guess the point being that this is something very simple to do...

Pelikano 08-22-2009 08:39 PM

I hope you're not going to put backups on the same server...

LoneAngelIbesu 08-22-2009 09:18 PM

Quote:

Originally Posted by Pelikano (Post 1517631)
I hope you're not going to put backups on the same server...

I'm guessing he wouldn't be making backups for the purpose you're thinking of. As far as I know, those kind of backups are done routinely by GraalOnline. Chris probably wants to back-up files that are changed frequently. If some errant change occurs, he would be able to restore the pre-error file.

Pelikano 08-22-2009 10:42 PM

Quote:

Originally Posted by LoneAngelIbesu (Post 1517659)
I'm guessing he wouldn't be making backups for the purpose you're thinking of. As far as I know, those kind of backups are done routinely by GraalOnline. Chris probably wants to back-up files that are changed frequently. If some errant change occurs, he would be able to restore the pre-error file.

Oh I see, I just remembered the "resetting people on mistake case" xD

cbk1994 08-22-2009 11:00 PM

Quote:

Originally Posted by Pelikano (Post 1517692)
Oh I see, I just remembered the "resetting people on mistake case" xD

That would be useful, actually, but what I was thinking of was backing up the SQLite database every few hours, and placing it in some backups/* folder that a staff member can download every day or so. We already keep backups of banks, stock info, etc. on Era's server in case someone accidentally resets ones (a lot less likely now that Hachi no longer works here).

I guess copyfile() can already be done with loadstring/savestring, but it's roundabout and probably far less efficient.

LoneAngelIbesu 08-23-2009 12:35 AM

Quote:

Originally Posted by cbk1994 (Post 1517699)
I guess copyfile() can already be done with loadstring/savestring, but it's roundabout and probably far less efficient.

It's file I/O no matter which way you do it, so I doubt it's neither more nor less efficient than if it were to be part of the engine.

Pelikano 08-23-2009 10:07 AM

Quote:

Originally Posted by LoneAngelIbesu (Post 1517729)
It's file I/O no matter which way you do it, so I doubt it's neither more nor less efficient than if it were to be part of the engine.

agreed, it just... copies the level :D

Deas_Voice 12-20-2009 01:13 AM

Bump, would be glad if this existed.


All times are GMT +2. The time now is 11:23 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.