CloneSet18


Previous CloneSetNext CloneSetBack to Main Report
Clone
Mass
Clones in
CloneSet
Parameter
Count
Clone
Similarity
Syntax Category
[Sequence Length]
95250.987statement_sequence[16]
Clone AbstractionParameter Bindings
Clone Instance
(Click to see clone)
Line CountSource Line
Source File
1102123
libraries/joomla/installer/adapters/module.php
295101
libraries/joomla/installer/adapters/plugin.php
Clone Instance
1
Line Count
102
Source Line
123
Source File
libraries/joomla/installer/adapters/module.php

                try {
                        $db->Query();
                      }
                  catch (JException $e) {
                        // Install failed, roll back changes
                        $this->parent->abort(JText::_('Module')
                                             .                  ' '
                                             .                      JText::_($this->route)
                                             .                                             ': '
                                             .                                                  $db->stderr(TRUE));
                        return FALSE;
                      }
                $id=  $db->loadResult();
                /*
                 * If the module directory already exists, then we will assume that the
                 * module is already installed or another module is using that
                 * directory.
                 * Check that this is either an issue where its not overwriting or it is
                 * set to upgrade anyway
                 */
                if (file_exists($this->parent->getPath('extension_root'))
                    &&                                                       (!$this->parent->getOverwrite()
                                                                              ||                                $this->parent->getUpgrade())) {
                        // look for an update function or update tag
                        $updateElement=  $this->manifest->getElementByPath('update');
                        // upgrade manually set
                        // update function available
                        // update tag detected
                        if ($this->parent->getUpgrade()
                            ||                             ($this->parent->manifestClass
                                                            &&                              method_exists($this->parent->manifestClass ,'update'))
                            ||                                                                                                                       is_a($updateElement, 'JSimpleXMLElement')) {
                                // force these one
                                $this->parent->setOverwrite(TRUE);
                                $this->parent->setUpgrade(TRUE);
                                if ($id) { // if there is a matching extension mark this as an update; semantics really
                                        $this->route = 'Update';
                                      }
                              }
                        else   if (!$this->parent->getOverwrite()) { // overwrite is set
                                // we didn't have overwrite set, find an udpate function or find an update tag so lets call it safe
                                $this->parent->abort(JText::_('Module')
                                                     .                  ' '
                                                     .                      JText::_($this->route)
                                                     .                                             ': '
                                                     .                                                  JText::_('Another module is already using directory')
                                                     .                                                                                                        ': "'
                                                     .                                                                                                              $this->parent->getPath('extension_root')
                                                     .                                                                                                                                                       '"');
                                return FALSE;
                              }
                      }
                /**
                 * ---------------------------------------------------------------------------------------------
                 * Installer Trigger Loading
                 * ---------------------------------------------------------------------------------------------
                 */
                // If there is an manifest class file, lets load it; we'll copy it later (don't have dest yet)
                $this->scriptElement = &$this->manifest->getElementByPath('scriptfile');
                if (is_a($this->scriptElement ,'JSimpleXMLElement')) {
                        $manifestScript=  $this->scriptElement->data();
                        $manifestScriptFile=  $this->parent->getPath('source')
                        .                                                      DS
                        .                                                         $manifestScript;
                        if (is_file($manifestScriptFile)) {
                                // load the file
                                include_once ($manifestScriptFile);
                              }
                        // Set the class name
                        $classname=  $element
                                     .        'InstallerScript';
                        if (class_exists($classname)) {
                                // create a new instance
                                $this->parent->manifestClass = new $classname($this);
                                // and set this so we can copy it later
                                $this->set('manifest_script', $manifestScript);
                                // Note: if we don't find the class, don't bother to copy the file
                              }
                      }
                // run preflight if possible (since we know we're not an update)
                ob_start();
                ob_implicit_flush(FALSE);
                if ($this->parent->manifestClass
                    &&                              method_exists($this->parent->manifestClass ,'preflight')) $this->parent->manifestClass->preflight($this->route ,$this);
                $msg=  ob_get_contents(); // create msg object; first use here
                ob_end_clean();
                /**
                 * ---------------------------------------------------------------------------------------------
                 * Filesystem Processing Section
                 * ---------------------------------------------------------------------------------------------
                 */
                // If the module directory does not exist, lets create it
                $created=  FALSE;
                if (!file_exists($this->parent->getPath('extension_root'))) {
                        if (!$created=  JFolder::create($this->parent->getPath('extension_root'))) {
                                $this->parent->abort(JText::_('Module')
                                                     .                  ' '
                                                     .                      JText::_($this->route)
                                                     .                                             ': '
                                                     .                                                  JText::_('Failed to create directory')
                                                     .                                                                                         ': "'
                                                     .                                                                                               $this->parent->getPath('extension_root')
                                                     .                                                                                                                                        '"');
                                return FALSE;
                              }
                      }
                /*
                 * Since we created the module directory and will want to remove it if
                 * we have to roll back the installation, lets add it to the
                 * installation step stack
                 */
                if ($created) {
                        $this->parent->pushStep(array( 'type' => 'folder', 'path' => $this->parent->getPath('extension_root')
                                                     ));
                      }
                // Copy all necessary files
                if ($this->parent->parseFiles($module_files, -1) === FALSE) {
                        // Install failed, roll back changes
                        $this->parent->abort();
                        return FALSE;
                      }
                // Parse optional tags
                $this->parent->parseMedia($this->manifest->getElementByPath('media'), $clientId);
                $this->parent->parseLanguages($this->manifest->getElementByPath('languages'), $clientId);


