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


PHP JInstaller::getParent方法代码示例

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


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

示例1: postflight

 /**
  * method to run after an install/update/uninstall method
  *
  * @param   string      $type    Installation type (install, update, discover_install)
  * @param   JInstaller  $parent  Parent object
  *
  * @return void
  */
 function postflight($type, $parent)
 {
     $src = $parent->getParent()->getPath('source');
     // Install the babioon Library
     $source = $src . '/library/babioon';
     $installer = new JInstaller();
     $result = $installer->install($source);
 }
开发者ID:rdeutz,项目名称:babioon-spll,代码行数:16,代码来源:script.babioon.php

示例2: postflight

 /**
  * Runs after install, update or discover_update. In other words, it executes after Joomla! has finished installing
  * or updating your component. This is the last chance you've got to perform any additional installations, clean-up,
  * database updates and similar housekeeping functions.
  *
  * @param   string     $type   install, update or discover_update
  * @param   JInstaller $parent Parent object
  */
 function postflight($type, $parent)
 {
     $this->isPaid = is_dir($parent->getParent()->getPath('source') . '/plugins/system/srp');
     parent::postflight($type, $parent);
     // Make sure the two plugins folders exist in Core release and are empty
     if (!$this->isPaid) {
         if (!JFolder::exists(JPATH_ADMINISTRATOR . '/components/com_akeeba/plugins')) {
             JFolder::create(JPATH_ADMINISTRATOR . '/components/com_akeeba/plugins');
         }
         if (!JFolder::exists(JPATH_ADMINISTRATOR . '/components/com_akeeba/akeeba/plugins')) {
             JFolder::create(JPATH_ADMINISTRATOR . '/components/com_akeeba/akeeba/plugins');
         }
     }
 }
开发者ID:01J,项目名称:topm,代码行数:22,代码来源:script.akeeba.php

示例3: _copyCliFiles

 /**
  * Copies the CLI scripts into Joomla!'s cli directory
  *
  * @param JInstaller $parent
  */
 private function _copyCliFiles($parent)
 {
     $src = $parent->getParent()->getPath('source');
     if (empty($this->eventgalleryCliScripts)) {
         return;
     }
     foreach ($this->eventgalleryCliScripts as $script) {
         if (JFile::exists(JPATH_ROOT . '/cli/' . $script)) {
             JFile::delete(JPATH_ROOT . '/cli/' . $script);
         }
         if (JFile::exists($src . '/cli/' . $script)) {
             JFile::move($src . '/cli/' . $script, JPATH_ROOT . '/cli/' . $script);
         }
     }
 }
开发者ID:sansandeep143,项目名称:av,代码行数:20,代码来源:script.php

示例4: getManifest

 /**
  * Shit happens. Patched function to bypass bug in package uninstaller
  *
  * @param   JInstaller  $parent  Parent object
  *
  * @return  SimpleXMLElement
  */
 protected function getManifest($parent)
 {
     $element = strtolower(str_replace('InstallerScript', '', __CLASS__));
     $elementParts = explode('_', $element);
     if (count($elementParts) == 2) {
         $extType = $elementParts[0];
         $extName = $elementParts[1];
         if ($extType == 'pkg') {
             $rootPath = $parent->getParent()->getPath('extension_root');
             $manifestPath = dirname($rootPath);
             $manifestFile = $manifestPath . '/' . $element . '.xml';
             if (file_exists($manifestFile)) {
                 return JFactory::getXML($manifestFile);
             }
         }
     }
     return $parent->get('manifest');
 }
开发者ID:prox91,项目名称:joomla-dev,代码行数:25,代码来源:install.php

示例5: fixBrokenSQLUpdates

 /**
  * Let's say that a user tries to install a component and it somehow fails
  * in a non-graceful manner, e.g. a server timeout error, going over the
  * quota etc. In this case the component's administrator directory is
  * created and not removed (because the installer died an untimely death).
  * When the user retries installing the component JInstaller sees that and
  * thinks it's an update. This causes it to neither run the installation SQL
  * file (because it's not supposed to run on extension update) nor the
  * update files (because there is no schema version defined). As a result
  * the files are installed, the database tables are not, the component is
  * broken and I have to explain to non-technical users how to edit their
  * database with phpMyAdmin.
  *
  * This method detects this stupid situation and attempts to execute the
  * installation file instead.
  *
  * @param   string      $extension  Extension name
  * @param   JInstaller  $parent     Installer object
  *
  * @return void
  */
 public static function fixBrokenSQLUpdates($extension, $parent)
 {
     // Get the extension ID
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     $query->select('extension_id')->from('#__extensions')->where($db->qn('element') . ' = ' . $db->q($extension));
     $db->setQuery($query);
     $eid = $db->loadResult();
     // Get the schema version
     $query = $db->getQuery(true);
     $query->select('version_id')->from('#__schemas')->where('extension_id = ' . $eid);
     $db->setQuery($query);
     $version = $db->loadResult();
     // If there is a schema version it's not a false update
     if ($version) {
         return;
     }
     // Execute the installation SQL file. Since I don't have access to
     // the manifest, I will improvise (again!)
     $dbDriver = strtolower($db->name);
     if ($dbDriver == 'mysqli') {
         $dbDriver = 'mysql';
     } elseif ($dbDriver == 'sqlsrv') {
         $dbDriver = 'sqlazure';
     }
     // Get the name of the sql file to process
     $sqlfile = $parent->getParent()->getPath('extension_root') . '/' . BABIOON_INSTALL_SUBDIR . $dbDriver . '/install.sql';
     if (file_exists($sqlfile)) {
         $buffer = file_get_contents($sqlfile);
         if ($buffer === false) {
             return;
         }
         $queries = JInstallerHelper::splitSql($buffer);
         if (count($queries) == 0) {
             // No queries to process
             return;
         }
         // Process each query in the $queries array (split out of sql file).
         foreach ($queries as $query) {
             $query = trim($query);
             if ($query != '' && $query[0] != '#') {
                 $db->setQuery($query);
                 if (!$db->execute()) {
                     JError::raiseWarning(1, JText::sprintf('JLIB_INSTALLER_ERROR_SQL_ERROR', $db->stderr(true)));
                     return false;
                 }
             }
         }
     }
     // Update #__schemas to the latest version. Again, since I don't have
     // access to the manifest I have to improvise...
     $path = $parent->getParent()->getPath('extension_root') . '/' . BABIOON_INSTALL_SUBDIR . 'updates/' . $dbDriver;
     $files = str_replace('.sql', '', JFolder::files($path, '\\.sql$'));
     if (count($files) > 0) {
         usort($files, 'version_compare');
         $version = array_pop($files);
     } else {
         $version = '0.0.1-2007-08-15';
     }
     $query = $db->getQuery(true);
     $query->insert($db->quoteName('#__schemas'));
     $query->columns(array($db->quoteName('extension_id'), $db->quoteName('version_id')));
     $query->values($eid . ', ' . $db->quote($version));
     $db->setQuery($query);
     $db->execute();
 }
开发者ID:rdeutz,项目名称:babioon-ad,代码行数:87,代码来源:helper.php

示例6: uninstallObsoleteSubextensions

 /**
  * Uninstalls obsolete subextensions (modules, plugins) bundled with the main extension
  *
  * @param   JInstaller $parent The parent object
  *
  * @return  stdClass The subextension uninstallation status
  */
 protected function uninstallObsoleteSubextensions($parent)
 {
     JLoader::import('joomla.installer.installer');
     $db = F0FPlatform::getInstance()->getDbo();
     $status = new stdClass();
     $status->modules = array();
     $status->plugins = array();
     $src = $parent->getParent()->getPath('source');
     // Modules uninstallation
     if (isset($this->uninstallation_queue['modules']) && count($this->uninstallation_queue['modules'])) {
         foreach ($this->uninstallation_queue['modules'] as $folder => $modules) {
             if (count($modules)) {
                 foreach ($modules as $module) {
                     // Find the module ID
                     $sql = $db->getQuery(true)->select($db->qn('extension_id'))->from($db->qn('#__extensions'))->where($db->qn('element') . ' = ' . $db->q('mod_' . $module))->where($db->qn('type') . ' = ' . $db->q('module'));
                     $db->setQuery($sql);
                     $id = $db->loadResult();
                     // Uninstall the module
                     if ($id) {
                         $installer = new JInstaller();
                         $result = $installer->uninstall('module', $id, 1);
                         $status->modules[] = array('name' => 'mod_' . $module, 'client' => $folder, 'result' => $result);
                     }
                 }
             }
         }
     }
     // Plugins uninstallation
     if (isset($this->uninstallation_queue['plugins']) && count($this->uninstallation_queue['plugins'])) {
         foreach ($this->uninstallation_queue['plugins'] as $folder => $plugins) {
             if (count($plugins)) {
                 foreach ($plugins as $plugin) {
                     $sql = $db->getQuery(true)->select($db->qn('extension_id'))->from($db->qn('#__extensions'))->where($db->qn('type') . ' = ' . $db->q('plugin'))->where($db->qn('element') . ' = ' . $db->q($plugin))->where($db->qn('folder') . ' = ' . $db->q($folder));
                     $db->setQuery($sql);
                     $id = $db->loadResult();
                     if ($id) {
                         $installer = new JInstaller();
                         $result = $installer->uninstall('plugin', $id, 1);
                         $status->plugins[] = array('name' => 'plg_' . $plugin, 'group' => $folder, 'result' => $result);
                     }
                 }
             }
         }
     }
     return $status;
 }
开发者ID:lyrasoft,项目名称:lyrasoft.github.io,代码行数:53,代码来源:installscript.php

示例7: _uninstallSubextensions

 /**
  * Uninstalls subextensions (modules, plugins) bundled with the main extension
  * 
  * @param JInstaller $parent 
  * @return JObject The subextension uninstallation status
  */
 private function _uninstallSubextensions($parent)
 {
     jimport('joomla.installer.installer');
     $db = JFactory::getDBO();
     $status = new JObject();
     $status->modules = array();
     $status->plugins = array();
     if (version_compare(JVERSION, '1.6.0', 'ge')) {
         $src = $parent->getParent()->getPath('source');
     } else {
         $src = $parent->getPath('source');
     }
     // Modules uninstallation
     if (count($this->installation_queue['modules'])) {
         foreach ($this->installation_queue['modules'] as $folder => $modules) {
             if (count($modules)) {
                 foreach ($modules as $module => $modulePreferences) {
                     // Find the module ID
                     $sql = $db->getQuery(true)->select($db->qn('extension_id'))->from($db->qn('#__extensions'))->where($db->qn('element') . ' = ' . $db->q('mod_' . $module))->where($db->qn('type') . ' = ' . $db->q('module'));
                     $db->setQuery($sql);
                     $id = $db->loadResult();
                     // Uninstall the module
                     if ($id) {
                         $installer = new JInstaller();
                         $result = $installer->uninstall('module', $id, 1);
                         $status->modules[] = array('name' => 'mod_' . $module, 'client' => $folder, 'result' => $result);
                     }
                 }
             }
         }
     }
     // Plugins uninstallation
     if (count($this->installation_queue['plugins'])) {
         foreach ($this->installation_queue['plugins'] as $folder => $plugins) {
             if (count($plugins)) {
                 foreach ($plugins as $plugin => $published) {
                     $sql = $db->getQuery(true)->select($db->qn('extension_id'))->from($db->qn('#__extensions'))->where($db->qn('type') . ' = ' . $db->q('plugin'))->where($db->qn('element') . ' = ' . $db->q($plugin))->where($db->qn('folder') . ' = ' . $db->q($folder));
                     $db->setQuery($sql);
                     $id = $db->loadResult();
                     if ($id) {
                         $installer = new JInstaller();
                         $result = $installer->uninstall('plugin', $id, 1);
                         $status->plugins[] = array('name' => 'plg_' . $plugin, 'group' => $folder, 'result' => $result);
                     }
                 }
             }
         }
     }
     return $status;
 }
开发者ID:networksoft,项目名称:seekerplus2.com,代码行数:56,代码来源:install.adsmanager.php

