Edit file File name : extensions Content :#!/usr/local/bin/php <?php function error($msg){ echo "\n$msg\n"; exit(); } function debug($msg){ echo "\n$msg\n"; } error_reporting(E_ALL); ini_set("display_errors",1); if( ( file_exists( "defines.php" ) || file_exists("includes/defines.php") ) && file_exists( "index.php" ) ){ debug("1"); $_SERVER['SERVER_PORT'] = 80; if (!defined('_JEXEC')) { debug("2"); $_SERVER['HTTP_HOST'] = 'localhost'; $_SERVER['HTTP_USER_AGENT'] = 'joomla-console/1.0.0'; define('_JEXEC', 1); define('DS', DIRECTORY_SEPARATOR); define('JPATH_BASE', realpath(getcwd())); require_once JPATH_BASE . '/includes/defines.php'; require_once JPATH_BASE . '/includes/framework.php'; require_once JPATH_LIBRARIES . '/import.php'; require_once JPATH_LIBRARIES . '/cms.php'; } debug("3"); if($argc > 1){ debug("4"); debug($argv[1]); switch($argv[1]){ case 'install': debug($argv[2]); if( isset($argv[2]) && file_exists($argv[2])) { debug("5"); $packageFile = $argv[2]; $tmp = JPATH_BASE . '/tmp/tmp.zip'; copy($packageFile,$tmp); // Extract the package file into a temporary folder $package = JInstallerHelper::unpack($tmp); if (!$package) { die('An error occurred while unpacking the file'); } debug(6); // Install the package $installer = new JInstaller; debug(var_export($package,true)); debug(var_export($installer)); $installed = $installer->install($package['extractdir']); debug(8); // Remove the temporary folder where the package was extracted to if (JFolder::exists($package['extractdir'])) { debug(9); JFolder::delete($package['extractdir']); } debug(10); // Remove the extension package if (JFile::exists($package['packagefile'])) { JFile::delete($package['packagefile']); } if ($installed) { echo "Extension successfully installed"; } else { echo "Extension installation failed"; } } break; default: die("\n{$argv[1]} is not a supported command.\n"); } } } else{ echo "\nThis is not a Joomla! installation.\n"; } Save