Clone Instance
2
Line Count
95
Source Line
101
Source File
libraries/joomla/installer/adapters/plugin.php

                try {
                        $db->Query();
                      }
                  catch (JException $e) {
                        // Install failed, roll back changes
                        $this->parent->abort(JText::_('Plugin')
                                             .                  ' '
                                             .                      JText::_($this->route)
                                             .                                             ': '
                                             .                                                  $db->stderr(TRUE));
                        return FALSE;
                      }
                $id=  $db->loadResult();
                // if its on the fs...
                if (file_exists($this->parent->getPath('extension_root'))
                    &&                                                       (!$this->parent->getOverwrite()
                                                                              ||                                $this->parent->getUpgrade())) {
                        $updateElement=  $this->manifest->getElementByPath('update');
                        // upgrade manually set
                        // update function available
                        // update tag detected
                        if ($this->parent->getUpgrade()
                            ||                             ($this->parent->manifestClass
                                                            &&                              method_exists($this->parent->manifestClass ,'update'))
                            ||                                                                                                                       is_a($updateElement, 'JSimpleXMLElement')) {
                                // force these one
                                $this->parent->setOverwrite(TRUE);
                                $this->parent->setUpgrade(TRUE);
                                if ($id) { // if there is a matching extension mark this as an update; semantics really
                                        $this->route = 'Update';
                                      }
                              }
                        else   if (!$this->parent->getOverwrite()) { // overwrite is set
                                // we didn't have overwrite set, find an udpate function or find an update tag so lets call it safe
                                $this->parent->abort(JText::_('Plugin')
                                                     .                  ' '
                                                     .                      JText::_($this->route)
                                                     .                                             ': '
                                                     .                                                  JText::_('Another extension is already using directory')
                                                     .                                                                                                           ': "'
                                                     .                                                                                                                 $this->parent->getPath('extension_root')
                                                     .                                                                                                                                                          '"');
                                return FALSE;
                              }
                      }
                /**
                 * ---------------------------------------------------------------------------------------------
                 * Installer Trigger Loading
                 * ---------------------------------------------------------------------------------------------
                 */
                // If there is an manifest class file, lets load it; we'll copy it later (don't have dest yet)
                $this->scriptElement = &$this->manifest->getElementByPath('scriptfile');
                if (is_a($this->scriptElement ,'JSimpleXMLElement')) {
                        $manifestScript=  $this->scriptElement->data();
                        $manifestScriptFile=  $this->parent->getPath('source')
                        .                                                      DS
                        .                                                         $manifestScript;
                        if (is_file($manifestScriptFile)) {
                                // load the file
                                include_once ($manifestScriptFile);
                              }
                        // Set the class name
                        $classname=  'plg'
                                     .     $group
                                     .            $element
                                     .                     'InstallerScript';
                        if (class_exists($classname)) {
                                // create a new instance
                                $this->parent->manifestClass = new $classname($this);
                                // and set this so we can copy it later
                                $this->set('manifest_script', $manifestScript);
                                // Note: if we don't find the class, don't bother to copy the file
                              }
                      }
                // run preflight if possible (since we know we're not an update)
                ob_start();
                ob_implicit_flush(FALSE);
                if ($this->parent->manifestClass
                    &&                              method_exists($this->parent->manifestClass ,'preflight')) $this->parent->manifestClass->preflight($this->route ,$this);
                $msg=  ob_get_contents(); // create msg object; first use here
                ob_end_clean();
                /**
                 * ---------------------------------------------------------------------------------------------
                 * Filesystem Processing Section
                 * ---------------------------------------------------------------------------------------------
                 */
                // If the plugin directory does not exist, lets create it
                $created=  FALSE;
                if (!file_exists($this->parent->getPath('extension_root'))) {
                        if (!$created=  JFolder::create($this->parent->getPath('extension_root'))) {
                                $this->parent->abort(JText::_('Plugin')
                                                     .                  ' '
                                                     .                      JText::_($this->route)
                                                     .                                             ': '
                                                     .                                                  JText::_('Failed to create directory')
                                                     .                                                                                         ': "'
                                                     .                                                                                               $this->parent->getPath('extension_root')
                                                     .                                                                                                                                        '"');
                                return FALSE;
                              }
                      }
                /*
                 * If we created the plugin directory and will want to remove it if we
                 * have to roll back the installation, lets add it to the installation
                 * step stack
                 */
                if ($created) {
                        $this->parent->pushStep(array( 'type' => 'folder', 'path' => $this->parent->getPath('extension_root')
                                                     ));
                      }
                // Copy all necessary files
                if ($this->parent->parseFiles($plugin_files, -1) === FALSE) {
                        // Install failed, roll back changes
                        $this->parent->abort();
                        return FALSE;
                      }
                // Parse optional tags -- media and language files for plugins go in admin app
                $this->parent->parseMedia($this->manifest->getElementByPath('media'), 1);
                $this->parent->parseLanguages($this->manifest->getElementByPath('languages'), 1);


