Beispiel #1
0
} else {
    echo '<br /> &nbsp; Installing FLEXIcontent version ' . $this->release;
}
echo '<br /> &nbsp; Minimum Joomla version = ' . $this->minimum_joomla_release . ' &nbsp Current is ' . $jversion->getShortVersion();
echo '<p> -- ' . JText::_('Performing PRE-installation Tasks/Checks') . '</p>';
// Abort if the current Joomla release is older
if (version_compare($jversion->getShortVersion(), $this->minimum_joomla_release, 'lt')) {
    Jerror::raiseWarning(null, 'Cannot install com_flexicontent in a Joomla release prior to ' . $this->minimum_joomla_release);
    return false;
}
// Abort if the component being installed is not newer than the currently installed version
if ($type == 'update') {
    $oldRelease = $this->getParam('version');
    $rel = $this->release_existing . ' to ' . $this->release;
    if (version_compare($this->release, $oldRelease, 'l')) {
        Jerror::raiseNotice(null, 'Downgrading component from ' . $rel);
        //return false;  // Returning false here would abort
    }
}
// Detect FLEXIcontent installed
if (FLEXI_J16GE) {
    define('FLEXI_INSTALLED', $this->release_existing ? 1 : 0);
} else {
    define('FLEXI_INSTALLED', JPluginHelper::isEnabled('system', 'flexisystem'));
}
// init vars
$error = false;
$extensions = array();
// clear a cache
$cache = JFactory::getCache();
$cache->clean('_system');
Beispiel #2
0
 function preflight($type, $parent)
 {
     // Make sure that fatal errors are printed
     error_reporting(E_ERROR);
     ini_set('display_errors', 1);
     // Try to increment some limits
     @set_time_limit(240);
     // execution time 5 minutes
     ignore_user_abort(true);
     // continue execution if client disconnects
     // Try to increment memory limits
     $memory_limit = trim(@ini_get('memory_limit'));
     if ($memory_limit) {
         switch (strtolower(substr($memory_limit, -1))) {
             case 'm':
                 $memory_limit = (int) substr($memory_limit, 0, -1) * 1048576;
                 break;
             case 'k':
                 $memory_limit = (int) substr($memory_limit, 0, -1) * 1024;
                 break;
             case 'g':
                 $memory_limit = (int) substr($memory_limit, 0, -1) * 1073741824;
                 break;
             case 'b':
                 switch (strtolower(substr($memory_limit, -2, 1))) {
                     case 'm':
                         $memory_limit = (int) substr($memory_limit, 0, -2) * 1048576;
                         break;
                     case 'k':
                         $memory_limit = (int) substr($memory_limit, 0, -2) * 1024;
                         break;
                     case 'g':
                         $memory_limit = (int) substr($memory_limit, 0, -2) * 1073741824;
                         break;
                     default:
                         break;
                 }
                 break;
             default:
                 break;
         }
         if ($memory_limit < 16000000) {
             @ini_set('memory_limit', '16M');
         }
         if ($memory_limit < 32000000) {
             @ini_set('memory_limit', '32M');
         }
         if ($memory_limit < 64000000) {
             @ini_set('memory_limit', '64M');
         }
     }
     // first check if PHP5 is running
     $PHP_VERSION_NEEDED = FLEXI_J16GE ? '5.3.0' : '5.1.0';
     if (version_compare(PHP_VERSION, $PHP_VERSION_NEEDED, '<')) {
         // load english language file for 'com_flexicontent' component then override with current language file
         JFactory::getLanguage()->load('com_flexicontent', JPATH_ADMINISTRATOR, 'en-GB', true);
         JFactory::getLanguage()->load('com_flexicontent', JPATH_ADMINISTRATOR, null, true);
         Jerror::raiseWarning(null, JText::sprintf('FLEXI_UPGRADE_PHP_VERSION_GE', $PHP_VERSION_NEEDED));
         return false;
     }
     // Get Joomla version
     $jversion = new JVersion();
     // File version of new manifest file
     $this->release = FLEXI_J16GE ? $parent->get("manifest")->version : $this->manifest->getElementByPath('version')->data();
     // File version of existing manifest file
     $this->release_existing = FLEXI_J16GE ? $this->getParam('version') : 0;
     // Manifest file minimum Joomla version
     $this->minimum_joomla_release = FLEXI_J16GE ? $parent->get("manifest")->attributes()->version : $this->manifest->attributes('version');
     // Show the essential information at the install/update back-end
     if ($this->release_existing) {
         echo '<br /> &nbsp; Updating FLEXIcontent from ' . $this->release_existing . ' to version ' . $this->release;
     } else {
         echo '<br /> &nbsp; Installing FLEXIcontent version ' . $this->release;
     }
     echo '<br /> &nbsp; Minimum Joomla version = ' . $this->minimum_joomla_release . ' &nbsp Current is ' . $jversion->getShortVersion();
     echo '<p> -- ' . JText::_('Performing PRE-installation Tasks/Checks') . '</p>';
     // Abort if the current Joomla release is older
     if (version_compare($jversion->getShortVersion(), $this->minimum_joomla_release, 'lt')) {
         Jerror::raiseWarning(null, 'Cannot install com_flexicontent in a Joomla release prior to ' . $this->minimum_joomla_release);
         return false;
     }
     // Abort if the component being installed is not newer than the currently installed version
     if ($type == 'update') {
         $oldRelease = $this->getParam('version');
         $rel = $this->release_existing . ' to ' . $this->release;
         if (version_compare($this->release, $oldRelease, 'l')) {
             Jerror::raiseNotice(null, 'Downgrading component from ' . $rel);
             //return false;  // Returning false here would abort
         }
     }
     // Detect FLEXIcontent installed
     if (FLEXI_J16GE) {
         define('FLEXI_INSTALLED', $this->release_existing ? 1 : 0);
     } else {
         define('FLEXI_INSTALLED', JPluginHelper::isEnabled('system', 'flexisystem'));
     }
 }