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


PHP Bootstrap::getInstance方法代码示例

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


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

示例1: getDatabaseConnection

 /**
  * Returns a valid DatabaseConnection object that is connected and ready
  * to be used static
  *
  * @return \TYPO3\CMS\Core\Database\DatabaseConnection
  */
 public static function getDatabaseConnection()
 {
     if (!$GLOBALS['TYPO3_DB']) {
         \TYPO3\CMS\Core\Core\Bootstrap::getInstance()->initializeTypo3DbGlobal();
     }
     return $GLOBALS['TYPO3_DB'];
 }
开发者ID:99grad,项目名称:TYPO3.Extbase.t3viewhelpers,代码行数:13,代码来源:DatabaseUtility.php

示例2: execute

 /**
  * Execute environment and folder step:
  * - Create main folder structure
  * - Create typo3conf/LocalConfiguration.php
  *
  * @return array<\TYPO3\CMS\Install\Status\StatusInterface>
  */
 public function execute()
 {
     /** @var $folderStructureFactory \TYPO3\CMS\Install\FolderStructure\DefaultFactory */
     $folderStructureFactory = $this->objectManager->get(\TYPO3\CMS\Install\FolderStructure\DefaultFactory::class);
     /** @var $structureFacade \TYPO3\CMS\Install\FolderStructure\StructureFacade */
     $structureFacade = $folderStructureFactory->getStructure();
     $structureFixMessages = $structureFacade->fix();
     /** @var \TYPO3\CMS\Install\Status\StatusUtility $statusUtility */
     $statusUtility = $this->objectManager->get(\TYPO3\CMS\Install\Status\StatusUtility::class);
     $errorsFromStructure = $statusUtility->filterBySeverity($structureFixMessages, 'error');
     if (@is_dir(PATH_typo3conf)) {
         /** @var \TYPO3\CMS\Core\Configuration\ConfigurationManager $configurationManager */
         $configurationManager = $this->objectManager->get(\TYPO3\CMS\Core\Configuration\ConfigurationManager::class);
         $configurationManager->createLocalConfigurationFromFactoryConfiguration();
         // Create a PackageStates.php with all packages activated marked as "part of factory default"
         if (!file_exists(PATH_typo3conf . 'PackageStates.php')) {
             /** @var \TYPO3\CMS\Core\Package\FailsafePackageManager $packageManager */
             $packageManager = \TYPO3\CMS\Core\Core\Bootstrap::getInstance()->getEarlyInstance(\TYPO3\CMS\Core\Package\PackageManager::class);
             $packages = $packageManager->getAvailablePackages();
             foreach ($packages as $package) {
                 /** @var $package \TYPO3\CMS\Core\Package\PackageInterface */
                 if ($package instanceof \TYPO3\CMS\Core\Package\PackageInterface && $package->isPartOfFactoryDefault()) {
                     $packageManager->activatePackage($package->getPackageKey());
                 }
             }
             $packageManager->forceSortAndSavePackageStates();
         }
         // Create enable install tool file after typo3conf & LocalConfiguration were created
         /** @var \TYPO3\CMS\Install\Service\EnableFileService $installToolService */
         $installToolService = $this->objectManager->get(\TYPO3\CMS\Install\Service\EnableFileService::class);
         $installToolService->removeFirstInstallFile();
         $installToolService->createInstallToolEnableFile();
     }
     return $errorsFromStructure;
 }
开发者ID:plan2net,项目名称:TYPO3.CMS,代码行数:42,代码来源:EnvironmentAndFolders.php

示例3: initializeCmsContext

 /**
  * @return $this
  */
 public function initializeCmsContext()
 {
     \TYPO3\CMS\Core\Core\Bootstrap::getInstance()->baseSetup('typo3/')->initializeClassLoader()->initializeCachingFramework()->initializePackageManagement('FluidTYPO3\\Development\\NullPackageManager');
     $container = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\Container\\Container');
     $this->setObjectContainer($container);
     return $this;
 }
