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


PHP com_install函数代码示例

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


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

示例1: postflight

 /**
  * Called after any type of action
  *
  * @param   string  $route  Which action is happening (install|uninstall|discover_install)
  * @param   JAdapterInstance  $adapter  The object responsible for running this script
  *
  * @return  boolean  True on success
  */
 public function postflight($route, JAdapterInstance $adapter)
 {
     if ($route == 'install' or $route == 'update') {
         com_install();
     }
     if ($route == 'uninstall') {
         com_uninstall();
     }
 }
开发者ID:naka211,项目名称:kkvn,代码行数:17,代码来源:install.php

示例2: install

 /**
  * Called on installation
  *
  * @param   JAdapterInstance  $adapter  The object responsible for running this script
  *
  * @return  boolean  True on success
  */
 public function install($adapter)
 {
     $adminpath = JPATH_SITE . '/administrator/components/com_extplorer';
     com_install($adminpath);
     if (JVersion::isCompatible('3.0')) {
         rename($adminpath . '/extplorer.j30.php', $adminpath . '/extplorer.php');
     }
     return true;
 }
开发者ID:kostya1017,项目名称:our,代码行数:16,代码来源:install.extplorer.php

示例3: postflight

 public function postflight($action, $installer)
 {
     switch ($action) {
         case "install":
         case "update":
             include_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_simplelists' . DS . 'install.simplelists.php';
             if (function_exists('com_install')) {
                 com_install();
             }
             break;
     }
 }
开发者ID:renekreijveld,项目名称:SimpleLists,代码行数:12,代码来源:script.simplelists.php

示例4: postflight

 public function postflight($action, $installer)
 {
     switch ($action) {
         case 'install':
         case 'update':
             include_once JPATH_ADMINISTRATOR . '/components/com_simplelists/install.simplelists.php';
             if (function_exists('com_install')) {
                 // @todo: Removed in Joomla! 3.0
                 com_install();
             }
             // Remove obsolete files
             $files = array(JPATH_ADMINISTRATOR . '/components/com_simplelists/views/home/tmpl/default.php', JPATH_ADMINISTRATOR . '/components/com_simplelists/views/home/tmpl/default_ads.php', JPATH_ADMINISTRATOR . '/components/com_simplelists/views/home/tmpl/default_cpanel.php', JPATH_ADMINISTRATOR . '/components/com_simplelists/views/home/tmpl/feeds.php');
             foreach ($files as $file) {
                 if (file_exists($file)) {
                     @unlink($file);
                 }
             }
             break;
     }
 }
开发者ID:renekreijveld,项目名称:SimpleLists,代码行数:20,代码来源:script.simplelists.php

示例5: install


//.........这里部分代码省略.........
     $row->published = 1;
     $row->editable = 1;
     $row->icon = $icon->data();
     $row->layout = $layout->data();
     $row->iscore = 0;
     if (!$row->store()) {
         // Install failed, roll back changes
         $this->parent->abort('Plugin Install: ' . $db->stderr(true));
         return false;
     }
     // Process default extension installation (files are assumed to have been copied!)
     $element =& $this->manifest->getElementByPath('extensions');
     if (is_a($element, 'JSimpleXMLElement') && count($element->children())) {
         $extensions =& $element->children();
         foreach ($extensions as $extension) {
             if ($extension->attributes('name')) {
                 $query = 'INSERT INTO `#__jce_extensions` ' . ' VALUES ("", ' . (int) $row->id . ', ' . $db->Quote($extension->attributes('title')) . ', ' . $db->Quote($extension->attributes('name')) . ', ' . $db->Quote($extension->attributes('folder')) . ', 1 )';
                 $db->setQuery($query);
                 if (!$db->query()) {
                     // Install failed, raise error
                     JError::raiseWarning(100, 'Plugin Install: Unable to install default extension ' . $extension->attributes('title'));
                     return false;
                 }
             }
         }
     }
     // Since we have created a plugin item, we add it to the installation step stack
     // so that if we have to rollback the changes we can undo it.
     $this->parent->pushStep(array('type' => 'plugin', 'id' => $row->id));
     /**
      * ---------------------------------------------------------------------------------------------
      * Install plugin into Default Group
      * ---------------------------------------------------------------------------------------------
      */
     // Add to Default Group
     if ($row->type == 'plugin') {
         JTable::addIncludePath(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_jce' . DS . 'groups');
         $group =& JTable::getInstance('groups', 'JCETable');
         $query = 'SELECT id' . ' FROM #__jce_groups' . ' WHERE name = ' . $db->Quote('Default');
         $db->setQuery($query);
         $gid = $db->loadResult();
         $group->load($gid);
         // Add to plugins list
         $plugins = explode(',', $group->plugins);
         if (!in_array($row->id, explode(',', $group->plugins))) {
             $group->plugins .= ',' . $row->id;
         }
         // Add to last row if plugin has a layout icon
         if ($row->layout) {
             if (!in_array($row->id, preg_split('/[;,]+/', $group->rows))) {
                 $group->rows .= ',' . $row->id;
             }
         }
         if (!$group->store()) {
             JError::raiseWarning(100, 'Plugin Install: Unable to add plugin to Default group');
         }
     }
     /**
      * ---------------------------------------------------------------------------------------------
      * Finalization and Cleanup Section
      * ---------------------------------------------------------------------------------------------
      */
     // Lastly, we will copy the manifest file to its appropriate place.
     if (!$this->parent->copyManifest(-1)) {
         // Install failed, rollback changes
         $this->parent->abort('Plugin Install: ' . JText::_('Could not copy setup file'));
         return false;
     }
     /*
      * If we have an install script, lets include it, execute the custom
      * install method, and append the return value from the custom install
      * method to the installation message.
      */
     if ($this->get('install.script')) {
         if (is_file($this->parent->getPath('extension_root') . DS . $this->get('install.script'))) {
             ob_start();
             ob_implicit_flush(false);
             require_once $this->parent->getPath('extension_root') . DS . $this->get('install.script');
             if (function_exists('jce_install')) {
                 if (jce_install() === false) {
                     $this->parent->abort(JText::_('Plugin') . ' ' . JText::_('Install') . ': ' . JText::_('Custom install routine failure'));
                     return false;
                 }
             } else {
                 if (function_exists('com_install')) {
                     if (com_install() === false) {
                         $this->parent->abort(JText::_('Plugin') . ' ' . JText::_('Install') . ': ' . JText::_('Custom install routine failure'));
                         return false;
                     }
                 }
             }
             $msg = ob_get_contents();
             ob_end_clean();
             if ($msg != '') {
                 $this->parent->set('extension.message', $msg);
             }
         }
     }
     return true;
 }
开发者ID:rlee1962,项目名称:diylegalcenter,代码行数:101,代码来源:plugin.php

示例6: install


//.........这里部分代码省略.........
         return false;
     }
     $this->parseFiles('images');
     $this->parseFiles('administration/files', '', '', 1);
     $this->parseFiles('administration/images', '', '', 1);
     // Are there any SQL queries??
     $query_element =& $xml->getElementsByPath('install/queries', 1);
     if (!is_null($query_element)) {
         $queries = $query_element->childNodes;
         foreach ($queries as $query) {
             $database->setQuery($query->getText());
             if (!$database->query()) {
                 $this->setError(1, "SQL Error " . $database->stderr(true));
                 return false;
             }
         }
     }
     // Is there an installfile
     $installfile_elemet =& $xml->getElementsByPath('installfile', 1);
     if (!is_null($installfile_elemet)) {
         // check if parse files has already copied the install.component.php file (error in 3rd party xml's!)
         if (!file_exists($this->componentAdminDir() . $installfile_elemet->getText())) {
             if (!$this->copyFiles($this->installDir(), $this->componentAdminDir(), array($installfile_elemet->getText()))) {
                 $this->setError(1, 'Could not copy PHP install file.');
                 return false;
             }
         }
         $this->hasInstallfile(true);
         $this->installFile($installfile_elemet->getText());
     }
     // Is there an uninstallfile
     $uninstallfile_elemet =& $xml->getElementsByPath('uninstallfile', 1);
     if (!is_null($uninstallfile_elemet)) {
         if (!file_exists($this->componentAdminDir() . $uninstallfile_elemet->getText())) {
             if (!$this->copyFiles($this->installDir(), $this->componentAdminDir(), array($uninstallfile_elemet->getText()))) {
                 $this->setError(1, 'Could not copy PHP uninstall file');
                 return false;
             }
         }
     }
     // Is the menues ?
     $adminmenu_element =& $xml->getElementsByPath('administration/menu', 1);
     if (!is_null($adminmenu_element)) {
         $adminsubmenu_element =& $xml->getElementsByPath('administration/submenu', 1);
         $com_name = strtolower("com_" . str_replace(" ", "", $this->elementName()));
         $com_admin_menuname = $adminmenu_element->getText();
         if (!is_null($adminsubmenu_element)) {
             $com_admin_menu_id = $this->createParentMenu($com_admin_menuname, $com_name);
             if ($com_admin_menu_id === false) {
                 return false;
             }
             $com_admin_submenus = $adminsubmenu_element->childNodes;
             $submenuordering = 0;
             foreach ($com_admin_submenus as $admin_submenu) {
                 $com = new mosComponent($database);
                 $com->name = $admin_submenu->getText();
                 $com->link = '';
                 $com->menuid = 0;
                 $com->parent = $com_admin_menu_id;
                 $com->iscore = 0;
                 if ($admin_submenu->getAttribute("act")) {
                     $com->admin_menu_link = "option={$com_name}&act=" . $admin_submenu->getAttribute("act");
                 } else {
                     if ($admin_submenu->getAttribute("task")) {
                         $com->admin_menu_link = "option={$com_name}&task=" . $admin_submenu->getAttribute("task");
                     } else {
                         if ($admin_submenu->getAttribute("link")) {
                             $com->admin_menu_link = $admin_submenu->getAttribute("link");
                         } else {
                             $com->admin_menu_link = "option={$com_name}";
                         }
                     }
                 }
                 $com->admin_menu_alt = $admin_submenu->getText();
                 $com->option = $com_name;
                 $com->ordering = $submenuordering++;
                 $com->admin_menu_img = "js/ThemeOffice/component.png";
                 if (!$com->store()) {
                     $this->setError(1, $database->stderr(true));
                     return false;
                 }
             }
         } else {
             $this->createParentMenu($com_admin_menuname, $com_name);
         }
     }
     $desc = '';
     if ($e =& $xml->getElementsByPath('description', 1)) {
         $desc = $this->elementName() . '<p>' . $e->getText() . '</p>';
     }
     $this->setError(0, $desc);
     if ($this->hasInstallfile()) {
         require_once $this->componentAdminDir() . "/" . $this->installFile();
         $ret = com_install();
         if ($ret != '') {
             $this->setError(0, $desc . $ret);
         }
     }
     return $this->copySetupFile();
 }
开发者ID:cwcw,项目名称:cms,代码行数:101,代码来源:component.class.php

示例7: upgrade

 /**
  * Upgrade database schema
  */
 function upgrade()
 {
     require_once JPATH_COMPONENT . '/install.osmembership.php';
     com_install();
 }
开发者ID:vstorm83,项目名称:propertease,代码行数:8,代码来源:controller.php

示例8: install


//.........这里部分代码省略.........
                 // Install failed, rollback changes
                 $this->parent->abort(JText('WF_INSTALLER_PLUGIN_INSTALL') . ' : ' . WFText::_('WF_INSTALLER_PHP_INSTALL_FILE_ERROR'));
                 return false;
             }
         }
     }
     $uninstall = $this->get('uninstall.script');
     if ($uninstall) {
         // Make sure it hasn't already been copied (this would be an error in the xml install file)
         if (!file_exists($this->parent->getPath('extension_root') . DS . $uninstall)) {
             $path['src'] = $this->parent->getPath('source') . DS . $uninstall;
             $path['dest'] = $this->parent->getPath('extension_root') . DS . $uninstall;
             if (!$this->parent->copyFiles(array($path))) {
                 // Install failed, rollback changes
                 $this->parent->abort(JText('WF_INSTALLER_PLUGIN_INSTALL') . ' : ' . WFText::_('WF_INSTALLER_PHP_UNINSTALL_FILE_ERROR'));
                 return false;
             }
         }
     }
     // Install plugin install default profile layout if a row is set
     if (is_numeric($this->get('row')) && intval($this->get('row'))) {
         // Add to Default Group
         $profile = JTable::getInstance('profiles', 'WFTable');
         $query = 'SELECT id' . ' FROM #__wf_profiles' . ' WHERE name = ' . $db->Quote('Default');
         $db->setQuery($query);
         $id = $db->loadResult();
         $profile->load($id);
         // Add to plugins list
         $plugins = explode(',', $profile->plugins);
         if (!in_array($this->get('plugin'), $plugins)) {
             $plugins[] = $this->get('plugin');
         }
         $profile->plugins = implode(',', $plugins);
         if ($this->get('icon')) {
             if (!in_array($this->get('plugin'), preg_split('/[;,]+/', $profile->rows))) {
                 // get rows as array
                 $rows = explode(';', $profile->rows);
                 // get key (row number)
                 $key = intval($this->get('row')) - 1;
                 // get row contents as array
                 $row = explode(',', $rows[$key]);
                 // add plugin name to end of row
                 $row[] = $this->get('plugin');
                 // add row data back to rows array
                 $rows[$key] = implode(',', $row);
                 $profile->rows = implode(';', $rows);
             }
         }
         if (!$profile->store()) {
             JError::raiseWarning(100, 'WF_INSTALLER_PLUGIN_PROFILE_ERROR');
         }
     }
     /**
      * ---------------------------------------------------------------------------------------------
      * Finalization and Cleanup Section
      * ---------------------------------------------------------------------------------------------
      */
     // Lastly, we will copy the manifest file to its appropriate place.
     if (!$this->parent->copyManifest(-1)) {
         // Install failed, rollback changes
         $this->parent->abort(WFText::_('WF_INSTALLER_PLUGIN_INSTALL') . ' : ' . WFText::_('WF_INSTALLER_SETUP_COPY_ERROR'));
         return false;
     }
     /*
      * If we have an install script, lets include it, execute the custom
      * install method, and append the return value from the custom install
      * method to the installation message.
      */
     $install = $this->get('install.script');
     if ($install) {
         if (file_exists($this->parent->getPath('extension_root') . DS . $install)) {
             ob_start();
             ob_implicit_flush(false);
             require_once $this->parent->getPath('extension_root') . DS . $install;
             if (function_exists('jce_install')) {
                 if (jce_install() === false) {
                     $this->parent->abort(WFText::_('WF_INSTALLER_PLUGIN_INSTALL') . ' : ' . WFText::_('WF_INSTALLER_CUSTOM_INSTALL_ERROR'));
                     return false;
                 }
             } else {
                 if (function_exists('com_install')) {
                     if (com_install() === false) {
                         $this->parent->abort(WFText::_('WF_INSTALLER_PLUGIN_INSTALL') . ' : ' . WFText::_('WF_INSTALLER_CUSTOM_INSTALL_ERROR'));
                         return false;
                     }
                 }
             }
             $msg = ob_get_contents();
             ob_end_clean();
             if ($msg != '') {
                 $this->parent->set('extension.message', $msg);
             }
         }
     } else {
         $this->parent->set('extension.message', '');
     }
     // post-install
     $this->addIndexfiles();
     return true;
 }
