Re: String concatenation not working

2007-11-15 Thread technicaltitch

PS. Important point - no email backup method should be used unless you
have encrypted your users' passwords.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: String concatenation not working

2007-11-15 Thread technicaltitch

Our content changes much less than that - I only need a backup once
every 6 months, but no harm in doing it monthly as it is zipped. You
can have as frequent as once every 5 mins.

Probably obvious lesson: the backup script deletes the temp directory
and all files in it, so don't set the temp directory to just
dirname(__FILE__) or the script deletes itself!

This problem is now well and truely solved (over-engineered!). I think
both solutions are equally great - mine is very quick to implement and
rollout (quicker than registering, setting up, configing the script,
diagnosing teething troubles, noting passwords, etc), Baz's is
slightly more reliable and zips, and doesn't require changing the cake
framework (making future Cake upgrade problematic).

Thanks hugely Baz for your tireless patience!
Chris

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: String concatenation not working

2007-11-14 Thread Baz
Unless Remote-Cron has changed their service within the last month, they
have jobs less than 1 month.

I used them to run jobs as low as 15 minutes before.
--
Baz L
Web Development 2.0: Web Design, CakePHP, Javascript
http://www.WebDevelopment2.com/

On Nov 14, 2007 4:18 AM, technicaltitch <[EMAIL PROTECTED]> wrote:

>
> Hi Baz,
>
> Thanks for elaborating - I did understand your links and have a look
> at the cron service and backup scripts. I dont want to use the cron
> service as it is a dependency and given I'll not be online much soon,
> I want to minimise dependencies, however running that script without
> redirecting and losing $this->data illuded me.
>
> However out of interest I've now added your solution as well as mine -
> a monthly zipped backup (remote-chron doesn't do less), as well as
> every 6 months, my solution, which I think is also perfectly reliable,
> more nicely formatted, but 4 times the size (not zipped), and delays a
> user action once every 6 months. If either fail I have the other.
>
> Thanks for making this so simple for me
> Chris
>
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: String concatenation not working

2007-11-14 Thread technicaltitch

Hi Baz,

Thanks for elaborating - I did understand your links and have a look
at the cron service and backup scripts. I dont want to use the cron
service as it is a dependency and given I'll not be online much soon,
I want to minimise dependencies, however running that script without
redirecting and losing $this->data illuded me.

However out of interest I've now added your solution as well as mine -
a monthly zipped backup (remote-chron doesn't do less), as well as
every 6 months, my solution, which I think is also perfectly reliable,
more nicely formatted, but 4 times the size (not zipped), and delays a
user action once every 6 months. If either fail I have the other.

Thanks for making this so simple for me
Chris


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: String concatenation not working

2007-11-13 Thread Baz
What we have here is a failure to communicate.

A. Here's your scheduling:
http://www.remote-cron.com/

B. Here's your Backup AND email:
http://www.dagondesign.com/articles/automatic-mysql-backup-script/


You use A to launch B. And be done with it. What's so hard about that?
There is no coding or *implementation* involved here.
--
Baz L
Web Development 2.0: Web Design, CakePHP, Javascript
http://www.WebDevelopment2.com/

On Nov 13, 2007 7:51 PM, technicaltitch <[EMAIL PROTECTED]> wrote:

>
> You are absolutely right - this is a better solution than mine -
> thanks very much Baz!
>
> It does require learning how to send attachments (not very well
> supported within native PHP) and doesn't provide scheduling though, so
> rather than integrate two new modules I've stuck with my substandard
> approach. If I were doing this from scratch I'd use Baz's
> recommendations.
>
> Thanks hugely for everyone's great help and inspiration
> Chris
>
> (PS. The call isnt asynchronous - the redirect happens only once the
> backup has finished.)
>
> (To implement scheduling I've done:
>
> $ret = $this->Article->query("SELECT 1 AS BackupRequired FROM
> last_backup WHERE DATEDIFF(CURDATE(), date) > 180");
> if ($ret) {
>   // DO BACKUP
> .
>   $this->Article->execute("UPDATE last_backup SET date =
> CURDATE()");
> }
>
> (table script:
> CREATE TABLE last_backup (
> date datetime NULL
> ) ENGINE = MYISAM ;
> INSERT INTO last_backup (date) VALUES (CURDATE());
>
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: String concatenation not working

2007-11-13 Thread technicaltitch

You are absolutely right - this is a better solution than mine -
thanks very much Baz!

It does require learning how to send attachments (not very well
supported within native PHP) and doesn't provide scheduling though, so
rather than integrate two new modules I've stuck with my substandard
approach. If I were doing this from scratch I'd use Baz's
recommendations.

Thanks hugely for everyone's great help and inspiration
Chris

(PS. The call isnt asynchronous - the redirect happens only once the
backup has finished.)

(To implement scheduling I've done:

$ret = $this->Article->query("SELECT 1 AS BackupRequired FROM
last_backup WHERE DATEDIFF(CURDATE(), date) > 180");
if ($ret) {
   // DO BACKUP
.
   $this->Article->execute("UPDATE last_backup SET date =
CURDATE()");
}

(table script:
CREATE TABLE last_backup (
date datetime NULL
) ENGINE = MYISAM ;
INSERT INTO last_backup (date) VALUES (CURDATE());


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: String concatenation not working

2007-11-13 Thread technicaltitch

Apologies Baz - I did try that link and it didn't work. Just tried
again and it has this time - very interesting! Thanks and sorry for
not trying those links again...


On Nov 13, 9:51 pm, Baz <[EMAIL PROTECTED]> wrote:
> I guess you missed my previous message. Read these:
>
> http://www.webdevelopment2.com/automate-database-backup-webcron-cron-...http://www.webdevelopment2.com/automate-mysql-database-backup-webcron...
>
> First article tells you where to get FREE cron service...
> The next ... free database backup.
>
> I highly recommend AGAINST what you're thinking about...it just sounds
> clunky and prone to failure.
> --
> Baz L
> Web Development 2.0: Web Design, CakePHP, 
> Javascripthttp://www.WebDevelopment2.com/
>
> On Nov 13, 2007 3:04 PM, technicaltitch <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
> > Forgot to mention - I tried emailing the output of mysqldump, but
> > shell_exec is disabled.
>
> > What are these prewritten scripts/cron services? I can't find them...- Hide 
> > quoted text -
>
> - Show quoted text -


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: String concatenation not working

2007-11-13 Thread technicaltitch

The problem was the setFlash function I'm using to debug! I've just
given the method a view of its own rather than setFlash to a redirect,
and the string outputs fine That never entered my mind...!

So the final function:

function backup() {

$this->redirect('/articles/index');

// Send backup of Articles *
$sql_string = '';
$db_records = $this->Article->findAll();

foreach ($db_records as $article) {
$sql_string .= $this->Article->saveString($article);
}

$to  = '[EMAIL PROTECTED]';
$subject = 'ciwy site articles backup';
$message = wordwrap($sql_string, 70);
$headers = 'From: [EMAIL PROTECTED]' . "\r\n" .
'Reply-To: [EMAIL PROTECTED]' . "\r\n";

mail($to, $subject, $message, $headers);

...and do this for each database table you wish to back up.



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: String concatenation not working

2007-11-13 Thread Baz
I guess you missed my previous message. Read these:

http://www.webdevelopment2.com/automate-database-backup-webcron-cron-jobs-problem/
http://www.webdevelopment2.com/automate-mysql-database-backup-webcron-cron-jobs-problem-part-2/

First article tells you where to get FREE cron service...
The next ... free database backup.

I highly recommend AGAINST what you're thinking about...it just sounds
clunky and prone to failure.
--
Baz L
Web Development 2.0: Web Design, CakePHP, Javascript
http://www.WebDevelopment2.com/

On Nov 13, 2007 3:04 PM, technicaltitch <[EMAIL PROTECTED]> wrote:

>
> Forgot to mention - I tried emailing the output of mysqldump, but
> shell_exec is disabled.
>
> What are these prewritten scripts/cron services? I can't find them...
>
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: String concatenation not working

2007-11-13 Thread technicaltitch

Forgot to mention - I tried emailing the output of mysqldump, but
shell_exec is disabled.

What are these prewritten scripts/cron services? I can't find them...


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: String concatenation not working

2007-11-13 Thread technicaltitch

Thanks hugely for all the great suggestions!

The database is 400kb - if I var_dump the array I get each SQL line
perfectly. I have looked at the vars seperately and each and every
individual array entry works fine, a single insert stmnt works fine, I
have managed to concatenate 2, but as soon as I concatenate all the
string disappears...

The reason for being so cheap is we are a voluntary Bolivian NGO with
> 1000 animals, 3 refuges, campaigning, etc, and we rely entirely on
donations and volunteer fees (www.intiwarayassi.org). Been using
bargainvault for years now and they have been flawless.

By asynchronous I may be ignorant, but I'm planning to do a redirect
and then email the data. I thought this would redirect before
emailing. Anyway shouldn't be a problem as the database is tiny.

Any easy answers or plugin scripts VERY welcome - keen to do this the
laziest way possible.

Thanks HUGELY for all your great suggestions - much appreciated.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: String concatenation not working

2007-11-13 Thread maschoen

I know this might sound a little obvious, but what would you say the
size of your database is in bytes of text?
I only ask because if for example, your database had 100Gig, you
certainly would not expect this to work, would you?
It would seem that for a website that can be hosted for $11/month that
the operation aught to work, however I don't have an experience with
what kind of room PHP or probably mod_php gives you.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: String concatenation not working

2007-11-12 Thread Baz
There is no asynchronous call done during an HTTP GET/POST unless you're
running PHP with FastCGI or something. And even then, there's a lot of other
parameters. PHP scripts stop when the client connection dies.

If *all* we're looking for is a database backup, there are prewritten
scripts that already do that...and there is a free cron service that you can
use.

I really don't get why we're making this so hard. But maybe that's just me,
I'm lazy that way.
--
Baz L
Web Development 2.0: Web Design, CakePHP, Javascript
http://www.WebDevelopment2.com/

On Nov 12, 2007 12:21 PM, technicaltitch <[EMAIL PROTECTED]> wrote:

>
> That is exactly how I intend to kick this off thanksif I ever get
> it working!
>
> (By sticking the code after the redirect call the backup will
> presumably be dealt with asynchronously.)
>
> On Nov 12, 4:19 pm, "Samuel DeVore" <[EMAIL PROTECTED]> wrote:
> > you could also do a 'lazy mans' cron. and just have a script that is
> > kicked off the first time a web page is loaded every n-days.  I use
> > the robots.txt because I really don't care too much if once every
> > month late at night it takes a while to load.  I also dynamically
> > generate that page for a couple of other reasons.
> >
> > Sam D
> >
> > On 11/12/07, technicaltitch <[EMAIL PROTECTED]> wrote:
> >
> >
> >
> >
> >
> >
> >
> > > Thanks very much for your help, but I'm afraid I don't have a
> > > workstation to run this from. Also, having this arrive at people's
> > > inboxes is incredibly convenient. I'm just at a complete loss as to
> > > why the string concatenation doesn't work.
> >
> > > On Nov 12, 1:08 pm, Guillaume <[EMAIL PROTECTED]> wrote:
> > > > If your host allows it, you can use your own workstation and program
> a
> > > > script that periodically does something like
> >
> > > > mysqldump -C --host DB_HOSTNAME -u USERNAME -p PASSWORD DB_NAME >
> > > > mysdump.sql
> >
> > > > over the network.
> >
> > > > Your mysql needs to be reachable from outside the server.
> >
> > > > My host used to allow it and it was a very convenient and quick
> (owing
> > > > to the C option) way to backup a database remotely.
> >
> > > > There can be security hazards though (but sending the dump via email
> > > > too).
> >
> > > > Guillaumehttp://cherryonthe.popnews.com
> >
> > > > On 12 nov, 10:21, technicaltitch <[EMAIL PROTECTED]> wrote:
> >
> > > > > surely it is easier to concatenate a string in PHP than change my
> > > > > host?! i'm keen to hear of workarounds, but mostly hoping for help
> > > > > with the string handling.
> >
> > > > > our hosting is US$11 per year which is incredibly competitive, we
> are
> > > > > very happy with their service (faultless in several years) and
> > > > > familiar with the setup - and every single cent makes a difference
> in
> > > > > bolivia. ( they are bargainvault.com and the website i'm replacing
> iswww.intiwarayassi.org)
> >
> > > > > On Nov 11, 9:55 pm, Steve Boyd <[EMAIL PROTECTED]> wrote:
> >
> > > > > > then changes your host.  there is incredibly cheap hosting
> everywhere
> > > > > > (well within the USA anyhow) that allows you cron jobs + all the
> other
> > > > > > bells and whistles
> >
> > > > > > On Nov 12, 8:37 am, technicaltitch <[EMAIL PROTECTED]>
> wrote:
> >
> > > > > > > because it's for a bolivian volunteer organization we're using
> > > > > > > incredibly cheap hosting which doesn't allow us cron jobs. i
> thought
> > > > > > > this would be trivial.
> >
> > > > > > > On Nov 11, 5:21 pm, AD7six <[EMAIL PROTECTED]> wrote:
> >
> > > > > > > > On Nov 11, 1:33 pm, technicaltitch <[EMAIL PROTECTED]>
> wrote:
> > > > > > > > 
> >
> > > > > > > > Why would you not use mysqldump and a cron job?
> >
> > > > > > > > AD- Hide quoted text -
> >
> > > > > > - Show quoted text -- Hide quoted text -
> >
> > > > - Show quoted text -
> >
> > --
> > (the old fart) the advice is free, the lack of crankiness will cost you
> >
> > - its a fine line between a real question and an idiot
> >
> > http://blog.samdevore.com/archives/2007/03/05/when-open-source-bugs-me/-Hide
> >  quoted text -
> >
> > - Show quoted text -
>
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: String concatenation not working

2007-11-12 Thread Baz
Wow,
And I thought I was cheap. No worries dude. Read the next two posts and you
shouldn't have to go through all this headache. I've been using them for
years before I just ponied up the money for a better host.

http://www.webdevelopment2.com/automate-database-backup-webcron-cron-jobs-problem/
http://www.webdevelopment2.com/automate-mysql-database-backup-webcron-cron-jobs-problem-part-2/

FYI, a cheap host (especially one that cheap) is going to come back and bite
you in the but. And it will be worse than just lack of cron jobs. Trust me,
you get what you pay for.
--
Baz L
Web Development 2.0: Web Design, CakePHP, Javascript
http://www.WebDevelopment2.com/

On Nov 12, 2007 8:37 PM, Samuel DeVore <[EMAIL PROTECTED]> wrote:

>
> is it possible that those sql dumps could be popping php's memory?
>
> On 11/12/07, igor <[EMAIL PROTECTED]> wrote:
> >
> > Have you tried to debug() those seperately?
> >
> > Like...
> > debug($sql_string);
> > debug($sql_string[1]);
> > debug($sql_string2);
> > debug($sql_string3);
> >
> > Maybe that could help to see where you lose your data?
> >
> > Hope this helps..
> >
> >
> > >
> >
>
>
> --
> (the old fart) the advice is free, the lack of crankiness will cost you
>
> - its a fine line between a real question and an idiot
>
> http://blog.samdevore.com/archives/2007/03/05/when-open-source-bugs-me/
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: String concatenation not working

2007-11-12 Thread Samuel DeVore

is it possible that those sql dumps could be popping php's memory?

On 11/12/07, igor <[EMAIL PROTECTED]> wrote:
>
> Have you tried to debug() those seperately?
>
> Like...
> debug($sql_string);
> debug($sql_string[1]);
> debug($sql_string2);
> debug($sql_string3);
>
> Maybe that could help to see where you lose your data?
>
> Hope this helps..
>
>
> >
>


-- 
(the old fart) the advice is free, the lack of crankiness will cost you

- its a fine line between a real question and an idiot

http://blog.samdevore.com/archives/2007/03/05/when-open-source-bugs-me/

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: String concatenation not working

2007-11-12 Thread igor

Have you tried to debug() those seperately?

Like...
debug($sql_string);
debug($sql_string[1]);
debug($sql_string2);
debug($sql_string3);

Maybe that could help to see where you lose your data?

Hope this helps..


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: String concatenation not working

2007-11-12 Thread technicaltitch

That is exactly how I intend to kick this off thanksif I ever get
it working!

(By sticking the code after the redirect call the backup will
presumably be dealt with asynchronously.)

On Nov 12, 4:19 pm, "Samuel DeVore" <[EMAIL PROTECTED]> wrote:
> you could also do a 'lazy mans' cron. and just have a script that is
> kicked off the first time a web page is loaded every n-days.  I use
> the robots.txt because I really don't care too much if once every
> month late at night it takes a while to load.  I also dynamically
> generate that page for a couple of other reasons.
>
> Sam D
>
> On 11/12/07, technicaltitch <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
>
>
> > Thanks very much for your help, but I'm afraid I don't have a
> > workstation to run this from. Also, having this arrive at people's
> > inboxes is incredibly convenient. I'm just at a complete loss as to
> > why the string concatenation doesn't work.
>
> > On Nov 12, 1:08 pm, Guillaume <[EMAIL PROTECTED]> wrote:
> > > If your host allows it, you can use your own workstation and program a
> > > script that periodically does something like
>
> > > mysqldump -C --host DB_HOSTNAME -u USERNAME -p PASSWORD DB_NAME >
> > > mysdump.sql
>
> > > over the network.
>
> > > Your mysql needs to be reachable from outside the server.
>
> > > My host used to allow it and it was a very convenient and quick (owing
> > > to the C option) way to backup a database remotely.
>
> > > There can be security hazards though (but sending the dump via email
> > > too).
>
> > > Guillaumehttp://cherryonthe.popnews.com
>
> > > On 12 nov, 10:21, technicaltitch <[EMAIL PROTECTED]> wrote:
>
> > > > surely it is easier to concatenate a string in PHP than change my
> > > > host?! i'm keen to hear of workarounds, but mostly hoping for help
> > > > with the string handling.
>
> > > > our hosting is US$11 per year which is incredibly competitive, we are
> > > > very happy with their service (faultless in several years) and
> > > > familiar with the setup - and every single cent makes a difference in
> > > > bolivia. ( they are bargainvault.com and the website i'm replacing 
> > > > iswww.intiwarayassi.org)
>
> > > > On Nov 11, 9:55 pm, Steve Boyd <[EMAIL PROTECTED]> wrote:
>
> > > > > then changes your host.  there is incredibly cheap hosting everywhere
> > > > > (well within the USA anyhow) that allows you cron jobs + all the other
> > > > > bells and whistles
>
> > > > > On Nov 12, 8:37 am, technicaltitch <[EMAIL PROTECTED]> wrote:
>
> > > > > > because it's for a bolivian volunteer organization we're using
> > > > > > incredibly cheap hosting which doesn't allow us cron jobs. i thought
> > > > > > this would be trivial.
>
> > > > > > On Nov 11, 5:21 pm, AD7six <[EMAIL PROTECTED]> wrote:
>
> > > > > > > On Nov 11, 1:33 pm, technicaltitch <[EMAIL PROTECTED]> wrote:
> > > > > > > 
>
> > > > > > > Why would you not use mysqldump and a cron job?
>
> > > > > > > AD- Hide quoted text -
>
> > > > > - Show quoted text -- Hide quoted text -
>
> > > - Show quoted text -
>
> --
> (the old fart) the advice is free, the lack of crankiness will cost you
>
> - its a fine line between a real question and an idiot
>
> http://blog.samdevore.com/archives/2007/03/05/when-open-source-bugs-me/- Hide 
> quoted text -
>
> - Show quoted text -


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: String concatenation not working

2007-11-12 Thread Samuel DeVore

you could also do a 'lazy mans' cron. and just have a script that is
kicked off the first time a web page is loaded every n-days.  I use
the robots.txt because I really don't care too much if once every
month late at night it takes a while to load.  I also dynamically
generate that page for a couple of other reasons.

Sam D

On 11/12/07, technicaltitch <[EMAIL PROTECTED]> wrote:
>
> Thanks very much for your help, but I'm afraid I don't have a
> workstation to run this from. Also, having this arrive at people's
> inboxes is incredibly convenient. I'm just at a complete loss as to
> why the string concatenation doesn't work.
>
>
> On Nov 12, 1:08 pm, Guillaume <[EMAIL PROTECTED]> wrote:
> > If your host allows it, you can use your own workstation and program a
> > script that periodically does something like
> >
> > mysqldump -C --host DB_HOSTNAME -u USERNAME -p PASSWORD DB_NAME >
> > mysdump.sql
> >
> > over the network.
> >
> > Your mysql needs to be reachable from outside the server.
> >
> > My host used to allow it and it was a very convenient and quick (owing
> > to the C option) way to backup a database remotely.
> >
> > There can be security hazards though (but sending the dump via email
> > too).
> >
> > Guillaumehttp://cherryonthe.popnews.com
> >
> > On 12 nov, 10:21, technicaltitch <[EMAIL PROTECTED]> wrote:
> >
> >
> >
> > > surely it is easier to concatenate a string in PHP than change my
> > > host?! i'm keen to hear of workarounds, but mostly hoping for help
> > > with the string handling.
> >
> > > our hosting is US$11 per year which is incredibly competitive, we are
> > > very happy with their service (faultless in several years) and
> > > familiar with the setup - and every single cent makes a difference in
> > > bolivia. ( they are bargainvault.com and the website i'm replacing 
> > > iswww.intiwarayassi.org)
> >
> > > On Nov 11, 9:55 pm, Steve Boyd <[EMAIL PROTECTED]> wrote:
> >
> > > > then changes your host.  there is incredibly cheap hosting everywhere
> > > > (well within the USA anyhow) that allows you cron jobs + all the other
> > > > bells and whistles
> >
> > > > On Nov 12, 8:37 am, technicaltitch <[EMAIL PROTECTED]> wrote:
> >
> > > > > because it's for a bolivian volunteer organization we're using
> > > > > incredibly cheap hosting which doesn't allow us cron jobs. i thought
> > > > > this would be trivial.
> >
> > > > > On Nov 11, 5:21 pm, AD7six <[EMAIL PROTECTED]> wrote:
> >
> > > > > > On Nov 11, 1:33 pm, technicaltitch <[EMAIL PROTECTED]> wrote:
> > > > > > 
> >
> > > > > > Why would you not use mysqldump and a cron job?
> >
> > > > > > AD- Hide quoted text -
> >
> > > > - Show quoted text -- Hide quoted text -
> >
> > - Show quoted text -
>
>
> >
>


-- 
(the old fart) the advice is free, the lack of crankiness will cost you

- its a fine line between a real question and an idiot

http://blog.samdevore.com/archives/2007/03/05/when-open-source-bugs-me/

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: String concatenation not working

2007-11-12 Thread technicaltitch

Thanks very much for your help, but I'm afraid I don't have a
workstation to run this from. Also, having this arrive at people's
inboxes is incredibly convenient. I'm just at a complete loss as to
why the string concatenation doesn't work.


On Nov 12, 1:08 pm, Guillaume <[EMAIL PROTECTED]> wrote:
> If your host allows it, you can use your own workstation and program a
> script that periodically does something like
>
> mysqldump -C --host DB_HOSTNAME -u USERNAME -p PASSWORD DB_NAME >
> mysdump.sql
>
> over the network.
>
> Your mysql needs to be reachable from outside the server.
>
> My host used to allow it and it was a very convenient and quick (owing
> to the C option) way to backup a database remotely.
>
> There can be security hazards though (but sending the dump via email
> too).
>
> Guillaumehttp://cherryonthe.popnews.com
>
> On 12 nov, 10:21, technicaltitch <[EMAIL PROTECTED]> wrote:
>
>
>
> > surely it is easier to concatenate a string in PHP than change my
> > host?! i'm keen to hear of workarounds, but mostly hoping for help
> > with the string handling.
>
> > our hosting is US$11 per year which is incredibly competitive, we are
> > very happy with their service (faultless in several years) and
> > familiar with the setup - and every single cent makes a difference in
> > bolivia. ( they are bargainvault.com and the website i'm replacing 
> > iswww.intiwarayassi.org)
>
> > On Nov 11, 9:55 pm, Steve Boyd <[EMAIL PROTECTED]> wrote:
>
> > > then changes your host.  there is incredibly cheap hosting everywhere
> > > (well within the USA anyhow) that allows you cron jobs + all the other
> > > bells and whistles
>
> > > On Nov 12, 8:37 am, technicaltitch <[EMAIL PROTECTED]> wrote:
>
> > > > because it's for a bolivian volunteer organization we're using
> > > > incredibly cheap hosting which doesn't allow us cron jobs. i thought
> > > > this would be trivial.
>
> > > > On Nov 11, 5:21 pm, AD7six <[EMAIL PROTECTED]> wrote:
>
> > > > > On Nov 11, 1:33 pm, technicaltitch <[EMAIL PROTECTED]> wrote:
> > > > > 
>
> > > > > Why would you not use mysqldump and a cron job?
>
> > > > > AD- Hide quoted text -
>
> > > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: String concatenation not working

2007-11-12 Thread Guillaume

If your host allows it, you can use your own workstation and program a
script that periodically does something like

mysqldump -C --host DB_HOSTNAME -u USERNAME -p PASSWORD DB_NAME >
mysdump.sql

over the network.

Your mysql needs to be reachable from outside the server.

My host used to allow it and it was a very convenient and quick (owing
to the C option) way to backup a database remotely.

There can be security hazards though (but sending the dump via email
too).

Guillaume
http://cherryonthe.popnews.com


On 12 nov, 10:21, technicaltitch <[EMAIL PROTECTED]> wrote:
> surely it is easier to concatenate a string in PHP than change my
> host?! i'm keen to hear of workarounds, but mostly hoping for help
> with the string handling.
>
> our hosting is US$11 per year which is incredibly competitive, we are
> very happy with their service (faultless in several years) and
> familiar with the setup - and every single cent makes a difference in
> bolivia. ( they are bargainvault.com and the website i'm replacing 
> iswww.intiwarayassi.org)
>
> On Nov 11, 9:55 pm, Steve Boyd <[EMAIL PROTECTED]> wrote:
>
> > then changes your host.  there is incredibly cheap hosting everywhere
> > (well within the USA anyhow) that allows you cron jobs + all the other
> > bells and whistles
>
> > On Nov 12, 8:37 am, technicaltitch <[EMAIL PROTECTED]> wrote:
>
> > > because it's for a bolivian volunteer organization we're using
> > > incredibly cheap hosting which doesn't allow us cron jobs. i thought
> > > this would be trivial.
>
> > > On Nov 11, 5:21 pm, AD7six <[EMAIL PROTECTED]> wrote:
>
> > > > On Nov 11, 1:33 pm, technicaltitch <[EMAIL PROTECTED]> wrote:
> > > > 
>
> > > > Why would you not use mysqldump and a cron job?
>
> > > > AD- Hide quoted text -
>
> > - Show quoted text -


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: String concatenation not working

2007-11-12 Thread technicaltitch

surely it is easier to concatenate a string in PHP than change my
host?! i'm keen to hear of workarounds, but mostly hoping for help
with the string handling.

our hosting is US$11 per year which is incredibly competitive, we are
very happy with their service (faultless in several years) and
familiar with the setup - and every single cent makes a difference in
bolivia. ( they are bargainvault.com and the website i'm replacing is
www.intiwarayassi.org )


On Nov 11, 9:55 pm, Steve Boyd <[EMAIL PROTECTED]> wrote:
> then changes your host.  there is incredibly cheap hosting everywhere
> (well within the USA anyhow) that allows you cron jobs + all the other
> bells and whistles
>
> On Nov 12, 8:37 am, technicaltitch <[EMAIL PROTECTED]> wrote:
>
>
>
> > because it's for a bolivian volunteer organization we're using
> > incredibly cheap hosting which doesn't allow us cron jobs. i thought
> > this would be trivial.
>
> > On Nov 11, 5:21 pm, AD7six <[EMAIL PROTECTED]> wrote:
>
> > > On Nov 11, 1:33 pm, technicaltitch <[EMAIL PROTECTED]> wrote:
> > > 
>
> > > Why would you not use mysqldump and a cron job?
>
> > > AD- Hide quoted text -
>
> - Show quoted text -


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: String concatenation not working

2007-11-11 Thread Steve Boyd


then changes your host.  there is incredibly cheap hosting everywhere
(well within the USA anyhow) that allows you cron jobs + all the other
bells and whistles


On Nov 12, 8:37 am, technicaltitch <[EMAIL PROTECTED]> wrote:
> because it's for a bolivian volunteer organization we're using
> incredibly cheap hosting which doesn't allow us cron jobs. i thought
> this would be trivial.
>
> On Nov 11, 5:21 pm, AD7six <[EMAIL PROTECTED]> wrote:
>
> > On Nov 11, 1:33 pm, technicaltitch <[EMAIL PROTECTED]> wrote:
> > 
>
> > Why would you not use mysqldump and a cron job?
>
> > AD


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: String concatenation not working

2007-11-11 Thread technicaltitch

because it's for a bolivian volunteer organization we're using
incredibly cheap hosting which doesn't allow us cron jobs. i thought
this would be trivial.



On Nov 11, 5:21 pm, AD7six <[EMAIL PROTECTED]> wrote:
> On Nov 11, 1:33 pm, technicaltitch <[EMAIL PROTECTED]> wrote:
> 
>
> Why would you not use mysqldump and a cron job?
>
> AD


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: String concatenation not working

2007-11-11 Thread AD7six



On Nov 11, 1:33 pm, technicaltitch <[EMAIL PROTECTED]> wrote:


Why would you not use mysqldump and a cron job?

AD


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



String concatenation not working

2007-11-11 Thread technicaltitch

Hi

I'm developing a hands-off website CMS in CakePHP, and I want it to
email me a dump of the database every 6 months as a backup. I have
bodged the model_php5.php and dbo_source.php so they return the insert
statement of a model as a string, based on the save and create
functions but not running the sql. However I can't concatenate the
output.

The code:

function backup() {
$sql_string = array();
$sql_string2 = '';
$sql_string3 = '';
$i = 1;
$articles = $this->Article->findAll();
foreach ($articles as $article) {
$sql_string[$i] = $this->Article->saveString($article);
$sql_string2 .= $this->Article->saveString($article);
$i = $i + 1;
}
$sql_string3 = implode(";",$sql_string);
$this->Session->setFlash('$sql_string'.$sql_string[1].'-'.
$sql_string2.'-'.$sql_string3);
$this->redirect('/articles/index');
}

The array is fully populated, however as soon as I try to concatenate
the strings in the array, it becomes undisplayable - no error is
displayed but no string is displayed either. (In the case above none
of the three strings are displayed, but if I remove $sql_string2 and
3, the array entry is displayed. I've also tried $sql_string2 =
$sql_string2 . $this->Article->saveString($article);

Why won't the concatenate work? I'm completely baffled...

All time and help hugely appreciated thank you.
Chris



The bodge code is - in dbo_source.php - same as 'create' but returning
sql not executing it:

function createString(&$model, $fields = null, $values = null) {
$fieldInsert = array();
$valueInsert = array();
$id = null;

if ($fields == null) {
unset($fields, $values);
$fields = array_keys($model->data);
$values = array_values($model->data);
}

$count = count($fields);
for ($i = 0; $i < $count; $i++) {
$fieldInsert[] = $this->name($fields[$i]);
if ($fields[$i] == $model->primaryKey) {
$id = $values[$i];
}
}

$count = count($values);
for ($i = 0; $i < $count; $i++) {
$set = $this->value($values[$i], $model-
>getColumnType($fields[$i]));

if ($set === "''") {
unset ($fieldInsert[$i]);
} else {
$valueInsert[] = $set;
}
}

return 'INSERT INTO ' . $this->fullTableName($model) . ' (' .
join(',', $fieldInsert). ') VALUES (' . join(',', $valueInsert) . ')';
}

And in model_php5.php - the same as 'save' but calling my save db
function:

function saveString($data = null, $validate = true, $fieldList =
array()) {
$db =& ConnectionManager::getDataSource($this->useDbConfig);

if ($data) {
if (countdim($data) == 1) {
$this->set(array($this->name => $data));
} else {
$this->set($data);
}
}

$whitelist = !(empty($fieldList) || count($fieldList) == 0);

if ($validate && !$this->validates()) {
return false;
}

if (!$this->beforeSave()) {
return false;
}
$fields = $values = array();

if (count($this->data) > 1) {
$weHaveMulti = true;
$joined = false;
} else {
$weHaveMulti = false;
}
$habtm = count($this->hasAndBelongsToMany);

foreach ($this->data as $n => $v) {
if (isset($weHaveMulti) && isset($v[$n]) && $habtm > 0) {
$joined[] = $v;
} else {
if ($n === $this->name) {
foreach (array('created', 'updated', 
'modified') as $field) {
if (array_key_exists($field, $v) && 
(empty($v[$field]) ||
$v[$field] === null)) {
unset($v[$field]);
}
}

foreach ($v as $x => $y) {
if ($this->hasField($x) && ($whitelist 
&& in_array($x,
$fieldList) || !$whitelist)) {
$fields[] = $x;
$values[] = $y;
}
}
}
}
}

//set to false so always creates INSERT stmnt - could insert switch
here to create UPDATE strings (and use 'update' below)
$this->id = false;

return $db->createString($this, $fields, $values);
}


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake