• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP gc_disable函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: execute

 /**
  * @inheritdoc
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $output->writeln('PHPMetrics by Jean-François Lépine <https://twitter.com/Halleck45>');
     $output->writeln('');
     // config
     $configFactory = new ConfigFactory();
     $config = $configFactory->factory($input);
     // files
     if (null === $config->getPath()->getBasePath()) {
         throw new \LogicException('Please provide a path to analyze');
     }
     // files to analyze
     $finder = new Finder($config->getPath()->getExtensions(), $config->getPath()->getExcludedDirs(), $config->getPath()->isFollowSymlinks() ? Finder::FOLLOW_SYMLINKS : null);
     // prepare structures
     $bounds = new Bounds();
     $collection = new \Hal\Component\Result\ResultCollection();
     $aggregatedResults = new \Hal\Component\Result\ResultCollection();
     // execute analyze
     $queueFactory = new QueueFactory($input, $output, $config);
     $queue = $queueFactory->factory($finder, $bounds);
     gc_disable();
     $queue->execute($collection, $aggregatedResults);
     gc_enable();
     $output->writeln('<info>done</info>');
     // evaluation of success
     $evaluator = new Evaluator($collection, $aggregatedResults, $bounds);
     $result = $evaluator->evaluate($config->getFailureCondition());
     // fail if failure-condition is realized
     return $result->isValid() ? 1 : 0;
 }
开发者ID:umair-gujjar,项目名称:PhpMetrics,代码行数:33,代码来源:RunMetricsCommand.php


示例2: yay_parse

function yay_parse(string $source, Directives $directives = null, BlueContext $blueContext = null) : string
{
    if ($gc = gc_enabled()) {
        gc_disable();
    }
    // important optimization!
    static $globalDirectives = null;
    if (null === $globalDirectives) {
        $globalDirectives = new ArrayObject();
    }
    $directives = $directives ?: new Directives();
    $blueContext = $blueContext ?: new BlueContext();
    $cg = (object) ['ts' => TokenStream::fromSource($source), 'directives' => $directives, 'cycle' => new Cycle($source), 'globalDirectives' => $globalDirectives, 'blueContext' => $blueContext];
    foreach ($cg->globalDirectives as $d) {
        $cg->directives->add($d);
    }
    traverse(midrule(function (TokenStream $ts) use($directives, $blueContext) {
        $token = $ts->current();
        tail_call:
        if (null === $token) {
            return;
        }
        // skip when something looks like a new macro to be parsed
        if ('macro' === (string) $token) {
            return;
        }
        // here we do the 'magic' to match and expand userland macros
        $directives->apply($ts, $token, $blueContext);
        $token = $ts->next();
        goto tail_call;
    }), consume(chain(token(T_STRING, 'macro')->as('declaration'), optional(repeat(rtoken('/^·\\w+$/')))->as('tags'), lookahead(token('{')), commit(chain(braces()->as('pattern'), operator('>>'), braces()->as('expansion')))->as('body'), optional(token(';'))), CONSUME_DO_TRIM)->onCommit(function (Ast $macroAst) use($cg) {
        $scope = Map::fromEmpty();
        $tags = Map::fromValues(array_map('strval', $macroAst->{'tags'}));
        $pattern = new Pattern($macroAst->{'declaration'}->line(), $macroAst->{'body pattern'}, $tags, $scope);
        $expansion = new Expansion($macroAst->{'body expansion'}, $tags, $scope);
        $macro = new Macro($tags, $pattern, $expansion, $cg->cycle);
        $cg->directives->add($macro);
        // allocate the userland macro
        // allocate the userland macro globally if it's declared as global
        if ($macro->tags()->contains('·global')) {
            $cg->globalDirectives[] = $macro;
        }
    }))->parse($cg->ts);
    $expansion = (string) $cg->ts;
    if ($gc) {
        gc_enable();
    }
    return $expansion;
}
开发者ID:lastguest,项目名称:yay,代码行数:49,代码来源:yay_parse.php


示例3: processContent

 /**
  * @inheritdoc
  * @throws ContentProcessorException
  */
 public function processContent(File $asset)
 {
     $path = $asset->getPath();
     try {
         $parser = new \Less_Parser(['relativeUrls' => false, 'compress' => $this->appState->getMode() !== State::MODE_DEVELOPER]);
         $content = $this->assetSource->getContent($asset);
         if (trim($content) === '') {
             return '';
         }
         $tmpFilePath = $this->temporaryFile->createFile($path, $content);
         gc_disable();
         $parser->parseFile($tmpFilePath, '');
         $content = $parser->getCss();
         gc_enable();
         if (trim($content) === '') {
             $errorMessage = PHP_EOL . self::ERROR_MESSAGE_PREFIX . PHP_EOL . $path;
             $this->logger->critical($errorMessage);
             throw new ContentProcessorException(new Phrase($errorMessage));
         }
         return $content;
     } catch (\Exception $e) {
         $errorMessage = PHP_EOL . self::ERROR_MESSAGE_PREFIX . PHP_EOL . $path . PHP_EOL . $e->getMessage();
         $this->logger->critical($errorMessage);
         throw new ContentProcessorException(new Phrase($errorMessage));
     }
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:30,代码来源:Processor.php


示例4: run

 /**
  * Runtime of Worker process.
  * @return void
  */
 protected function run()
 {
     if (Daemon::$process instanceof Master) {
         Daemon::$process->unregisterSignals();
     }
     EventLoop::init();
     Daemon::$process = $this;
     if (Daemon::$logpointerAsync) {
         Daemon::$logpointerAsync->fd = null;
         Daemon::$logpointerAsync = null;
     }
     class_exists('Timer');
     if (Daemon::$config->autogc->value > 0) {
         gc_enable();
     } else {
         gc_disable();
     }
     $this->prepareSystemEnv();
     $this->registerEventSignals();
     FileSystem::init();
     // re-init
     FileSystem::initEvent();
     Daemon::openLogs();
     $this->fileWatcher = new FileWatcher();
     $this->IPCManager = Daemon::$appResolver->getInstanceByAppName('\\PHPDaemon\\IPCManager\\IPCManager');
     if (!$this->IPCManager) {
         $this->log('cannot instantiate IPCManager');
     }
     EventLoop::$instance->run();
 }
开发者ID:kakserpom,项目名称:phpdaemon,代码行数:34,代码来源:IPC.php


示例5: huffman_lookup_init

 private static function huffman_lookup_init()
 {
     gc_disable();
     $encodingAccess = [];
     $terminals = [];
     foreach (self::HUFFMAN_CODE as $chr => $bits) {
         $len = self::HUFFMAN_CODE_LENGTHS[$chr];
         for ($bit = 0; $bit < 8; $bit++) {
             $offlen = $len + $bit;
             $next =& $encodingAccess[$bit];
             for ($byte = (int) (($offlen - 1) / 8); $byte > 0; $byte--) {
                 $cur = \str_pad(\decbin($bits >> $byte * 8 - (0x30 - $offlen) % 8 & 0xff), 8, "0", STR_PAD_LEFT);
                 if (isset($next[$cur]) && $next[$cur][0] != $encodingAccess[0]) {
                     $next =& $next[$cur][0];
                 } else {
                     $tmp =& $next;
                     unset($next);
                     $tmp[$cur] = [&$next, null];
                 }
             }
             $key = \str_pad(\decbin($bits & (1 << ($offlen - 1) % 8 + 1) - 1), ($offlen - 1) % 8 + 1, "0", STR_PAD_LEFT);
             $next[$key] = [null, $chr > 0xff ? "" : \chr($chr)];
             if ($offlen % 8) {
                 $terminals[$offlen % 8][] = [$key, &$next];
             } else {
                 $next[$key][0] =& $encodingAccess[0];
             }
         }
     }
     $memoize = [];
     for ($off = 7; $off > 0; $off--) {
         foreach ($terminals[$off] as &$terminal) {
             $key = $terminal[0];
             $next =& $terminal[1];
             if ($next[$key][0] === null) {
                 foreach ($encodingAccess[$off] as $chr => &$cur) {
                     $next[($memoize[$key] ?? ($memoize[$key] = \str_pad($key, 8, "0", STR_PAD_RIGHT))) | $chr] = [&$cur[0], $next[$key][1] != "" ? $next[$key][1] . $cur[1] : ""];
                 }
                 unset($next[$key]);
             }
         }
     }
     $memoize = [];
     for ($off = 7; $off > 0; $off--) {
         foreach ($terminals[$off] as &$terminal) {
             $next =& $terminal[1];
             foreach ($next as $k => $v) {
                 if (\strlen($k) != 1) {
                     $next[$memoize[$k] ?? ($memoize[$k] = \chr(\bindec($k)))] = $v;
                     unset($next[$k]);
                 }
             }
         }
     }
     unset($tmp, $cur, $next, $terminals, $terminal);
     gc_enable();
     gc_collect_cycles();
     return $encodingAccess[0];
 }
开发者ID:amphp,项目名称:aerys,代码行数:59,代码来源:HPack.php


示例6: __construct

 public function __construct($bridgeName = null, $appBootstrap, array $config = [])
 {
     gc_disable();
     $this->config = $config;
     $this->appBootstrap = $appBootstrap;
     $this->bridgeName = $bridgeName;
     $this->run();
 }
开发者ID:marcj,项目名称:php-pm,代码行数:8,代码来源:ProcessSlave.php


示例7: execute

 /**
  * @inheritdoc
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $output->writeln('PHPMetrics by Jean-François Lépine <https://twitter.com/Halleck45>');
     $output->writeln('');
     // config
     $configFactory = new ConfigFactory();
     $config = $configFactory->factory($input);
     // files
     if (null === $config->getPath()->getBasePath()) {
         throw new \LogicException('Please provide a path to analyze');
     }
     // files to analyze
     $finder = new Finder($config->getPath()->getExtensions(), $config->getPath()->getExcludedDirs(), $config->getPath()->isFollowSymlinks() ? Finder::FOLLOW_SYMLINKS : null);
     // prepare plugins
     $repository = new Repository();
     foreach ($config->getExtensions()->getExtensions() as $filename) {
         if (!file_exists($filename) || !is_readable($filename)) {
             $output->writeln(sprintf('<error>Plugin %s skipped: not found</error>', $filename));
             continue;
         }
         $plugin = (require_once $filename);
         $repository->attach($plugin);
     }
     $extensionService = new ExtensionService($repository);
     // prepare structures
     $bounds = new Bounds();
     $collection = new ResultCollection();
     $aggregatedResults = new ResultCollection();
     // execute analyze
     $queueFactory = new QueueAnalyzeFactory($input, $output, $config, $extensionService);
     $queue = $queueFactory->factory($finder, $bounds);
     gc_disable();
     $queue->execute($collection, $aggregatedResults);
     gc_enable();
     $output->writeln('');
     // provide data to extensions
     if (($n = sizeof($repository->all())) > 0) {
         $output->writeln(sprintf('%d %s. Executing analyzis', $n, $n > 1 ? 'plugins are enabled' : 'plugin is enabled'));
         $extensionService->receive($config, $collection, $aggregatedResults, $bounds);
     }
     // generating reports
     $output->writeln("Generating reports...");
     $queueFactory = new QueueReportFactory($input, $output, $config, $extensionService);
     $queue = $queueFactory->factory($finder, $bounds);
     $queue->execute($collection, $aggregatedResults);
     $output->writeln('<info>Done</info>');
     // evaluation of success
     $rule = $config->getFailureCondition();
     if (null !== $rule) {
         $evaluator = new Evaluator($collection, $aggregatedResults, $bounds);
         $result = $evaluator->evaluate($rule);
         // fail if failure-condition is realized
         return $result->isValid() ? 1 : 0;
     }
     return 0;
 }
开发者ID:YuraLukashik,项目名称:PhpMetrics,代码行数:59,代码来源:RunMetricsCommand.php


示例8: setUp

 protected function setUp()
 {
     parent::setUp();
     // disable GC while https://bugs.php.net/bug.php?id=63677 is still open
     // If GC enabled, Gmagick unit tests fail
     gc_disable();
     if (!class_exists('Gmagick')) {
         $this->markTestSkipped('Gmagick is not installed');
     }
 }
开发者ID:Danack,项目名称:Imagine,代码行数:10,代码来源:ImageTest.php


示例9: gc

 /**
  * Gc
  */
 private function gc()
 {
     if (gc_enabled()) {
         gc_collect_cycles();
     } else {
         gc_enable();
         gc_collect_cycles();
         gc_disable();
     }
 }
开发者ID:gridguyz,项目名称:zork,代码行数:13,代码来源:AbstractHttpControllerTestCase.php


示例10: clean

 public static function clean($print = false)
 {
     gc_enable();
     // Enable Garbage Collector
     if ($print) {
         AppLog::log(gc_collect_cycles() . " garbage cycles cleaned");
         // # of elements cleaned up
     }
     gc_disable();
     // Disable Garbage Collector
 }
开发者ID:florinp,项目名称:dexonline,代码行数:11,代码来源:MemoryManagement.php


示例11: formatCode

 public function formatCode($source = '')
 {
     gc_enable();
     $passes = array_map(function ($pass) {
         return clone $pass;
     }, $this->passes);
     while ($pass = array_shift($passes)) {
         $source = $pass->format($source);
         gc_collect_cycles();
     }
     gc_disable();
     return $source;
 }
开发者ID:nipsongarrido,项目名称:php.tools,代码行数:13,代码来源:refactor.src.php


示例12: doBench

 private static function doBench(callable $func, array $args)
 {
     gc_collect_cycles();
     gc_disable();
     usleep(0);
     $t = microtime(true);
     for ($i = self::$iterations; $i >= 0; --$i) {
         call_user_func_array($func, $args);
     }
     $t = microtime(true) - $t;
     gc_enable();
     gc_collect_cycles();
     usleep(0);
     return round($t * 1000000 / self::$iterations, 3);
 }
开发者ID:intaro,项目名称:hstore-extension,代码行数:15,代码来源:Benchmark.php


示例13: execute

 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     gc_disable();
     $this->output = $output;
     $this->router->getContext()->setScheme($this->config['scheme']);
     $this->router->getContext()->setHost($this->config['host']);
     $start = time();
     $name = $input->getOption('name');
     if ($name && !$this->runSingleSitemap($name)) {
         return 1;
     } else {
         $this->runMultiSitemaps();
     }
     $this->output->writeln($this->getHelper('formatter')->formatBlock(['[Info]', sprintf('Mission Accomplished in %d s', time() - $start)], ConsoleLogger::INFO));
     return 0;
 }
