-
-
Notifications
You must be signed in to change notification settings - Fork 191
/
Copy pathPHP.c
81 lines (66 loc) · 1.78 KB
/
PHP.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later
* -------------------------------------------------------------
* File Authors : Aoran Zeng <[email protected]>
* Contributors : Nil Null <[email protected]>
* Created On : <2023-08-30>
* Last Modified : <2024-11-22>
* ------------------------------------------------------------*/
/**
* @update 2024-09-14
* @note 缺少教育网或开源社区软件源
*/
static Source_t pl_php_sources[] =
{
{&UpstreamProvider, NULL},
{&Ali, "https://mirrors.aliyun.com/composer/"},
{&Tencent, "https://mirrors.tencent.com/composer/"},
// {&Tencent_Intra, "https://mirrors.tencentyun.com/composer/"},
{&Huawei, "https://mirrors.huaweicloud.com/repository/php/"}
};
def_sources_n(pl_php);
void
pl_php_check_cmd ()
{
chsrc_ensure_program ("composer");
}
/**
* 已在Windows上测试通过,待其他平台PHP用户确认
*/
void
pl_php_getsrc (char *option)
{
pl_php_check_cmd ();
chsrc_run ("composer config -g repositories", RunOpt_Default);
}
/**
* @consult https://developer.aliyun.com/composer
*/
void
pl_php_setsrc (char *option)
{
pl_php_check_cmd ();
chsrc_yield_source_and_confirm (pl_php);
char *where = " -g ";
if (CliOpt_Locally==true)
{
where = " ";
}
char *cmd = xy_strjoin (4, "composer config", where, "repo.packagist composer ", source.url);
chsrc_run (cmd, RunOpt_Default);
ProgMode_ChgType = ChgType_Auto;
chsrc_conclude (&source);
}
Feature_t
pl_php_feat (char *option)
{
Feature_t f = {0};
f.can_get = true;
f.can_reset = false;
f.cap_locally = FullyCan;
f.cap_locally_explain = "Support `composer`";
f.can_english = false;
f.can_user_define = true;
return f;
}
def_target_gsf (pl_php);