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


PHP com_uninstall函数代码示例

本文整理汇总了PHP中com_uninstall函数的典型用法代码示例。如果您正苦于以下问题:PHP com_uninstall函数的具体用法?PHP com_uninstall怎么用?PHP com_uninstall使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: uninstall

 /**
  * Custom uninstall method for components
  *
  * @access	public
  * @param	int		$cid	The id of the component to uninstall
  * @param	int		$clientId	The id of the client (unused)
  * @return	mixed	Return value for uninstall method in component uninstall file
  * @since	1.0
  */
 function uninstall($id, $clientId)
 {
     // Initialize variables
     $db =& $this->parent->getDBO();
     $row = null;
     $retval = true;
     // First order of business will be to load the component object table from the database.
     // This should give us the necessary information to proceed.
     $row =& JTable::getInstance('component');
     if (!$row->load((int) $id)) {
         JError::raiseWarning(100, JText::_('ERRORUNKOWNEXTENSION'));
         return false;
     }
     // Is the component we are trying to uninstall a core one?
     // Because that is not a good idea...
     if ($row->iscore) {
         JError::raiseWarning(100, JText::_('Component') . ' ' . JText::_('Uninstall') . ': ' . JText::sprintf('WARNCORECOMPONENT', $row->name) . "<br />" . JText::_('WARNCORECOMPONENT2'));
         return false;
     }
     // Get the admin and site paths for the component
     $this->parent->setPath('extension_administrator', JPath::clean(JPATH_ADMINISTRATOR . DS . 'components' . DS . $row->option));
     $this->parent->setPath('extension_site', JPath::clean(JPATH_SITE . DS . 'components' . DS . $row->option));
     /**
      * ---------------------------------------------------------------------------------------------
      * Manifest Document Setup Section
      * ---------------------------------------------------------------------------------------------
      */
     // Find and load the XML install file for the component
     $this->parent->setPath('source', $this->parent->getPath('extension_administrator'));
     // Get the package manifest objecct
     $manifest =& $this->parent->getManifest();
     if (!is_a($manifest, 'JSimpleXML')) {
         // Make sure we delete the folders if no manifest exists
         JFolder::delete($this->parent->getPath('extension_administrator'));
         JFolder::delete($this->parent->getPath('extension_site'));
         // Remove the menu
         $this->_removeAdminMenus($row);
         // Raise a warning
         JError::raiseWarning(100, JText::_('ERRORREMOVEMANUALLY'));
         // Return
         return false;
     }
     // Get the root node of the manifest document
     $this->manifest =& $manifest->document;
     /**
      * ---------------------------------------------------------------------------------------------
      * Custom Uninstallation Script Section
      * ---------------------------------------------------------------------------------------------
      */
     // Now lets load the uninstall file if there is one and execute the uninstall function if it exists.
     $uninstallfileElement =& $this->manifest->getElementByPath('uninstallfile');
     if (is_a($uninstallfileElement, 'JSimpleXMLElement')) {
         // Element exists, does the file exist?
         if (is_file($this->parent->getPath('extension_administrator') . DS . $uninstallfileElement->data())) {
             ob_start();
             ob_implicit_flush(false);
             require_once $this->parent->getPath('extension_administrator') . DS . $uninstallfileElement->data();
             if (function_exists('com_uninstall')) {
                 if (com_uninstall() === false) {
                     JError::raiseWarning(100, JText::_('Component') . ' ' . JText::_('Uninstall') . ': ' . JText::_('Custom Uninstall script unsuccessful'));
                     $retval = false;
                 }
             }
             $msg = ob_get_contents();
             ob_end_clean();
             if ($msg != '') {
                 $this->parent->set('extension.message', $msg);
             }
         }
     }
     /**
      * ---------------------------------------------------------------------------------------------
      * Database Processing Section
      * ---------------------------------------------------------------------------------------------
      */
     /*
      * Let's run the uninstall queries for the component
      *	If backward compatibility is required - run queries in xml file
      *	If Joomla 1.5 compatible, with discreet sql files - execute appropriate
      *	file for utf-8 support or non-utf support
      */
     $result = $this->parent->parseQueries($this->manifest->getElementByPath('uninstall/queries'));
     if ($result === false) {
         // Install failed, rollback changes
         JError::raiseWarning(100, JText::_('Component') . ' ' . JText::_('Uninstall') . ': ' . JText::_('SQL Error') . " " . $db->stderr(true));
         $retval = false;
     } elseif ($result === 0) {
         // no backward compatibility queries found - try for Joomla 1.5 type queries
         // second argument is the utf compatible version attribute
         $utfresult = $this->parent->parseSQLFiles($this->manifest->getElementByPath('uninstall/sql'));
         if ($utfresult === false) {
//.........这里部分代码省略.........
开发者ID:Fellah,项目名称:govnobaki,代码行数:101,代码来源:component.php

示例2: uninstall

 /**
  * Custom uninstall method
  *
  * @access	public
  * @param	int		$cid	The id of the plugin to uninstall
  * @param	int		$clientId	The id of the client (unused)
  * @return	boolean	True on success
  * @since	1.5
  */
 function uninstall($id, $clientId)
 {
     // Initialize variables
     $row = null;
     $retval = true;
     $db =& $this->parent->getDBO();
     // First order of business will be to load the module object table from the database.
     // This should give us the necessary information to proceed.
     // ^ Changes to plugin parameters. Use JCEPluginsTable class.
     $row =& JTable::getInstance('plugin', 'JCETable');
     $row->load((int) $id);
     // Is the plugin we are trying to uninstall a core one?
     // Because that is not a good idea...
     if ($row->iscore) {
         JError::raiseWarning(100, 'Plugin Uninstall: ' . JText::sprintf('WARNCOREPLUGIN', $row->title) . "<br />" . JText::_('WARNCOREPLUGIN2'));
         return false;
     }
     // Get the plugin folder so we can properly build the plugin path
     if (trim($row->name) == '') {
         JError::raiseWarning(100, 'Plugin Uninstall: ' . JText::_('Plugin field empty, cannot remove files'));
         return false;
     }
     // Set the plugin root path
     $this->parent->setPath('extension_root', JPATH_PLUGINS . DS . 'editors' . DS . 'jce' . DS . 'tiny_mce' . DS . 'plugins' . DS . $row->name);
     $manifestFile = $this->parent->getPath('extension_root') . DS . $row->name . '.xml';
     if (file_exists($manifestFile)) {
         $xml =& JFactory::getXMLParser('Simple');
         // If we cannot load the xml file return null
         if (!$xml->loadFile($manifestFile)) {
             JError::raiseWarning(100, 'Plugin Uninstall: ' . JText::_('Could not load manifest file'));
             return false;
         }
         /*
          * Check for a valid XML root tag.
          * @todo: Remove backwards compatability in a future version
          * Should be 'install', but for backward compatability we will accept 'mosinstall'.
          */
         $root =& $xml->document;
         if ($root->name() != 'install' && $root->name() != 'mosinstall') {
             JError::raiseWarning(100, 'Plugin Uninstall: ' . JText::_('Invalid manifest file'));
             return false;
         }
         // Remove the plugin files
         $this->parent->removeFiles($root->getElementByPath('files'), -1);
         JFile::delete($manifestFile);
         // Remove all media and languages as well
         $this->parent->removeFiles($root->getElementByPath('languages'), 0);
         /**
          * ---------------------------------------------------------------------------------------------
          * Custom Uninstallation Script Section
          * ---------------------------------------------------------------------------------------------
          */
         // Now lets load the uninstall file if there is one and execute the uninstall function if it exists.
         $uninstallfileElement =& $root->getElementByPath('uninstallfile');
         if (is_a($uninstallfileElement, 'JSimpleXMLElement')) {
             // Element exists, does the file exist?
             if (is_file($this->parent->getPath('extension_root') . DS . $uninstallfileElement->data())) {
                 ob_start();
                 ob_implicit_flush(false);
                 require_once $this->parent->getPath('extension_root') . DS . $uninstallfileElement->data();
                 if (function_exists('com_uninstall')) {
                     if (com_uninstall() === false) {
                         JError::raiseWarning(100, JText::_('Plugin') . ' ' . JText::_('Uninstall') . ': ' . JText::_('Custom Uninstall script unsuccessful'));
                         $retval = false;
                     }
                 }
                 $msg = ob_get_contents();
                 ob_end_clean();
                 if ($msg != '') {
                     $this->parent->set('extension.message', $msg);
                 }
             }
         }
         // Remove from Groups
         if ($row->type == 'plugin') {
             JTable::addIncludePath(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_jce' . DS . 'groups');
             $grow =& JTable::getInstance('groups', 'JCETable');
             $query = 'SELECT id, name, plugins, rows' . ' FROM #__jce_groups';
             $db->setQuery($query);
             $groups = $db->loadObjectList();
             foreach ($groups as $group) {
                 $plugins = explode(',', $group->plugins);
                 // Existence check
                 if (in_array($row->id, $plugins)) {
                     // Load tables
                     $grow->load($group->id);
                     // Remove from plugins list
                     foreach ($plugins as $k => $v) {
                         if ($row->id == $v) {
                             unset($plugins[$k]);
                         }
//.........这里部分代码省略.........
开发者ID:rlee1962,项目名称:diylegalcenter,代码行数:101,代码来源:plugin.php

示例3: uninstall


//.........这里部分代码省略.........
             include_once $manifestScriptFile;
         }
         // Set the class name
         $classname = $row->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', $scriptFile);
             // Note: if we don't find the class, don't bother to copy the file
         }
     }
     ob_start();
     ob_implicit_flush(false);
     // run uninstall if possible
     if ($this->parent->manifestClass && method_exists($this->parent->manifestClass, 'uninstall')) {
         $this->parent->manifestClass->uninstall($this);
     }
     $msg = ob_get_contents();
     ob_end_clean();
     /**
      * ---------------------------------------------------------------------------------------------
      * Custom Uninstallation Script Section; Legacy CMS 1.5 Support
      * ---------------------------------------------------------------------------------------------
      */
     // Now let's load the uninstall file if there is one and execute the uninstall function if it exists.
     $uninstallFile = (string) $this->manifest->uninstallfile;
     if ($uninstallFile) {
         // Element exists, does the file exist?
         if (is_file($this->parent->getPath('extension_administrator') . '/' . $uninstallFile)) {
             ob_start();
             ob_implicit_flush(false);
             require_once $this->parent->getPath('extension_administrator') . '/' . $uninstallFile;
             if (function_exists('com_uninstall')) {
                 if (com_uninstall() === false) {
                     JError::raiseWarning(100, JText::_('JLIB_INSTALLER_ERROR_COMP_UNINSTALL_CUSTOM'));
                     $retval = false;
                 }
             }
             // append this in case there was something else
             $msg .= ob_get_contents();
             ob_end_clean();
         }
     }
     if ($msg != '') {
         $this->parent->set('extension_message', $msg);
     }
     /**
      * ---------------------------------------------------------------------------------------------
      * Database Processing Section
      * ---------------------------------------------------------------------------------------------
      */
     /*
      * Let's run the uninstall queries for the component
      * If Joomla CMS 1.5 compatible, with discrete sql files - execute appropriate
      * file for utf-8 support or non-utf support
      */
     // Try for Joomla 1.5 type queries
     // Second argument is the utf compatible version attribute
     if (isset($this->manifest->uninstall->sql)) {
         $utfresult = $this->parent->parseSQLFiles($this->manifest->uninstall->sql);
         if ($utfresult === false) {
             // Install failed, rollback changes
             JError::raiseWarning(100, JText::sprintf('JLIB_INSTALLER_ERROR_COMP_UNINSTALL_SQL_ERROR', $db->stderr(true)));
             $retval = false;
         }
开发者ID:rdeutz,项目名称:square-one-cms,代码行数:67,代码来源:component.php

示例4: uninstall

 /**
  * Uninstall method
  *
  * @access  public
  * @param 	string   $name  The name of the plugin to uninstall
  * @return  boolean True on success
  */
 public function uninstall($name)
 {
     // Initialize variables
     $row = null;
     $retval = true;
     $db = $this->parent->getDBO();
     $parts = explode('.', $name);
     // get name
     $name = array_pop($parts);
     // get type eg: plugin or extension
     $type = array_shift($parts);
     $this->parent->set('name', $name);
     // Load the language file
     $language = JFactory::getLanguage();
     switch ($type) {
         case 'plugin':
             // create $path
             $path = JPATH_COMPONENT_SITE . '/editor/tiny_mce/plugins/' . $name;
             // load language file
             $language->load('com_jce_' . $name, JPATH_SITE);
             break;
         case 'extension':
             $parts[] = $name;
             $path = dirname(JPATH_COMPONENT_SITE . '/editor/extensions/' . implode('/', $parts));
             // load language file
             $language->load('com_jce_' . trim(implode('_', $parts)), JPATH_SITE);
             break;
     }
     // Set the plugin root path
     $this->parent->setPath('extension_root', $path);
     // set manifest path
     $manifest = $this->parent->getPath('extension_root') . '/' . $name . '.xml';
     if (file_exists($manifest)) {
         $xml = WFXMLHelper::getXML($manifest);
         if (!$xml) {
             JError::raiseWarning(100, WFText::_('WF_INSTALLER_PLUGIN_UNINSTALL') . ' : ' . WFText::_('WF_INSTALLER_MANIFEST_INVALID'));
         }
         $this->parent->set('name', (string) $xml->name);
         $this->parent->set('version', (string) $xml->version);
         $this->parent->set('message', (string) $xml->description);
         // can't remove a core plugin
         if ((int) $xml->attributes()->core == 1) {
             JError::raiseWarning(100, WFText::_('WF_INSTALLER_PLUGIN_UNINSTALL') . ' : ' . JText::sprintf('WF_INSTALLER_WARNCOREPLUGIN', WFText::_((string) $xml->name)));
             return false;
         }
         if ($type == 'extension') {
             $this->parent->removeFiles($xml->files, -1);
             JFile::delete($manifest);
         }
         // Remove all media and languages as well
         $this->parent->removeFiles($xml->languages, 0);
         $this->parent->removeFiles($xml->media, 0);
         /**
          * ---------------------------------------------------------------------------------------------
          * Custom Uninstallation Script Section
          * ---------------------------------------------------------------------------------------------
          */
         // Now lets load the uninstall file if there is one and execute the uninstall function if it exists.
         $uninstall = (string) $xml->children('uninstall.script');
         if ($uninstall) {
             // Element exists, does the file exist?
             if (is_file($this->parent->getPath('extension_root') . '/' . $uninstall)) {
                 ob_start();
                 ob_implicit_flush(false);
                 require_once $this->parent->getPath('extension_root') . '/' . $uninstall;
                 if (function_exists('com_uninstall')) {
                     if (com_uninstall() === false) {
                         JError::raiseWarning(100, WFText::_('WF_INSTALLER_PLUGIN_UNINSTALL') . ' : ' . WFText::_('WF_INSTALLER_CUSTOM_UNINSTALL_ERROR'));
                         $retval = false;
                     }
                 }
                 $msg = ob_get_contents();
                 ob_end_clean();
                 if ($msg != '') {
                     $this->parent->set('extension.message', $msg);
                 }
             }
         }
         // remove form profile
         if ($xml->icon) {
             $plugin = new StdClass();
             $plugin->name = (string) $xml->plugin;
             $plugin->icon = (string) $xml->icon;
             $plugin->path = $this->parent->getPath('extension_root');
             wfimport('admin.models.plugins');
             $model = new WFModelPlugins();
             $model->postInstall('uninstall', $plugin, $this);
         }
     } else {
         JError::raiseWarning(100, WFText::_('WF_INSTALLER_PLUGIN_UNINSTALL') . ' : ' . WFText::_('WF_INSTALLER_MANIFEST_ERROR'));
         $retval = false;
     }
     // set plugin path
//.........这里部分代码省略.........
开发者ID:acculitx,项目名称:fleetmatrixsite,代码行数:101,代码来源:plugin.php

示例5: uninstall

 /**
  * Custom install method
  * @param int The id of the module
  * @param string The URL option
  * @param int The client id
  */
 function uninstall($cid, $option, $client = 0)
 {
     global $database, $mosConfig_absolute_path;
     $uninstallret = "";
     $sql = "SELECT * FROM #__components WHERE id={$cid}";
     $database->setQuery($sql);
     $row = null;
     if (!$database->loadObject($row)) {
         HTML_installer::showInstallMessage($database->stderr(true), 'Uninstall -  error', $this->returnTo($option, 'component', $client));
         exit;
     }
     if ($row->iscore) {
         HTML_installer::showInstallMessage("Component {$row->name} is a core component, and can not be uninstalled.<br />You need to unpublish it if you don't want to use it", 'Uninstall -  error', $this->returnTo($option, 'component', $client));
         exit;
     }
     // Delete entries in the DB
     $sql = "DELETE FROM #__components WHERE parent={$row->id}";
     $database->setQuery($sql);
     if (!$database->query()) {
         HTML_installer::showInstallMessage($database->stderr(true), 'Uninstall -  error', $this->returnTo($option, 'component', $client));
         exit;
     }
     $sql = "DELETE FROM #__components WHERE id={$row->id}";
     $database->setQuery($sql);
     if (!$database->query()) {
         HTML_installer::showInstallMessage($database->stderr(true), 'Uninstall -  error', $this->returnTo($option, 'component', $client));
         exit;
     }
     // Try to find the uninstall file
     $filesindir = mosReadDirectory($mosConfig_absolute_path . '/administrator/components/' . $row->option, 'uninstall');
     if (count($filesindir) > 0) {
         $uninstall_file = $filesindir[0];
         if (file_exists($mosConfig_absolute_path . '/administrator/components/' . $row->option . '/' . $uninstall_file)) {
             require_once $mosConfig_absolute_path . '/administrator/components/' . $row->option . '/' . $uninstall_file;
             $uninstallret = com_uninstall();
         }
     }
     // Try to find the XML file
     $filesindir = mosReadDirectory(mosPathName($mosConfig_absolute_path . '/administrator/components/' . $row->option), '.xml$');
     if (count($filesindir) > 0) {
         $ismosinstall = false;
         foreach ($filesindir as $file) {
             $xmlDoc =& new DOMIT_Lite_Document();
             $xmlDoc->resolveErrors(true);
             if (!$xmlDoc->loadXML($mosConfig_absolute_path . "/administrator/components/" . $row->option . "/" . $file, false, true)) {
                 return false;
             }
             $element =& $xmlDoc->documentElement;
             if ($element->getTagName() != 'mosinstall') {
                 HTML_installer::showInstallMessage('XML File invalid', 'Uninstall -  error', $this->returnTo($option, 'component', $client));
                 exit;
             }
             $query_element =& $xmlDoc->getElementsbyPath('uninstall/queries', 1);
             if (!is_null($query_element)) {
                 $queries = $query_element->childNodes;
                 foreach ($queries as $query) {
                     $database->setQuery($query->getText());
                     if (!$database->query()) {
                         HTML_installer::showInstallMessage($database->stderr(true), 'Uninstall -  error', $this->returnTo($option, 'component', $client));
                         exit;
                     }
                 }
             }
         }
     } else {
         /*
         HTML_installer::showInstallMessage( 'Could not find XML Setup file in '.$mosConfig_absolute_path.'/administrator/components/'.$row->option,
         	'Uninstall -  error', $option, 'component' );
         exit();
         */
     }
     // Delete directories
     if (trim($row->option)) {
         $result = 0;
         $path = mosPathName($mosConfig_absolute_path . '/administrator/components/' . $row->option);
         if (is_dir($path)) {
             $result |= deldir($path);
         }
         $path = mosPathName($mosConfig_absolute_path . '/components/' . $row->option);
         if (is_dir($path)) {
             $result |= deldir($path);
         }
         return $result;
     } else {
         HTML_installer::showInstallMessage('Option field empty, cannot remove files', 'Uninstall -  error', $option, 'component');
         exit;
     }
     return $uninstallret;
 }
开发者ID:cwcw,项目名称:cms,代码行数:95,代码来源:component.class.php

示例6: uninstall


//.........这里部分代码省略.........
             include_once $manifestScriptFile;
         }
         // Set the class name
         $classname = $row->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', $scriptFile);
             // Note: if we don't find the class, don't bother to copy the file
         }
     }
     ob_start();
     ob_implicit_flush(false);
     // run uninstall if possible
     if ($this->parent->manifestClass && method_exists($this->parent->manifestClass, 'uninstall')) {
         $this->parent->manifestClass->uninstall($this);
     }
     $msg = ob_get_contents();
     ob_end_clean();
     /**
      * ---------------------------------------------------------------------------------------------
      * Custom Uninstallation Script Section; Legacy 1.5 Support
      * ---------------------------------------------------------------------------------------------
      */
     // Now lets load the uninstall file if there is one and execute the uninstall function if it exists.
     $uninstallFile = (string) $this->manifest->uninstallfile;
     if ($uninstallFile) {
         // Element exists, does the file exist?
         if (is_file($this->parent->getPath('extension_administrator') . DS . $uninstallFile)) {
             ob_start();
             ob_implicit_flush(false);
             require_once $this->parent->getPath('extension_administrator') . DS . $uninstallFile;
             if (function_exists('com_uninstall')) {
                 if (com_uninstall() === false) {
                     JError::raiseWarning(100, JText::_('Component') . ' ' . JText::_('Uninstall') . ': ' . JText::_('Custom Uninstall script unsuccessful'));
                     $retval = false;
                 }
             }
             $msg .= ob_get_contents();
             // append this in case there was something else
             ob_end_clean();
         }
     }
     if ($msg != '') {
         $this->parent->set('extension_message', $msg);
     }
     /**
      * ---------------------------------------------------------------------------------------------
      * Database Processing Section
      * ---------------------------------------------------------------------------------------------
      */
     /*
      * Let's run the uninstall queries for the component
      *	If Joomla 1.5 compatible, with discreet sql files - execute appropriate
      *	file for utf-8 support or non-utf support
      */
     // try for Joomla 1.5 type queries
     // second argument is the utf compatible version attribute
     $utfresult = $this->parent->parseSQLFiles($this->manifest->uninstall->sql);
     if ($utfresult === false) {
         // Install failed, rollback changes
         JError::raiseWarning(100, JText::_('Component') . ' ' . JText::_('Uninstall') . ': ' . JText::_('SQLERRORORFILE') . " " . $db->stderr(true));
         $retval = false;
     }
     $this->_removeAdminMenus($row);
开发者ID:joebushi,项目名称:joomla,代码行数:67,代码来源:component.php

示例7: uninstall

 /**
  * Uninstall method
  *
  * @access  public
  * @param 	string   $name  The name of the plugin to uninstall
  * @return  boolean True on success
  */
 public function uninstall($name)
 {
     // Initialize variables
     $row = null;
     $retval = true;
     $db = $this->parent->getDBO();
     $this->parent->set('name', $name);
     // Set the plugin root path
     $this->parent->setPath('extension_root', JPATH_COMPONENT_SITE . DS . 'editor' . DS . 'tiny_mce' . DS . 'plugins' . DS . $name);
     $manifest = $this->parent->getPath('extension_root') . DS . $name . '.xml';
     // Load the language file
     $language = JFactory::getLanguage();
     $language->load('com_jce_' . trim($name), JPATH_SITE);
     if (file_exists($manifest)) {
         $xml = WFXMLHelper::getXML($manifest);
         if (!$this->setManifest($xml)) {
             JError::raiseWarning(100, WFText::_('WF_INSTALLER_PLUGIN_UNINSTALL') . ' : ' . WFText::_('WF_INSTALLER_MANIFEST_INVALID'));
         }
         $this->parent->set('name', $this->get('name'));
         $this->parent->set('version', $this->get('version'));
         $this->parent->set('message', $this->get('description'));
         // can't remove a core plugin
         if ($this->get('core') == 1) {
             JError::raiseWarning(100, WFText::_('WF_INSTALLER_PLUGIN_UNINSTALL') . ' : ' . JText::sprintf('WF_INSTALLER_WARNCOREPLUGIN', WFText::_($this->get('name'))));
             return false;
         }
         // Remove all media and languages as well
         $this->parent->removeFiles($this->get('languages'), 0);
         $this->parent->removeFiles($this->get('media'), 0);
         /**
          * ---------------------------------------------------------------------------------------------
          * Custom Uninstallation Script Section
          * ---------------------------------------------------------------------------------------------
          */
         // Now lets load the uninstall file if there is one and execute the uninstall function if it exists.
         $uninstall = $this->get('uninstall.script');
         if ($uninstall) {
             // Element exists, does the file exist?
             if (is_file($this->parent->getPath('extension_root') . DS . $uninstall)) {
                 ob_start();
                 ob_implicit_flush(false);
                 require_once $this->parent->getPath('extension_root') . DS . $uninstall;
                 if (function_exists('com_uninstall')) {
                     if (com_uninstall() === false) {
                         JError::raiseWarning(100, WFText::_('WF_INSTALLER_PLUGIN_UNINSTALL') . ' : ' . WFText::_('WF_INSTALLER_CUSTOM_UNINSTALL_ERROR'));
                         $retval = false;
                     }
                 }
                 $msg = ob_get_contents();
                 ob_end_clean();
                 if ($msg != '') {
                     $this->parent->set('extension.message', $msg);
                 }
             }
         }
         // Remove from Groups
         JTable::addIncludePath(WF_ADMINISTRATOR . DS . 'groups');
         $rows = JTable::getInstance('profiles', 'WFTable');
         $query = 'SELECT id, name, plugins, rows' . ' FROM #__wf_profiles';
         $db->setQuery($query);
         $profiles = $db->loadObjectList();
         foreach ($profiles as $profile) {
             $plugins = explode(',', $profile->plugins);
             // Existence check
             if (in_array($this->get('plugin'), $plugins)) {
                 // Load tables
                 $rows->load($profile->id);
                 // Remove from plugins list
                 foreach ($plugins as $k => $v) {
                     if ($this->get('plugin') == $v) {
                         unset($plugins[$k]);
                     }
                 }
                 $rows->plugins = implode(',', $plugins);
                 // Remove from rows
                 if ($this->get('icon')) {
                     $lists = array();
                     foreach (explode(';', $profile->rows) as $list) {
                         $icons = explode(',', $list);
                         foreach ($icons as $k => $v) {
                             if ($this->get('plugin') == $v) {
                                 unset($icons[$k]);
                             }
                         }
                         $lists[] = implode(',', $icons);
                     }
                     $rows->rows = implode(';', $lists);
                 }
                 if (!$rows->store()) {
                     JError::raiseWarning(100, WFText::_('WF_INSTALLER_PLUGIN_UNINSTALL') . ' : ' . JText::sprintf('WF_INSTALLER_REMOVE_FROM_GROUP_ERROR', $prows->name));
                 }
             }
         }
//.........这里部分代码省略.........
开发者ID:srbsnkr,项目名称:sellingonlinemadesimple,代码行数:101,代码来源:plugin.php

示例8: uninstall


//.........这里部分代码省略.........
         foreach ($toolbarnames as $toolbarname) {
             $tmpfilename = $CKfolder . DS . $toolbarname . '.php';
             require_once $tmpfilename;
             $classname = 'JCK' . ucfirst($toolbarname);
             $toolbar = new $classname();
             $pluginTitle = str_replace(' ', '', $row->title);
             $pluginTitle = ucfirst($pluginTitle);
             if (!isset($toolbar->{$pluginTitle})) {
                 continue;
             }
             //fix toolbar values or they will get wiped out
             foreach (get_object_vars($toolbar) as $k => $v) {
                 if (is_null($v)) {
                     $toolbar->{$k} = '';
                 }
                 if ($k[0] == '_') {
                     $toolbar->{$k} = NULL;
                 }
             }
             $toolbar->{$pluginTitle} = NULL;
             $toolbarConfig = new JRegistry('toolbar');
             $toolbarConfig->loadObject($toolbar);
             // Get the config registry in PHP class format and write it to configuation.php
             if (!JFile::write($tmpfilename, $toolbarConfig->toString('PHP', array('class' => $classname . ' extends JCKToolbar')))) {
                 JError::raiseWarning(100, 'Failed to remove ' . $row->name . 'plugin from  ' . $classname . ' toolbar');
             }
         }
         /**
          *
          * Remove plugin from config file  AW
          *
          */
         $config =& JCKHelper::getEditorPluginConfig();
         $config->setValue($row->name, NULL);
         // remove value from output
         $cfgFile = CKEDITOR_LIBRARY . DS . 'plugins' . DS . 'toolbarplugins.php';
         // Get the config registry in PHP class format and write it to configuation.php
         if (!JFile::write($cfgFile, $config->toString('PHP', array('class' => 'JCKToolbarPlugins extends JCKPlugins')))) {
             JError::raiseWarning(100, 'Failed to remove ' . $pname . ' jckeditor plugin from config file');
         }
         /*
          * Check for a valid XML root tag.
          * @todo: Remove backwards compatability in a future version
          * Should be 'install', but for backward compatability we will accept 'mosinstall'.
          */
         $root =& $xml;
         if ($root->getName() != 'extension' && $root->getName() != 'install') {
             JError::raiseWarning(100, 'Plugin Uninstall: ' . JText::_('Invalid manifest file'));
             return false;
         }
         // Remove the plugin files
         $this->parent->removeFiles($root->files, -1);
         JFile::delete($manifestFile);
         // Remove all media and languages as well
         $this->parent->removeFiles($root->languages, 0);
         /**
          * ---------------------------------------------------------------------------------------------
          * Custom Uninstallation Script Section
          * ---------------------------------------------------------------------------------------------
          */
         // Now lets load the uninstall file if there is one and execute the uninstall function if it exists.
         $uninstallfileElement =& $root->uninstallfile;
         if (is_a($uninstallfileElement, 'JXMLElement')) {
             // Element exists, does the file exist?
             if (is_file($this->parent->getPath('extension_root') . DS . $uninstallfileElement->data())) {
                 ob_start();
                 ob_implicit_flush(false);
                 require_once $this->parent->getPath('extension_root') . DS . $uninstallfileElement->data();
                 if (function_exists('com_uninstall')) {
                     if (com_uninstall() === false) {
                         JError::raiseWarning(100, JText::_('Plugin') . ' ' . JText::_('Uninstall') . ': ' . JText::_('Custom Uninstall script unsuccessful'));
                         $retval = false;
                     }
                 }
                 $msg = ob_get_contents();
                 ob_end_clean();
                 if ($msg != '') {
                     $this->parent->set('extension.message', $msg);
                 }
             }
         }
     } else {
         JError::raiseWarning(100, 'Plugin Uninstall: Manifest File invalid or not found. Plugin entry removed from database.');
         $row->delete($row->id);
         unset($row);
         $retval = false;
     }
     // Now we will no longer need the plugin object, so lets delete it
     $row->delete($row->id);
     unset($row);
     // If the folder is empty, let's delete it
     $files = JFolder::files($this->parent->getPath('extension_root'));
     if (!count($files)) {
         JFolder::delete($this->parent->getPath('extension_root'));
     }
     //Now delete copy of plugin stored in the component
     $copyPath = JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_jckman' . DS . 'editor' . DS . 'plugins' . DS . $pname;
     JFolder::delete($copyPath);
     return $retval;
 }
开发者ID:shamusdougan,项目名称:MillparkNoticeBoards,代码行数:101,代码来源:plugin.php

示例9: uninstall

 function uninstall($id, $clientId)
 {
     // Initialize variables
     $db =& $this->parent->getDBO();
     $basepath = JPATH_ROOT . DS . 'components' . DS . 'com_sef' . DS . 'sef_ext';
     $xmlFile = $basepath . DS . $id;
     $ext = str_replace('.xml', '', $id);
     $retval = true;
     $xml =& JFactory::getXMLParser('Simple');
     if (!$xml->loadFile($xmlFile)) {
         unset($xml);
         JError::raiseWarning(100, JText::_('Unable to load XML file.'));
         return false;
     }
     $root =& $xml->document;
     // Now lets load the uninstall file if there is one and execute the uninstall function if it exists.
     $uninstallfileElement =& $root->getElementByPath('uninstallfile');
     if (is_a($uninstallfileElement, 'JSimpleXMLElement')) {
         // Element exists, does the file exist?
         if (is_file($basepath . DS . $uninstallfileElement->data())) {
             ob_start();
             ob_implicit_flush(false);
             require_once $basepath . DS . $uninstallfileElement->data();
             if (function_exists('com_uninstall')) {
                 if (com_uninstall() === false) {
                     JError::raiseWarning(100, JText::_('SEF Extension') . ' ' . JText::_('Uninstall') . ': ' . JText::_('Custom Uninstall script unsuccessful'));
                     $retval = false;
                 }
             }
             $msg = ob_get_contents();
             ob_end_clean();
             if ($msg != '') {
                 $this->parent->set('extension.message', $msg);
             }
         }
     }
     /*
      * Let's run the uninstall queries for the component
      *	If backward compatibility is required - run queries in xml file
      *	If Joomla 1.5 compatible, with discreet sql files - execute appropriate
      *	file for utf-8 support or non-utf support
      */
     $result = $this->parent->parseQueries($root->getElementByPath('uninstall/queries'));
     if ($result === false) {
         // Install failed, rollback changes
         JError::raiseWarning(100, JText::_('SEF Extension') . ' ' . JText::_('Uninstall') . ': ' . JText::_('SQL Error') . " " . $db->stderr(true));
         $retval = false;
     } elseif ($result === 0) {
         // no backward compatibility queries found - try for Joomla 1.5 type queries
         // second argument is the utf compatible version attribute
         $utfresult = $this->parent->parseSQLFiles($root->getElementByPath('uninstall/sql'));
         if ($utfresult === false) {
             // Install failed, rollback changes
             JError::raiseWarning(100, JText::_('SEF Extension') . ' ' . JText::_('Uninstall') . ': ' . JText::_('SQLERRORORFILE') . " " . $db->stderr(true));
             $retval = false;
         }
     }
     // Now remove files
     $fileselement = $root->getElementByPath('files');
     if (is_a($fileselement, 'JSimpleXMLElement')) {
         $files = $fileselement->children();
         if (count($files) > 0) {
             foreach ($files as $file) {
                 $filename = $file->data();
                 if (file_exists($basepath . DS . $filename)) {
                     if (!JFile::delete($basepath . DS . $filename)) {
                         JError::raiseWarning(100, JText::_('SEF Extension') . ' ' . JText::_('Uninstall') . ': ' . JText::_('Could not delete file') . ': ' . $filename);
                         $retval = false;
                     }
                 }
             }
         }
     }
     // Remove the XML file
     if (!JFile::delete($xmlFile)) {
         JError::raiseWarning(100, JText::_('SEF Extension') . ' ' . JText::_('Uninstall') . ': ' . JText::_('Could not delete file') . ': ' . $id);
         $retval = false;
     }
     // Remove the extension's texts
     $query = "DELETE FROM `#__sefexttexts` WHERE `extension` = " . $db->Quote($ext);
     $db->setQuery($query);
     if (!$db->query()) {
         JError::raiseWarning(100, JText::_('SEF Extension') . ' ' . JText::_('Uninstall') . ': ' . JText::_('SQL Error') . " " . $db->stderr(true));
         $retval = false;
     }
     return $retval;
 }
开发者ID:andreassetiawanhartanto,项目名称:PDKKI,代码行数:87,代码来源:sef_ext.php

示例10: uninstall

 function uninstall($parent)
 {
     com_uninstall();
 }
开发者ID:01J,项目名称:bealtine,代码行数:4,代码来源:install.php

示例11: uninstall

 public function uninstall()
 {
     com_uninstall();
 }
开发者ID:naka211,项目名称:kkvn,代码行数:4,代码来源:install.php

示例12: uninstall_component

 function uninstall_component()
 {
     $com_name = 'com_' . str_replace(' ', '', strtolower($this->getName('component')));
     $this->user_dir = mosPathName(mamboCore::get('mosConfig_absolute_path') . '/components/' . $com_name);
     $this->admin_dir = mosPathName(mamboCore::get('mosConfig_absolute_path') . '/administrator/components/' . $com_name);
     if ($this->uninstallfile) {
         $ufile = mosPathName($this->admin_dir) . $this->uninstallfile;
         if (is_file($ufile)) {
             require_once $ufile;
             com_uninstall();
         }
     }
     $database =& mamboDatabase::getInstance();
     foreach ($this->queries as $query) {
         $database->setQuery($query[0]);
         if (!$database->query()) {
             $this->errors->addErrorDetails(sprintf(T_('Uninstaller error with %s: %s %s SQL error %s'), $this->xmlfile, 'component', $com_name, $database->stderr(true)), _MOS_ERROR_SEVERE);
         }
     }
     $udir = new mosDirectory($this->user_dir);
     $udir->deleteAll();
     $adir = new mosDirectory($this->admin_dir);
     $adir->deleteAll();
     $sql = "DELETE FROM #__components WHERE `option`='{$com_name}'";
     $database->setQuery($sql);
     if (!$database->query()) {
         $this->errors->addErrorDetails(sprintf(T_('Uninstaller error with %s: %s %s not fully deleted from database'), $this->xmlfile, 'component', $com_name), _MOS_ERROR_SEVERE);
         return;
     }
     $this->errors->addErrorDetails($this->getDescription('component'), _MOS_ERROR_INFORM);
 }
开发者ID:jwest00724,项目名称:mambo,代码行数:31,代码来源:installer.class.php


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