开发者ID:skuola,项目名称:SitemapBundle,代码行数:19,代码来源:SitemapGeneratorCommand.php


示例14: timeExec

 protected static function timeExec(callable $code, $rounds)
 {
     $gc_enabled = gc_enabled();
     if ($gc_enabled) {
         gc_disable();
     }
     $start = microtime(TRUE);
     for ($i = 0; $i < $rounds; $i++) {
         $code();
     }
     $end = microtime(TRUE);
     if ($gc_enabled) {
         gc_enable();
     }
     return $end - $start;
 }
开发者ID:flaviovs,项目名称:timeit,代码行数:16,代码来源:Timer.php


示例15: install

 function install($diff)
 {
     if (!file_exists($diff)) {
         return;
     }
     gc_enable();
     $root = __DIR__ . "/../../";
     $archive = new ZipArchive();
     $archive->open($diff);
     $bower = $archive->locateName("bower.json");
     $webDir = $root . "web";
     if (!file_exists($webDir)) {
         mkdir($webDir);
     }
     $privateDir = $root . "private";
     if (!file_exists($privateDir)) {
         mkdir($privateDir);
     }
     if ($bower) {
         $bowerDir = $root . "web/vendor";
         if (file_exists($bowerDir)) {
             $this->rrmdir($bowerDir);
         }
         mkdir($bowerDir);
     }
     $composer = $archive->locateName("composer.json");
     if ($composer) {
         $composerDir = $root . "private/vendor";
         if (file_exists($composerDir)) {
             $this->rrmdir($composerDir);
         }
         mkdir($composerDir);
     }
     $tempDir = $root . "private/temp";
     $this->rrmdir($tempDir);
     mkdir($tempDir);
     $archive->extractTo($root);
     @unlink($diff);
     unset($archive);
     gc_collect_cycles();
     gc_disable();
 }
开发者ID:AppsDevTeam,项目名称:ziploy,代码行数:42,代码来源:DiffInstaller.php


示例16: generateProjectIndex

 public function generateProjectIndex(Project $project)
 {
     // You know what this mean
     gc_disable();
     $index = $project->getIndex();
     $globalTime = 0;
     $done = 0;
     $files = $this->filesFinder->getProjectFiles($project);
     $all = count($files);
     foreach ($files as $file) {
         $start = microtime(1);
         $this->processFile($index, $file, false, false);
         $end = microtime(1) - $start;
         $this->getLogger()->debug("Indexing: [{$end}]s");
         $this->getLogger()->debug("Memory: " . memory_get_usage());
         $globalTime += $end;
         ++$done;
         $process = floor($done / $all * 100);
         $this->getLogger()->info("Progress: {$process}%");
     }
     $this->getLogger()->info("[ {$globalTime} ]");
     gc_enable();
 }
开发者ID:nevernet,项目名称:padawan.php,代码行数:23,代码来源:IndexGenerator.php


示例17: __Destruct

 /**
  * Metodo Magico
  * __Destruct()
  * 
  * Proceso de liberacion de memoria, se genera el proceso del garbage collector para una eliminacion de datos mas eficiente
  * @access private
  */
 function __Destruct()
 {
     gc_enable();
     $this->MatrizAccesos;
     $this->MatrizErrores;
     gc_collect_cycles();
     gc_disable();
 }