开发者ID:xf-,项目名称:fluidtypo3-development,代码行数:10,代码来源:Bootstrap.php

示例4: setUp

 /**
  * Set up
  */
 protected function setUp()
 {
     parent::setUp();
     $this->setUpBackendUserFromFixture(1);
     \TYPO3\CMS\Core\Core\Bootstrap::getInstance()->initializeLanguageObject();
     $this->importDataSet(__DIR__ . '/../Fixtures/sys_workspace.xml');
 }
开发者ID:plan2net,项目名称:TYPO3.CMS,代码行数:10,代码来源:WorkspaceServiceTest.php

示例5: execute

 /**
  * @return void
  */
 public function execute()
 {
     // check for the Bootstrap class to check if the current TYPO3 version meets our requirements
     if (class_exists('TYPO3\\CMS\\Core\\Core\\Bootstrap')) {
         /** @var \TYPO3\CMS\Install\Sql\SchemaMigrator $schemaMigrator */
         $schemaMigrator = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Install\\Sql\\SchemaMigrator');
         /** @var \TYPO3\CMS\Core\Database\DatabaseConnection $databaseConnection */
         $databaseConnection = $GLOBALS['TYPO3_DB'];
         \TYPO3\CMS\Core\Core\Bootstrap::getInstance()->loadExtensionTables(FALSE);
         $tableDefinitionsString = $this->resolveTableDefinitions();
         $currentFieldDefinitions = $schemaMigrator->getFieldDefinitions_database();
         $updatedFieldDefinitions = $schemaMigrator->getFieldDefinitions_fileContent($tableDefinitionsString);
         $fieldDefinitionsDifferences = $schemaMigrator->getDatabaseExtra($updatedFieldDefinitions, $currentFieldDefinitions);
         $updateStatements = $schemaMigrator->getUpdateSuggestions($fieldDefinitionsDifferences);
         $allowedStatementTypes = array('add', 'create_table');
         if (!empty($updateStatements)) {
             $this->messageService->warningMessage('Difference detected in table definitions. Statement types: ' . implode(',', array_keys($updateStatements)), TRUE);
             foreach ($allowedStatementTypes as $statementType) {
                 if (array_key_exists($statementType, $updateStatements) && is_array($updateStatements[$statementType])) {
                     foreach ($updateStatements[$statementType] as $statement) {
                         $this->messageService->infoMessage('Executing "' . $statement . '"');
                         $result = $databaseConnection->admin_query($statement);
                         if ($result !== TRUE) {
                             $this->messageService->warningMessage('Executing query failed!');
                         }
                     }
                 }
             }
         }
     }
 }
开发者ID:pitscribble,项目名称:typo3-upgradereport,代码行数:34,代码来源:Processor.php

