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

PHP phutil_passthru函数代码示例

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

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



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

示例1: run

 public function run()
 {
     $roots = array();
     $roots['libphutil'] = dirname(phutil_get_library_root('phutil'));
     $roots['arcanist'] = dirname(phutil_get_library_root('arcanist'));
     foreach ($roots as $lib => $root) {
         echo "Upgrading {$lib}...\n";
         if (!Filesystem::pathExists($root . '/.git')) {
             throw new ArcanistUsageException("{$lib} must be in its git working copy to be automatically " . "upgraded. This copy of {$lib} (in '{$root}') is not in a git " . "working copy.");
         }
         $working_copy = ArcanistWorkingCopyIdentity::newFromPath($root);
         $configuration_manager = clone $this->getConfigurationManager();
         $configuration_manager->setWorkingCopyIdentity($working_copy);
         $repository_api = ArcanistRepositoryAPI::newAPIFromConfigurationManager($configuration_manager);
         $this->setRepositoryAPI($repository_api);
         // Require no local changes.
         $this->requireCleanWorkingCopy();
         // Require the library be on master.
         $branch_name = $repository_api->getBranchName();
         if ($branch_name != 'master') {
             throw new ArcanistUsageException("{$lib} must be on branch 'master' to be automatically upgraded. " . "This copy of {$lib} (in '{$root}') is on branch '{$branch_name}'.");
         }
         chdir($root);
         try {
             phutil_passthru('git pull --rebase');
         } catch (Exception $ex) {
             phutil_passthru('git rebase --abort');
             throw $ex;
         }
     }
     echo phutil_console_wrap(phutil_console_format("**Updated!** Your copy of arc is now up to date.\n"));
     return 0;
 }
开发者ID:ivoryxiong,项目名称:arcanist,代码行数:33,代码来源:ArcanistUpgradeWorkflow.php


示例2: run

 public function run()
 {
     $roots = array();
     $roots['libphutil'] = dirname(phutil_get_library_root('phutil'));
     $roots['arcanist'] = dirname(phutil_get_library_root('arcanist'));
     foreach ($roots as $lib => $root) {
         echo "Upgrading {$lib}...\n";
         if (!Filesystem::pathExists($root . '/.git')) {
             throw new ArcanistUsageException("{$lib} must be in its git working copy to be automatically " . "upgraded. This copy of {$lib} (in '{$root}') is not in a git " . "working copy.");
         }
         $working_copy = ArcanistWorkingCopyIdentity::newFromPath($root);
         $repository_api = ArcanistRepositoryAPI::newAPIFromWorkingCopyIdentity($working_copy);
         // Force the range to HEAD^..HEAD, which is meaningless but keeps us
         // from triggering "base" rules or other commit range resolution rules
         // that might prompt the user when we pull the working copy status.
         $repository_api->setRelativeCommit('HEAD^');
         $this->setRepositoryAPI($repository_api);
         // Require no local changes.
         $this->requireCleanWorkingCopy();
         // Require the library be on master.
         $branch_name = $repository_api->getBranchName();
         if ($branch_name != 'master') {
             throw new ArcanistUsageException("{$lib} must be on branch 'master' to be automatically upgraded. " . "This copy of {$lib} (in '{$root}') is on branch '{$branch_name}'.");
         }
         chdir($root);
         try {
             phutil_passthru('git pull --rebase');
         } catch (Exception $ex) {
             phutil_passthru('git rebase --abort');
             throw $ex;
         }
     }
     echo phutil_console_wrap(phutil_console_format("**Updated!** Your copy of arc is now up to date.\n"));
     return 0;
 }
开发者ID:rafikk,项目名称:arcanist,代码行数:35,代码来源:ArcanistUpgradeWorkflow.php


示例3: run

 public function run()
 {
     $roots = array('libphutil' => dirname(phutil_get_library_root('phutil')), 'arcanist' => dirname(phutil_get_library_root('arcanist')));
     foreach ($roots as $lib => $root) {
         echo phutil_console_format("%s\n", pht('Upgrading %s...', $lib));
         $working_copy = ArcanistWorkingCopyIdentity::newFromPath($root);
         $configuration_manager = clone $this->getConfigurationManager();
         $configuration_manager->setWorkingCopyIdentity($working_copy);
         $repository = ArcanistRepositoryAPI::newAPIFromConfigurationManager($configuration_manager);
         if (!Filesystem::pathExists($repository->getMetadataPath())) {
             throw new ArcanistUsageException(pht("%s must be in its git working copy to be automatically upgraded. " . "This copy of %s (in '%s') is not in a git working copy.", $lib, $lib, $root));
         }
         $this->setRepositoryAPI($repository);
         // Require no local changes.
         $this->requireCleanWorkingCopy();
         // Require the library be on master.
         $branch_name = $repository->getBranchName();
         if ($branch_name != 'master') {
             throw new ArcanistUsageException(pht("%s must be on branch '%s' to be automatically upgraded. " . "This copy of %s (in '%s') is on branch '%s'.", $lib, 'master', $lib, $root, $branch_name));
         }
         chdir($root);
         try {
             phutil_passthru('git pull --rebase');
         } catch (Exception $ex) {
             phutil_passthru('git rebase --abort');
             throw $ex;
         }
     }
     echo phutil_console_format("**%s** %s\n", pht('Updated!'), pht('Your copy of arc is now up to date.'));
     return 0;
 }
开发者ID:lewisf,项目名称:arcanist,代码行数:31,代码来源:ArcanistUpgradeWorkflow.php


示例4: handleEvent

 public function handleEvent(PhutilEvent $event)
 {
     $script = self::SCRIPT;
     if (!file_exists($script)) {
         throw new Exception(pht('%s does not exist.', $script));
     }
     if (!is_executable($script)) {
         throw new Exception(pht('%s is not executable.', $script));
     }
     $err = phutil_passthru('%C', $script);
     if ($err) {
         throw new Exception(pht('%s exited with non-zero status: %d.', $script, $err));
     }
 }
开发者ID:rmaz,项目名称:arcanist,代码行数:14,代码来源:UberArcPrePushEventListener.php


示例5: execute

 public function execute(PhutilArgumentParser $args)
 {
     $api = $this->getSingleAPI();
     list($host, $port) = $this->getBareHostAndPort($api->getHost());
     $flag_port = $port ? csprintf('--port %d', $port) : '';
     $flag_password = '';
     $password = $api->getPassword();
     if ($password) {
         if (strlen($password->openEnvelope())) {
             $flag_password = csprintf('--password=%P', $password);
         }
     }
     return phutil_passthru('mysql --protocol=TCP --default-character-set=utf8mb4 ' . '-u %s %C -h %s %C', $api->getUser(), $flag_password, $host, $flag_port);
 }
开发者ID:NeoArmageddon,项目名称:phabricator,代码行数:14,代码来源:PhabricatorStorageManagementShellWorkflow.php


示例6: execute

 public function execute(PhutilArgumentParser $args)
 {
     $api = $this->getAPI();
     $patches = $this->getPatches();
     $applied = $api->getAppliedPatches();
     if ($applied === null) {
         $namespace = $api->getNamespace();
         echo phutil_console_wrap(phutil_console_format("**No Storage**: There is no database storage initialized in this " . "storage namespace ('{$namespace}'). Use '**storage upgrade**' to " . "initialize storage.\n"));
         return 1;
     }
     $databases = $api->getDatabaseList($patches);
     list($host, $port) = $this->getBareHostAndPort($api->getHost());
     $flag_password = $api->getPassword() ? csprintf('-p %s', $api->getPassword()) : '';
     $flag_port = $port ? csprintf('--port %d', $port) : '';
     return phutil_passthru('mysqldump --default-character-set=utf8 ' . '-u %s %C -h %s %C --databases %Ls', $api->getUser(), $flag_password, $host, $flag_port, $databases);
 }
开发者ID:nexeck,项目名称:phabricator,代码行数:16,代码来源:PhabricatorStorageManagementDumpWorkflow.php


示例7: didExecute

 public function didExecute(PhutilArgumentParser $args)
 {
     $api = $this->getAPI();
     $patches = $this->getPatches();
     $console = PhutilConsole::getConsole();
     $applied = $api->getAppliedPatches();
     if ($applied === null) {
         $namespace = $api->getNamespace();
         $console->writeErr(pht('**Storage Not Initialized**: There is no database storage ' . 'initialized in this storage namespace ("%s"). Use ' . '**%s** to initialize storage.', $namespace, './bin/storage upgrade'));
         return 1;
     }
     $databases = $api->getDatabaseList($patches, true);
     list($host, $port) = $this->getBareHostAndPort($api->getHost());
     $has_password = false;
     $password = $api->getPassword();
     if ($password) {
         if (strlen($password->openEnvelope())) {
             $has_password = true;
         }
     }
     $argv = array();
     $argv[] = '--hex-blob';
     $argv[] = '--single-transaction';
     $argv[] = '--default-character-set=utf8';
     if ($args->getArg('for-replica')) {
         $argv[] = '--master-data';
     }
     $argv[] = '-u';
     $argv[] = $api->getUser();
     $argv[] = '-h';
     $argv[] = $host;
     if ($port) {
         $argv[] = '--port';
         $argv[] = $port;
     }
     $argv[] = '--databases';
     foreach ($databases as $database) {
         $argv[] = $database;
     }
     if ($has_password) {
         $err = phutil_passthru('mysqldump -p%P %Ls', $password, $argv);
     } else {
         $err = phutil_passthru('mysqldump %Ls', $argv);
     }
     return $err;
 }
开发者ID:rchicoli,项目名称:phabricator,代码行数:46,代码来源:PhabricatorStorageManagementDumpWorkflow.php


示例8: execute

 public function execute(PhutilArgumentParser $args)
 {
     $console = PhutilConsole::getConsole();
     $console->getServer()->setEnableLog(true);
     PhabricatorLDAPAuthProvider::assertLDAPExtensionInstalled();
     $provider = PhabricatorLDAPAuthProvider::getLDAPProvider();
     if (!$provider) {
         $console->writeOut("%s\n", pht('The LDAP authentication provider is not enabled.'));
         exit(1);
     }
     if (!function_exists('ldap_connect')) {
         $console->writeOut("%s\n", pht('The LDAP extension is not enabled.'));
         exit(1);
     }
     $adapter = $provider->getAdapter();
     $console->writeOut("%s\n", pht('Enter LDAP Credentials'));
     $username = phutil_console_prompt(pht('LDAP Username: '));
     if (!strlen($username)) {
         throw new PhutilArgumentUsageException(pht('You must enter an LDAP username.'));
     }
     phutil_passthru('stty -echo');
     $password = phutil_console_prompt(pht('LDAP Password: '));
     phutil_passthru('stty echo');
     if (!strlen($password)) {
         throw new PhutilArgumentUsageException(pht('You must enter an LDAP password.'));
     }
     $adapter->setLoginUsername($username);
     $adapter->setLoginPassword(new PhutilOpaqueEnvelope($password));
     $console->writeOut("\n");
     $console->writeOut("%s\n", pht('Connecting to LDAP...'));
     $account_id = $adapter->getAccountID();
     if ($account_id) {
         $console->writeOut("%s\n", pht('Found LDAP Account: %s', $account_id));
     } else {
         $console->writeOut("%s\n", pht('Unable to find LDAP account!'));
     }
     return 0;
 }
开发者ID:truSense,项目名称:phabricator,代码行数:38,代码来源:PhabricatorAuthManagementLDAPWorkflow.php


示例9: run

 public function run()
 {
     $repository_api = $this->getRepositoryAPI();
     $project_root = $this->getWorkingCopy()->getProjectRoot();
     $in_paths = $this->getArgument('paths');
     $paths = array();
     foreach ($in_paths as $key => $path) {
         $full_path = Filesystem::resolvePath($path);
         $paths[$key] = Filesystem::readablePath($full_path, $project_root);
     }
     if (!$paths) {
         throw new ArcanistUsageException("Specify a path to browse");
     }
     $base_uri = $this->getBaseURI();
     $browser = $this->getBrowserCommand();
     foreach ($paths as $path) {
         $ret_code = phutil_passthru("%s %s", $browser, $base_uri . $path);
         if ($ret_code) {
             throw new ArcanistUsageException("It seems we failed to open the browser; Perhaps you should try to " . "set the 'browser' config option. The command we tried to use was: " . $browser);
         }
     }
     return 0;
 }
开发者ID:chaozhang80,项目名称:tool-package,代码行数:23,代码来源:ArcanistBrowseWorkflow.php


示例10: execute

 public function execute(PhutilArgumentParser $args)
 {
     $console = PhutilConsole::getConsole();
     $api = $this->getAPI();
     $patches = $this->getPatches();
     $applied = $api->getAppliedPatches();
     if ($applied === null) {
         $namespace = $api->getNamespace();
         $console->writeErr(pht('**Storage Not Initialized**: There is no database storage ' . 'initialized in this storage namespace ("%s"). Use ' . '**%s** to initialize storage.', $namespace, 'storage upgrade'));
         return 1;
     }
     $databases = $api->getDatabaseList($patches, $only_living = true);
     list($host, $port) = $this->getBareHostAndPort($api->getHost());
     $flag_password = '';
     $password = $api->getPassword();
     if ($password) {
         if (strlen($password->openEnvelope())) {
             $flag_password = csprintf('-p%P', $password);
         }
     }
     $flag_port = $port ? csprintf('--port %d', $port) : '';
     return phutil_passthru('mysqldump --hex-blob --single-transaction --default-character-set=utf8 ' . '-u %s %C -h %s %C --databases %Ls', $api->getUser(), $flag_password, $host, $flag_port, $databases);
 }
开发者ID:fengshao0907,项目名称:phabricator,代码行数:23,代码来源:PhabricatorStorageManagementDumpWorkflow.php


示例11: foreach

} else {
    $have_optipng = true;
}
foreach ($sheets as $name => $sheet) {
    $sheet->setBasePath($root);
    $manifest_path = $root . '/resources/sprite/manifest/' . $name . '.json';
    if (!$args->getArg('force')) {
        if (Filesystem::pathExists($manifest_path)) {
            $data = Filesystem::readFile($manifest_path);
            $data = json_decode($data, true);
            if (!$sheet->needsRegeneration($data)) {
                continue;
            }
        }
    }
    $sheet->generateCSS($webroot . "/css/sprite-{$name}.css")->generateManifest($root . "/resources/sprite/manifest/{$name}.json");
    foreach ($sheet->getScales() as $scale) {
        if ($scale == 1) {
            $sheet_name = "sprite-{$name}.png";
        } else {
            $sheet_name = "sprite-{$name}-X{$scale}.png";
        }
        $full_path = "{$webroot}/image/{$sheet_name}";
        $sheet->generateImage($full_path, $scale);
        if ($have_optipng) {
            echo "Optimizing...\n";
            phutil_passthru('optipng -o7 -clobber %s', $full_path);
        }
    }
}
echo "Done.\n";
开发者ID:denghp,项目名称:phabricator,代码行数:31,代码来源:generate_sprites.php


示例12: launchDaemon

 public function launchDaemon($daemon, array $argv, $debug = false)
 {
     $symbols = $this->loadAvailableDaemonClasses();
     $symbols = ipull($symbols, 'name', 'name');
     if (empty($symbols[$daemon])) {
         throw new Exception("Daemon '{$daemon}' is not loaded, misspelled or abstract.");
     }
     $libphutil_root = dirname(phutil_get_library_root('phutil'));
     $launch_daemon = $libphutil_root . '/scripts/daemon/';
     foreach ($argv as $key => $arg) {
         $argv[$key] = escapeshellarg($arg);
     }
     $flags = array();
     if ($debug || PhabricatorEnv::getEnvConfig('phd.trace')) {
         $flags[] = '--trace';
     }
     if ($debug || PhabricatorEnv::getEnvConfig('phd.verbose')) {
         $flags[] = '--verbose';
     }
     if (!$debug) {
         $flags[] = '--daemonize';
     }
     $bootloader = PhutilBootloader::getInstance();
     foreach ($bootloader->getAllLibraries() as $library) {
         if ($library == 'phutil') {
             // No need to load libphutil, it's necessarily loaded implicitly by the
             // daemon itself.
             continue;
         }
         $flags[] = csprintf('--load-phutil-library=%s', phutil_get_library_root($library));
     }
     $flags[] = csprintf('--conduit-uri=%s', PhabricatorEnv::getURI('/api/'));
     if (!$debug) {
         $log_file = $this->getLogDirectory() . '/daemons.log';
         $flags[] = csprintf('--log=%s', $log_file);
     }
     $pid_dir = $this->getPIDDirectory();
     // TODO: This should be a much better user experience.
     Filesystem::assertExists($pid_dir);
     Filesystem::assertIsDirectory($pid_dir);
     Filesystem::assertWritable($pid_dir);
     $flags[] = csprintf('--phd=%s', $pid_dir);
     $command = csprintf('./launch_daemon.php %s %C %C', $daemon, implode(' ', $flags), implode(' ', $argv));
     if ($debug) {
         // Don't terminate when the user sends ^C; it will be sent to the
         // subprocess which will terminate normally.
         pcntl_signal(SIGINT, array('PhabricatorDaemonControl', 'ignoreSignal'));
         echo "\n    libphutil/scripts/daemon/ \$ {$command}\n\n";
         phutil_passthru('(cd %s && exec %C)', $launch_daemon, $command);
     } else {
         $future = new ExecFuture('exec %C', $command);
         // Play games to keep 'ps' looking reasonable.
         $future->setCWD($launch_daemon);
         $future->resolvex();
     }
 }
开发者ID:nexeck,项目名称:phabricator,代码行数:56,代码来源:PhabricatorDaemonControl.php


示例13: phutil_console_prompt

        $email = phutil_console_prompt(pht('Enter user email address:'));
        $duplicate = id(new PhabricatorUserEmail())->loadOneWhere('address = %s', $email);
        if ($duplicate) {
            echo pht("ERROR: There is already a user with that email address. " . "Each user must have a unique email address.\n");
        } else {
            break;
        }
    } while (true);
    $create_email = $email;
}
$changed_pass = false;
// This disables local echo, so the user's password is not shown as they type
// it.
phutil_passthru('stty -echo');
$password = phutil_console_prompt(pht('Enter a password for this user [blank to leave unchanged]:'));
phutil_passthru('stty echo');
if (strlen($password)) {
    $changed_pass = $password;
}
$is_system_agent = $user->getIsSystemAgent();
$set_system_agent = phutil_console_confirm(pht('Is this user a bot?'), $default_no = !$is_system_agent);
$verify_email = null;
$set_verified = false;
// Allow administrators to verify primary email addresses at this time in edit
// scenarios. (Create will work just fine from here as we auto-verify email
// on create.)
if (!$is_new) {
    $verify_email = $user->loadPrimaryEmail();
    if (!$verify_email->getIsVerified()) {
        $set_verified = phutil_console_confirm(pht('Should the primary email address be verified?'), $default_no = true);
    } else {
开发者ID:truSense,项目名称:phabricator,代码行数:31,代码来源:account_admin.php


示例14: selectWorkflow

 public final function selectWorkflow(&$command, array &$args, ArcanistConfigurationManager $configuration_manager, PhutilConsole $console)
 {
     // First, try to build a workflow with the exact name provided. We always
     // pick an exact match, and do not allow aliases to override it.
     $workflow = $this->buildWorkflow($command);
     if ($workflow) {
         return $workflow;
     }
     // If the user has an alias, like 'arc alias dhelp diff help', look it up
     // and substitute it. We do this only after trying to resolve the workflow
     // normally to prevent you from doing silly things like aliasing 'alias'
     // to something else.
     $aliases = ArcanistAliasWorkflow::getAliases($configuration_manager);
     list($new_command, $args) = ArcanistAliasWorkflow::resolveAliases($command, $this, $args, $configuration_manager);
     $full_alias = idx($aliases, $command, array());
     $full_alias = implode(' ', $full_alias);
     // Run shell command aliases.
     if (ArcanistAliasWorkflow::isShellCommandAlias($new_command)) {
         $shell_cmd = substr($full_alias, 1);
         $console->writeLog("[%s: 'arc %s' -> \$ %s]", pht('alias'), $command, $shell_cmd);
         if ($args) {
             $err = phutil_passthru('%C %Ls', $shell_cmd, $args);
         } else {
             $err = phutil_passthru('%C', $shell_cmd);
         }
         exit($err);
     }
     // Run arc command aliases.
     if ($new_command) {
         $workflow = $this->buildWorkflow($new_command);
         if ($workflow) {
             $console->writeLog("[%s: 'arc %s' -> 'arc %s']\n", pht('alias'), $command, $full_alias);
             $command = $new_command;
             return $workflow;
         }
     }
     $all = array_keys($this->buildAllWorkflows());
     // We haven't found a real command or an alias, so try to locate a command
     // by unique prefix.
     $prefixes = $this->expandCommandPrefix($command, $all);
     if (count($prefixes) == 1) {
         $command = head($prefixes);
         return $this->buildWorkflow($command);
     } else {
         if (count($prefixes) > 1) {
             $this->raiseUnknownCommand($command, $prefixes);
         }
     }
     // We haven't found a real command, alias, or unique prefix. Try similar
     // spellings.
     $corrected = self::correctCommandSpelling($command, $all, 2);
     if (count($corrected) == 1) {
         $console->writeErr(pht("(Assuming '%s' is the British spelling of '%s'.)", $command, head($corrected)) . "\n");
         $command = head($corrected);
         return $this->buildWorkflow($command);
     } else {
         if (count($corrected) > 1) {
             $this->raiseUnknownCommand($command, $corrected);
         }
     }
     $this->raiseUnknownCommand($command);
 }
开发者ID:sophie-nextdoor,项目名称:arcanist,代码行数:62,代码来源:ArcanistConfiguration.php


示例15: push

 private function push()
 {
     $repository_api = $this->getRepositoryAPI();
     if ($this->isGit) {
         $repository_api->execxLocal('commit -F %s', $this->messageFile);
     } else {
         if ($this->isHg) {
             // hg rebase produces a commit earlier as part of rebase
             if (!$this->useSquash) {
                 $repository_api->execxLocal('commit --logfile %s', $this->messageFile);
             }
         }
     }
     // We dispatch this event so we can run checks on the merged revision, right
     // before it gets pushed out. It's easier to do this in arc land than to
     // try to hook into git/hg.
     try {
         $this->dispatchEvent(ArcanistEventType::TYPE_LAND_WILLPUSHREVISION, array());
     } catch (Exception $ex) {
         $this->executeCleanupAfterFailedPush();
         throw $ex;
     }
     if ($this->getArgument('hold')) {
         echo phutil_console_format("Holding change in **%s**: it has NOT been pushed yet.\n", $this->onto);
     } else {
         echo "Pushing change...\n\n";
         chdir($repository_api->getPath());
         if ($this->isGitSvn) {
             $err = phutil_passthru('git svn dcommit');
             $cmd = "git svn dcommit";
         } else {
             if ($this->isGit) {
                 $err = phutil_passthru('git push %s %s', $this->remote, $this->onto);
                 $cmd = "git push";
             } else {
                 if ($this->isHgSvn) {
                     // hg-svn doesn't support 'push -r', so we do a normal push
                     // which hg-svn modifies to only push the current branch and
                     // ancestors.
                     $err = $repository_api->execPassthru('push %s', $this->remote);
                     $cmd = "hg push";
                 } else {
                     if ($this->isHg) {
                         $err = $repository_api->execPassthru('push -r %s %s', $this->onto, $this->remote);
                         $cmd = "hg push";
                     }
                 }
             }
         }
         if ($err) {
             echo phutil_console_format("<bg:red>**   PUSH FAILED!   **</bg>\n");
             $this->executeCleanupAfterFailedPush();
             if ($this->isGit) {
                 throw new ArcanistUsageException("'{$cmd}' failed! Fix the error and run 'arc land' again.");
             }
             throw new ArcanistUsageException("'{$cmd}' failed! Fix the error and push this change manually.");
         }
         $mark_workflow = $this->buildChildWorkflow('close-revision', array('--finalize', '--quiet', $this->revision['id']));
         $mark_workflow->run();
         echo "\n";
     }
 }
开发者ID:chaozhang80,项目名称:tool-package,代码行数:62,代码来源:ArcanistLandWorkflow.php


示例16: pushChangesToStagingArea

 private function pushChangesToStagingArea($id)
 {
     if ($this->getArgument('skip-staging')) {
         $this->writeInfo(pht('SKIP STAGING'), pht('Flag --skip-staging was specified.'));
         return self::STAGING_USER_SKIP;
     }
     if ($this->isRawDiffSource()) {
         $this->writeInfo(pht('SKIP STAGING'), pht('Raw changes can not be pushed to a staging area.'));
         return self::STAGING_DIFF_RAW;
     }
     if (!$this->getRepositoryPHID()) {
         $this->writeInfo(pht('SKIP STAGING'), pht('Unable to determine repository for this change.'));
         return self::STAGING_REPOSITORY_UNKNOWN;
     }
     $staging = $this->getRepositoryStagingConfiguration();
     if ($staging === null) {
         $this->writeInfo(pht('SKIP STAGING'), pht('The server does not support staging areas.'));
         return self::STAGING_REPOSITORY_UNAVAILABLE;
     }
     $supported = idx($staging, 'supported');
     if (!$supported) {
         $this->writeInfo(pht('SKIP STAGING'), pht('Phabricator does not support staging areas for this repository.'));
         return self::STAGING_REPOSITORY_UNSUPPORTED;
     }
     $staging_uri = idx($staging, 'uri');
     if (!$staging_uri) {
         $this->writeInfo(pht('SKIP STAGING'), pht('No staging area is configured for this repository.'));
         return self::STAGING_REPOSITORY_UNCONFIGURED;
     }
     $api = $this->getRepositoryAPI();
     if (!$api instanceof ArcanistGitAPI) {
         $this->writeInfo(pht('SKIP STAGING'), pht('This client version does not support staging this repository.'));
         return self::STAGING_CLIENT_UNSUPPORTED;
     }
     $commit = $api->getHeadCommit();
     $prefix = idx($staging, 'prefix', 'phabricator');
     $base_tag = "refs/tags/{$prefix}/base/{$id}";
     $diff_tag = "refs/tags/{$prefix}/diff/{$id}";
     $this->writeOkay(pht('PUSH STAGING'), pht('Pushing changes to staging area...'));
     $push_flags = array();
     if (version_compare($api->getGitVersion(), '1.8.2', '>=')) {
         $push_flags[] = '--no-verify';
     }
     $refs = array();
     $remote = array('uri' => $staging_uri);
     // If the base commit is a real commit, we're going to push it. We don't
     // use this, but pushing it to a ref reduces the amount of redundant work
     // that Git does on later pushes by helping it figure out that the remote
     // already has most of the history. See T10509.
     // In the future, we could avoid this push if the staging area is the same
     // as the main repository, or if the staging area is a virtual repository.
     // In these cases, the staging area should automatically have up-to-date
     // refs.
     $base_commit = $api->getSourceControlBaseRevision();
     if ($base_commit !== ArcanistGitAPI::GIT_MAGIC_ROOT_COMMIT) {
         $refs[] = array('ref' => $base_tag, 'type' => 'base', 'commit' => $base_commit, 'remote' => $remote);
     }
     // We're always going to push the change itself.
     $refs[] = array('ref' => $diff_tag, 'type' => 'diff', 'commit' => $commit, 'remote' => $remote);
     $ref_list = array();
     foreach ($refs as $ref) {
         $ref_list[] = $ref['commit'] . ':' . $ref['ref'];
     }
     $err = phutil_passthru('git push %Ls -- %s %Ls', $push_flags, $staging_uri, $ref_list);
     if ($err) {
         $this->writeWarn(pht('STAGING FAILED'), pht('Unable to push changes to the staging area.'));
         throw new ArcanistUsageException(pht('Failed to push changes to staging area. Correct the issue, or ' . 'use --skip-staging to skip this step.'));
     }
     return $refs;
 }
开发者ID:rmaz,项目名称:arcanist,代码行数:70,代码来源:ArcanistDiffWorkflow.php


示例17: launchDaemon

 protected final function launchDaemon($class, array $argv, $debug)
 {
     $daemon = $this->findDaemonClass($class);
     $console = PhutilConsole::getConsole();
     if ($debug) {
         if ($argv) {
             $console->writeOut(pht("Launching daemon \"%s\" in debug mode (not daemonized) " . "with arguments %s.\n", $daemon, csprintf('%LR', $argv)));
         } else {
             $console->writeOut(pht("Launching daemon \"%s\" in debug mode (not daemonized).\n", $daemon));
         }
     } else {
         if ($argv) {
             $console->writeOut(pht("Launching daemon \"%s\" with arguments %s.\n", $daemon, csprintf('%LR', $argv)));
         } else {
             $console->writeOut(pht("Launching daemon \"%s\".\n", $daemon));
         }
     }
     foreach ($argv as $key => $arg) {
         $argv[$key] = escapeshellarg($arg);
     }
     $flags = array();
     if ($debug || PhabricatorEnv::getEnvConfig('phd.trace')) {
         $flags[] = '--trace';
     }
     if ($debug || PhabricatorEnv::getEnvConfig('phd.verbose')) {
         $flags[] = '--verbose';
     }
     if (!$debug) {
         $flags[] = '--daemonize';
     }
     if (!$debug) {
         $log_file = $this->getLogDirectory() . '/daemons.log';
         $flags[] = csprintf('--log=%s', $log_file);
     }
     $pid_dir = $this->getPIDDirectory();
     // TODO: This should be a much better user experience.
     Filesystem::assertExists($pid_dir);
     Filesystem::assertIsDirectory($pid_dir);
     Filesystem::assertWritable($pid_dir);
     $flags[] = csprintf('--phd=%s', $pid_dir);
     $command = csprintf('./phd-daemon %s %C %C', $daemon, implode(' ', $flags), implode(' ', $argv));
     $phabricator_root = dirname(phutil_get_library_root('phabricator'));
     $daemon_script_dir = $phabricator_root . '/scripts/daemon/';
     if ($debug) {
         // Don't terminate when the user sends ^C; it will be sent to the
         // subprocess which will terminate normally.
         pcntl_signal(SIGINT, array(__CLASS__, 'ignoreSignal'));
         echo "\n    phabricator/scripts/daemon/ \$ {$command}\n\n";
         phutil_passthru('(cd %s && exec %C)', $daemon_script_dir, $command);
     } else {
         $future = new ExecFuture('exec %C', $command);
         // Play games to keep 'ps' looking reasonable.
         $future->setCWD($daemon_script_dir);
         $future->resolvex();
     }
 }
开发者ID:denghp,项目名称:phabricator,代码行数:56,代码来源:PhabricatorDaemonManagementWorkflow.php


示例18: dirname

#!/usr/bin/env php
<?php 
/*
 * Copyright 2011 Facebook, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
$root = dirname(dirname(dirname(__FILE__)));
require_once $root . '/scripts/__init_script__.php';
// Simple test script for PhutilServiceProfiler.
PhutilServiceProfiler::installEchoListener();
phutil_require_module('phutil', 'future/exec');
execx('ls %s', '/tmp');
exec_manual('sleep %s', 1);
phutil_passthru('cat');
echo "\n\nSERVICE CALL LOG\n";
var_dump(PhutilServiceProfiler::getInstance()->getServiceCallLog());
开发者ID:rmoorman,项目名称:libphutil,代码行数:27,代码来源:test_service_profiler.php


示例19: performLocalBranchMerge

 public function performLocalBranchMerge($branch, $message)
 {
     if (!$branch) {
         throw new ArcanistUsageException('Under git, you must specify the branch you want to merge.');
     }
     $err = phutil_passthru('(cd %s && git merge --no-ff -m %s %s)', $this->getPath(), $message, $branch);
     if ($err) {
         throw new ArcanistUsageException('Merge failed!');
     }
 }
开发者ID:ivoryxiong,项目名称:arcanist,代码行数:10,代码来源:ArcanistGitAPI.php


示例20: launch

 protected final function launch()
 {
     $console = PhutilConsole::getConsole();
     if ($this->debug) {
         $console->writeOut("%s\n", pht('Starting Aphlict server in foreground...'));
     } else {
         Filesystem::writeFile($this->getPIDPath(), getmypid());
     }
     $command = csprintf('%s %s %Ls', $this->getNodeBinary(), $this->getAphlictScriptPath(), $this->getServerArgv());
     if (!$this->debug) {
         declare (ticks=1);
         pcntl_signal(SIGINT, array($this, 'cleanup'));
         pcntl_signal(SIGTERM, array($this, 'cleanup'));
     }
     register_shutdown_function(array($this, 'cleanup'));
     if ($this->debug) {
         $console->writeOut("%s\n\n    \$ %s\n\n", pht('Launching server:'), $command);
         $err = phutil_passthru('%C', $command);
         $console->writeOut(">>> %s\n", pht('Server exited!'));
         exit($err);
     } else {
         while (true) {
             global $g_future;
             $g_future = new ExecFuture('exec %C', $command);
             $g_future->resolve();
             // If the server exited, wait a couple of seconds and restart it.
             unset($g_future);
             sleep(2);
         }
     }
 }
开发者ID:fengshao0907,项目名称:phabricator,代码行数:31,代码来源:PhabricatorAphlictManagementWorkflow.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP phutil_register_library函数代码示例发布时间:2022-05-15
下一篇:
PHP phutil_load_library函数代码示例发布时间: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