Exemplo n.º 1
0
 /**
  * Function called before module installation/update/removal procedure commences
  *
  * @param   string                   $type    The type of change (install, update or discover_install
  *                                            , not uninstall)
  * @param   JInstallerAdapterModule  $parent  The class calling this method
  *
  * @return  void
  *
  * @since  1.3.3
  */
 public function preflight($type, $parent)
 {
     $version = new JVersion();
     if (!$version->isCompatible('3.2.0')) {
         JFactory::getApplication()->enqueueMessage(JText::_('JJ_SOCIAL_SLIDER_JOOMLA_VERSION_OUTDATED'));
         return false;
     }
     // Module manifest file version
     $this->release = $parent->get("manifest")->version;
     // Abort if the module being installed is not newer than the currently installed version
     if ($type == 'Update') {
         $manifest = $this->getItemArray('manifest_cache', '#__extensions', 'element', JFactory::getDbo()->quote($this->extension));
         $oldRelease = $manifest['version'];
         if (version_compare($oldRelease, $this->release, '<')) {
             // Update to reflect colour form field change in 1.3.2
             if (version_compare($oldRelease, '1.3.2', '<=')) {
                 $this->update132();
             }
             // Update to reflect move from assets subfolder to media folder
             if (version_compare($oldRelease, '1.4.0', '<=')) {
                 $this->update140();
             }
         }
     }
 }
Exemplo n.º 2
0
 /**
  * Function called before module installation/update/removal procedure commences
  *
  * @param   string                   $type    The type of change (install, update or discover_install,
  *                                            not uninstall)
  * @param   JInstallerAdapterModule  $parent  The class calling this method
  *
  * @return  boolean  true on success and false on failure
  *
  * @since  1.1.2
  */
 public function preflight($type, $parent)
 {
     // Module manifest file version
     $this->release = $parent->get("manifest")->version;
     // Abort if the module being installed is not newer than the currently installed version
     if (strtolower($type) == 'update') {
         $manifest = $this->getItemArray('manifest_cache', '#__extensions', 'element', JFactory::getDbo()->quote($this->extension));
         $oldRelease = $manifest['version'];
         if (version_compare($this->release, $oldRelease, '<')) {
             JFactory::getApplication()->enqueueMessage(JText::sprintf('MOD_SHOUTBOX_INCORRECT_SEQUENCE', $oldRelease, $this->release), 'error');
             return false;
         }
         if (version_compare($oldRelease, $this->release, '<')) {
             // Update db schema to reflect new change in version 1.1.4
             if (version_compare($oldRelease, '1.1.3', '<=')) {
                 $this->update114();
             }
             /**
              * For extensions going from < version 1.2.4 rename colour form field values and move assets
              * folder to media folder
              */
             if (version_compare($oldRelease, '1.2.3', '<=')) {
                 $this->update124();
             }
             /**
              * For extensions going from < version 1.2.6 we need to update the permissions settings if guests cannot post
              */
             if (version_compare($oldRelease, '1.2.5', '<=')) {
                 $this->update126();
             }
             /**
              * In 2.0.0 we fixed the Freichat broken compatability so remove the check form field
              */
             if (version_compare($oldRelease, '2.0.1', '<=')) {
                 $this->update202();
             }
             /**
              * For extensions going from < version 3.0.0 we need to change the loginname field option values
              */
             if (version_compare($oldRelease, '2.0.2', '<=')) {
                 $this->update300();
             }
             /**
              * In 6.0.0 we updated to ReCaptcha v2 which doesn't accept old keys
              */
             if (version_compare($oldRelease, '5.0.2', '<=')) {
                 $this->update600();
             }
             /**
              * In 7.0.0 show a notification
              */
             if (version_compare($oldRelease, '6.0.4', '<=')) {
                 $this->update700();
             }
         }
     }
     return true;
 }