示例6: clearAll

 /**
  * This clear cache implementation follows a pretty brutal approach.
  * Goal is to reliably get rid of cache entries, even if some broken
  * extension is loaded that would kill the backend 'clear cache' action.
  *
  * Therefor this method "knows" implementation details of the cache
  * framework and uses them to clear all file based cache (typo3temp/Cache)
  * and database caches (tables prefixed with cf_) manually.
  *
  * After that ext_tables and ext_localconf of extensions are loaded, those
  * may register additional caches in the caching framework with different
  * backend, and will then clear them with the usual flush() method.
  *
  * @return void
  */
 public function clearAll()
 {
     // Delete typo3temp/Cache
     GeneralUtility::flushDirectory(PATH_site . 'typo3temp/var/Cache', true, true);
     $bootstrap = \TYPO3\CMS\Core\Core\Bootstrap::getInstance();
     $bootstrap->initializeCachingFramework()->initializePackageManagement(\TYPO3\CMS\Core\Package\PackageManager::class);
     // Get all table names starting with 'cf_' and truncate them
     $database = $this->getDatabaseConnection();
     $tables = $database->admin_get_tables();
     foreach ($tables as $table) {
         $tableName = $table['Name'];
         if (substr($tableName, 0, 3) === 'cf_') {
             $database->exec_TRUNCATEquery($tableName);
         } elseif ($tableName === 'cache_treelist') {
             // cache_treelist is not implemented in the caching framework.
             // clear this table manually
             $database->exec_TRUNCATEquery('cache_treelist');
         }
     }
     // From this point on, the code may fatal, if some broken extension is loaded.
     // Use bootstrap to load all ext_localconf and ext_tables
     $bootstrap->loadTypo3LoadedExtAndExtLocalconf(false)->defineLoggingAndExceptionConstants()->unsetReservedGlobalVariables()->initializeTypo3DbGlobal()->loadExtensionTables(false);
     // The cache manager is already instantiated in the install tool
     // with some hacked settings to disable caching of extbase and fluid.
     // We want a "fresh" object here to operate on a different cache setup.
     // cacheManager implements SingletonInterface, so the only way to get a "fresh"
     // instance is by circumventing makeInstance and/or the objectManager and
     // using new directly!
     $cacheManager = new \TYPO3\CMS\Core\Cache\CacheManager();
     $cacheManager->setCacheConfigurations($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']);
     // Cache manager needs cache factory. cache factory injects itself to manager in __construct()
     new \TYPO3\CMS\Core\Cache\CacheFactory('production', $cacheManager);
     $cacheManager->flushCaches();
 }
开发者ID:dachcom-digital,项目名称:TYPO3.CMS,代码行数:49,代码来源:ClearCacheService.php

示例7: isFirstInstallAllowed

 /**
  * @return bool
  */
 public static function isFirstInstallAllowed()
 {
     $files = self::getFirstInstallFilePaths();
     if (!empty($files) && !\TYPO3\CMS\Core\Core\Bootstrap::getInstance()->checkIfEssentialConfigurationExists()) {
         return true;
     }
     return false;
 }
开发者ID:rickymathew,项目名称:TYPO3.CMS,代码行数:11,代码来源:EnableFileService.php

示例8: __construct

 /**
  * Constructor setting up legacy constant and register available Request Handlers
  *
  * @param \Composer\Autoload\ClassLoader|\Helhum\ClassAliasLoader\Composer\ClassAliasLoader $classLoader an instance of the class loader
  */
 public function __construct($classLoader)
 {
     $this->defineLegacyConstants();
     $this->bootstrap = Bootstrap::getInstance()->initializeClassLoader($classLoader)->baseSetup($this->entryPointPath);
     foreach ($this->availableRequestHandlers as $requestHandler) {
         $this->bootstrap->registerRequestHandlerImplementation($requestHandler);
     }
 }
开发者ID:adrolli,项目名称:TYPO3.CMS,代码行数:13,代码来源:Application.php

示例9: setUp

 /**
  * Set up for set up the backend user, initialize the language object
  * and creating the Export instance
  *
  * @return void
  */
 protected function setUp()
 {
     parent::setUp();
     $this->setUpBackendUserFromFixture(1);
     \TYPO3\CMS\Core\Core\Bootstrap::getInstance()->initializeLanguageObject();
     $this->export = GeneralUtility::makeInstance(\TYPO3\CMS\Impexp\Export::class);
     $this->export->init(0, 'export');
 }
开发者ID:TYPO3Incubator,项目名称:TYPO3.CMS,代码行数:14,代码来源:AbstractExportTestCase.php

示例10: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->backendUser = $this->setUpBackendUserFromFixture(self::VALUE_BackendUserId);
     // By default make tests on live workspace
     $this->backendUser->workspace = 0;
     $this->actionService = $this->getActionService();
     \TYPO3\CMS\Core\Core\Bootstrap::getInstance()->initializeLanguageObject();
 }
开发者ID:plan2net,项目名称:TYPO3.CMS,代码行数:9,代码来源:AbstractDataHandlerActionTestCase.php

