1

Whenever I want to update my project to web host, I have to set suspend state via control panel or I have to set in code manually as follow.

<?
$SUSPEND=true; //setting manually before ftp upload
if($SUSPEND)
  redirect("busy.php");
?>

Is there any rapid and efficient way to set to suspend mode during ftp update. Thanks alot.

1 Answers1

0

you can try following apache mod rewrite trick that I tested successfully.
1. rename your busy.php to other name (eg. restricted.php)
2. redirect to busy.php if file exists using following code in .htaccess

RewriteEngine on
    RewriteCond %{DOCUMENT_ROOT}/busy.php -f
    RewriteRule ^(.*)$ busy.php
  1. before updating your ftp, change restricted.php to busy.php
  2. after updating complete, rename back busy.php to restricted.php.
    If you are updating your project to online server with php ftp client via localhost (without ftp client like filezila), you can even attach step 3 at the top of ftp process queue and attach step 4 to end of ftp processes. this will set suspend mode automatically. I hope this is faster approach than manually setting suspend variable in source code. to prevent unnecessary access to restricted.php in normal condition, you should also restrict to restricted.php file in apache rewrite rule.
KyawLay
  • 403
  • 2
  • 10
  • thanks!, nice hacking, it works for me. But what is your suggestion about php ftp client. do you mean update project with another ftp client php project. I currently update with ftp client coffee cup, please explain me, Thanks – Mioonion Rai Sep 10 '14 at 10:59
  • you should learn about sftp in php.I think [this link](http://stackoverflow.com/questions/4689540/how-to-sftp-with-php) will be useful. – KyawLay Sep 10 '14 at 11:04