示例8: postflight

 /**
  * Runs after install, update or discover_update. In other words, it executes after Joomla! has finished installing
  * or updating your component. This is the last chance you've got to perform any additional installations, clean-up,
  * database updates and similar housekeeping functions.
  *
  * @param   string     $type   install, update or discover_update
  * @param   JInstaller $parent Parent object
  */
 function postflight($type, $parent)
 {
     $this->isPaid = is_dir($parent->getParent()->getPath('source') . '/backend/alice');
     // Let's install common tables
     $model = F0FModel::getTmpInstance('Stats', 'AkeebaModel');
     if (method_exists($model, 'checkAndFixCommonTables')) {
         $model->checkAndFixCommonTables();
     }
     parent::postflight($type, $parent);
     $this->uninstallObsoletePostinstallMessages();
     // Make sure the two plugins folders exist in Core release and are empty
     if (!$this->isPaid) {
         if (!JFolder::exists(JPATH_ADMINISTRATOR . '/components/com_akeeba/plugins')) {
             JFolder::create(JPATH_ADMINISTRATOR . '/components/com_akeeba/plugins');
         }
         if (!JFolder::exists(JPATH_ADMINISTRATOR . '/components/com_akeeba/akeeba/plugins')) {
             JFolder::create(JPATH_ADMINISTRATOR . '/components/com_akeeba/akeeba/plugins');
         }
     }
     // If this is a new installation tell it to NOT mark the backup profiles as configured.
     if (defined('AKEEBA_THIS_IS_INSTALLATION_FROM_SCRATCH')) {
         $db = F0FPlatform::getInstance()->getDbo();
         $query = $db->getQuery(true)->select($db->qn('params'))->from($db->qn('#__extensions'))->where($db->qn('type') . ' = ' . $db->q('component'))->where($db->qn('element') . ' = ' . $db->q('com_akeeba'));
         $jsonData = $db->setQuery($query)->loadResult();
         $reg = new JRegistry($jsonData);
         $reg->set('confwiz_upgrade', 1);
         $jsonData = $reg->toString('JSON');
         $query = $db->getQuery()->update($db->qn('#__extensions'))->set($db->qn('params') . ' = ' . $db->q($jsonData))->where($db->qn('type') . ' = ' . $db->q('component'))->where($db->qn('element') . ' = ' . $db->q('com_akeeba'));
         $db->setQuery($query)->execute();
     }
     // This is an update of an existing installation
     if (!defined('AKEEBA_THIS_IS_INSTALLATION_FROM_SCRATCH')) {
         // Migrate profiles if necessary
         $this->migrateProfiles();
     }
 }
开发者ID:densem-2013,项目名称:exikom,代码行数:44,代码来源:script.akeeba.php

示例9: postflight

 /**
  * Runs after install, update or discover_update. In other words, it executes after Joomla! has finished installing
  * or updating your component. This is the last chance you've got to perform any additional installations, clean-up,
  * database updates and similar housekeeping functions.
  *
  * @param   string     $type   install, update or discover_update
  * @param   JInstaller $parent Parent object
  */
 function postflight($type, $parent)
 {
     $this->isPaid = is_dir($parent->getParent()->getPath('source') . '/plugins/system/srp');
     if (!$this->isPaid) {
         unset($this->postInstallationMessages['srp']);
         unset($this->postInstallationMessages['backuponupdate']);
     }
     // Let's install common tables
     $model = F0FModel::getTmpInstance('Stats', 'AkeebaModel');
     if (method_exists($model, 'checkAndFixCommonTables')) {
         $model->checkAndFixCommonTables();
     }
     parent::postflight($type, $parent);
     if (version_compare(JVERSION, '3.2.0', 'ge')) {
         $this->uninstallObsoletePostinstallMessages();
     }
     // Make sure the two plugins folders exist in Core release and are empty
     if (!$this->isPaid) {
         if (!JFolder::exists(JPATH_ADMINISTRATOR . '/components/com_akeeba/plugins')) {
             JFolder::create(JPATH_ADMINISTRATOR . '/components/com_akeeba/plugins');
         }
         if (!JFolder::exists(JPATH_ADMINISTRATOR . '/components/com_akeeba/akeeba/plugins')) {
             JFolder::create(JPATH_ADMINISTRATOR . '/components/com_akeeba/akeeba/plugins');
         }
     }
 }