开发者ID:alejofix,项目名称:Mejoramiento,代码行数:15,代码来源:Bootstrap.php


示例18: run

 /**
  * Run installation (or update)
  *
  * @throws \Exception
  * @return int        0 on success or a positive error code on failure
  */
 public function run()
 {
     // Disable GC to save CPU cycles, as the dependency solver can create hundreds of thousands
     // of PHP objects, the GC can spend quite some time walking the tree of references looking
     // for stuff to collect while there is nothing to collect. This slows things down dramatically
     // and turning it off results in much better performance. Do not try this at home however.
     gc_collect_cycles();
     gc_disable();
     // Force update if there is no lock file present
     if (!$this->update && !$this->locker->isLocked()) {
         $this->update = true;
     }
     if ($this->dryRun) {
         $this->verbose = true;
         $this->runScripts = false;
         $this->installationManager->addInstaller(new NoopInstaller());
         $this->mockLocalRepositories($this->repositoryManager);
     }
     if ($this->runScripts) {
         // dispatch pre event
         $eventName = $this->update ? ScriptEvents::PRE_UPDATE_CMD : ScriptEvents::PRE_INSTALL_CMD;
         $this->eventDispatcher->dispatchScript($eventName, $this->devMode);
     }
     $this->downloadManager->setPreferSource($this->preferSource);
     $this->downloadManager->setPreferDist($this->preferDist);
     // create installed repo, this contains all local packages + platform packages (php & extensions)
     $localRepo = $this->repositoryManager->getLocalRepository();
     if ($this->update) {
         $platformOverrides = $this->config->get('platform') ?: array();
     } else {
         $platformOverrides = $this->locker->getPlatformOverrides();
     }
     $platformRepo = new PlatformRepository(array(), $platformOverrides);
     $installedRepo = $this->createInstalledRepo($localRepo, $platformRepo);
     $aliases = $this->getRootAliases();
     $this->aliasPlatformPackages($platformRepo, $aliases);
     if (!$this->suggestedPackagesReporter) {
         $this->suggestedPackagesReporter = new SuggestedPackagesReporter($this->io);
     }
     try {
         list($res, $devPackages) = $this->doInstall($localRepo, $installedRepo, $platformRepo, $aliases);
         if ($res !== 0) {
             return $res;
         }
     } catch (\Exception $e) {
         if (!$this->dryRun) {
             $this->installationManager->notifyInstalls($this->io);
         }
         throw $e;
     }
     if (!$this->dryRun) {
         $this->installationManager->notifyInstalls($this->io);
     }
     // output suggestions if we're in dev mode
     if ($this->devMode && !$this->skipSuggest) {
         $this->suggestedPackagesReporter->output($installedRepo);
     }
     # Find abandoned packages and warn user
     foreach ($localRepo->getPackages() as $package) {
         if (!$package instanceof CompletePackage || !$package->isAbandoned()) {
             continue;
         }
         $replacement = is_string($package->getReplacementPackage()) ? 'Use ' . $package->getReplacementPackage() . ' instead' : 'No replacement was suggested';
         $this->io->writeError(sprintf("<warning>Package %s is abandoned, you should avoid using it. %s.</warning>", $package->getPrettyName(), $replacement));
     }
     if (!$this->dryRun) {
         // write lock
         if ($this->update) {
             $localRepo->reload();
             $platformReqs = $this->extractPlatformRequirements($this->package->getRequires());
             $platformDevReqs = $this->extractPlatformRequirements($this->package->getDevRequires());
             $updatedLock = $this->locker->setLockData(array_diff($localRepo->getCanonicalPackages(), $devPackages), $devPackages, $platformReqs, $platformDevReqs, $aliases, $this->package->getMinimumStability(), $this->package->getStabilityFlags(), $this->preferStable || $this->package->getPreferStable(), $this->preferLowest, $this->config->get('platform') ?: array());
             if ($updatedLock) {
                 $this->io->writeError('<info>Writing lock file</info>');
             }
         }
         if ($this->dumpAutoloader) {
             // write autoloader
             if ($this->optimizeAutoloader) {
                 $this->io->writeError('<info>Generating optimized autoload files</info>');
             } else {
                 $this->io->writeError('<info>Generating autoload files</info>');
             }
             $this->autoloadGenerator->setDevMode($this->devMode);
             $this->autoloadGenerator->setClassMapAuthoritative($this->classMapAuthoritative);
             $this->autoloadGenerator->setRunScripts($this->runScripts);
             $this->autoloadGenerator->dump($this->config, $localRepo, $this->package, $this->installationManager, 'composer', $this->optimizeAutoloader);
         }
         if ($this->runScripts) {
             $devMode = (int) $this->devMode;
             putenv("COMPOSER_DEV_MODE={$devMode}");
             // dispatch post event
             $eventName = $this->update ? ScriptEvents::POST_UPDATE_CMD : ScriptEvents::POST_INSTALL_CMD;
             $this->eventDispatcher->dispatchScript($eventName, $this->devMode);
//.........这里部分代码省略.........
开发者ID:Rudloff,项目名称:composer,代码行数:101,代码来源:Installer.php


示例19: run

 /**
  * Starts the main loop. Blocks.
  */
 public function run()
 {
     Debug::enable();
     gc_disable();
     //necessary, since connections will be dropped without reasons after several hundred connections.
     $this->loop = \React\EventLoop\Factory::create();
     $this->controller = new \React\Socket\Server($this->loop);
     $this->controller->on('connection', array($this, 'onSlaveConnection'));
     $this->controller->listen(5500);
     $this->web = new \React\Socket\Server($this->loop);
     $this->web->on('connection', array($this, 'onWeb'));
     $this->web->listen($this->port, $this->host);
     $this->tcpConnector = new \React\SocketClient\TcpConnector($this->loop);
     $pcntl = new \MKraemer\ReactPCNTL\PCNTL($this->loop);
     $pcntl->on(SIGTERM, [$this, 'shutdown']);
     $pcntl->on(SIGINT, [$this, 'shutdown']);
     if ($this->isDebug()) {
         $this->loop->addPeriodicTimer(0.5, function () {
             $this->checkChangedFiles();
         });
     }
     $this->isRunning = true;
     $loopClass = (new \ReflectionClass($this->loop))->getShortName();
     $this->output->writeln("<info>Starting PHP-PM with {$this->slaveCount} workers, using {$loopClass} ...</info>");
     for ($i = 0; $i < $this->slaveCount; $i++) {
         $this->newInstance(5501 + $i);
     }
     $this->loop->run();
 }
开发者ID:marcj,项目名称:php-pm,代码行数:32,代码来源:ProcessManager.php


示例20: run

 /**
  * Run installation (or update)
  *
  * @throws \Exception
  * @return int        0 on success or a positive error code on failure
  */
 public function run()
 {
     // Disable GC to save CPU cycles, as the dependency solver can create hundreds of thousands
     // of PHP objects, the GC can spend quite some time walking the tree of references looking
     // for stuff to collect while there is nothing to collect. This slows things down dramatically
     // and turning it off results in much better performance. Do not try this at home however.
     gc_collect_cycles();
     gc_disable();
     if ($this->dryRun) {
         $this->verbose = true;
         $this->runScripts = false;
         $this->installationManager->addInstaller(new NoopInstaller());
         $this->mockLocalRepositories($this->repositoryManager);
     }
     if ($this->runScripts) {
         // dispatch pre event
         $eventName = $this->update ? ScriptEvents::PRE_UPDATE_CMD : ScriptEvents::PRE_INSTALL_CMD;
         $this->eventDispatcher->dispatchScript($eventName, $this->devMode);
     }
     $this->downloadManager->setPreferSource($this->preferSource);
     $this->downloadManager->setPreferDist($this->preferDist);
     // clone root package to have one in the installed repo that does not require anything
     // we don't want it to be uninstallable, but its requirements should not conflict
     // with the lock file for example
     $installedRootPackage = clone $this->package;
     $installedRootPackage->setRequires(array());
     $installedRootPackage->setDevRequires(array());
     // create installed repo, this contains all local packages + platform packages (php & extensions)
     $localRepo = $this->repositoryManager->getLocalRepository();
     if (!$this->update && $this->locker->isLocked()) {
         $platformOverrides = $this->locker->getPlatformOverrides();
     } else {
         $platformOverrides = $this->config->get('platform') ?: array();
     }
     $platformRepo = new PlatformRepository(array(), $platformOverrides);
     $repos = array($localRepo, new InstalledArrayRepository(array($installedRootPackage)), $platformRepo);
     $installedRepo = new CompositeRepository($repos);
     if ($this->additionalInstalledRepository) {
         $installedRepo->addRepository($this->additionalInstalledRepository);
     }
     $aliases = $this->getRootAliases();
     $this->aliasPlatformPackages($platformRepo, $aliases);
     try {
         $this->suggestedPackages = array();
         $res = $this->doInstall($localRepo, $installedRepo, $platformRepo, $aliases, $this->devMode);
         if ($res !== 0) {
             return $res;
         }
     } catch (\Exception $e) {
         if (!$this->dryRun) {
             $this->installationManager->notifyInstalls($this->io);
         }
         throw $e;
     }
     if (!$this->dryRun) {
         $this->installationManager->notifyInstalls($this->io);
     }
     // output suggestions if we're in dev mode
     if ($this->devMode) {
         foreach ($this->suggestedPackages as $suggestion) {
             $target = $suggestion['target'];
             foreach ($installedRepo->getPackages() as $package) {
                 if (in_array($target, $package->getNames())) {
                     continue 2;
                 }
             }
             $this->io->writeError($suggestion['source'] . ' suggests installing ' . $suggestion['target'] . ' (' . $suggestion['reason'] . ')');
         }
     }
     # Find abandoned packages and warn user
     foreach ($localRepo->getPackages() as $package) {
         if (!$package instanceof CompletePackage || !$package->isAbandoned()) {
             continue;
         }
         $replacement = is_string($package->getReplacementPackage()) ? 'Use ' . $package->getReplacementPackage() . ' instead' : 'No replacement was suggested';
         $this->io->writeError(sprintf("<warning>Package %s is abandoned, you should avoid using it. %s.</warning>", $package->getPrettyName(), $replacement));
     }
     if (!$this->dryRun) {
         // write lock
         if ($this->update || !$this->locker->isLocked()) {
             $localRepo->reload();
             // if this is not run in dev mode and the root has dev requires, the lock must
             // contain null to prevent dev installs from a non-dev lock
             $devPackages = $this->devMode || !$this->package->getDevRequires() ? array() : null;
             // split dev and non-dev requirements by checking what would be removed if we update without the dev requirements
             if ($this->devMode && $this->package->getDevRequires()) {
                 $policy = $this->createPolicy();
                 $pool = $this->createPool(true);
                 $pool->addRepository($installedRepo, $aliases);
                 // creating requirements request
                 $request = $this->createRequest($this->package, $platformRepo);
                 $request->updateAll();
                 foreach ($this->package->getRequires() as $link) {
                     $request->install($link->getTarget(), $link->getConstraint());
//.........这里部分代码省略.........
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:101,代码来源:Installer.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP gc_enable函数代码示例发布时间:2022-05-15
下一篇:
PHP gc_collect_cycles函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap