Example #1
0
 /**
  * Constructor
  *
  * @param   object  An optional KConfig object with configuration options
  */
 public function __construct(KConfig $config)
 {
     $config->persistent = false;
     parent::__construct($config);
     // Register apis
     Jloader::register('JInstaller', JPATH_LIBRARIES . '/joomla/installer/installer.php');
     Jloader::register('JArchive', JPATH_LIBRARIES . '/joomla/filesystem/archive.php');
     Jloader::register('JFile', JPATH_LIBRARIES . '/joomla/filesystem/file.php');
 }
Example #2
0
    $packages = true;
}
//Because 1.6 sucks, we have to do these inline
//$document->addStyleSheet(JURI::root(1).'/media/com_extensions/css/install.css');
//$document->addStyleDeclaration('.log {padding-left:270px}');
//Always render install log
$class = 'debug';
//$config = JFactory::getConfig();
//$class = $config->getValue('debug', null) ? 'debug' : null;
$jversion = JVersion::isCompatible('1.6.0') ? '1.6' : '1.5';
//Run upgrade procedures if we're upgrading from a dashboard
//@TODO make dashboard upgraders support com.extensions instead of doing the following
if (JRequest::getCmd('view', false) == 'dashboard') {
    //To prevent script timeouts, set limit to 5 minutes for those slow godaddy hosts
    @set_time_limit(300);
    Jloader::register('JArchive', JPATH_LIBRARIES . '/joomla/filesystem/archive.php');
    $root = JPATH_ADMINISTRATOR . '/components/com_extensions/packages';
    $files = JFolder::files($root);
    foreach ($files as $file) {
        $installer = new JInstaller();
        $folder = JFile::stripExt($file);
        //If there already is a folder, delete it before extracting
        if (JFolder::exists($root . '/' . $folder)) {
            JFolder::delete($root . '/' . $folder);
        }
        JArchive::extract($root . '/' . $file, $root . '/' . $folder);
        JFile::delete($root . '/' . $file);
        $installer->install($root . '/' . $folder . '/');
        //Delete exctracted zip post install as we no longer need it
        if (JFolder::exists($root . '/' . $folder)) {
            JFolder::delete($root . '/' . $folder);