开发者ID:ppantilla,项目名称:bbninja,代码行数:34,代码来源:script.akeeba.php

示例10: postflight

 /**
  * Runs after install, update or discover_update
  *
  * @param string     $type install, update or discover_update
  * @param JInstaller $parent
  */
 function postflight($type, $parent)
 {
     /** @var AdmintoolsModelStats $model */
     $this->isPaid = is_dir($parent->getParent()->getPath('source') . '/plugins/system/admintools/admintools/pro.php');
     if (!$this->isPaid) {
         unset($this->postInstallationMessages['autojupdate']);
     }
     // Let's install common tables
     $model = F0FModel::getTmpInstance('Stats', 'AdmintoolsModel');
     if (method_exists($model, 'checkAndFixCommonTables')) {
         $model->checkAndFixCommonTables();
     }
     parent::postflight($type, $parent);
 }
开发者ID:neoandrew1000,项目名称:crao_journal,代码行数:20,代码来源:script.admintools.php

示例11: postflight

 /**
  * Runs after install, update or discover_update
  *
  * @param string     $type install, update or discover_update
  * @param JInstaller $parent
  */
 function postflight($type, $parent)
 {
     /** @var AdmintoolsModelStats $model */
     $this->isPaid = is_dir($parent->getParent()->getPath('source') . '/plugins/system/admintools/admintools/pro.php');
     if (!$this->isPaid) {
         unset($this->postInstallationMessages['autojupdate']);
     }
     // Let's install common tables
     $model = F0FModel::getTmpInstance('Stats', 'AdmintoolsModel');
     if (method_exists($model, 'checkAndFixCommonTables')) {
         $model->checkAndFixCommonTables();
     }
     // Set the configuration wizad flag on update (so as not to bother existing users)
     if ($type == 'update') {
         if (!class_exists('AdmintoolsModelStorage')) {
             include_once JPATH_ADMINISTRATOR . '/components/com_admintools/models/storage.php';
         }
         if (class_exists('AdmintoolsModelStorage')) {
             $params = JModelLegacy::getInstance('Storage', 'AdmintoolsModel');
             $params->load();
             $params->setValue('quickstart', 1, true);
         }
     }
     parent::postflight($type, $parent);
 }
开发者ID:enjoy2000,项目名称:smcd,代码行数:31,代码来源:script.admintools.php