示例11: __construct

 /**
  * Constructor setting up legacy constant and register available Request Handlers
  *
  * @param \Composer\Autoload\ClassLoader $classLoader an instance of the class loader
  */
 public function __construct($classLoader)
 {
     $this->defineLegacyConstants();
     $this->bootstrap = Bootstrap::getInstance()->initializeClassLoader($classLoader)->baseSetup($this->entryPointPath);
     foreach ($this->availableRequestHandlers as $requestHandler) {
         $this->bootstrap->registerRequestHandlerImplementation($requestHandler);
     }
     $this->bootstrap->startOutputBuffering()->loadConfigurationAndInitialize(false, \TYPO3\CMS\Core\Package\FailsafePackageManager::class);
 }
开发者ID:Gregpl,项目名称:TYPO3.CMS,代码行数:14,代码来源:Application.php

示例12: setUp

 /**
  * Set up for set up the backend user, initialize the language object
  * and creating the ImportExport instance
  *
  * @return void
  */
 protected function setUp()
 {
     parent::setUp();
     $this->setUpBackendUserFromFixture(1);
     // Needed to avoid PHP Warnings
     $GLOBALS['TBE_STYLES']['spriteIconApi']['iconsAvailable'] = array();
     \TYPO3\CMS\Core\Core\Bootstrap::getInstance()->initializeLanguageObject();
     $this->export = GeneralUtility::makeInstance(\TYPO3\CMS\Impexp\ImportExport::class);
     $this->export->init(0, 'export');
 }
开发者ID:graurus,项目名称:testgit_t37,代码行数:16,代码来源:AbstractExportTestCase.php

示例13: initTCA

 /**
  * Makes TCA available inside eID
  *
  * @return void
  */
 public static function initTCA()
 {
     // Some badly made extensions attempt to manipulate TCA in a wrong way
     // (inside ext_localconf.php). Therefore $GLOBALS['TCA'] may become an array
     // but in fact it is not loaded. The check below ensure that
     // TCA is still loaded if such bad extensions are installed
     if (!is_array($GLOBALS['TCA']) || !isset($GLOBALS['TCA']['pages'])) {
         Bootstrap::getInstance()->loadCachedTca();
     }
 }
开发者ID:rickymathew,项目名称:TYPO3.CMS,代码行数:15,代码来源:EidUtility.php

示例14: setUp

 /**
  * Sets up this test case.
  *
  * @return void
  */
 protected function setUp()
 {
     parent::setUp();
     $this->setUpBackendUserFromFixture(1);
     Bootstrap::getInstance()->initializeLanguageObject();
     $this->importDataSet(ORIGINAL_ROOT . 'typo3/sysext/backend/Tests/Functional/Fixtures/pages.xml');
     $this->importDataSet(ORIGINAL_ROOT . 'typo3/sysext/core/Tests/Functional/Fixtures/sys_language.xml');
     $this->importDataSet(ORIGINAL_ROOT . 'typo3/sysext/backend/Tests/Functional/Controller/Page/Fixtures/tt_content-default-language.xml');
     $this->subject = new LocalizationController();
 }
开发者ID:dachcom-digital,项目名称:TYPO3.CMS,代码行数:15,代码来源:LocalizationControllerTest.php

示例15: __construct

 /**
  * Constructor setting up legacy constants and register available Request Handlers
  *
  * @param \Composer\Autoload\ClassLoader|\Helhum\ClassAliasLoader\Composer\ClassAliasLoader $classLoader an instance of the class loader
  */
 public function __construct($classLoader)
 {
     $this->defineLegacyConstants();
     \TYPO3\CMS\Core\Core\CliBootstrap::checkEnvironmentOrDie();
     $this->bootstrap = Bootstrap::getInstance()->initializeClassLoader($classLoader)->baseSetup($this->entryPointPath);
     foreach ($this->availableRequestHandlers as $requestHandler) {
         $this->bootstrap->registerRequestHandlerImplementation($requestHandler);
     }
     $this->bootstrap->configure();
 }
开发者ID:plan2net,项目名称:TYPO3.CMS,代码行数:15,代码来源:Application.php


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