当前位置: 首页>>代码示例>>PHP>>正文


PHP JInstaller::setupInstall方法代码示例

本文整理汇总了PHP中JInstaller::setupInstall方法的典型用法代码示例。如果您正苦于以下问题:PHP JInstaller::setupInstall方法的具体用法?PHP JInstaller::setupInstall怎么用?PHP JInstaller::setupInstall使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JInstaller的用法示例。


在下文中一共展示了JInstaller::setupInstall方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getManifestObject

 function getManifestObject($path)
 {
     $installer = new JInstaller();
     $installer->setPath('source', $path);
     if (!$installer->setupInstall()) {
         return null;
     }
     $manifest =& $installer->getManifest();
     return $manifest;
 }
开发者ID:jnvilo,项目名称:tomasinasanctuary.org,代码行数:10,代码来源:install.php

示例2: installExtension

 /**
  * Uses the joomla installer framework to install an extension from a package file
  *
  * @param $file String the filename of the file to be installed
  * @return the extension information if the install is successfull, false otherwise
  */
 function installExtension($entry, $entryType = 'archive', $name = null)
 {
     switch (strtolower($entryType)) {
         case "Folder":
         case "folder":
             // create a package array based on contents of folder
             $package = $this->createVirtualPackage($entry);
             break;
         default:
             //Build the appropriate paths
             $config = JFactory::getConfig();
             $packageFile = $this->_extensionsPath . DS . $entry;
             //Unpack the package file
             $package = JInstallerHelper::unpack($packageFile);
             break;
     }
     //Get an installer instance, always get a new one
     $installer = new JInstaller();
     //setup for the install
     if ($package['dir'] && JFolder::exists($package['dir'])) {
         $installer->setPath('source', $package['dir']);
     } else {
         $this->setError("DSCInstaller::installExtension: " . JText::_("Package dir does not exist"));
         return false;
     }
     //this makes sure the manifest file is loaded into the installer object
     if (!$installer->setupInstall()) {
         $this->setError("DSCInstaller::installExtension: " . JText::_("Could not load manifest file"));
         return false;
     }
     //grab the manifest information
     $manifestInformation = $this->getManifestInformation($installer, $name);
     $savedParameters = new stdClass();
     //set the installer to overwrite just encase any files were left on the server
     $installer->setOverwrite(true);
     //now that the extension was uninstalled if nessecary we can install it
     if (!$installer->install($package['dir'])) {
         //something blew up with the install if we get here
         $this->setError("DSCInstaller::installExtension: " . $installer->getError());
         $result = false;
     } else {
         // Package installed sucessfully so publish the extension if set to yes
         $manifestInformation = $this->getManifestInformation($installer, $name);
         $publishExtension = $this->get('_publishExtension', false);
         if ($publishExtension) {
             $this->publishExtension($manifestInformation);
         }
         //restore extension parameters if requested
         if ($this->_saveParameters && isset($savedParameters->params)) {
             $this->restoreParameters($manifestInformation, $savedParameters);
         }
         $result = true;
     }
     // Cleanup the install files
     if (!is_file($package['packagefile'])) {
         $config = JFactory::getConfig();
         $package['packagefile'] = $config->getValue('config.tmp_path') . DS . $package['packagefile'];
     }
     //decide whether or not to delete the local copy
     if (!$this->_keepLocalCopy) {
         //delete temporary directory and install file
         JInstallerHelper::cleanupInstall($package['packagefile'], $package['extractdir']);
     } else {
         //just delete the temporary directory
         JInstallerHelper::cleanupInstall("", $package['extractdir']);
     }
     //check to see if the install was successfull and if so return the manifestinformation
     if ($result) {
         return $manifestInformation;
     } else {
         // error message is already set
         return false;
     }
 }
开发者ID:joomlacorner,项目名称:citruscart,代码行数:80,代码来源:installer.php

示例3: installExtension

 /**
  * Uses the joomla installer framework to install an extension from a package file
  *
  * @param $file String the filename of the file to be installed
  * @return the extension information if the install is successfull, false otherwise
  */
 function installExtension($entry, $entryType = 'archive')
 {
     switch (strtolower($entryType)) {
         case "Folder":
         case "folder":
             // create a package array based on contents of folder
             $package = $this->createVirtualPackage($entry);
             break;
         default:
             //Build the appropriate paths
             $config = JFactory::getConfig();
             $packageFile = $this->_extensionsPath . DS . $entry;
             //Unpack the package file
             $package = JInstallerHelper::unpack($packageFile);
             break;
     }
     //Get an installer instance, always get a new one
     $installer = new JInstaller();
     //setup for the install
     if ($package['dir'] && JFolder::exists($package['dir'])) {
         $installer->setPath('source', $package['dir']);
     } else {
         $this->setError("dscInstaller::installExtension: " . JText::_('COM_TIENDA_PACKAGE_DIR_DOES_NOT_EXIST'));
         return false;
     }
     //this makes sure the manifest file is loaded into the installer object
     if (!$installer->setupInstall()) {
         $this->setError("dscInstaller::installExtension: " . JText::_('COM_TIENDA_COULD_NOT_LOAD_MANIFEST_FILE'));
         return false;
     }
     //grab the manifest information
     $manifestInformation = $this->getManifestInformation($installer);
     $savedParameters = new stdClass();
     //check if the extension is installed already and if so uninstall it
     $elementID = $this->checkIfInstalledAlready($manifestInformation);
     // This is not necessary if everything has method=upgrade
     //			if ($elementID != 0) {
     //				//save the extensions parameters if requested
     //				$savedParameters = $this->saveParameters($manifestInformation);
     //
     //				//prevent any custom uninstall scripts if requested for components
     //				if (($this->_preventUninstallScript) && ($manifestInformation["type"] == "component")) {
     //					$this->preventCustomUninstall($installer);
     //				}
     //				//uninstall the extension using the joomla uninstaller
     //				$installer->uninstall($manifestInformation["type"], $elementID);
     //			}
     //set the installer to overwrite just encase any files were left on the server
     $installer->setOverwrite(true);
     //now that the extension was uninstalled if nessecary we can install it
     if (!$installer->install($package['dir'])) {
         //something blew up with the install if we get here
         $this->setError("dscInstaller::installExtension: " . $installer->getError());
         $result = false;
     } else {
         // Package installed sucessfully so publish the extension if set to yes
         $manifestInformation = $this->getManifestInformation($installer);
         $publishExtension = $this->get('_publishExtension', false);
         if ($publishExtension) {
             $this->publishExtension($manifestInformation);
         }
         //restore extension parameters if requested
         if ($this->_saveParameters && isset($savedParameters->params)) {
             $this->restoreParameters($manifestInformation, $savedParameters);
         }
         $result = true;
     }
     // Cleanup the install files
     if (!is_file($package['packagefile'])) {
         $config = JFactory::getConfig();
         $package['packagefile'] = $config->getValue('config.tmp_path') . DS . $package['packagefile'];
     }
     //decide whether or not to delete the local copy
     if (!$this->_keepLocalCopy) {
         //delete temporary directory and install file
         JInstallerHelper::cleanupInstall($package['packagefile'], $package['extractdir']);
     } else {
         //just delete the temporary directory
         JInstallerHelper::cleanupInstall("", $package['extractdir']);
     }
     //check to see if the install was successfull and if so return the manifestinformation
     if ($result) {
         return $manifestInformation;
     } else {
         // error message is already set
         return false;
     }
 }
开发者ID:annggeel,项目名称:tienda,代码行数:94,代码来源:dscinstaller.php


注:本文中的JInstaller::setupInstall方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。