當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。