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


PHP JInstaller::setAdapter方法代码示例

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


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

示例1: testAbortDefault

	/**
	 * @todo Implement testAbort().
	 */
	public function testAbortDefault()
	{
		$this->saveFactoryState();

		$newDbo = $this->getMock('test');

		JFactory::$database = &$newDbo;

		$adapterMock = $this->getMock('test', array('_rollback_testtype'));

		$adapterMock->expects($this->once())
			->method('_rollback_testtype')
			->with($this->equalTo(array('type' => 'testtype')))
			->will($this->returnValue(true));


		//$this->object = JInstaller::getInstance();
		$this->object = new JInstaller;

		$this->object->setAdapter('testadapter', $adapterMock);

		$this->object->pushStep(array('type' => 'testtype'));

		$this->assertThat(
			$this->object->abort(null, 'testadapter'),
			$this->isTrue()
		);

		$this->restoreFactoryState();
	}
开发者ID:realityking,项目名称:JAJAX,代码行数:33,代码来源:JInstallerTest.php

示例2: setAdapter

 /**
  * Set an installer adapter by name
  *
  * @access	public
  * @param	string	$name		Adapter name
  * @param	object	$adapter	Installer adapter object
  * @return	boolean True if successful
  * @since	1.5
  */
 public function setAdapter($name, &$adapter = null, $options = array())
 {
     if (!is_object($adapter)) {
         // Try to load the adapter object
         $fullpath = dirname(__FILE__) . DS . 'adapters' . DS . strtolower($name) . '.php';
         if (!file_exists($fullpath)) {
             return false;
         }
         // Try to load the adapter object
         require_once $fullpath;
         $class = "RokInstaller" . ucfirst($name);
         if (!class_exists($class)) {
             return false;
         }
         $adapter = new $class($this, $this->_db, $options);
     }
     if (!is_object($adapter)) {
         $ret = parent::setAdapter($name, $adapter);
         if (!$ret) {
             return $ret;
         }
     }
     $this->_adapters[$name] =& $adapter;
     return true;
 }
开发者ID:resmun,项目名称:template-hawk1-j25,代码行数:34,代码来源:RokInstaller.php

示例3: testAbortDefault

 /**
  * Test...
  *
  * @covers  JInstaller::abort
  *
  * @return void
  */
 public function testAbortDefault()
 {
     $adapterMock = $this->getMock('test', array('_rollback_testtype'));
     $adapterMock->expects($this->once())->method('_rollback_testtype')->with($this->equalTo(array('type' => 'testtype')))->will($this->returnValue(true));
     $this->object->setAdapter('testadapter', $adapterMock);
     $this->object->pushStep(array('type' => 'testtype'));
     $this->assertThat($this->object->abort(null, 'testadapter'), $this->isTrue());
 }
开发者ID:shoffmann52,项目名称:install-from-web-server,代码行数:15,代码来源:JInstallerTest.php

示例4: install

 public function install()
 {
     foreach ($this->manifests as $i => $manifest) {
         $installer = new JInstaller();
         $installer->setPath('source', $this->parent->getPath('source'));
         //This is essentially what method="upgrade" does
         $installer->_overwrite = true;
         $xml =& JFactory::getXMLParser('Simple');
         $xml->loadFile($manifest);
         $installer->_manifest = $xml;
         $installer->setPath('manifest', $manifest);
         $root = $xml->document;
         $type = $root->attributes('type');
         //Don't install if the type isn't defined
         if (!$type) {
             unset($this->manifests[$i]);
             continue;
         }
         // Lazy load the adapter
         if (!isset($installer->_adapters[$type]) || !is_object($installer->_adapters[$type])) {
             $installer->setAdapter($type);
         }
         $installer->_adapters[$type]->install();
         $installer->install($this->parent->getPath('source'));
     }
     if (JFolder::exists($this->parent->getPath('source') . '/nooku')) {
         $this->manifests[] = $manifest = $this->parent->getPath('source') . '/nooku/manifest.xml';
         $installer = new JInstaller();
         $installer->setPath('source', $this->parent->getPath('source') . '/nooku');
         //This is essentially what method="upgrade" does
         $installer->_overwrite = true;
         $xml =& JFactory::getXMLParser('Simple');
         $xml->loadFile($manifest);
         $installer->_manifest = $xml;
         $installer->setPath('manifest', $manifest);
         $root = $xml->document;
         $type = $root->attributes('type');
         // Lazy load the adapter
         if (!isset($installer->_adapters[$type]) || !is_object($installer->_adapters[$type])) {
             $installer->setAdapter($type);
         }
         $installer->_adapters[$type]->install();
         $installer->install($this->parent->getPath('source'));
     }
     return $this;
 }
开发者ID:ravenlife,项目名称:Ninja-Framework,代码行数:46,代码来源:helper.php

示例5: setAdapter

 /**
  * Set an installer adapter by name
  *
  * @access	public
  * @param	string	$name		Adapter name
  * @param	object	$adapter	Installer adapter object
  * @return	boolean True if successful
  * @since	1.5
  */
 function setAdapter($name, $adapter = null)
 {
     $ret = parent::setAdapter($name, $adapter);
     if (!$ret) {
         return $ret;
     }
     if (!is_object($adapter)) {
         // Try to load the adapter object
         $adapter_file = dirname(__FILE__) . DS . 'adapters' . DS . strtolower($name) . '.php';
         if (JFile::exists($adapter_file)) {
             @(include_once $adapter_file);
             $class = 'RokInstaller' . ucfirst($name);
             if (!class_exists($class)) {
                 return false;
             }
             $adapter = new $class($this);
             $adapter->parent =& $this;
             $this->_adapters[strtolower($name)] =& $adapter;
         }
     }
     return true;
 }
开发者ID:Simarpreet05,项目名称:joomla,代码行数:31,代码来源:RokStarInstaller.php

示例6: postflight

 /**
  * method to run after an install/update/uninstall method
  *
  * @return void
  */
 public function postflight($type, $parent)
 {
     /* Install redform plugin */
     jimport('joomla.filesystem.file');
     jimport('joomla.filesystem.folder');
     $db =& JFactory::getDBO();
     JFolder::copy(JPATH_SITE . DS . 'administrator' . DS . 'components' . DS . 'com_redevent' . DS . 'extras' . DS . 'redform', JPATH_SITE . DS . 'tmp' . DS . 'redform_redevent', '', true);
     $installer = new JInstaller();
     $installer->setAdapter('plugin');
     if (!$installer->install(JPATH_SITE . DS . 'tmp' . DS . 'redform_redevent')) {
         echo JText::_('COM_REDEVENT_Plugin_install_failed') . $installer->getError() . '<br />';
     } else {
         // autopublish the plugin
         $query = ' UPDATE #__extensions SET enabled = 1 WHERE folder = ' . $db->Quote('redform_integration') . ' AND element = ' . $db->Quote('redevent');
         $db->setQuery($query);
         if ($db->query()) {
             echo JText::_('COM_REDEVENT_Succesfully_installed_redform_integration_plugin') . '<br />';
         } else {
             echo JText::_('COM_REDEVENT_Error_publishing_redform_integration_plugin') . '<br />';
         }
     }
 }
开发者ID:jaanusnurmoja,项目名称:redjoomla,代码行数:27,代码来源:install.redevent.php


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