本文整理汇总了PHP中GitRepository::exists方法的典型用法代码示例。如果您正苦于以下问题:PHP GitRepository::exists方法的具体用法?PHP GitRepository::exists怎么用?PHP GitRepository::exists使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GitRepository
的用法示例。
在下文中一共展示了GitRepository::exists方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: changeProjectRepositoriesAccess
/**
* Internal method called by SystemEvent_PROJECT_IS_PRIVATE
* @param <type> $projectId
* @param <type> $isPublic
* @return <type>
*/
public static function changeProjectRepositoriesAccess($projectId, $isPrivate)
{
//if the project is private, then no changes may be applied to repositories,
//in other words only if project is set to private, its repositories have to be set to private
if (empty($isPrivate)) {
return;
}
$dao = new GitDao();
$repositories = $dao->getProjectRepositoryList($projectId);
if (empty($repositories)) {
return false;
}
foreach ($repositories as $repoId => $repoData) {
$r = new GitRepository();
$r->setId($repoId);
if (!$r->exists()) {
continue;
}
$newAccess = !empty($isPrivate) ? GitRepository::PRIVATE_ACCESS : GitRepository::PUBLIC_ACCESS;
if ($r->getAccess() == $newAccess) {
continue;
}
$r->setAccess($newAccess);
$r->changeAccess();
unset($r);
}
}