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


PHP JInstaller::removeFiles方法代码示例

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


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

示例1: _actionUninstall

 /**
  * Custom uninstall method
  *
  * @access	public
  * @param	int		$path		The template name
  * @param	int		$clientId	The id of the client
  * @return	boolean	True on success
  * @since	1.5
  */
 function _actionUninstall()
 {
     $ids = (array) KRequest::get('post.id', 'string');
     // For a template the id will be the template name which represents the subfolder of the templates folder that the template resides in.
     if (empty($ids)) {
         JError::raiseWarning(100, KInflector::singularize($this->_identifier->name) . ' ' . JText::_('Uninstall') . ': ' . JText::_(KInflector::singularize($this->_identifier->name) . ' id is empty, cannot uninstall files'));
         return false;
     }
     foreach ($ids as $id) {
         $this->set('extension_root', $this->_basepath . DS . $id);
         $this->set('source', $this->get('extension_root'));
         $manifest =& $this->_findManifest();
         if (!is_a($manifest, 'JSimpleXML')) {
             // Make sure we delete the folders
             JFolder::delete($this->installer->getPath('extension_root'));
             JError::raiseWarning(100, KInflector::singularize($this->_identifier->name) . ' ' . JTEXT::_('Uninstall') . ': ' . JTEXT::_('Package manifest file invalid or not found'));
             return false;
         }
         $root =& $manifest->document;
         // Remove files
         Napi::import('lib.joomla.installer.installer');
         JInstaller::removeFiles($root->getElementByPath('media'), 0);
         JInstaller::removeFiles($root->getElementByPath('languages'));
         JInstaller::removeFiles($root->getElementByPath('administration/languages'), 1);
         // Delete the template directory
         if (JFolder::exists($this->get('extension_root'))) {
             JFolder::delete($this->get('extension_root'));
         } else {
             JError::raiseWarning(100, KInflector::singularize($this->_identifier->name) . ' ' . JText::_('Uninstall') . ': ' . JText::_('Directory does not exist, cannot remove files'));
             return false;
         }
     }
     $text = count($ids) > 1 ? KInflector::pluralize($this->_identifier->name) . ' successfully removed' : KInflector::singularize($this->_identifier->name) . ' successfully removed';
     $this->setRedirect('view=' . KInflector::pluralize($this->_identifier->name) . '&format=' . KRequest::get('get.format', 'cmd', 'html'), JText::_($text));
     return true;
 }
开发者ID:ravenlife,项目名称:Ninja-Framework,代码行数:45,代码来源:install.php


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