开发者ID:srbsnkr,项目名称:sellingonlinemadesimple,代码行数:101,代码来源:plugin.php

示例9: install


//.........这里部分代码省略.........
         }
     }
     // Set overwrite flag if not set by Manifest
     $this->parent->setOverwrite(true);
     /*
      * If we created the extension directory and will want to remove it if we
      * have to roll back the installation, lets add it to the installation
      * step stack
      */
     if ($created) {
         $this->parent->pushStep(array('type' => 'folder', 'path' => $this->parent->getPath('extension_root')));
     }
     // Copy all necessary files
     if (!$this->parent->parseFiles($this->get('files'), -1)) {
         // Install failed, roll back changes
         $this->parent->abort();
         return false;
     }
     // install languages
     $this->parent->parseLanguages($this->get('languages'), 0);
     // install media
     $this->parent->parseMedia($this->get('media'), 0);
     // Load the language file
     $language = JFactory::getLanguage();
     $language->load('com_jce_' . trim($plugin), JPATH_SITE);
     $install = (string) $this->get('install.script');
     if ($install) {
         // Make sure it hasn't already been copied (this would be an error in the xml install file)
         if (!file_exists($this->parent->getPath('extension_root') . '/' . $install)) {
             $path['src'] = $this->parent->getPath('source') . '/' . $install;
             $path['dest'] = $this->parent->getPath('extension_root') . '/' . $install;
             if (!$this->parent->copyFiles(array($path))) {
                 // Install failed, rollback changes
                 $this->parent->abort(WFText::_('WF_INSTALLER_PLUGIN_INSTALL') . ' : ' . WFText::_('WF_INSTALLER_PHP_INSTALL_FILE_ERROR'));
                 return false;
             }
         }
     }
     $uninstall = $this->get('uninstall.script');
     if ($uninstall) {
         // Make sure it hasn't already been copied (this would be an error in the xml install file)
         if (!file_exists($this->parent->getPath('extension_root') . '/' . $uninstall)) {
             $path['src'] = $this->parent->getPath('source') . '/' . $uninstall;
             $path['dest'] = $this->parent->getPath('extension_root') . '/' . $uninstall;
             if (!$this->parent->copyFiles(array($path))) {
                 // Install failed, rollback changes
                 $this->parent->abort(JText('WF_INSTALLER_PLUGIN_INSTALL') . ' : ' . WFText::_('WF_INSTALLER_PHP_UNINSTALL_FILE_ERROR'));
                 return false;
             }
         }
     }
     /**
      * ---------------------------------------------------------------------------------------------
      * Finalization and Cleanup Section
      * ---------------------------------------------------------------------------------------------
      */
     // Lastly, we will copy the manifest file to its appropriate place.
     if (!$this->parent->copyManifest(-1)) {
         // Install failed, rollback changes
         $this->parent->abort(WFText::_('WF_INSTALLER_PLUGIN_INSTALL') . ' : ' . WFText::_('WF_INSTALLER_SETUP_COPY_ERROR'));
         return false;
     }
     if ($install) {
         if (file_exists($this->parent->getPath('extension_root') . '/' . $install)) {
             ob_start();
             ob_implicit_flush(false);
             require_once $this->parent->getPath('extension_root') . '/' . $install;
             if (function_exists('jce_install')) {
                 if (jce_install() === false) {
                     $this->parent->abort(WFText::_('WF_INSTALLER_PLUGIN_INSTALL') . ' : ' . WFText::_('WF_INSTALLER_CUSTOM_INSTALL_ERROR'));
                     return false;
                 }
             } else {
                 if (function_exists('com_install')) {
                     if (com_install() === false) {
                         $this->parent->abort(WFText::_('WF_INSTALLER_PLUGIN_INSTALL') . ' : ' . WFText::_('WF_INSTALLER_CUSTOM_INSTALL_ERROR'));
                         return false;
                     }
                 }
             }
             $msg = ob_get_contents();
             ob_end_clean();
             if ($msg != '') {
                 $this->parent->set('extension.message', $msg);
             }
         }
     } else {
         $this->parent->set('extension.message', '');
     }
     $plugin = new StdClass();
     $plugin->name = $this->get('plugin');
     $plugin->icon = $this->parent->get('icon');
     $plugin->row = (int) $this->get('row');
     $plugin->path = $this->parent->getPath('extension_root');
     $plugin->type = $type;
     wfimport('admin.models.plugins');
     $model = new WFModelPlugins();
     $model->postInstall('install', $plugin, $this);
     return true;
 }
开发者ID:acculitx,项目名称:fleetmatrixsite,代码行数:101,代码来源:plugin.php

示例10: install

 public function install($parent)
 {
     return com_install();
 }
开发者ID:rogatnev-nikita,项目名称:cloudinterpreter,代码行数:4,代码来源:install.comprofiler.php

示例11: discover_install


//.........这里部分代码省略.........
     ob_end_clean();
     // Normally we would copy files and create directories, lets skip to the optional files
     // Note: need to dereference things!
     // Parse optional tags
     //$this->parent->parseMedia($this->manifest->media);
     // We don't do language because 1.6 suggests moving to extension based languages
     //$this->parent->parseLanguages($this->manifest->languages);
     //$this->parent->parseLanguages($this->manifest->administration->languages, 1);
     /**
      * ---------------------------------------------------------------------------------------------
      * Database Processing Section
      * ---------------------------------------------------------------------------------------------
      */
     /*
      * Let's run the install queries for the component
      *	If Joomla 1.5 compatible, with discreet sql files - execute appropriate
      *	file for utf-8 support or non-utf-8 support
      */
     // Try for Joomla 1.5 type queries
     // second argument is the utf compatible version attribute
     if (isset($this->manifest->install->sql)) {
         $utfresult = $this->parent->parseSQLFiles($this->manifest->install->sql);
         if ($utfresult === false) {
             // Install failed, rollback changes
             $this->parent->abort(JText::sprintf('JLIB_INSTALLER_ABORT_COMP_INSTALL_SQL_ERROR', $db->stderr(true)));
             return false;
         }
     }
     // Time to build the admin menus
     if (!$this->_buildAdminMenus($this->parent->extension->extension_id)) {
         JError::raiseWarning(100, JText::_('JLIB_INSTALLER_ABORT_COMP_BUILDADMINMENUS_FAILED'));
         //$this->parent->abort(JText::sprintf('JLIB_INSTALLER_ABORT_COMP_INSTALL_ROLLBACK', $db->stderr(true)));
         //return false;
     }
     /**
      * ---------------------------------------------------------------------------------------------
      * Custom Installation Script Section
      * ---------------------------------------------------------------------------------------------
      */
     /*
      * If we have an install script, lets include it, execute the custom
      * install method, and append the return value from the custom install
      * method to the installation message.
      */
     // start legacy support
     if ($this->get('install_script')) {
         if (is_file($this->parent->getPath('extension_administrator') . '/' . $this->get('install_script'))) {
             ob_start();
             ob_implicit_flush(false);
             require_once $this->parent->getPath('extension_administrator') . '/' . $this->get('install_script');
             if (function_exists('com_install')) {
                 if (com_install() === false) {
                     $this->parent->abort(JText::_('JLIB_INSTALLER_ABORT_COMP_INSTALL_CUSTOM_INSTALL_FAILURE'));
                     return false;
                 }
             }
             // Append messages
             $msg .= ob_get_contents();
             ob_end_clean();
         }
     }
     // End legacy support
     // Start Joomla! 1.6
     ob_start();
     ob_implicit_flush(false);
     if ($this->parent->manifestClass && method_exists($this->parent->manifestClass, 'install')) {
         if ($this->parent->manifestClass->install($this) === false) {
             // Install failed, rollback changes
             $this->parent->abort(JText::_('JLIB_INSTALLER_ABORT_COMP_INSTALL_CUSTOM_INSTALL_FAILURE'));
             return false;
         }
     }
     $msg .= ob_get_contents();
     // append messages
     ob_end_clean();
     /**
      * ---------------------------------------------------------------------------------------------
      * Finalization and Cleanup Section
      * ---------------------------------------------------------------------------------------------
      */
     // Clobber any possible pending updates
     $update = JTable::getInstance('update');
     $uid = $update->find(array('element' => $this->get('element'), 'type' => 'component', 'client_id' => '', 'folder' => ''));
     if ($uid) {
         $update->delete($uid);
     }
     // And now we run the postflight
     ob_start();
     ob_implicit_flush(false);
     if ($this->parent->manifestClass && method_exists($this->parent->manifestClass, 'postflight')) {
         $this->parent->manifestClass->postflight('discover_install', $this);
     }
     $msg .= ob_get_contents();
     // append messages
     ob_end_clean();
     if ($msg != '') {
         $this->parent->set('extension_message', $msg);
     }
     return $this->parent->extension->extension_id;
 }
开发者ID:rdeutz,项目名称:square-one-cms,代码行数:101,代码来源:component.php

示例12: install_component

 function install_component()
 {
     $com_name = 'com_' . str_replace(' ', '', strtolower($this->name));
     $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);
     $database =& mamboDatabase::getInstance();
     $sql = "SELECT COUNT(id) FROM #__components WHERE `option`='{$com_name}'";
     $database->setQuery($sql);
     if ($count = $database->loadResult()) {
         $this->errors->addErrorDetails(sprintf(T_('Installer error with %s: %s %s already installed'), $this->xmlfile, 'component', $com_name), _MOS_ERROR_WARN);
         return;
     }
     if (!$this->createDirectories($com_name)) {
         return;
     }
     $fmanager =& mosFileManager::getInstance();
     $here = mosPathName(dirname($this->xmlfile));
     $fmanager->forceCopy($this->xmlfile, $this->admin_dir . basename($this->xmlfile));
     foreach ($this->files as $ufile) {
         $fmanager->forceCopy($here . $ufile, $this->user_dir . $ufile);
     }
     foreach ($this->images as $uimage) {
         $fmanager->forceCopy($here . $uimage, $this->user_dir . $uimage);
     }
     foreach ($this->admin_files as $afile) {
         $fmanager->forceCopy($here . $afile, $this->admin_dir . $afile);
     }
     foreach ($this->admin_images as $aimage) {
         $fmanager->forceCopy($here . $aimage, $this->admin_dir . $aimage);
     }
     if ($this->installfile) {
         $fmanager->forceCopy($here . $this->installfile, $this->admin_dir . $this->installfile);
     }
     if ($this->uninstallfile) {
         $fmanager->forceCopy($here . $this->uninstallfile, $this->admin_dir . $this->uninstallfile);
     }
     foreach ($this->queries as $query) {
         $database->setQuery($query[0]);
         if (!$database->query()) {
             $this->errors->addErrorDetails(sprintf(T_('Installer error with %s: %s %s SQL error %s'), $this->xmlfile, 'component', $com_name, $database->stderr(true)), _MOS_ERROR_FATAL);
         }
     }
     if ($this->mainmenu) {
         $topid = $this->createComponentMenu(array($this->mainmenu), $com_name);
         foreach ($this->submenus as $submenu) {
             $this->createComponentMenu($submenu, $com_name, $topid);
         }
     }
     if ($this->installfile) {
         $ifile = mosPathName($this->admin_dir) . $this->installfile;
         if (is_file($ifile)) {
             global $mosConfig_absolute_path, $mosConfig_live_site, $acl, $database;
             require_once $ifile;
             $_ret = com_install();
             if ($_ret) {
                 // convert the first character of the returned string to be represented by an integer
                 $_type = intval(bin2hex($_ret[0])) - intval(bin2hex(_MOS_ERROR_INFORM));
                 switch ($_type) {
                     case _MOS_ERROR_INFORM:
                     case _MOS_ERROR_WARN:
                     case _MOS_ERROR_SEVERE:
                     case _MOS_ERROR_FATAL:
                         //strip off the first character
                         $_ret = substr($_ret, 1);
                         break;
                     default:
                         $_type = _MOS_ERROR_INFORM;
                         break;
                 }
                 if ($_type < _MOS_ERROR_FATAL) {
                     $this->errors->addErrorDetails(sprintf(T_('%s'), $_ret), $_type);
                 } else {
                     $this->errors->addErrorDetails(sprintf(T_('The com_install() function for component "%s" aborted with: %s'), $com_name, $_ret), $_type);
                 }
             }
         }
     }
     $this->errors->addErrorDetails($this->getDescription('component'), _MOS_ERROR_INFORM);
 }
