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


PHP Core\Bootstrap类代码示例

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


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

示例1: run

 /**
  * Set up the application and shut it down afterwards
  *
  * @param callable $execute
  * @return void
  */
 public function run(callable $execute = null)
 {
     $this->request = \TYPO3\CMS\Core\Http\ServerRequestFactory::fromGlobals();
     // see below when this option is set and Bootstrap::defineTypo3RequestTypes() for more details
     if (TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_AJAX) {
         $this->request = $this->request->withAttribute('isAjaxRequest', true);
     } elseif (isset($this->request->getQueryParams()['M'])) {
         $this->request = $this->request->withAttribute('isModuleRequest', true);
     }
     $this->bootstrap->handleRequest($this->request);
     if ($execute !== null) {
         call_user_func($execute);
     }
     $this->bootstrap->shutdown();
 }
开发者ID:dachcom-digital,项目名称:TYPO3.CMS,代码行数:21,代码来源:Application.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: 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

示例4: 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

示例5: 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

示例6: 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

示例7: generateMenu

 /**
  * Generates the action menu
  *
  * @return void
  */
 protected function generateMenu()
 {
     $menuItems = ['installedExtensions' => ['controller' => 'List', 'action' => 'index', 'label' => $this->translate('installedExtensions')]];
     if (!$this->settings['offlineMode'] && !Bootstrap::usesComposerClassLoading()) {
         $menuItems['getExtensions'] = ['controller' => 'List', 'action' => 'ter', 'label' => $this->translate('getExtensions')];
         $menuItems['distributions'] = ['controller' => 'List', 'action' => 'distributions', 'label' => $this->translate('distributions')];
         if ($this->actionMethodName === 'showAllVersionsAction') {
             $menuItems['showAllVersions'] = ['controller' => 'List', 'action' => 'showAllVersions', 'label' => $this->translate('showAllVersions') . ' ' . $this->request->getArgument('extensionKey')];
         }
     }
     $uriBuilder = $this->objectManager->get(UriBuilder::class);
     $uriBuilder->setRequest($this->request);
     $menu = $this->view->getModuleTemplate()->getDocHeaderComponent()->getMenuRegistry()->makeMenu();
     $menu->setIdentifier('ExtensionManagerModuleMenu');
     foreach ($menuItems as $menuItemConfig) {
         if ($this->request->getControllerName() === $menuItemConfig['controller']) {
             $isActive = $this->request->getControllerActionName() === $menuItemConfig['action'] ? true : false;
         } else {
             $isActive = false;
         }
         $menuItem = $menu->makeMenuItem()->setTitle($menuItemConfig['label'])->setHref($this->getHref($menuItemConfig['controller'], $menuItemConfig['action']))->setActive($isActive);
         $menu->addMenuItem($menuItem);
     }
     $this->view->getModuleTemplate()->getDocHeaderComponent()->getMenuRegistry()->addMenu($menu);
     $this->view->getModuleTemplate()->setFlashMessageQueue($this->controllerContext->getFlashMessageQueue());
 }
开发者ID:rickymathew,项目名称:TYPO3.CMS,代码行数:31,代码来源:AbstractModuleController.php

示例8: 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

示例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: handleRequest

 /**
  * Handles a frontend request based on the _GP "eID" variable.
  *
  * @return void
  */
 public function handleRequest()
 {
     // Timetracking started
     $configuredCookieName = trim($GLOBALS['TYPO3_CONF_VARS']['BE']['cookieName']);
     if (empty($configuredCookieName)) {
         $configuredCookieName = 'be_typo_user';
     }
     if ($_COOKIE[$configuredCookieName]) {
         $GLOBALS['TT'] = new TimeTracker();
     } else {
         $GLOBALS['TT'] = new NullTimeTracker();
     }
     $GLOBALS['TT']->start();
     // Hook to preprocess the current request
     if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/index_ts.php']['preprocessRequest'])) {
         foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/index_ts.php']['preprocessRequest'] as $hookFunction) {
             $hookParameters = array();
             GeneralUtility::callUserFunction($hookFunction, $hookParameters, $hookParameters);
         }
         unset($hookFunction);
         unset($hookParameters);
     }
     // Remove any output produced until now
     $this->bootstrap->endOutputBufferingAndCleanPreviousOutput();
     require EidUtility::getEidScriptPath();
     $this->bootstrap->shutdown();
     exit;
 }
开发者ID:adrolli,项目名称:TYPO3.CMS,代码行数:33,代码来源:EidRequestHandler.php

示例11: run

 /**
  * Set up the application and shut it down afterwards
  * Failsafe minimal setup mode for the install tool
  * Does not call "run()" therefore
  *
  * @param callable $execute
  * @return void
  */
 public function run(callable $execute = null)
 {
     $this->bootstrap->handleRequest(\TYPO3\CMS\Core\Http\ServerRequestFactory::fromGlobals());
     if ($execute !== null) {
         call_user_func($execute);
     }
     $this->bootstrap->shutdown();
 }
开发者ID:dachcom-digital,项目名称:TYPO3.CMS,代码行数:16,代码来源:Application.php

示例12: run

 /**
  * Set up the application and shut it down afterwards
  *
  * @param callable $execute
  * @return void
  */
 public function run(callable $execute = null)
 {
     $this->bootstrap->handleRequest(new \Symfony\Component\Console\Input\ArgvInput());
     if ($execute !== null) {
         call_user_func($execute);
     }
     $this->bootstrap->shutdown();
 }
开发者ID:TYPO3Incubator,项目名称:TYPO3.CMS,代码行数:14,代码来源:Application.php

示例13: handleRequest

 /**
  * Handles any backend request
  *
  * @return void
  */
 public function handleRequest()
 {
     // Evaluate the constant for skipping the BE user check for the bootstrap
     if (defined('TYPO3_PROCEED_IF_NO_USER') && TYPO3_PROCEED_IF_NO_USER) {
         $proceedIfNoUserIsLoggedIn = TRUE;
     } else {
         $proceedIfNoUserIsLoggedIn = FALSE;
     }
     $this->bootstrap->checkLockedBackendAndRedirectOrDie()->checkBackendIpOrDie()->checkSslBackendAndRedirectIfNeeded()->checkValidBrowserOrDie()->loadExtensionTables(TRUE)->initializeSpriteManager()->initializeBackendUser()->initializeBackendAuthentication($proceedIfNoUserIsLoggedIn)->initializeLanguageObject()->initializeBackendTemplate()->endOutputBufferingAndCleanPreviousOutput()->initializeOutputCompression()->sendHttpHeaders();
 }
开发者ID:adrolli,项目名称:TYPO3.CMS,代码行数:15,代码来源:RequestHandler.php

示例14: run

 /**
  * Set up the application and shut it down afterwards
  *
  * @param callable $execute
  * @return void
  */
 public function run(callable $execute = NULL)
 {
     $this->bootstrap->handleRequest(\TYPO3\CMS\Core\Http\ServerRequestFactory::fromGlobals());
     if ($execute !== NULL) {
         if ($execute instanceof \Closure) {
             $execute->bindTo($this);
         }
         call_user_func($execute);
     }
     $this->bootstrap->shutdown();
 }
开发者ID:plan2net,项目名称:TYPO3.CMS,代码行数:17,代码来源:Application.php

示例15: run

 /**
  * Set up the application and shut it down afterwards
  * Failsafe minimal setup mode for the install tool
  * Does not call "run()" therefore
  *
  * @param callable $execute
  * @return void
  */
 public function run(callable $execute = NULL)
 {
     $this->bootstrap->startOutputBuffering()->loadConfigurationAndInitialize(FALSE, \TYPO3\CMS\Core\Package\FailsafePackageManager::class)->handleRequest();
     if ($execute !== NULL) {
         if ($execute instanceof \Closure) {
             $execute->bindTo($this);
         }
         call_user_func($execute);
     }
     $this->bootstrap->shutdown();
 }
开发者ID:adrolli,项目名称:TYPO3.CMS,代码行数:19,代码来源:Application.php


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