當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。