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


PHP JInstaller::findManifest方法代码示例

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


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

示例1: update

 /**
  * Custom update method for components
  *
  * @return  boolean  True on success
  *
  * @since   3.1
  */
 public function update()
 {
     // Get a database connector object
     $db = $this->parent->getDbo();
     // Set the overwrite setting
     $this->parent->setOverwrite(true);
     // Get the extension manifest object
     $this->manifest = $this->parent->getManifest();
     /**
      * ---------------------------------------------------------------------------------------------
      * Manifest Document Setup Section
      * ---------------------------------------------------------------------------------------------
      */
     // Set the extension's name
     $name = strtolower(JFilterInput::getInstance()->clean((string) $this->manifest->name, 'cmd'));
     if (substr($name, 0, 4) == 'com_') {
         $element = $name;
     } else {
         $element = 'com_' . $name;
     }
     $this->set('name', $name);
     $this->set('element', $element);
     // Get the component description
     $description = (string) $this->manifest->description;
     if ($description) {
         $this->parent->set('message', JText::_($description));
     } else {
         $this->parent->set('message', '');
     }
     // Set the installation target paths
     $this->parent->setPath('extension_site', JPath::clean(JPATH_SITE . '/components/' . $this->get('element')));
     $this->parent->setPath('extension_administrator', JPath::clean(JPATH_ADMINISTRATOR . '/components/' . $this->get('element')));
     // Copy the admin path as it's used as a common base
     $this->parent->setPath('extension_root', $this->parent->getPath('extension_administrator'));
     // Hunt for the original XML file
     $old_manifest = null;
     // Create a new installer because findManifest sets stuff
     // Look in the administrator first
     $tmpInstaller = new JInstaller();
     $tmpInstaller->setPath('source', $this->parent->getPath('extension_administrator'));
     if (!$tmpInstaller->findManifest()) {
         // Then the site
         $tmpInstaller->setPath('source', $this->parent->getPath('extension_site'));
         if ($tmpInstaller->findManifest()) {
             $old_manifest = $tmpInstaller->getManifest();
         }
     } else {
         $old_manifest = $tmpInstaller->getManifest();
     }
     // Should do this above perhaps?
     if ($old_manifest) {
         $this->oldAdminFiles = $old_manifest->administration->files;
         $this->oldFiles = $old_manifest->files;
     } else {
         $this->oldAdminFiles = null;
         $this->oldFiles = null;
     }
     /**
      * ---------------------------------------------------------------------------------------------
      * Basic Checks Section
      * ---------------------------------------------------------------------------------------------
      */
     // Make sure that we have an admin element
     if (!$this->manifest->administration) {
         JLog::add(JText::_('JLIB_INSTALLER_ABORT_COMP_UPDATE_ADMIN_ELEMENT'), JLog::WARNING, 'jerror');
         return false;
     }
     /**
      * ---------------------------------------------------------------------------------------------
      * Installer Trigger Loading
      * ---------------------------------------------------------------------------------------------
      */
     // If there is an manifest class file, lets load it; we'll copy it later (don't have dest yet)
     $manifestScript = (string) $this->manifest->scriptfile;
     if ($manifestScript) {
         $manifestScriptFile = $this->parent->getPath('source') . '/' . $manifestScript;
         if (is_file($manifestScriptFile)) {
             // Load the file
             include_once $manifestScriptFile;
         }
         // Set the class name
         $classname = $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', $manifestScript);
         }
     }
     // Run preflight if possible (since we know we're not an update)
     ob_start();
     ob_implicit_flush(false);
     if ($this->parent->manifestClass && method_exists($this->parent->manifestClass, 'preflight')) {
//.........这里部分代码省略.........
开发者ID:WineWorld,项目名称:joomlatrialcmbg,代码行数:101,代码来源:component.php

示例2: install


//.........这里部分代码省略.........
     ob_start();
     ob_implicit_flush(false);
     if ($this->parent->manifestClass && method_exists($this->parent->manifestClass, 'preflight')) {
         if ($this->parent->manifestClass->preflight($this->route, $this) === false) {
             // Install failed, rollback changes
             $this->parent->abort(JText::_('JLIB_INSTALLER_ABORT_PLG_INSTALL_CUSTOM_INSTALL_FAILURE'));
             return false;
         }
     }
     $msg = ob_get_contents();
     // create msg object; first use here
     ob_end_clean();
     /**
      * ---------------------------------------------------------------------------------------------
      * Filesystem Processing Section
      * ---------------------------------------------------------------------------------------------
      */
     // If the plugin directory does not exist, lets create it
     $created = false;
     if (!file_exists($this->parent->getPath('extension_root'))) {
         if (!($created = JFolder::create($this->parent->getPath('extension_root')))) {
             $this->parent->abort(JText::sprintf('JLIB_INSTALLER_ABORT_PLG_INSTALL_CREATE_DIRECTORY', JText::_('JLIB_INSTALLER_' . $this->route), $this->parent->getPath('extension_root')));
             return false;
         }
     }
     // if we're updating at this point when there is always going to be an extension_root find the old xml files
     if ($this->route == 'update') {
         // Hunt for the original XML file
         $old_manifest = null;
         $tmpInstaller = new JInstaller();
         // create a new installer because findManifest sets stuff; side effects!
         // look in the extension root
         $tmpInstaller->setPath('source', $this->parent->getPath('extension_root'));
         if ($tmpInstaller->findManifest()) {
             $old_manifest = $tmpInstaller->getManifest();
             $this->oldFiles = $old_manifest->files;
         }
     }
     /*
      * If we created the plugin 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($xml->files, -1, $this->oldFiles) === false) {
         // Install failed, roll back changes
         $this->parent->abort();
         return false;
     }
     // Parse optional tags -- media and language files for plugins go in admin app
     $this->parent->parseMedia($xml->media, 1);
     $this->parent->parseLanguages($xml->languages, 1);
     // If there is a manifest script, lets copy it.
     if ($this->get('manifest_script')) {
         $path['src'] = $this->parent->getPath('source') . DS . $this->get('manifest_script');
         $path['dest'] = $this->parent->getPath('extension_root') . DS . $this->get('manifest_script');
         if (!file_exists($path['dest'])) {
             if (!$this->parent->copyFiles(array($path))) {
                 // Install failed, rollback changes
                 $this->parent->abort(JText::sprintf('JLIB_INSTALLER_ABORT_PLG_INSTALL_MANIFEST', JText::_('JLIB_INSTALLER_' . $this->route)));
                 return false;
             }
         }
开发者ID:Joomla-on-NoSQL,项目名称:LaMojo,代码行数:67,代码来源:plugin.php

示例3: createExtensionRoot

 /**
  * Method to create the extension root path if necessary
  *
  * @return  void
  *
  * @since   3.4
  * @throws  RuntimeException
  */
 protected function createExtensionRoot()
 {
     // Run the common create code first
     parent::createExtensionRoot();
     // If we're updating at this point when there is always going to be an extension_root find the old XML files
     if ($this->route == 'update') {
         // Create a new installer because findManifest sets stuff; side effects!
         $tmpInstaller = new JInstaller();
         // Look in the extension root
         $tmpInstaller->setPath('source', $this->parent->getPath('extension_root'));
         if ($tmpInstaller->findManifest()) {
             $old_manifest = $tmpInstaller->getManifest();
             $this->oldFiles = $old_manifest->files;
         }
     }
 }
开发者ID:naka211,项目名称:studiekorrektur,代码行数:24,代码来源:plugin.php

示例4: setupUpdates

 /**
  * Method to setup the update routine for the adapter
  *
  * @return  void
  *
  * @since   3.4
  */
 protected function setupUpdates()
 {
     // Hunt for the original XML file
     $old_manifest = null;
     // Use a temporary instance due to side effects; start in the administrator first
     $tmpInstaller = new JInstaller();
     $tmpInstaller->setPath('source', $this->parent->getPath('extension_administrator'));
     if (!$tmpInstaller->findManifest()) {
         // Then the site
         $tmpInstaller->setPath('source', $this->parent->getPath('extension_site'));
         if ($tmpInstaller->findManifest()) {
             $old_manifest = $tmpInstaller->getManifest();
         }
     } else {
         $old_manifest = $tmpInstaller->getManifest();
     }
     if ($old_manifest) {
         $this->oldAdminFiles = $old_manifest->administration->files;
         $this->oldFiles = $old_manifest->files;
     }
 }
开发者ID:joomla-projects,项目名称:media-manager-improvement,代码行数:28,代码来源:component.php

示例5: update

 /**
  * Custom update method for components
  *
  * @access	public
  * @return	boolean	True on success
  * @since	1.5
  */
 function update()
 {
     // Get a database connector object
     $db =& $this->parent->getDbo();
     // set the overwrite setting
     $this->parent->setOverwrite(true);
     // Get the extension manifest object
     $this->manifest = $this->parent->getManifest();
     /**
      * ---------------------------------------------------------------------------------------------
      * Manifest Document Setup Section
      * ---------------------------------------------------------------------------------------------
      */
     // Set the extensions name
     $name = JFilterInput::getInstance()->clean((string) $this->manifest->name, 'cmd');
     $element = strtolower('com_' . $name);
     $this->set('name', $name);
     $this->set('element', $element);
     // Get the component description
     $description = (string) $this->manifest->description;
     if ($description) {
         $this->parent->set('message', JText::_($description));
     } else {
         $this->parent->set('message', '');
     }
     // Set the installation target paths
     $this->parent->setPath('extension_site', JPath::clean(JPATH_SITE . DS . "components" . DS . $this->get('element')));
     $this->parent->setPath('extension_administrator', JPath::clean(JPATH_ADMINISTRATOR . DS . "components" . DS . $this->get('element')));
     $this->parent->setPath('extension_root', $this->parent->getPath('extension_administrator'));
     // copy this as its used as a common base
     /**
      * Hunt for the original XML file
      */
     $oldmanifest = null;
     $tmpInstaller = new JInstaller();
     // create a new installer because findManifest sets stuff
     // look in the administrator first
     $tmpInstaller->setPath('source', $this->parent->getPath('extension_administrator'));
     if (!$tmpInstaller->findManifest()) {
         // then the site
         $tmpInstaller->setPath('source', $this->parent->getPath('extension_site'));
         if ($tmpInstaller->findManifest()) {
             $old_manifest = $tmpInstaller->getManifest();
         }
     } else {
         $old_manifest = $tmpInstaller->getManifest();
     }
     // should do this above perhaps?
     if ($old_manifest) {
         $this->oldAdminFiles = $old_manifest->administration->files;
         $this->oldFiles = $old_manifest->files;
     } else {
         $this->oldAdminFiles = null;
         $this->oldFiles = null;
     }
     /**
      * ---------------------------------------------------------------------------------------------
      * Basic Checks Section
      * ---------------------------------------------------------------------------------------------
      */
     // Make sure that we have an admin element
     if (!$this->manifest->administration) {
         JError::raiseWarning(1, JText::_('Component') . ' ' . JText::_('Update') . ': ' . JText::_('The XML file did not contain an administration element'));
         return false;
     }
     /**
      * ---------------------------------------------------------------------------------------------
      * Installer Trigger Loading
      * ---------------------------------------------------------------------------------------------
      */
     // If there is an manifest class file, lets load it; we'll copy it later (don't have dest yet)
     $manifestScript = (string) $this->manifest->scriptfile;
     if ($manifestScript) {
         $manifestScriptFile = $this->parent->getPath('source') . DS . $manifestScript;
         if (is_file($manifestScriptFile)) {
             // load the file
             include_once $manifestScriptFile;
         }
         // Set the class name
         $classname = $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', $manifestScript);
             // Note: if we don't find the class, don't bother to copy the file
         }
     }
     // run preflight if possible (since we know we're not an update)
     ob_start();
     ob_implicit_flush(false);
     if ($this->parent->manifestClass && method_exists($this->parent->manifestClass, 'preflight')) {
         $this->parent->manifestClass->preflight('update', $this);
//.........这里部分代码省略.........
开发者ID:joebushi,项目名称:joomla,代码行数:101,代码来源:component.php

示例6: preflight

 public function preflight($type, $parent)
 {
     // Bugfix for "Can not build admin menus"
     if (in_array($type, array('install', 'discover_install'))) {
         $this->bugfixDBFunctionReturnedNoError();
     } else {
         $this->bugfixCantBuildAdminMenus();
     }
     $manifest = $parent->getParent()->getManifest();
     // Prevent installation if requirements are not met.
     if (!$this->checkRequirements($manifest->version)) {
         return false;
     }
     // TODO: If we do not need to display the warning (but only after dropping J1.5 support)
     //		if (version_compare($manifest->version, '2.0', '>')) return true;
     $adminpath = $parent->getParent()->getPath('extension_administrator');
     $sitepath = $parent->getParent()->getPath('extension_site');
     // If Kunena wasn't installed, there's nothing to do.
     if (!file_exists($adminpath)) {
         return true;
     }
     // Find the old manifest file.
     $tmpInstaller = new JInstaller();
     $tmpInstaller->setPath('source', $adminpath);
     $obj_manifest = $tmpInstaller->findManifest() ? $tmpInstaller->getManifest() : null;
     $old_manifest = basename($tmpInstaller->getPath('manifest'));
     if ($obj_manifest) {
         $this->oldAdminFiles = $this->findFilesFromManifest($obj_manifest->administration->files) + array($old_manifest => $old_manifest);
         $this->oldAdminFiles += $this->findFilesFromManifest($manifest->administration->files);
         $this->oldFiles = $this->findFilesFromManifest($obj_manifest->files);
         $this->oldFiles += $this->findFilesFromManifest($manifest->files);
     }
     // Detect existing installation.
     if ($old_manifest && JFile::exists("{$adminpath}/admin.kunena.php")) {
         $contents = file_get_contents("{$adminpath}/admin.kunena.php");
         if (!strstr($contents, '/* KUNENA FORUM INSTALLER */')) {
             // If we don't find Kunena 2.0 installer, backup existing files...
             $backuppath = "{$adminpath}/bak";
             if (JFolder::exists($backuppath)) {
                 JFolder::delete($backuppath);
             }
             $this->backup($adminpath, $backuppath, $this->oldAdminFiles);
             $backuppath = "{$sitepath}/bak";
             if (JFolder::exists($backuppath)) {
                 JFolder::delete($backuppath);
             }
             $this->backup($sitepath, $backuppath, $this->oldFiles);
         }
     }
     // Remove old manifest files, excluding the current one.
     $manifests = array('manifest.xml', 'kunena.j16.xml', 'kunena.j25.xml', 'kunena.xml');
     foreach ($manifests as $filename) {
         if ($filename == $old_manifest) {
             continue;
         }
         if (JFile::exists("{$adminpath}/{$filename}")) {
             JFile::delete("{$adminpath}/{$filename}");
         }
     }
     clearstatcache();
     return true;
 }
开发者ID:laiello,项目名称:senluonirvana,代码行数:62,代码来源:install.script.php

示例7: preflight

 public function preflight($type, $adapter)
 {
     if ($type !== 'update') {
         return true;
     }
     // "Fix" Joomla! bug
     $row = JTable::getInstance('extension');
     $eid = $row->find(array('element' => strtolower($adapter->get('element')), 'type' => 'component'));
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     $query->select('version_id')->from('#__schemas')->where('extension_id = ' . $eid);
     $db->setQuery($query);
     if ($db->loadResult()) {
         return true;
     }
     // Get the previous version
     $old_manifest = null;
     // Create a new installer because findManifest sets stuff
     // Look in the administrator first
     $tmpInstaller = new JInstaller();
     $tmpInstaller->setPath('source', JPATH_ADMINISTRATOR . '/components/com_slicomments');
     if (!$tmpInstaller->findManifest()) {
         echo 'Could not find old manifest.';
         return false;
     }
     $old_manifest = $tmpInstaller->getManifest();
     $version = (string) $old_manifest->version;
     // Store
     $data = new stdClass();
     $data->extension_id = $eid;
     $data->version_id = $version;
     $db->insertObject('#__schemas', $data);
     return true;
 }
开发者ID:rivetweb,项目名称:old-joomla-dd-countrymap,代码行数:34,代码来源:script.slicomments.php


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