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


PHP PhabricatorRepository::isValidRepositorySlug方法代码示例

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


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

示例1: testRepositoryShortNameValidation

 public function testRepositoryShortNameValidation()
 {
     $good = array('sensible-repository', 'AReasonableName', 'ACRONYM-project', 'sol-123', '46-helixes', 'node.io', 'internet.com', 'www.internet-site.com.repository', 'with_under-scores', 'A-_._-_._-_._-_._-_._-_._-1', str_repeat('a', 64));
     $poor = array('', '1', '.', '-_-', 'AAAA', '..', 'a/b', '../../etc/passwd', '/', '!', '@', 'ca$hmoney', 'repo with spaces', 'hyphen-', '-ated', '_underscores_', 'yes!', 'quack.git', 'git.git', '.git.git.git', str_repeat('a', 65));
     foreach ($good as $nice_name) {
         $actual = PhabricatorRepository::isValidRepositorySlug($nice_name);
         $this->assertEqual(true, $actual, pht('Expected "%s" to be a valid repository short name.', $nice_name));
     }
     foreach ($poor as $poor_name) {
         $actual = PhabricatorRepository::isValidRepositorySlug($poor_name);
         $this->assertEqual(false, $actual, pht('Expected "%s" to be rejected as an invalid repository ' . 'short name.', $poor_name));
     }
 }
开发者ID:NeoArmageddon,项目名称:phabricator,代码行数:13,代码来源:PhabricatorRepositoryTestCase.php

示例2: PhabricatorRepository

<?php

$table = new PhabricatorRepository();
$conn_w = $table->establishConnection('w');
foreach (new LiskMigrationIterator($table) as $repository) {
    $slug = $repository->getRepositorySlug();
    if ($slug !== null) {
        continue;
    }
    $clone_name = $repository->getDetail('clone-name');
    if (!strlen($clone_name)) {
        continue;
    }
    if (!PhabricatorRepository::isValidRepositorySlug($clone_name)) {
        echo tsprintf("%s\n", pht('Repository "%s" has a "Clone/Checkout As" name which is no longer ' . 'valid ("%s"). You can edit the repository to give it a new, valid ' . 'short name.', $repository->getDisplayName(), $clone_name));
        continue;
    }
    try {
        queryfx($conn_w, 'UPDATE %T SET repositorySlug = %s WHERE id = %d', $table->getTableName(), $clone_name, $repository->getID());
    } catch (AphrontDuplicateKeyQueryException $ex) {
        echo tsprintf("%s\n", pht('Repository "%s" has a duplicate "Clone/Checkout As" name ("%s"). ' . 'Each name must now be unique. You can edit the repository to give ' . 'it a new, unique short name.', $repository->getDisplayName(), $clone_name));
    }
}
开发者ID:truSense,项目名称:phabricator,代码行数:23,代码来源:20160110.repo.02.slug.php


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