Exemple #1
0
 /**
  * Method to parse through a webservices element of the installation manifest and take appropriate
  * action.
  *
  * @param   JInstallerAdapter  $parent  class calling this method
  *
  * @return  boolean     True on success
  *
  * @since   1.3
  */
 public function installWebservices($parent)
 {
     $installer = $this->getInstaller();
     $manifest = $this->getManifest($parent);
     $src = $parent->getParent()->getPath('source');
     if (!$manifest) {
         return false;
     }
     $installer->setPath('source', $src);
     $element = $manifest->webservices;
     if (!$element || !count($element->children())) {
         // Either the tag does not exist or has no children therefore we return zero files processed.
         return false;
     }
     // Here we set the folder we are going to copy the files from.
     $folder = (string) $element->attributes()->folder;
     // This prevents trying to install webservice from other extension directory if webservice folder is not set
     if (!$folder || !is_dir($src . '/' . $folder)) {
         return false;
     }
     // Here we set the folder we are going to copy the files to.
     $destination = JPath::clean(RApiHalHelper::getWebservicesPath());
     $source = $src . '/' . $folder;
     $copyFiles = $this->prepareFilesForCopy($element, $source, $destination);
     // Copy the webservice XML files
     $return = $installer->copyFiles($copyFiles, true);
     // Recreate or create new SOAP WSDL files
     if (method_exists('RApiSoapHelper', 'generateWsdlFromFolder')) {
         foreach ($element->children() as $file) {
             RApiSoapHelper::generateWsdlFromFolder($destination . '/' . $file);
         }
     }
     return $return;
 }