开发者ID:jwest00724,项目名称:mambo,代码行数:79,代码来源:installer.class.php

示例13: foreach

        static $installable;
        if (isset($installable)) {
            return $installable;
        }
        $db = JFactory::getDBO();
        foreach (array(function_exists('mysqli_connect') => "Your server don't have MySQLi.", version_compare(phpversion(), '5.2', '>=') => "Your PHP version is older than 5.2.", version_compare(JVERSION, '1.5.10', '>=') => "Your Joomla version is older than 1.5.10.", version_compare($db->getVersion(), '5.0.41', '>=') => "Your MySQL version is older than 5.0.41.") as $succeed => $fail) {
            if (!$succeed) {
                JError::raiseWarning(0, $fail);
                $installable = false;
                return false;
            }
        }
        return $installable = true;
    }
}
if (!com_install()) {
    return;
}
@set_time_limit(30);
//Install Nooku first, before anything else
$nooku = $this->parent->getPath('source') . '/nooku';
if (JFolder::exists($nooku)) {
    $installer = new JInstaller();
    $installer->install($nooku);
}
$this->name = strtolower($this->name);
$extname = 'com_' . $this->name;
// load the component language file
$language =& JFactory::getLanguage();
$language->load($extname);
$source = $this->parent->getPath('source');
开发者ID:rpijpers,项目名称:Create,代码行数:31,代码来源:install.create.php

示例14: install


//.........这里部分代码省略.........
             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} = '';
             $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 add ' . $pname . 'plugin to  ' . $classname . ' toolbar');
             }
             //layout stuff
             $query = 'SELECT id' . ' FROM #__jcktoolbars' . ' WHERE name = "' . $toolbarname . '"';
             $db->setQuery($query);
             $toolbarid = $db->loadResult();
             if (!$toolbarid) {
                 continue;
             }
             $rowDetail = JCKHelper::getNextLayoutRow($toolbarid);
             $values[] = '(' . $toolbarid . ',' . $row->id . ',' . $rowDetail->rowid . ',' . $rowDetail->rowordering . ',1)';
         }
         //insert into layout table
         if (!empty($values)) {
             //Now delete dependencies
             $query = 'DELETE FROM #__jcktoolbarplugins' . ' WHERE pluginid =' . $row->id;
             $db->setQuery($query);
             if (!$db->query()) {
                 JError::raiseWarning(100, $db->getErrorMsg());
             }
             $query = 'INSERT INTO #__jcktoolbarplugins(toolbarid,pluginid,row,ordering,state) VALUES ' . implode(',', $values);
             $db->setQuery($query);
             if (!$db->query()) {
                 JError::raiseWarning(100, $db->getErrorMsg());
             }
         }
     }
     /**
      * ---------------------------------------------------------------------------------------------
      * Custom Installation Script Section
      * ---------------------------------------------------------------------------------------------
      */
     /*
      * If we have an install script, lets include it, execute the custom
      * install method, and append the return value from the custom install
      * method to the installation message.
      */
     if ($this->get('install.script')) {
         if (is_file($this->parent->getPath('extension_root') . DS . $this->get('install.script'))) {
             ob_start();
             ob_implicit_flush(false);
             require_once $this->parent->getPath('extension_root') . DS . $this->get('install.script');
             if (function_exists('com_install')) {
                 if (com_install() === false) {
                     $this->parent->abort(JText::_('Plugin') . ' ' . JText::_('Install') . ': ' . JText::_('Custom install routine failure'));
                     return false;
                 }
             }
             $msg = ob_get_contents();
             ob_end_clean();
             if ($msg != '') {
                 $this->parent->set('extension.message', $msg);
             }
         }
     }
     /**
      * ---------------------------------------------------------------------------------------------
      * Finalization and Cleanup Section
      * ---------------------------------------------------------------------------------------------
      */
     // Lastly, we will copy the manifest file to its appropriate place.
     if (!$this->parent->copyManifest(-1)) {
         // Install failed, rollback changes
         $this->parent->abort('Plugin Install: ' . JText::_('Could not copy setup file'));
         return false;
     }
     //make a copy of the plugin
     $src = $this->parent->getPath('extension_root');
     $dest = JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_jckman' . DS . 'editor' . DS . 'plugins' . DS . $pname;
     if (!JFolder::copy($src, $dest, null, true)) {
         // Install failed, roll back changes
         $this->parent->abort();
         return false;
     }
     // And now we run the postflight
     ob_start();
     ob_implicit_flush(false);
     if ($this->parent->manifestClass && method_exists($this->parent->manifestClass, 'postflight')) {
         $this->parent->manifestClass->postflight('install', $this);
     }
     ob_end_clean();
     return true;
 }
