New install script

A meet-and-greet for our aspiring developers looking for like minded souls to share inspiring ideas and concepts related to Joomla! development. Discuss your apps, gather your team, and get ready to code!

Moderators: tjay, seadap, Rogue4ngel, matthewhayashida

Post Reply
User avatar
Crafty
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Thu Jun 15, 2006 6:00 am
Contact:

New install script

Post by Crafty » Thu Nov 22, 2007 12:43 pm

Hi every one. My 1st bit of contribution. This script will (once it is working) make installs a breeze. Non of this uploading 100's of files via ftp, and then change perms etc. Now I need a little help in finding where the problem lies in this script. Once I have this working I will complete it, and upload it with the unnzip section. After this it should be a breeze. You upload 2 files with ftp, and run the completed script. This will then decompress everything and setup all the folder permissions as well. Perhaps one can even go a little further and add a some flags that can be changed to set the perm level like 755 or 775 or what ever.  But 1st things 1st. the basics of the script. I tried a few other methods of doing this, but due to ownership issues decided it will work best this way. Then this is a  section from another forum topic of mine, but i have asked the moderator to delete that thread as it did not really belong there.


Code: Select all

<?php
$ftp_root = '/httpdocs/DEV/D1/';
function chmod_open()
{
    $ftp_user_name = 'username';
    $ftp_user_pass = 'password';
    $ftp_server = 'ftp.myserver.co.za';
    $conn_id = ftp_connect($ftp_server);
    $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
   echo "DEBUG Info: <br>";
   echo "=========== <br>";
   echo "<br>" ;
   echo "Server Name: " . $ftp_server . "<br>";
   echo "FTP Username: " . $ftp_user_pass . "<br>";
   echo "DEBUG: Login Result - " . $login_result . "<br>";
   echo "<br>" ;
   return $conn_id;
}
function chmod_file($conn_id, $permissions, $path)
{
    if (ftp_site($conn_id, 'CHMOD ' . $permissions . ' ' . $ftp_root . $path) !== false)
    {
        return TRUE;
    }
    else
    {
        return FALSE;
    }
}
function chmod_close($conn_id)
{
    ftp_close($conn_id);
   echo "Connection Closed";
}
$conn_id = chmod_open();

echo chmod_file($conn_id, 777, 'administrator/backups/') ? 'CHMODed successfully!' : 'Error' . $ftp_root . $path . '<br>';
echo chmod_file($conn_id, 777, 'administrator/cache/') ? 'CHMODed successfully!' : 'Error' . $ftp_root . $path . ' <br>';
echo chmod_file($conn_id, 777, 'administrator/components/') ? 'CHMODed successfully!' : 'Error' . $ftp_root . $path . ' <br>';
echo chmod_file($conn_id, 777, 'administrator/language/') ? 'CHMODed successfully!' : 'Error' . $ftp_root . $path . ' <br>';
echo chmod_file($conn_id, 777, 'administrator/language/en-GB/') ? 'CHMODed successfully!' : 'Error' . $ftp_root . $path . ' <br>';
echo chmod_file($conn_id, 777, 'administrator/modules/') ? 'CHMODed successfully!' : 'Error' . $ftp_root . $path . ' <br>';
echo chmod_file($conn_id, 777, 'administrator/templates/') ? 'CHMODed successfully!' : 'Error' . $ftp_root . $path . ' <br>';
echo chmod_file($conn_id, 777, 'cache/') ? 'CHMODed successfully!' : 'Error' . $ftp_root . $path . ' <br>';
echo chmod_file($conn_id, 777, 'components/') ? 'CHMODed successfully!' : 'Error' . $ftp_root . $path . ' <br>';
echo chmod_file($conn_id, 777, 'images/') ? 'CHMODed successfully!' : 'Error' . $ftp_root . $path . ' <br>';
echo chmod_file($conn_id, 777, 'images/banners/') ? 'CHMODed successfully!' : 'Error' . $ftp_root . $path . ' <br>';
echo chmod_file($conn_id, 777, 'images/stories/') ? 'CHMODed successfully!' : 'Error' . $ftp_root . $path . ' <br>';
echo chmod_file($conn_id, 777, 'language/') ? 'CHMODed successfully!' : 'Error:' . $ftp_root . $path . ' <br>';
echo chmod_file($conn_id, 777, 'language/en-GB/') ? 'CHMODed successfully!' : 'Error:' . $ftp_root . $path . ' <br>';
echo chmod_file($conn_id, 777, 'language/pdf_fonts/') ? 'CHMODed successfully!' : 'Error:' . $ftp_root . $path . ' <br>';
echo chmod_file($conn_id, 777, 'modules/') ? 'CHMODed successfully!' : 'Error:' . $ftp_root . $path . ' <br>';
echo chmod_file($conn_id, 777, 'plugins/') ? 'CHMODed successfully!' : 'Error:' . $ftp_root . $path . ' <br>';
echo chmod_file($conn_id, 777, 'plugins/content/') ? 'CHMODed successfully!' : 'Error:' . $ftp_root . $path . ' <br>';
echo chmod_file($conn_id, 777, 'plugins/editors/') ? 'CHMODed successfully!' : 'Error:' . $ftp_root . $path . ' <br>';
echo chmod_file($conn_id, 777, 'plugins/editors-xtd/') ? 'CHMODed successfully!' : 'Error:' . $ftp_root . $path . ' <br>';
echo chmod_file($conn_id, 777, 'plugins/search/') ? 'CHMODed successfully!' : 'Error:' . $ftp_root . $path . ' <br>';
echo chmod_file($conn_id, 777, 'plugins/system/') ? 'CHMODed successfully!' : 'Error:' . $ftp_root . $path . ' <br>';
echo chmod_file($conn_id, 777, 'plugins/user/') ? 'CHMODed successfully!' : 'Error:' . $ftp_root . $path . ' <br>';
echo chmod_file($conn_id, 777, 'plugins/xmlrpc/') ? 'CHMODed successfully!' : 'Error:' . $ftp_root . $path . ' <br>';
echo chmod_file($conn_id, 777, 'tmp/') ? 'CHMODed successfully!' : 'Error:' . $ftp_root . $path . ' <br>';
echo chmod_file($conn_id, 777, 'templates/') ? 'CHMODed successfully!' : 'Error:' . $ftp_root . $path . ' <br>';
chmod_close($conn_id);
?>
Its not about living life in the fast lane:
Its lane-splitting between them on 2wheels!
http://www.my2wheels.co.za

Post Reply