Clone AbstractionParameter Count: 5Parameter Bindings

try {
  $db->Query();
}
catch (JException $e) {
  // Install failed, roll back changes
  $this->parent->abort(JText::_( [[#variable45d6c600]])
                       . ' '
                       . JText::_($this->route)
                       . ': '
                       . $db->stderr(TRUE));
  return FALSE;
}
$id=$db->loadResult();
// if its on the fs...
/*
                 * If the module directory already exists, then we will assume that the
                 * module is already installed or another module is using that
                 * directory.
                 * Check that this is either an issue where its not overwriting or it is
                 * set to upgrade anyway
                 */
if (file_exists($this->parent->getPath('extension_root'))
    && (!$this->parent->getOverwrite()
        || $this->parent->getUpgrade())) {
  // look for an update function or update tag
  $updateElement=$this->manifest->getElementByPath('update');
  // upgrade manually set
  // update function available
  // update tag detected
  if ($this->parent->getUpgrade()
      || ($this->parent->manifestClass
          && method_exists($this->parent->manifestClass ,'update'))
      || is_a($updateElement,'JSimpleXMLElement')) {
    // force these one
    $this->parent->setOverwrite(TRUE);
    $this->parent->setUpgrade(TRUE);
    if ($id) { // if there is a matching extension mark this as an update; semantics really
      $this->route ='Update';
    }
  }
  else if (!$this->parent->getOverwrite()) { // overwrite is set
         // we didn't have overwrite set, find an udpate function or find an update tag so lets call it safe
         $this->parent->abort(JText::_( [[#variable45d6c600]])
                              . ' '
                              . JText::_($this->route)
                              . ': '
                              . JText::_( [[#variable45d6c580]])
                              . ': "'
                              . $this->parent->getPath('extension_root')
                              . '"');
         return FALSE;
       }
}
/**
                 * ---------------------------------------------------------------------------------------------
                 * Installer Trigger Loading
                 * ---------------------------------------------------------------------------------------------
                 */
// If there is an manifest class file, lets load it; we'll copy it later (don't have dest yet)
$this->scriptElement = &$this->manifest->getElementByPath('scriptfile');
if (is_a($this->scriptElement ,'JSimpleXMLElement')) {
  $manifestScript=$this->scriptElement->data();
  $manifestScriptFile=$this->parent->getPath('source')
  . DS
  . $manifestScript;
  if (is_file($manifestScriptFile)) {
    // load the file
    include_once ($manifestScriptFile);
  }
  // Set the class name
  $classname= [[#variable45d6c520]]
             . 'InstallerScript';
  if (class_exists($classname)) {
    // create a new instance
    $this->parent->manifestClass =new $classname($this);
    // and set this so we can copy it later
    $this->set('manifest_script',$manifestScript);
  // Note: if we don't find the class, don't bother to copy the file
  }
}
// run preflight if possible (since we know we're not an update)
ob_start();
ob_implicit_flush(FALSE);
if ($this->parent->manifestClass
    && method_exists($this->parent->manifestClass ,'preflight'))
  $this->parent->manifestClass->preflight($this->route ,$this);
$msg=ob_get_contents(); // create msg object; first use here
ob_end_clean();
/**
                 * ---------------------------------------------------------------------------------------------
                 * Filesystem Processing Section
                 * ---------------------------------------------------------------------------------------------
                 */
// If the plugin directory does not exist, lets create it
// If the module directory does not exist, lets create it
$created=FALSE;
if (!file_exists($this->parent->getPath('extension_root'))) {
  if (!$created=JFolder::create($this->parent->getPath('extension_root'))) {
    $this->parent->abort(JText::_( [[#variable45d6c600]])
                         . ' '
                         . JText::_($this->route)
                         . ': '
                         . JText::_('Failed to create directory')
                         . ': "'
                         . $this->parent->getPath('extension_root')
                         . '"');
    return FALSE;
  }
}
/*
                 * If we created the plugin directory and will want to remove it if we
                 * have to roll back the installation, lets add it to the installation
                 * step stack
                 */
/*
                 * Since we created the module directory and will want to remove it if
                 * we have to roll back the installation, lets add it to the
                 * installation step stack
                 */
if ($created) {
  $this->parent->pushStep(array( 'type' => 'folder',
                                 'path' => $this->parent->getPath('extension_root')
                               ));
}
// Copy all necessary files
if ($this->parent->parseFiles( [[#variable45d6c4c0]],-1) === FALSE) {
  // Install failed, roll back changes
  $this->parent->abort();
  return FALSE;
}
// Parse optional tags -- media and language files for plugins go in admin app
// Parse optional tags
$this->parent->parseMedia($this->manifest->getElementByPath('media'), [[#variable44e39d80]]);
$this->parent->parseLanguages($this->manifest->getElementByPath('languages'), [[#variable44e39d80]]);
 

CloneAbstraction
Parameter Bindings
Parameter
Index
Clone
Instance
Parameter
Name
Value
11[[#45d6c600]]
'Plugin' 
12[[#45d6c600]]
'Module' 
21[[#45d6c580]]
'Another extension is already using directory' 
22[[#45d6c580]]
'Another module is already using directory' 
31[[#45d6c520]]
'plg'
. $group
. $element 
32[[#45d6c520]]
$element 
41[[#45d6c4c0]]
$plugin_files 
42[[#45d6c4c0]]
$module_files 
51[[#44e39d80]]
1 
52[[#44e39d80]]
$clientId