开发者ID:shamusdougan,项目名称:MillparkNoticeBoards,代码行数:101,代码来源:plugin.php

示例15: install


//.........这里部分代码省略.........
     }
     /**
      * ---------------------------------------------------------------------------------------------
      * Database Processing Section
      * ---------------------------------------------------------------------------------------------
      */
     /*
      * Let's run the install 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-8 support
      */
     $result = $this->parent->parseQueries($this->manifest->getElementByPath('install/queries'));
     if ($result === false) {
         // Install failed, rollback changes
         $this->parent->abort(JText::_('SEF Extension') . ' ' . JText::_('Install') . ': ' . JText::_('SQL Error') . " " . $db->stderr(true));
         return 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('install/sql'));
         if ($utfresult === false) {
             // Install failed, rollback changes
             $this->parent->abort(JText::_('SEF Extension') . ' ' . JText::_('Install') . ': ' . JText::_('SQLERRORORFILE') . " " . $db->stderr(true));
             return false;
         }
     }
     // Insert extension into database
     $query = "SELECT `file` FROM `#__sefexts` WHERE `file` = " . $db->Quote(basename($this->parent->getPath('manifest')));
     $db->setQuery($query);
     $id = $db->loadResult();
     if (!$id) {
         $params = $this->_getDefaultParams();
         $filters = $this->_getDefaultFilters();
         $fields = array('`file`');
         $values = array($db->Quote(basename($this->parent->getPath('manifest'))));
         if (!empty($params)) {
             $fields[] = '`params`';
             $values[] = $db->Quote($params);
         }
         if (!empty($filters)) {
             $fields[] = '`filters`';
             $values[] = $db->Quote($filters);
         }
         $query = "INSERT INTO `#__sefexts` (" . implode(',', $fields) . ") VALUES (" . implode(',', $values) . ")";
         $db->setQuery($query);
         if (!$db->query()) {
             $this->parent->abort(JText::_('SEF Extension') . ' ' . JText::_('Install') . ': ' . JText::_('SQL Error') . " " . $db->stderr(true));
             return false;
         }
     }
     // Trash already created URLs for this extension
     $component = preg_replace('/.xml$/', '', basename($this->parent->getPath('manifest')));
     $query = "UPDATE `#__sefurls` SET `trashed` = '1' WHERE (`origurl` LIKE " . $db->Quote('%option=' . $component . '&%') . " OR `origurl` LIKE " . $db->Quote('%option=' . $component) . ")";
     $db->setQuery($query);
     if (!$db->query()) {
         $this->parent->abort(JText::_('SEF Extension') . ' ' . JText::_('Install') . ': ' . JText::_('SQL Error') . " " . $db->stderr(true));
         return false;
     }
     /**
      * ---------------------------------------------------------------------------------------------
      * Custom Installation Script Section
      * ---------------------------------------------------------------------------------------------
      */
     /*
      * If we have an install script, lets include it, execute the custom
      * install method, and append the return value from the custom install
      * method to the installation message.
      */
     if ($this->get('install.script')) {
         if (is_file($this->parent->getPath('extension_root') . DS . $this->get('install.script'))) {
             ob_start();
             ob_implicit_flush(false);
             require_once $this->parent->getPath('extension_root') . DS . $this->get('install.script');
             if (function_exists('com_install')) {
                 if (com_install() === false) {
                     $this->parent->abort(JText::_('SEF Extension') . ' ' . JText::_('Install') . ': ' . JText::_('Custom install routine failure'));
                     return false;
                 }
             }
             $msg = ob_get_contents();
             ob_end_clean();
             if ($msg != '') {
                 $this->parent->set('extension.message', $msg);
             }
         }
     }
     /**
      * ---------------------------------------------------------------------------------------------
      * Finalization and Cleanup Section
      * ---------------------------------------------------------------------------------------------
      */
     // Lastly, we will copy the manifest file to its appropriate place.
     if (!$this->parent->copyManifest(-1)) {
         // Install failed, rollback changes
         $this->parent->abort(JText::_('SEF Extension') . ' ' . JText::_('Install') . ': ' . JText::_('Could not copy setup file'));
         return false;
     }
     return true;
 }
开发者ID:andreassetiawanhartanto,项目名称:PDKKI,代码行数:101,代码来源:sef_ext.php


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