示例12: _installSubextensions

 /**
  * Installs subextensions (modules, plugins) bundled with the main extension
  *
  * @param JInstaller $parent
  * @return JObject The subextension installation status
  */
 private function _installSubextensions($parent)
 {
     $src = $parent->getParent()->getPath('source');
     $db = JFactory::getDbo();
     $status = new JObject();
     $status->modules = array();
     $status->plugins = array();
     // Modules installation
     if (count($this->installation_queue['modules'])) {
         foreach ($this->installation_queue['modules'] as $folder => $modules) {
             if (count($modules)) {
                 foreach ($modules as $module => $modulePreferences) {
                     // Install the module
                     if (empty($folder)) {
                         $folder = 'site';
                     }
                     $path = "{$src}/modules/{$folder}/{$module}";
                     if (!is_dir($path)) {
                         $path = "{$src}/modules/{$folder}/mod_{$module}";
                     }
                     if (!is_dir($path)) {
                         $path = "{$src}/modules/{$module}";
                     }
                     if (!is_dir($path)) {
                         $path = "{$src}/modules/mod_{$module}";
                     }
                     if (!is_dir($path)) {
                         $fortest = '';
                         //continue;
                     }
                     // Was the module already installed?
                     $sql = $db->getQuery(true)->select('COUNT(*)')->from('#__modules')->where($db->qn('module') . ' = ' . $db->q('mod_' . $module));
                     $db->setQuery($sql);
                     $count = $db->loadResult();
                     $installer = new JInstaller();
                     $result = $installer->install($path);
                     $status->modules[] = array('name' => $module, 'client' => $folder, 'result' => $result, 'status' => $modulePreferences[1]);
                     // Modify where it's published and its published state
                     if (!$count) {
                         // A. Position and state
                         list($modulePosition, $modulePublished) = $modulePreferences;
                         if ($modulePosition == 'cpanel') {
                             $modulePosition = 'icon';
                         }
                         $sql = $db->getQuery(true)->update($db->qn('#__modules'))->set($db->qn('position') . ' = ' . $db->q($modulePosition))->where($db->qn('module') . ' = ' . $db->q('mod_' . $module));
                         if ($modulePublished) {
                             $sql->set($db->qn('published') . ' = ' . $db->q('1'));
                         }
                         $db->setQuery($sql);
                         $db->query();
                         // B. Change the ordering of back-end modules to 1 + max ordering
                         if ($folder == 'admin') {
                             $query = $db->getQuery(true);
                             $query->select('MAX(' . $db->qn('ordering') . ')')->from($db->qn('#__modules'))->where($db->qn('position') . '=' . $db->q($modulePosition));
                             $db->setQuery($query);
                             $position = $db->loadResult();
                             $position++;
                             $query = $db->getQuery(true);
                             $query->update($db->qn('#__modules'))->set($db->qn('ordering') . ' = ' . $db->q($position))->where($db->qn('module') . ' = ' . $db->q('mod_' . $module));
                             $db->setQuery($query);
                             $db->query();
                         }
                         // C. Link to all pages
                         $query = $db->getQuery(true);
                         $query->select('id')->from($db->qn('#__modules'))->where($db->qn('module') . ' = ' . $db->q('mod_' . $module));
                         $db->setQuery($query);
                         $moduleid = $db->loadResult();
                         $query = $db->getQuery(true);
                         $query->select('*')->from($db->qn('#__modules_menu'))->where($db->qn('moduleid') . ' = ' . $db->q($moduleid));
                         $db->setQuery($query);
                         $assignments = $db->loadObjectList();
                         $isAssigned = !empty($assignments);
                         if (!$isAssigned) {
                             $o = (object) array('moduleid' => $moduleid, 'menuid' => 0);
                             $db->insertObject('#__modules_menu', $o);
                         }
                     }
                 }
             }
         }
     }
     // Plugins installation
     if (count($this->installation_queue['plugins'])) {
         foreach ($this->installation_queue['plugins'] as $folder => $plugins) {
             if (count($plugins)) {
                 foreach ($plugins as $plugin => $published) {
                     $path = "{$src}/plugins/{$folder}/{$plugin}";
                     if (!is_dir($path)) {
                         $path = "{$src}/plugins/{$folder}/plg_{$plugin}";
                     }
                     if (!is_dir($path)) {
                         $path = "{$src}/plugins/{$plugin}";
                     }
                     if (!is_dir($path)) {
//.........这里部分代码省略.........
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:101,代码来源:script.api.php

示例13: _fix_createAdminMenus

 /**
  * _fix_createAdminMenus
  *
  * @param   JInstaller  $parent  Parent object
  *
  * @return void
  */
 private function _fix_createAdminMenus($parent)
 {
     $db = $parent->getParent()->getDbo();
     $query = $db->getQuery(true);
     $option = $parent->get('element');
     $query->clear()->select('id')->from('#__menu')->where('menutype = ' . $db->quote('main'))->where('client_id = 1')->where('(link = ' . $db->quote('index.php?option=' . $option) . ' OR ' . 'link like ' . $db->quote('index.php?option=' . $option . '&%') . ')')->where('type = ' . $db->quote('component'))->where('home = 0');
     $db->setQuery($query);
     $menu_ids = $db->loadColumn();
     if (!empty($menu_ids)) {
         $ids = implode(',', $menu_ids);
         // Remove the old menu item
         $query->clear()->delete('#__menu')->where('id in (' . $ids . ')');
         $db->setQuery($query);
         $db->query();
     }
 }
开发者ID:johngrange,项目名称:wookeyholeweb,代码行数:23,代码来源:script.autotweet.php


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