Compare commits
862 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 31059fd653 | |||
| cbdde9a495 | |||
| ce65706ceb | |||
| 65f8dc31d8 | |||
| 779303d869 | |||
| 28c9a1993d | |||
| 8f866fa1c3 | |||
| a556c4d02c | |||
| 87c0820260 | |||
| 0444bcffc7 | |||
| 15990b65ac | |||
| 1f3066f197 | |||
| 532c25d5bd | |||
| c256614eab | |||
| 0f67177a54 | |||
| 2e6e70ccd2 | |||
| a13ae2ac2d | |||
| e19f164fc7 | |||
| 702c4b1206 | |||
| 17a31c7a1f | |||
| 7b258d7186 | |||
| 609a129b84 | |||
| ecd01922e9 | |||
| c8782c56d7 | |||
| 4deed68f49 | |||
| 40b705e153 | |||
| 3b35ea4686 | |||
| 5a9dde69b1 | |||
| a02ad260e0 | |||
| 15f15ccddd | |||
| 346e41d042 | |||
| 36bf61e152 | |||
| bc180cd111 | |||
| b10d7c59ae | |||
| 6aee251874 | |||
| d1e9bdfbc8 | |||
| 0c18577317 | |||
| 255221acdf | |||
| 93bd10c300 | |||
| 03bdfbd37b | |||
| d7de792dac | |||
| 763e5d6c83 | |||
| 436c7825b1 | |||
| 9074f5914f | |||
| 62ff078fcf | |||
| df174952fd | |||
| 9d97806c7e | |||
| e6f1c141bf | |||
| 687f244a6f | |||
| 461532ecfc | |||
| 16b6239a88 | |||
| 8121a2fad0 | |||
| d78e72a940 | |||
| 16a175de06 | |||
| ec4f31f984 | |||
| 323a7a151b | |||
| 14eb0c478d | |||
| e8b487e010 | |||
| 641351118e | |||
| 12e42d2246 | |||
| 0a668af390 | |||
| 22290d726a | |||
| 03fc135cb6 | |||
| 0459ed43e1 | |||
| 928f531307 | |||
| 767dfb307d | |||
| 3efe531af4 | |||
| ef54b1272a | |||
| 2e97e57edb | |||
| 2f64ea2a2e | |||
| 3fda0a9736 | |||
| 0047e4612c | |||
| 44088a5aeb | |||
| 2507ecbd3e | |||
| 439f2e7e83 | |||
| b523d5bc33 | |||
| 63e0fee364 | |||
| 063c6e23d4 | |||
| 5c1f1690bb | |||
| b46ad4bdd5 | |||
| 8001ddd8b2 | |||
| b9894e1e9f | |||
| 0e26b1d309 | |||
| 5cc6700f27 | |||
| 090f8f300d | |||
| fc36873f61 | |||
| 315392626b | |||
| c27add8d87 | |||
| ae18cf2461 | |||
| deab7fda59 | |||
| af3085d2d5 | |||
| 55a8f72251 | |||
| af02385d49 | |||
| c5b3017b49 | |||
| 5ec684b353 | |||
| 0a03803081 | |||
| 6527b097e8 | |||
| 8f5c4f6b34 | |||
| b1325427ec | |||
| 5de6795ec0 | |||
| 0dc138d47c | |||
| f367cfcbef | |||
| c2b526c484 | |||
| b01092111c | |||
| 8ef945280c | |||
| fbfeb98d39 | |||
| 24276da9ce | |||
| 1f316df7d9 | |||
| 467aefd1a6 | |||
| f354a67357 | |||
| 32193155f5 | |||
| b3f6c093aa | |||
| 82a678c91e | |||
| f3f21f18c4 | |||
| 05c7b75672 | |||
| 39c01271f0 | |||
| c09f63c5ac | |||
| 9f9bcb251c | |||
| 39864d9e88 | |||
| 2a46808ed3 | |||
| 4221300426 | |||
| d14fe6017f | |||
| cdc0a8db3f | |||
| 9ddb811866 | |||
| 29dd7397e2 | |||
| bef5900bdb | |||
| 623379d82b | |||
| 8480fd9364 | |||
| 5faaf18173 | |||
| d23d771071 | |||
| 5f690a9be6 | |||
| 95dae00235 | |||
| 7c4e3db7c0 | |||
| 0ed1b7d277 | |||
| 690988d958 | |||
| 26b3b4e80e | |||
| a5e67c5bcc | |||
| 01327cfcf5 | |||
| 1b775e96c1 | |||
| ef467ee957 | |||
| 247b756248 | |||
| 1eedfdf2c0 | |||
| d4bbbedbde | |||
| c8abe81b99 | |||
| 7943aabfbe | |||
| 2de77919d8 | |||
| 5094443f65 | |||
| 9ec65dc485 | |||
| 068ef548de | |||
| bad563d2f4 | |||
| 50eb74065b | |||
| febd8afc8e | |||
| cac959739b | |||
| cef5600303 | |||
| 63a2e24bc2 | |||
| 35eefad6b3 | |||
| c8121c53d1 | |||
| 74f6a6ae5b | |||
| d560fb3e26 | |||
| 213220c159 | |||
| baa476ce92 | |||
| 795dc143c2 | |||
| a18e060c5b | |||
| 84ebf61b82 | |||
| 300dff939f | |||
| 2aa6dd4c60 | |||
| e59d25c944 | |||
| a86531f20b | |||
| 239bfa31b0 | |||
| 9056ee506a | |||
| 5a8fdd1c27 | |||
| be14be6175 | |||
| 0b09c8e48f | |||
| 90e4b26229 | |||
| 8b9c45b666 | |||
| 2c3eea86fa | |||
| 39259ea58b | |||
| 3ce36f6ac1 | |||
| 6a9a7005b0 | |||
| 2d9145638c | |||
| 531b675632 | |||
| c41d4355ac | |||
| ac4bf23c02 | |||
| 51c59e8b9f | |||
| 606db83726 | |||
| a62801941e | |||
| 0282c20862 | |||
| 915e21170c | |||
| 11b6abd02c | |||
| 6005337c33 | |||
| ea2833bc35 | |||
| 2271f1845c | |||
| b4875aa348 | |||
| 3b4cc68ff4 | |||
| 2f0d26c522 | |||
| 3dd8bd5069 | |||
| eede6aae43 | |||
| a623fdf11b | |||
| 617144f163 | |||
| 61d3898de9 | |||
| ec297cc65b | |||
| 5e33ee65e5 | |||
| 3bf4cc3887 | |||
| 4f88c9f38d | |||
| 096ef13c79 | |||
| c49e848571 | |||
| 25a0be8b27 | |||
| b760c63189 | |||
| b3569fb6fa | |||
| db14163584 | |||
| c58559191a | |||
| d86be9c53e | |||
| 7de6a916a2 | |||
| cf93e03ea0 | |||
| f2774239cb | |||
| 5049dfceca | |||
| 186af5a430 | |||
| 7a4826bc3e | |||
| 1b1432ab88 | |||
| 5bfbec5521 | |||
| eee25b4a13 | |||
| a175c5d1ba | |||
| d209e7161a | |||
| ef494edcd6 | |||
| 20ada5de55 | |||
| c21c4761d1 | |||
| 9ab9793c53 | |||
| 4a106a5759 | |||
| b5256231a6 | |||
| b29e02d57e | |||
| 95bb29b902 | |||
| 59fe1b009f | |||
| ab8571d19a | |||
| 90ff64881e | |||
| 1818308bca | |||
| b47604e938 | |||
| c1ee5cf31b | |||
| 18f802f85a | |||
| ea8c5bdc74 | |||
| 6b7a5f86a0 | |||
| f28ce6eb2e | |||
| 5bb55eeb21 | |||
| ddb652c706 | |||
| 648cc055c2 | |||
| 0fbda60bb3 | |||
| 486ad6e842 | |||
| 74980995b4 | |||
| 33c3193f06 | |||
| 95924516fa | |||
| 1663aa1fb9 | |||
| 970536b659 | |||
| b6fadf63d4 | |||
| f1213f3a75 | |||
| adac041f8c | |||
| acadd22a65 | |||
| acafcb18f5 | |||
| 71f4cb812c | |||
| b1f78408a5 | |||
| 1669cf37f0 | |||
| 71e7387f43 | |||
| 4eb9f7dd72 | |||
| 568e9560af | |||
| dc7fe6acca | |||
| 786a6227d0 | |||
| fd9ee7dd8b | |||
| 8ba664e245 | |||
| b88a31a654 | |||
| 76dc0848c1 | |||
| c838cb15d8 | |||
| 3b1fec6fb2 | |||
| 4939d0d71a | |||
| d61604b455 | |||
| ec085021f2 | |||
| 4c6481694e | |||
| fdeb6af76e | |||
| ee7af1e19d | |||
| 7561f3d64a | |||
| a65c0da40d | |||
| 1e07291026 | |||
| 1215c112c0 | |||
| 0e37d94b67 | |||
| 3264dcece0 | |||
| cc1dc858c0 | |||
| 6ca7efb157 | |||
| 72d49e8419 | |||
| cd2f4a87a4 | |||
| b8ba7f3619 | |||
| aa8ae42d24 | |||
| 1c7509bc86 | |||
| 7ed94cbe9c | |||
| 7c7d086ae1 | |||
| 725ce55546 | |||
| 1f55a12bf8 | |||
| ee0f0b3986 | |||
| 92d4bcd9f7 | |||
| e7215ce5b7 | |||
| 6dc0b5482b | |||
| 45d7ec6123 | |||
| a7e348e937 | |||
| eba7490c31 | |||
| a4798ada52 | |||
| 0cc8a0b4b2 | |||
| 6d32f6300e | |||
| 08348b8f86 | |||
| 519eec044c | |||
| ab156686ff | |||
| 1fc8ebf085 | |||
| 0086364857 | |||
| 05cc5bf052 | |||
| 8bd3dfd6f5 | |||
| 1c9e079b7c | |||
| 8b90e93c94 | |||
| 94f0349745 | |||
| 50cc7daa0f | |||
| 0a841ac85c | |||
| 28d6752d07 | |||
| 1d0f235097 | |||
| 93d7596d3f | |||
| aa9f17df92 | |||
| d251180b31 | |||
| 67a77fa36f | |||
| c3cf035fad | |||
| 8a52ccea0c | |||
| d35f49ba45 | |||
| 38748c6ada | |||
| 68fb3969e1 | |||
| 527afcfb8c | |||
| c62f8bc71f | |||
| d3c034f8e8 | |||
| 5f399d0c52 | |||
| a9e0505fde | |||
| 96d73266ef | |||
| 66a0fea650 | |||
| a4bba406ad | |||
| 20914ba26a | |||
| 8b5520877b | |||
| 7cacba3db3 | |||
| f4c37747dc | |||
| 3e65f72a40 | |||
| d613a0db57 | |||
| 26f004f29b | |||
| 0ed87e5063 | |||
| 87cc899c44 | |||
| e1661a6346 | |||
| 3ba2b5c925 | |||
| 7c5d28c26c | |||
| 67711964d1 | |||
| bf394372d8 | |||
| d927f222a9 | |||
| bbcbbcd130 | |||
| cc0b20ba9d | |||
| 8f15eebc22 | |||
| d8b6437fa9 | |||
| e257ad8372 | |||
| ba03dc18ad | |||
| 7c15d3b34c | |||
| 1c76803ec1 | |||
| 5660ceba8d | |||
| ae59c35eb9 | |||
| 3c129829ce | |||
| 050720be90 | |||
| 7573d5ff21 | |||
| b3656b26be | |||
| 804c22b8f1 | |||
| 8716b6c89f | |||
| 8b3d19c2f5 | |||
| cf9ed67a4e | |||
| 417b6921d5 | |||
| f72a23d69b | |||
| ca602b6beb | |||
| 2b8647034a | |||
| 956ec418c6 | |||
| 31d453f735 | |||
| b4d0a4479c | |||
| 3e07b8a2f3 | |||
| 383776876b | |||
| 91c8d4da71 | |||
| 1721c8eb85 | |||
| ad3d9452bf | |||
| c5f351435e | |||
| 03b06dedbc | |||
| da80885cc6 | |||
| 94ac7a87fa | |||
| 10b02d6d41 | |||
| ebb6f3e80b | |||
| 7f4db6f4d9 | |||
| 4fc5861cba | |||
| 40b205197c | |||
| cb914a71aa | |||
| 85f376892d | |||
| e0708141f8 | |||
| 76b012d611 | |||
| 53ca351f7a | |||
| ea9f3057da | |||
| f1406d3b39 | |||
| 91251e4889 | |||
| 8994593332 | |||
| 67b3704318 | |||
| 37e7d91b8c | |||
| 3fe64cbd7d | |||
| 22051a4e34 | |||
| e7cd680765 | |||
| 84d2c6f761 | |||
| f97581eda7 | |||
| 2c0b608cda | |||
| eb1381de1d | |||
| c7bfbb01c6 | |||
| 4eacb77012 | |||
| 93835758f3 | |||
| a238e7ed72 | |||
| 98ac33bcb0 | |||
| 0caa8c60d2 | |||
| 2dbdaedc3e | |||
| 30a264540b | |||
| 6d05bee940 | |||
| 2535dfaf64 | |||
| 35186e3725 | |||
| bfe4417cb7 | |||
| 6b6affec1f | |||
| 9e13649c89 | |||
| 1465b22f7d | |||
| f549deed15 | |||
| ab59b7db71 | |||
| 200a2b7fad | |||
| 9945bcec41 | |||
| b4ac5653ed | |||
| 0207466e77 | |||
| 2ca9e09dab | |||
| 6eaf5ec8e3 | |||
| 1d110af2d6 | |||
| 2d121036cc | |||
| 61961447c2 | |||
| 867f40990b | |||
| da6ce47102 | |||
| 78ba7d9e6b | |||
| 63010978b4 | |||
| c5e9bc48f0 | |||
| cd90445d4a | |||
| 0052796dbb | |||
| b522356839 | |||
| 1d45b926f3 | |||
| 0ba5f02b15 | |||
| a31fdfb145 | |||
| d019ffd21f | |||
| a93f8344ae | |||
| 2d7617aa18 | |||
| 84acc68175 | |||
| 38d8b7b703 | |||
| 69ddeb42e2 | |||
| 2bd9cd1077 | |||
| 35588aa876 | |||
| fc415ee908 | |||
| 10b4bda916 | |||
| 3708e1bb7c | |||
| e7e79055e1 | |||
| 3d4cf404df | |||
| 31c0efeac7 | |||
| 3571cd46d2 | |||
| fa6db7b8c1 | |||
| 947a90339a | |||
| dc30afaafc | |||
| 03a5278a38 | |||
| d683942c6a | |||
| 24c0432bbc | |||
| c16de45a14 | |||
| 9d19781014 | |||
| ab6ae906cd | |||
| f45b59d427 | |||
| 3add7d878f | |||
| c9bd902bd3 | |||
| 366124d222 | |||
| 89203e11a7 | |||
| dd83fbfbbc | |||
| 1fb374121a | |||
| f3163a2002 | |||
| 65764352dd | |||
| 2c7b800f2f | |||
| ed7d676329 | |||
| b23bc0a148 | |||
| df9a669791 | |||
| b1ab535efa | |||
| 1e9dce0df4 | |||
| 8dd0756226 | |||
| 8458e3d2c2 | |||
| 951a64f6ef | |||
| b336cf98b4 | |||
| b6ac868d71 | |||
| 57ce05c631 | |||
| f0538cee92 | |||
| f4f4965a1c | |||
| 93a593daab | |||
| c8c1a2cb10 | |||
| 793ab11d95 | |||
| 47221d5fdd | |||
| 1affa3ea22 | |||
| 70971d43eb | |||
| 99e0bb23bf | |||
| d95453d903 | |||
| 53fb01aef0 | |||
| cfd5ba4101 | |||
| 5eb386fd09 | |||
| 594848bb15 | |||
| 64fea720ce | |||
| 83d08fcc21 | |||
| 01e7204646 | |||
| 3152864fd5 | |||
| 2997bd6dce | |||
| 083d5a6f0c | |||
| c1ee80fef5 | |||
| 0a9815d14e | |||
| 3ac5a3544c | |||
| b7cb9c60c1 | |||
| 6f5ca6613f | |||
| a16755314a | |||
| a4919abf4f | |||
| 022a58af8d | |||
| 6480ec0c48 | |||
| 1e4e4a05d7 | |||
| 9dc9608795 | |||
| e08d290469 | |||
| 80bb90c3ca | |||
| a3ddcab336 | |||
| a839769c23 | |||
| 1eb503b379 | |||
| cc5f8bd53f | |||
| bb512f7c1f | |||
| 5b5a73019d | |||
| ce0b9bb7ca | |||
| 38063e7d1b | |||
| ee5b9e137d | |||
| 55103810f0 | |||
| e5b111f26b | |||
| 7c2e2133cc | |||
| 3352ffcfa2 | |||
| 8e74bfa8e8 | |||
| 9f630b6cc4 | |||
| c2779c9f29 | |||
| 7fecbba80b | |||
| 80b81e5094 | |||
| 6e977fcdd6 | |||
| 9c8c5f2d01 | |||
| 9134f3f0df | |||
| b093752289 | |||
| bd87c3e225 | |||
| 7bea1ea240 | |||
| afd6e7d542 | |||
| e29eef4bde | |||
| 63dd180030 | |||
| 8eacbd5a32 | |||
| 680ff52414 | |||
| 884e310a3b | |||
| 7eac026a02 | |||
| deaddfb6b8 | |||
| 85b40b18d5 | |||
| 3b6987cea3 | |||
| 14ff3d59b3 | |||
| dd02a787d8 | |||
| cefe7c7f59 | |||
| d9fc73dc7a | |||
| 3bc1e345ca | |||
| 5d3fe21ab2 | |||
| 17db3e8af1 | |||
| a0da864ac2 | |||
| 0978aab839 | |||
| 7d947ad66c | |||
| 5e63c8e57e | |||
| 34bcea8159 | |||
| 2a56e3c8b9 | |||
| 1fb1c6d456 | |||
| 469e7dd82d | |||
| 1461f9d664 | |||
| 8791525d88 | |||
| a0f39f2b57 | |||
| 6fc2264a8a | |||
| 8893b111c2 | |||
| 3362673173 | |||
| 49703ecf1d | |||
| d56f3531b4 | |||
| 902a36137a | |||
| 19e4d5ada8 | |||
| d81917322f | |||
| b657f6db05 | |||
| abd980d36d | |||
| 7b27045680 | |||
| e4a56bd9dd | |||
| 5807b224d9 | |||
| 8b1596c257 | |||
| 2649eefe1c | |||
| b3bb3a4422 | |||
| 6e10f195c5 | |||
| ab7c329acf | |||
| 95d39aabc7 | |||
| 6e515be94f | |||
| b3b4f9a4a4 | |||
| c71d8267ed | |||
| 1742e76777 | |||
| 2797fcc75e | |||
| 2538e2dab1 | |||
| 6bf5eeed56 | |||
| c14d87daaa | |||
| cb201e866b | |||
| cc6a8bc792 | |||
| fa71841e9d | |||
| be7809f5fd | |||
| 655cdde2dc | |||
| 7f75f1507e | |||
| 3fbf089303 | |||
| 8a453265d2 | |||
| 807d45073a | |||
| 253bbbb668 | |||
| 8fbc1919df | |||
| c41ace2f7a | |||
| 3be351cabc | |||
| 53bd21e7d8 | |||
| 217530dfca | |||
| 30271d87aa | |||
| f271df32ec | |||
| 77ae35faba | |||
| 32d746479b | |||
| b18fd23232 | |||
| bbd644ea34 | |||
| c4bfba91c2 | |||
| 6e7a7aecf3 | |||
| 635493f6dd | |||
| 0f583e0c91 | |||
| 1a7ded8989 | |||
| 159e18c977 | |||
| 801dea3298 | |||
| d468b949f1 | |||
| a0881872c7 | |||
| a9e9cd31e1 | |||
| 0085d95576 | |||
| e4226ddc26 | |||
| 4c7169437b | |||
| b2cdd35a46 | |||
| aa0fad65e3 | |||
| 4c06cef684 | |||
| 6871df272d | |||
| 40a4427420 | |||
| f76b5133a5 | |||
| d5a7b7873e | |||
| ffa71ca45e | |||
| 5248eb8831 | |||
| 5468d02e60 | |||
| 251fd097bb | |||
| 3ac721e5a3 | |||
| ecd99dc88a | |||
| 3097fca71c | |||
| bc1c896692 | |||
| 6a927661f2 | |||
| 601d32ae66 | |||
| 2dde0b96da | |||
| d420bf952f | |||
| a02d7831b6 | |||
| 604db7d557 | |||
| 41ab96e7ff | |||
| 9dfb59fa28 | |||
| ad94e63238 | |||
| 82c0485aab | |||
| 4524454ff2 | |||
| 658bba713a | |||
| 238c388016 | |||
| 5e10e88673 | |||
| 7b6bad24ee | |||
| 11be1e8b2b | |||
| 42126ff6a5 | |||
| f12f99241c | |||
| 8fde6e8ef9 | |||
| 36bd6f3319 | |||
| 0f52f263ca | |||
| b9e1842e02 | |||
| 99261fdf05 | |||
| 07388eaded | |||
| d983601e46 | |||
| fd85f4eeb9 | |||
| c11ac48868 | |||
| 0d5c68bfd8 | |||
| a6b91c8407 | |||
| f6cac05e9c | |||
| 9a2938c57c | |||
| f4d6bab1b4 | |||
| ebfbd63b3c | |||
| 9ec7228b03 | |||
| 0a1f0c4b1f | |||
| 7180fb19c1 | |||
| ac2015f2ce | |||
| 6fc8187375 | |||
| 81e433d505 | |||
| 9fbdee633a | |||
| f1dee5ce23 | |||
| 1ffce0c735 | |||
| 3e307259ac | |||
| 8455124070 | |||
| a1d932bd82 | |||
| d9ef98fc80 | |||
| 4affd3c42e | |||
| 8771f49c0a | |||
| b018b44b49 | |||
| 3d4f5c6bf8 | |||
| 6bbdb16bb1 | |||
| 07783f9c20 | |||
| b19370bd35 | |||
| 9d18c714b8 | |||
| 474dd3da66 | |||
| 5095725a00 | |||
| 02da49597c | |||
| 5f86aa9d14 | |||
| ae916b5d6a | |||
| ea66859873 | |||
| 23f43bb4c4 | |||
| 108d281f6b | |||
| 4a0e272c5b | |||
| 647a688de3 | |||
| 3f9ea21ae3 | |||
| 34a46904c2 | |||
| d73b1f3e71 | |||
| 2c356d8ecd | |||
| 62c7d543f6 | |||
| 008cfb2a1f | |||
| 243f766222 | |||
| 2b9259ed7f | |||
| c5d9d36e79 | |||
| 296029fadf | |||
| 7e78f9c4a5 | |||
| 83bc3ccfdf | |||
| 6a001a3223 | |||
| 1974f5ade7 | |||
| 837e3741fd | |||
| 4bdb702918 | |||
| e588f20b6c | |||
| ad7d8edf0c | |||
| 9f4a69a8cd | |||
| fd4c7d7b69 | |||
| e77b4ac0de | |||
| 4fe4fbba9d | |||
| 331298218b | |||
| db52d4058d | |||
| b5d1353575 | |||
| fb3663ae5c | |||
| 6825f882e2 | |||
| 04b949a8f5 | |||
| 86976c5bd9 | |||
| 33238bb24b | |||
| 2b548c27ee | |||
| e0cd7e44db | |||
| 184cdf0d52 | |||
| 472896acdd | |||
| 1ff977a5e5 | |||
| 68a1c2a8d9 | |||
| db77228155 | |||
| 8a0dcb91cc | |||
| 11b5d9b763 | |||
| dc195425ee | |||
| 72cf8ec5eb | |||
| 1130c181f9 | |||
| 443d4dae06 | |||
| a2720952c2 | |||
| 89262fa9f1 | |||
| bc3c2a8eed | |||
| fb7e5c42cd | |||
| 2e2a229f58 | |||
| d12b20d022 | |||
| 5ce5bc6bdd | |||
| 54c9048405 | |||
| 7b04f1fa49 | |||
| eebd7f8964 | |||
| 871af2ebc5 | |||
| 0d4b11ff88 | |||
| e342149a37 | |||
| 9054cd2a25 | |||
| 7d5e56cffd | |||
| 137c0261ee | |||
| 1c500e2157 | |||
| 46021b98b2 | |||
| 55739cdfb6 | |||
| 63e5416f5b | |||
| 689a8f383c | |||
| 10f981a794 | |||
| 556a760d0c | |||
| 2ba0565d7d | |||
| 16d5729223 | |||
| 38ef7ab379 | |||
| 740cb942ce | |||
| 3725adf852 | |||
| b9c49aefb2 | |||
| 60f8e19ce1 | |||
| d0f43772fb | |||
| 106be68e82 | |||
| f12ad8521f | |||
| 9efa210e32 | |||
| 79b146cb5c | |||
| 8711ce1f4a | |||
| 417fa07162 | |||
| 1910d01a86 | |||
| c9c530fd6e | |||
| dadeff80c9 | |||
| cc41096ad5 | |||
| db9987c267 | |||
| 8d8a5e8035 | |||
| b60373f3e4 | |||
| 1d8bebfeaf | |||
| 41d178f9da | |||
| d144e53188 | |||
| 49b50ef5ab | |||
| 4fac06549a | |||
| 7141921ad4 | |||
| 70e78a4315 | |||
| 520592c43d | |||
| 553b1e6f6d | |||
| bb5652829f | |||
| 288a79ccd4 | |||
| 8f6d8a5653 | |||
| c64368bb1d | |||
| 177beaf23a | |||
| 147d7af758 | |||
| 20bd24b70d | |||
| 7c75924319 | |||
| d90846033b | |||
| da02a3c472 | |||
| 61609ec274 | |||
| 228fc821e0 | |||
| d44071ee09 | |||
| 91fae7e9b4 | |||
| 3e7b9158f4 | |||
| 95f9c8f716 | |||
| 170392d4a0 | |||
| 3724b3aa8d | |||
| 9af90f03bb | |||
| 64a2dfba1f | |||
| 043cf8bab7 | |||
| 832393cfc9 | |||
| d8e7fa9196 | |||
| 075e999c1a | |||
| 8efb66741f | |||
| fa348b5d46 | |||
| ac2eafee91 | |||
| e6c69d835d | |||
| bfa6c5080e | |||
| 0f0729b157 | |||
| f75d82450a | |||
| 3dd33e3862 | |||
| e3b98ac6b6 | |||
| 3951213860 | |||
| 24b81e0566 | |||
| 0ab271dcfd | |||
| b9cb39eaf6 | |||
| c83407f033 | |||
| da75ffce68 | |||
| d48b1de9f7 | |||
| 38d1c9a886 | |||
| 1c48d7e188 | |||
| 11b39253d2 | |||
| 56e84a7985 | |||
| 133f83d557 | |||
| 17e57aa07d | |||
| 710b364b44 | |||
| 81d72831b8 | |||
| 3cfabf7190 | |||
| 0e5791a6cd | |||
| da3e5e0c5c | |||
| ae3b9e1e1f | |||
| 3485ecf225 |
@@ -1,3 +0,0 @@
|
||||
--errors=errors,duplicate-properties
|
||||
--warnings=known-properties,display-property-grouping,empty-rules,important
|
||||
--exclude-list=vendor/,lib/editor/tinymce/,lib/yuilib/,theme/bootstrapbase/style/
|
||||
+2
-3
@@ -26,13 +26,12 @@ CVS
|
||||
/.buildpath
|
||||
/.cache
|
||||
phpunit.xml
|
||||
# Composer support. Do not ignore composer.json, or composer.lock. These should be shipped by us.
|
||||
# Composer support - only composer.json is to be in git, the rest is installed in each checkout.
|
||||
composer.phar
|
||||
composer.lock
|
||||
/vendor/
|
||||
/behat.yml
|
||||
*/yui/build/*/*-coverage.js
|
||||
/lib/yuilib/*/build/*/*-coverage.js
|
||||
# lib/yuilib/version/module/module-coverage.js
|
||||
/lib/yuilib/*/*/*-coverage.js
|
||||
atlassian-ide-plugin.xml
|
||||
/node_modules/
|
||||
|
||||
@@ -1,54 +1,48 @@
|
||||
{
|
||||
"asi": false,
|
||||
"bitwise": true,
|
||||
"boss": false,
|
||||
"browser": true,
|
||||
"yui": true,
|
||||
"bitwise": true,
|
||||
"curly": true,
|
||||
"eqeqeq": true,
|
||||
"forin": false,
|
||||
"immed": true,
|
||||
"newcap": true,
|
||||
"noarg": true,
|
||||
"noempty": true,
|
||||
"nomen": false,
|
||||
"onevar": false,
|
||||
"plusplus": false,
|
||||
"regexp": false,
|
||||
"strict": false,
|
||||
"trailing": true,
|
||||
"unused": true,
|
||||
"white": false,
|
||||
"asi": false,
|
||||
"boss": false,
|
||||
"debug": false,
|
||||
"eqeqeq": false,
|
||||
"eqnull": false,
|
||||
"es5": false,
|
||||
"esnext": false,
|
||||
"evil": false,
|
||||
"expr": false,
|
||||
"forin": false,
|
||||
"funcscope": false,
|
||||
"globalstrict": false,
|
||||
"immed": true,
|
||||
"indent": 4,
|
||||
"iterator": false,
|
||||
"lastsemic": false,
|
||||
"latedef": true,
|
||||
"laxbreak": true,
|
||||
"laxcomma": false,
|
||||
"loopfunc": false,
|
||||
"maxerr": 500,
|
||||
"maxlen": 132,
|
||||
"multistr": false,
|
||||
"newcap": true,
|
||||
"noarg": true,
|
||||
"noempty": true,
|
||||
"nomen": false,
|
||||
"onecase": false,
|
||||
"onevar": false,
|
||||
"passfail": false,
|
||||
"plusplus": false,
|
||||
"predef": [
|
||||
"M",
|
||||
"define"
|
||||
],
|
||||
"proto": false,
|
||||
"regexdash": false,
|
||||
"regexp": false,
|
||||
"scripturl": false,
|
||||
"shadow": false,
|
||||
"smarttabs": false,
|
||||
"strict": false,
|
||||
"sub": false,
|
||||
"supernew": false,
|
||||
"trailing": true,
|
||||
"undef": true,
|
||||
"unused": true,
|
||||
"white": false,
|
||||
"yui": true
|
||||
"maxerr": 500,
|
||||
"maxlen": 180,
|
||||
"passfail": false,
|
||||
"latedef": true
|
||||
}
|
||||
|
||||
-253
@@ -1,253 +0,0 @@
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* @copyright 2014 Andrew Nicols
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
/**
|
||||
* Grunt configuration
|
||||
*/
|
||||
|
||||
module.exports = function(grunt) {
|
||||
var path = require('path'),
|
||||
fs = require('fs'),
|
||||
tasks = {},
|
||||
cwd = process.env.PWD || process.cwd();
|
||||
|
||||
// Project configuration.
|
||||
grunt.initConfig({
|
||||
jshint: {
|
||||
options: {jshintrc: '.jshintrc'},
|
||||
files: ['**/amd/src/*.js']
|
||||
},
|
||||
uglify: {
|
||||
dynamic_mappings: {
|
||||
files: grunt.file.expandMapping(
|
||||
['**/src/*.js', '!**/node_modules/**'],
|
||||
'',
|
||||
{
|
||||
cwd: cwd,
|
||||
rename: function(destBase, destPath) {
|
||||
destPath = destPath.replace('src', 'build');
|
||||
destPath = destPath.replace('.js', '.min.js');
|
||||
destPath = path.resolve(cwd, destPath);
|
||||
return destPath;
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
},
|
||||
less: {
|
||||
bootstrapbase: {
|
||||
files: {
|
||||
"theme/bootstrapbase/style/moodle.css": "theme/bootstrapbase/less/moodle.less",
|
||||
"theme/bootstrapbase/style/editor.css": "theme/bootstrapbase/less/editor.less",
|
||||
},
|
||||
options: {
|
||||
compress: true
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
tasks.shifter = function() {
|
||||
var exec = require('child_process').spawn,
|
||||
done = this.async(),
|
||||
args = [],
|
||||
options = {
|
||||
recursive: true,
|
||||
watch: false,
|
||||
walk: false,
|
||||
module: false
|
||||
},
|
||||
shifter;
|
||||
|
||||
args.push( path.normalize(__dirname + '/node_modules/shifter/bin/shifter'));
|
||||
|
||||
// Determine the most appropriate options to run with based upon the current location.
|
||||
if (path.basename(cwd) === 'src') {
|
||||
// Detect whether we're in a src directory.
|
||||
grunt.log.debug('In a src directory');
|
||||
args.push('--walk');
|
||||
options.walk = true;
|
||||
} else if (path.basename(path.dirname(cwd)) === 'src') {
|
||||
// Detect whether we're in a module directory.
|
||||
grunt.log.debug('In a module directory');
|
||||
options.module = true;
|
||||
}
|
||||
|
||||
if (grunt.option('watch')) {
|
||||
if (!options.walk && !options.module) {
|
||||
grunt.fail.fatal('Unable to watch unless in a src or module directory');
|
||||
}
|
||||
|
||||
// It is not advisable to run with recursivity and watch - this
|
||||
// leads to building the build directory in a race-like fashion.
|
||||
grunt.log.debug('Detected a watch - disabling recursivity');
|
||||
options.recursive = false;
|
||||
args.push('--watch');
|
||||
}
|
||||
|
||||
if (options.recursive) {
|
||||
args.push('--recursive');
|
||||
}
|
||||
|
||||
// Always ignore the node_modules directory.
|
||||
args.push('--excludes', 'node_modules');
|
||||
|
||||
// Add the stderr option if appropriate
|
||||
if (grunt.option('verbose')) {
|
||||
args.push('--lint-stderr');
|
||||
}
|
||||
|
||||
if (grunt.option('no-color')) {
|
||||
args.push('--color=false');
|
||||
}
|
||||
|
||||
var execShifter = function() {
|
||||
|
||||
shifter = exec("node", args, {
|
||||
cwd: cwd,
|
||||
stdio: 'inherit',
|
||||
env: process.env
|
||||
});
|
||||
|
||||
// Tidy up after exec.
|
||||
shifter.on('exit', function (code) {
|
||||
if (code) {
|
||||
grunt.fail.fatal('Shifter failed with code: ' + code);
|
||||
} else {
|
||||
grunt.log.ok('Shifter build complete.');
|
||||
done();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// Actually run shifter.
|
||||
if (!options.recursive) {
|
||||
execShifter();
|
||||
} else {
|
||||
// Check that there are yui modules otherwise shifter ends with exit code 1.
|
||||
var found = false;
|
||||
var hasYuiModules = function(directory, callback) {
|
||||
fs.readdir(directory, function(err, files) {
|
||||
if (err) {
|
||||
return callback(err, null);
|
||||
}
|
||||
|
||||
// If we already found a match there is no need to continue scanning.
|
||||
if (found === true) {
|
||||
return;
|
||||
}
|
||||
|
||||
// We need to track the number of files to know when we return a result.
|
||||
var pending = files.length;
|
||||
|
||||
// We first check files, so if there is a match we don't need further
|
||||
// async calls and we just return a true.
|
||||
for (var i = 0; i < files.length; i++) {
|
||||
if (files[i] === 'yui') {
|
||||
return callback(null, true);
|
||||
}
|
||||
}
|
||||
|
||||
// Iterate through subdirs if there were no matches.
|
||||
files.forEach(function (file) {
|
||||
|
||||
var p = path.join(directory, file);
|
||||
stat = fs.statSync(p);
|
||||
if (!stat.isDirectory()) {
|
||||
pending--;
|
||||
} else {
|
||||
|
||||
// We defer the pending-1 until we scan the whole dir and subdirs.
|
||||
hasYuiModules(p, function(err, result) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
|
||||
if (result === true) {
|
||||
// Once we get a true we notify the caller.
|
||||
found = true;
|
||||
return callback(null, true);
|
||||
}
|
||||
|
||||
pending--;
|
||||
if (pending === 0) {
|
||||
// Notify the caller that the whole dir has been scaned and there are no matches.
|
||||
return callback(null, false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// No subdirs here, otherwise the return would be deferred until all subdirs are scanned.
|
||||
if (pending === 0) {
|
||||
return callback(null, false);
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
hasYuiModules(cwd, function(err, result) {
|
||||
if (err) {
|
||||
grunt.fail.fatal(err.message);
|
||||
}
|
||||
|
||||
if (result === true) {
|
||||
execShifter();
|
||||
} else {
|
||||
grunt.log.ok('No YUI modules to build.');
|
||||
done();
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
tasks.startup = function() {
|
||||
// Are we in a YUI directory?
|
||||
if (path.basename(path.resolve(cwd, '../../')) == 'yui') {
|
||||
grunt.task.run('shifter');
|
||||
// Are we in an AMD directory?
|
||||
} else if (path.basename(cwd) == 'amd') {
|
||||
grunt.task.run('amd');
|
||||
} else {
|
||||
// Run them all!.
|
||||
grunt.task.run('css');
|
||||
grunt.task.run('js');
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// Register NPM tasks.
|
||||
grunt.loadNpmTasks('grunt-contrib-uglify');
|
||||
grunt.loadNpmTasks('grunt-contrib-jshint');
|
||||
grunt.loadNpmTasks('grunt-contrib-less');
|
||||
|
||||
// Register JS tasks.
|
||||
grunt.registerTask('shifter', 'Run Shifter against the current directory', tasks.shifter);
|
||||
grunt.registerTask('amd', ['jshint', 'uglify']);
|
||||
grunt.registerTask('js', ['amd', 'shifter']);
|
||||
|
||||
// Register CSS taks.
|
||||
grunt.registerTask('css', ['less:bootstrapbase']);
|
||||
|
||||
// Register the startup task.
|
||||
grunt.registerTask('startup', 'Run the correct tasks for the current directory', tasks.startup);
|
||||
|
||||
// Register the default task.
|
||||
grunt.registerTask('default', ['startup']);
|
||||
};
|
||||
@@ -64,8 +64,6 @@ echo "<form id=\"authmenu\" method=\"post\" action=\"auth_config.php\">\n";
|
||||
echo "<div>\n";
|
||||
echo "<input type=\"hidden\" name=\"sesskey\" value=\"".sesskey()."\" />\n";
|
||||
echo "<input type=\"hidden\" name=\"auth\" value=\"".$auth."\" />\n";
|
||||
// HACK to prevent browsers from automatically inserting the user's password into the wrong fields.
|
||||
echo prevent_form_autofill_password();
|
||||
|
||||
// auth plugin description
|
||||
echo $OUTPUT->box_start();
|
||||
@@ -148,8 +146,8 @@ function print_auth_lock_options($auth, $user_fields, $helptext, $retrieveopts,
|
||||
// If custom field then pick name from database.
|
||||
$fieldshortname = str_replace('profile_field_', '', $fieldname);
|
||||
$fieldname = $customfieldname[$fieldshortname]->name;
|
||||
} elseif ($fieldname == 'phone1') {
|
||||
$fieldname = get_string('phone');
|
||||
} elseif (preg_match('/^(.+?)(\d+)$/', $fieldname, $matches)) {
|
||||
$fieldname = get_string($matches[1]) . ' ' . $matches[2];
|
||||
} elseif ($fieldname == 'url') {
|
||||
$fieldname = get_string('webpage');
|
||||
} else {
|
||||
|
||||
+1
-2
@@ -155,8 +155,7 @@
|
||||
} else if ($blocksettings instanceof admin_settingpage) {
|
||||
$settings = '<a href="'.$CFG->wwwroot.'/'.$CFG->admin.'/settings.php?section=blocksetting'.$block->name.'">'.$strsettings.'</a>';
|
||||
} else {
|
||||
debugging('Warning: block_'.$block->name.' returns true in has_config() but does not provide a settings.php file',
|
||||
DEBUG_DEVELOPER);
|
||||
$settings = '<a href="block.php?block='.$blockid.'">'.$strsettings.'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -67,6 +67,7 @@ if ($data = data_submitted() and confirm_sesskey()) {
|
||||
$errormsg = get_string('errorwithsettings', 'admin');
|
||||
$firsterror = reset($adminroot->errors);
|
||||
}
|
||||
$adminroot = admin_get_root(true); //reload tree
|
||||
$settingspage = $adminroot->locate($category, true);
|
||||
}
|
||||
|
||||
@@ -155,4 +156,4 @@ echo $outputhtml;
|
||||
echo html_writer::end_tag('fieldset');
|
||||
echo html_writer::end_tag('form');
|
||||
|
||||
echo $OUTPUT->footer();
|
||||
echo $OUTPUT->footer();
|
||||
@@ -1,76 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Validate that the current db structure matches the install.xml files.
|
||||
*
|
||||
* @package core
|
||||
* @copyright 2014 Totara Learning Solutions Ltd {@link http://www.totaralms.com/}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @author Petr Skoda <petr.skoda@totaralms.com>
|
||||
*/
|
||||
|
||||
define('CLI_SCRIPT', true);
|
||||
|
||||
require(__DIR__ . '/../../config.php');
|
||||
require_once($CFG->libdir.'/clilib.php');
|
||||
|
||||
$help = "Validate database structure
|
||||
|
||||
Options:
|
||||
-h, --help Print out this help.
|
||||
|
||||
Example:
|
||||
\$ sudo -u www-data /usr/bin/php admin/cli/check_database_schema.php
|
||||
";
|
||||
|
||||
list($options, $unrecognized) = cli_get_params(
|
||||
array(
|
||||
'help' => false,
|
||||
),
|
||||
array(
|
||||
'h' => 'help',
|
||||
)
|
||||
);
|
||||
|
||||
if ($options['help']) {
|
||||
echo $help;
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if (empty($CFG->version)) {
|
||||
echo "Database is not yet installed.\n";
|
||||
exit(2);
|
||||
}
|
||||
|
||||
$dbmanager = $DB->get_manager();
|
||||
$schema = $dbmanager->get_install_xml_schema();
|
||||
|
||||
if (!$errors = $dbmanager->check_database_schema($schema)) {
|
||||
echo "Database structure is ok.\n";
|
||||
exit(0);
|
||||
}
|
||||
|
||||
foreach ($errors as $table => $items) {
|
||||
cli_separator();
|
||||
echo "$table\n";
|
||||
foreach ($items as $item) {
|
||||
echo " * $item\n";
|
||||
}
|
||||
}
|
||||
cli_separator();
|
||||
|
||||
exit(1);
|
||||
@@ -1,103 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* This script fixes orphaned question categories.
|
||||
*
|
||||
* Orphaned question categories have had their associated context deleted
|
||||
* but the category itself remains in the database with an invalid context.
|
||||
*
|
||||
* @package core
|
||||
* @subpackage cli
|
||||
* @copyright 2013 Tyler Bannister (tyler.bannister@remote-learner.net)
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
define('CLI_SCRIPT', true);
|
||||
|
||||
require(__DIR__.'/../../config.php');
|
||||
require_once($CFG->libdir.'/clilib.php');
|
||||
require_once($CFG->libdir.'/questionlib.php');
|
||||
|
||||
$long = array('fix' => false, 'help' => false);
|
||||
$short = array('f' => 'fix', 'h' => 'help');
|
||||
|
||||
// Now get cli options.
|
||||
list($options, $unrecognized) = cli_get_params($long, $short);
|
||||
|
||||
if ($unrecognized) {
|
||||
$unrecognized = implode("\n ", $unrecognized);
|
||||
cli_error(get_string('cliunknowoption', 'admin', $unrecognized));
|
||||
}
|
||||
|
||||
if ($options['help']) {
|
||||
$help =
|
||||
"Fix orphaned question categories.
|
||||
|
||||
This scripts detects question categories that have had their
|
||||
context deleted, thus severing them from their original purpose.
|
||||
|
||||
This script will find the orphaned categories and delete the unused
|
||||
questions in each category found. Used questions will not be
|
||||
deleted, instead they will be moved to a rescue question category.
|
||||
|
||||
Options:
|
||||
-h, --help Print out this help
|
||||
-f, --fix Fix the orphaned question categories in the DB.
|
||||
If not specified only check and report problems to STDERR.
|
||||
Example:
|
||||
\$sudo -u www-data /usr/bin/php admin/cli/fix_orphaned_question_categories.php
|
||||
\$sudo -u www-data /usr/bin/php admin/cli/fix_orphaned_question_categories.php -f
|
||||
";
|
||||
|
||||
echo $help;
|
||||
die;
|
||||
}
|
||||
|
||||
cli_heading('Checking for orphaned categories');
|
||||
|
||||
|
||||
$sql = 'SELECT qc.id, qc.contextid, qc.name
|
||||
FROM {question_categories} qc
|
||||
LEFT JOIN {context} c ON qc.contextid = c.id
|
||||
WHERE c.id IS NULL';
|
||||
$categories = $DB->get_recordset_sql($sql);
|
||||
|
||||
$i = 0;
|
||||
foreach ($categories as $category) {
|
||||
$i += 1;
|
||||
echo "Found orphaned category: {$category->name}\n";
|
||||
if (!empty($options['fix'])) {
|
||||
echo "Cleaning...";
|
||||
// One transaction per category.
|
||||
$transaction = $DB->start_delegated_transaction();
|
||||
question_category_delete_safe($category);
|
||||
$transaction->allow_commit();
|
||||
echo " Done!\n";
|
||||
}
|
||||
}
|
||||
|
||||
if (($i > 0) && !empty($options['fix'])) {
|
||||
echo "Found and removed {$i} orphaned question categories\n";
|
||||
} else if ($i > 0) {
|
||||
echo "Found {$i} orphaned question categories. To fix, run:\n";
|
||||
echo "\$sudo -u www-data /usr/bin/php admin/cli/fix_orphaned_question_categories.php --fix\n";
|
||||
} else {
|
||||
echo "No orphaned question categories found.\n";
|
||||
}
|
||||
|
||||
|
||||
$categories->close();
|
||||
+3
-22
@@ -69,11 +69,9 @@ Options:
|
||||
--prefix=STRING Table prefix for above database tables. Default is mdl_
|
||||
--fullname=STRING The fullname of the site
|
||||
--shortname=STRING The shortname of the site
|
||||
--summary=STRING The summary to be displayed on the front page
|
||||
--adminuser=USERNAME Username for the moodle admin account. Default is admin
|
||||
--adminpass=PASSWORD Password for the moodle admin account,
|
||||
required in non-interactive mode.
|
||||
--adminemail=STRING Email address for the moodle admin account.
|
||||
--non-interactive No interactive questions, installation fails if any
|
||||
problem encountered.
|
||||
--agree-license Indicates agreement with software license,
|
||||
@@ -122,11 +120,10 @@ $olddir = getcwd();
|
||||
chdir(dirname($_SERVER['argv'][0]));
|
||||
|
||||
// Servers should define a default timezone in php.ini, but if they don't then make sure something is defined.
|
||||
if (!function_exists('date_default_timezone_set') or !function_exists('date_default_timezone_get')) {
|
||||
fwrite(STDERR, "Timezone functions are not available.\n");
|
||||
exit(1);
|
||||
// This is a quick hack. Ideally we should ask the admin for a value. See MDL-22625 for more on this.
|
||||
if (function_exists('date_default_timezone_set') and function_exists('date_default_timezone_get')) {
|
||||
@date_default_timezone_set(@date_default_timezone_get());
|
||||
}
|
||||
date_default_timezone_set(@date_default_timezone_get());
|
||||
|
||||
// make sure PHP errors are displayed - helps with diagnosing of problems
|
||||
@error_reporting(E_ALL);
|
||||
@@ -253,10 +250,8 @@ list($options, $unrecognized) = cli_get_params(
|
||||
'prefix' => 'mdl_',
|
||||
'fullname' => '',
|
||||
'shortname' => '',
|
||||
'summary' => '',
|
||||
'adminuser' => 'admin',
|
||||
'adminpass' => '',
|
||||
'adminemail' => '',
|
||||
'non-interactive' => false,
|
||||
'agree-license' => false,
|
||||
'allow-unstable' => false,
|
||||
@@ -692,20 +687,6 @@ if ($interactive) {
|
||||
}
|
||||
}
|
||||
|
||||
// Ask for the admin email address.
|
||||
if ($interactive) {
|
||||
cli_separator();
|
||||
cli_heading(get_string('cliadminemail', 'install'));
|
||||
$prompt = get_string('clitypevaluedefault', 'admin', $options['adminemail']);
|
||||
$options['adminemail'] = cli_input($prompt);
|
||||
}
|
||||
|
||||
// Validate that the address provided was an e-mail address.
|
||||
if (!empty($options['adminemail']) && !validate_email($options['adminemail'])) {
|
||||
$a = (object) array('option' => 'adminemail', 'value' => $options['adminemail']);
|
||||
cli_error(get_string('cliincorrectvalueerror', 'admin', $a));
|
||||
}
|
||||
|
||||
if ($interactive) {
|
||||
if (!$options['agree-license']) {
|
||||
cli_separator();
|
||||
|
||||
@@ -52,7 +52,6 @@ Options:
|
||||
--lang=CODE Installation and default site language. Default is en.
|
||||
--adminuser=USERNAME Username for the moodle admin account. Default is admin.
|
||||
--adminpass=PASSWORD Password for the moodle admin account.
|
||||
--adminemail=STRING Email address for the moodle admin account.
|
||||
--agree-license Indicates agreement with software license.
|
||||
--fullname=STRING Name of the site
|
||||
--shortname=STRING Name of the site
|
||||
@@ -103,7 +102,6 @@ list($options, $unrecognized) = cli_get_params(
|
||||
'lang' => 'en',
|
||||
'adminuser' => 'admin',
|
||||
'adminpass' => '',
|
||||
'adminemail' => '',
|
||||
'fullname' => '',
|
||||
'shortname' => '',
|
||||
'agree-license' => false,
|
||||
@@ -128,12 +126,6 @@ if ($options['adminpass'] === true or $options['adminpass'] === '') {
|
||||
cli_error('You have to specify admin password. --help prints out the help'); // TODO: localize
|
||||
}
|
||||
|
||||
// Validate that the address provided was an e-mail address.
|
||||
if (!empty($options['adminemail']) && !validate_email($options['adminemail'])) {
|
||||
$a = (object) array('option' => 'adminemail', 'value' => $options['adminemail']);
|
||||
cli_error(get_string('cliincorrectvalueerror', 'admin', $a));
|
||||
}
|
||||
|
||||
$options['lang'] = clean_param($options['lang'], PARAM_SAFEDIR);
|
||||
if (!file_exists($CFG->dirroot.'/install/lang/'.$options['lang'])) {
|
||||
$options['lang'] = 'en';
|
||||
|
||||
@@ -1,202 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* MySQL table row compression tool tool.
|
||||
*
|
||||
* @package core
|
||||
* @copyright 2014 Totara Learning Solutions Ltd {@link http://www.totaralms.com/}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @author Petr Skoda <petr.skoda@totaralms.com>
|
||||
*/
|
||||
|
||||
define('CLI_SCRIPT', true);
|
||||
|
||||
require(dirname(__FILE__).'/../../config.php');
|
||||
require_once($CFG->libdir . '/clilib.php');
|
||||
|
||||
if ($DB->get_dbfamily() !== 'mysql') {
|
||||
cli_error('This script is used for MySQL databases only.');
|
||||
}
|
||||
|
||||
$engine = strtolower($DB->get_dbengine());
|
||||
if ($engine !== 'innodb' and $engine !== 'xtradb') {
|
||||
cli_error('This script is for MySQL servers using InnoDB or XtraDB engines only.');
|
||||
}
|
||||
|
||||
list($options, $unrecognized) = cli_get_params(
|
||||
array('help' => false, 'info' => false, 'list' => false, 'fix' => false, 'showsql' => false),
|
||||
array('h' => 'help', 'i' => 'info', 'l' => 'list', 'f' => 'fix', 's' => 'showsql')
|
||||
);
|
||||
|
||||
if ($unrecognized) {
|
||||
$unrecognized = implode("\n ", $unrecognized);
|
||||
cli_error(get_string('cliunknowoption', 'admin', $unrecognized));
|
||||
}
|
||||
|
||||
$help =
|
||||
"Script for detection of row size problems in MySQL InnoDB tables.
|
||||
|
||||
By default InnoDB storage table is using legacy Antelope file format
|
||||
which has major restriction on database row size.
|
||||
Use this script to detect and fix database tables with potential data
|
||||
overflow problems.
|
||||
|
||||
Options:
|
||||
-i, --info Show database information
|
||||
-l, --list List problematic tables
|
||||
-f, --fix Attempt to fix all tables (requires SUPER privilege)
|
||||
-s, --showsql Print SQL statements for fixing of tables
|
||||
-h, --help Print out this help
|
||||
|
||||
Example:
|
||||
\$ sudo -u www-data /usr/bin/php admin/cli/mysql_compressed_rows.php -l
|
||||
";
|
||||
|
||||
/** @var mysql_sql_generator $generator */
|
||||
$generator = $DB->get_manager()->generator;
|
||||
|
||||
$info = $DB->get_server_info();
|
||||
$filepertable = $DB->get_record_sql("SHOW VARIABLES LIKE 'innodb_file_per_table'");
|
||||
$filepertable = $filepertable ? $filepertable->value : '';
|
||||
$fileformat = $DB->get_record_sql("SHOW VARIABLES LIKE 'innodb_file_format'");
|
||||
$fileformat = $fileformat ? $fileformat->value : '';
|
||||
$prefix = $DB->get_prefix();
|
||||
$database = $CFG->dbname;
|
||||
|
||||
if (!empty($options['info'])) {
|
||||
echo "Database version: " . $info['description'] . "\n";
|
||||
echo "Database name: $database\n";
|
||||
echo "Database engine: " . $DB->get_dbengine() . "\n";
|
||||
echo "innodb_file_per_table: $filepertable\n";
|
||||
echo "innodb_file_format: $fileformat\n";
|
||||
|
||||
exit(0);
|
||||
|
||||
} else if (!empty($options['list'])) {
|
||||
$problem = false;
|
||||
foreach ($DB->get_tables(false) as $table) {
|
||||
$columns = $DB->get_columns($table, false);
|
||||
$size = $generator->guess_antelope_row_size($columns);
|
||||
$format = $DB->get_row_format($table);
|
||||
if ($size <= $generator::ANTELOPE_MAX_ROW_SIZE) {
|
||||
continue;
|
||||
}
|
||||
|
||||
echo str_pad($prefix . $table, 32, ' ', STR_PAD_RIGHT);
|
||||
echo str_pad($format, 11, ' ', STR_PAD_RIGHT);
|
||||
|
||||
if ($format === 'Compact' or $format === 'Redundant') {
|
||||
$problem = true;
|
||||
echo " (needs fixing)\n";
|
||||
|
||||
} else if ($format !== 'Compressed' and $format !== 'Dynamic') {
|
||||
echo " (unknown)\n";
|
||||
|
||||
} else {
|
||||
echo "\n";
|
||||
}
|
||||
}
|
||||
|
||||
if ($problem) {
|
||||
exit(1);
|
||||
}
|
||||
exit(0);
|
||||
|
||||
} else if (!empty($options['fix'])) {
|
||||
$fixtables = array();
|
||||
foreach ($DB->get_tables(false) as $table) {
|
||||
$columns = $DB->get_columns($table, false);
|
||||
$size = $generator->guess_antelope_row_size($columns);
|
||||
$format = $DB->get_row_format($table);
|
||||
if ($size <= $generator::ANTELOPE_MAX_ROW_SIZE) {
|
||||
continue;
|
||||
}
|
||||
if ($format === 'Compact' or $format === 'Redundant') {
|
||||
$fixtables[$table] = $table;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$fixtables) {
|
||||
echo "No changes necessary\n";
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if ($filepertable !== 'ON') {
|
||||
try {
|
||||
$DB->execute("SET GLOBAL innodb_file_per_table=1");
|
||||
} catch (dml_exception $e) {
|
||||
echo "Cannot enable GLOBAL innodb_file_per_table setting, use --showsql option and execute the statements manually.";
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
if ($fileformat !== 'Barracuda') {
|
||||
try {
|
||||
$DB->execute("SET GLOBAL innodb_file_format=Barracuda");
|
||||
} catch (dml_exception $e) {
|
||||
echo "Cannot change GLOBAL innodb_file_format setting, use --showsql option and execute the statements manually.";
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$DB->is_compressed_row_format_supported(false)) {
|
||||
echo "MySQL server is not compatible with compressed row format.";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
foreach ($fixtables as $table) {
|
||||
$DB->change_database_structure("ALTER TABLE {$prefix}$table ROW_FORMAT=Compressed");
|
||||
echo str_pad($prefix . $table, 32, ' ', STR_PAD_RIGHT) . " ... Compressed\n";
|
||||
}
|
||||
|
||||
exit(0);
|
||||
|
||||
} else if (!empty($options['showsql'])) {
|
||||
$fixtables = array();
|
||||
|
||||
foreach ($DB->get_tables(false) as $table) {
|
||||
$columns = $DB->get_columns($table, false);
|
||||
$size = $generator->guess_antelope_row_size($columns);
|
||||
$format = $DB->get_row_format($table);
|
||||
if ($size <= $generator::ANTELOPE_MAX_ROW_SIZE) {
|
||||
continue;
|
||||
}
|
||||
if ($format === 'Compact' or $format === 'Redundant') {
|
||||
$fixtables[$table] = $table;
|
||||
}
|
||||
}
|
||||
if (!$fixtables) {
|
||||
echo "No changes necessary\n";
|
||||
exit(0);
|
||||
}
|
||||
|
||||
echo "Copy the following SQL statements and execute them using account with SUPER privilege:\n\n";
|
||||
echo "USE $database;\n";
|
||||
echo "SET SESSION sql_mode=STRICT_ALL_TABLES;\n";
|
||||
echo "SET GLOBAL innodb_file_per_table=1;\n";
|
||||
echo "SET GLOBAL innodb_file_format=Barracuda;\n";
|
||||
foreach ($fixtables as $table) {
|
||||
echo "ALTER TABLE {$prefix}$table ROW_FORMAT=Compressed;\n";
|
||||
}
|
||||
echo "\n";
|
||||
exit(0);
|
||||
|
||||
} else {
|
||||
echo $help;
|
||||
die;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ admin_externalpage_setup('environment', '', $extraurlparams);
|
||||
// Handle the 'updatecomponent' action
|
||||
if ($action == 'updatecomponent' && confirm_sesskey()) {
|
||||
// Create component installer and execute it
|
||||
if ($cd = new component_installer('https://download.moodle.org',
|
||||
if ($cd = new component_installer('http://download.moodle.org',
|
||||
'environment',
|
||||
'environment.zip')) {
|
||||
$status = $cd->install(); //returns COMPONENT_(ERROR | UPTODATE | INSTALLED)
|
||||
@@ -53,7 +53,7 @@ if ($action == 'updatecomponent' && confirm_sesskey()) {
|
||||
case COMPONENT_ERROR:
|
||||
if ($cd->get_error() == 'remotedownloaderror') {
|
||||
$a = new stdClass();
|
||||
$a->url = 'https://download.moodle.org/environment/environment.zip';
|
||||
$a->url = 'http://download.moodle.org/environment/environment.zip';
|
||||
$a->dest = $CFG->dataroot . '/';
|
||||
print_error($cd->get_error(), 'error', $PAGE->url, $a);
|
||||
die();
|
||||
|
||||
@@ -1027,7 +1027,6 @@
|
||||
<VENDOR name="oracle" version="10.2" />
|
||||
</DATABASE>
|
||||
<PHP version="5.4.4" level="required">
|
||||
<RESTRICT function="restrict_php_version_7" message="unsupportedphpversion7" />
|
||||
</PHP>
|
||||
<PCREUNICODE level="optional">
|
||||
<FEEDBACK>
|
||||
@@ -1135,427 +1134,6 @@
|
||||
<ON_ERROR message="quizattemptsupgradedmessage" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_slasharguments" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="slashargumentswarning" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_database_tables_row_format" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="unsupporteddbtablerowformat" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
</CUSTOM_CHECKS>
|
||||
</MOODLE>
|
||||
<MOODLE version="2.8" requires="2.2">
|
||||
<UNICODE level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="unicoderequired" />
|
||||
</FEEDBACK>
|
||||
</UNICODE>
|
||||
<DATABASE level="required">
|
||||
<VENDOR name="mariadb" version="5.5.31" />
|
||||
<VENDOR name="mysql" version="5.5.31" />
|
||||
<VENDOR name="postgres" version="9.1" />
|
||||
<VENDOR name="mssql" version="10.0" />
|
||||
<VENDOR name="oracle" version="10.2" />
|
||||
</DATABASE>
|
||||
<PHP version="5.4.4" level="required">
|
||||
<RESTRICT function="restrict_php_version_7" message="unsupportedphpversion7" />
|
||||
</PHP>
|
||||
<PCREUNICODE level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="pcreunicodewarning" />
|
||||
</FEEDBACK>
|
||||
</PCREUNICODE>
|
||||
<PHP_EXTENSIONS>
|
||||
<PHP_EXTENSION name="iconv" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="iconvrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="mbstring" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="mbstringrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="curl" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="curlrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="openssl" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="opensslrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="tokenizer" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="tokenizerrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="xmlrpc" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="xmlrpcrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="soap" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="soaprecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="ctype" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="ctyperequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="zip" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="ziprequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="zlib" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="gd" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="gdrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="simplexml" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="simplexmlrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="spl" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="splrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="pcre" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="dom" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="xml" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="intl" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="intlrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="json" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="hash" level="required"/>
|
||||
</PHP_EXTENSIONS>
|
||||
<PHP_SETTINGS>
|
||||
<PHP_SETTING name="memory_limit" value="96M" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="settingmemorylimit" />
|
||||
</FEEDBACK>
|
||||
</PHP_SETTING>
|
||||
<PHP_SETTING name="file_uploads" value="1" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="settingfileuploads" />
|
||||
</FEEDBACK>
|
||||
</PHP_SETTING>
|
||||
<PHP_SETTING name="opcache.enable" value="1" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="opcacherecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_SETTING>
|
||||
</PHP_SETTINGS>
|
||||
<CUSTOM_CHECKS>
|
||||
<CUSTOM_CHECK file="question/engine/upgrade/upgradelib.php" function="quiz_attempts_upgraded" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="quizattemptsupgradedmessage" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_slasharguments" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="slashargumentswarning" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_database_tables_row_format" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="unsupporteddbtablerowformat" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
</CUSTOM_CHECKS>
|
||||
</MOODLE>
|
||||
<MOODLE version="2.9" requires="2.2">
|
||||
<UNICODE level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="unicoderequired" />
|
||||
</FEEDBACK>
|
||||
</UNICODE>
|
||||
<DATABASE level="required">
|
||||
<VENDOR name="mariadb" version="5.5.31" />
|
||||
<VENDOR name="mysql" version="5.5.31" />
|
||||
<VENDOR name="postgres" version="9.1" />
|
||||
<VENDOR name="mssql" version="10.0" />
|
||||
<VENDOR name="oracle" version="10.2" />
|
||||
</DATABASE>
|
||||
<PHP version="5.4.4" level="required">
|
||||
<RESTRICT function="restrict_php_version_7" message="unsupportedphpversion7" />
|
||||
</PHP>
|
||||
<PCREUNICODE level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="pcreunicodewarning" />
|
||||
</FEEDBACK>
|
||||
</PCREUNICODE>
|
||||
<PHP_EXTENSIONS>
|
||||
<PHP_EXTENSION name="iconv" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="iconvrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="mbstring" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="mbstringrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="curl" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="curlrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="openssl" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="opensslrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="tokenizer" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="tokenizerrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="xmlrpc" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="xmlrpcrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="soap" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="soaprecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="ctype" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="ctyperequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="zip" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="ziprequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="zlib" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="gd" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="gdrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="simplexml" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="simplexmlrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="spl" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="splrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="pcre" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="dom" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="xml" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="intl" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="intlrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="json" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="hash" level="required"/>
|
||||
</PHP_EXTENSIONS>
|
||||
<PHP_SETTINGS>
|
||||
<PHP_SETTING name="memory_limit" value="96M" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="settingmemorylimit" />
|
||||
</FEEDBACK>
|
||||
</PHP_SETTING>
|
||||
<PHP_SETTING name="file_uploads" value="1" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="settingfileuploads" />
|
||||
</FEEDBACK>
|
||||
</PHP_SETTING>
|
||||
<PHP_SETTING name="opcache.enable" value="1" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="opcacherecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_SETTING>
|
||||
</PHP_SETTINGS>
|
||||
<CUSTOM_CHECKS>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_database_storage_engine" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="unsupporteddbstorageengine" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="question/engine/upgrade/upgradelib.php" function="quiz_attempts_upgraded" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="quizattemptsupgradedmessage" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_slasharguments" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="slashargumentswarning" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_database_tables_row_format" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="unsupporteddbtablerowformat" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
</CUSTOM_CHECKS>
|
||||
</MOODLE>
|
||||
<MOODLE version="3.0" requires="2.2">
|
||||
<UNICODE level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="unicoderequired" />
|
||||
</FEEDBACK>
|
||||
</UNICODE>
|
||||
<DATABASE level="required">
|
||||
<VENDOR name="mariadb" version="5.5.31" />
|
||||
<VENDOR name="mysql" version="5.5.31" />
|
||||
<VENDOR name="postgres" version="9.1" />
|
||||
<VENDOR name="mssql" version="10.0" />
|
||||
<VENDOR name="oracle" version="10.2" />
|
||||
</DATABASE>
|
||||
<PHP version="5.4.4" level="required">
|
||||
</PHP>
|
||||
<PCREUNICODE level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="pcreunicodewarning" />
|
||||
</FEEDBACK>
|
||||
</PCREUNICODE>
|
||||
<PHP_EXTENSIONS>
|
||||
<PHP_EXTENSION name="iconv" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="iconvrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="mbstring" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="mbstringrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="curl" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="curlrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="openssl" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="opensslrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="tokenizer" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="tokenizerrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="xmlrpc" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="xmlrpcrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="soap" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="soaprecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="ctype" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="ctyperequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="zip" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="ziprequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="zlib" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="gd" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="gdrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="simplexml" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="simplexmlrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="spl" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="splrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="pcre" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="dom" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="xml" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="intl" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="intlrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="json" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="hash" level="required"/>
|
||||
</PHP_EXTENSIONS>
|
||||
<PHP_SETTINGS>
|
||||
<PHP_SETTING name="memory_limit" value="96M" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="settingmemorylimit" />
|
||||
</FEEDBACK>
|
||||
</PHP_SETTING>
|
||||
<PHP_SETTING name="file_uploads" value="1" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="settingfileuploads" />
|
||||
</FEEDBACK>
|
||||
</PHP_SETTING>
|
||||
<PHP_SETTING name="opcache.enable" value="1" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="opcacherecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_SETTING>
|
||||
</PHP_SETTINGS>
|
||||
<CUSTOM_CHECKS>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_database_storage_engine" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="unsupporteddbstorageengine" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="question/engine/upgrade/upgradelib.php" function="quiz_attempts_upgraded" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="quizattemptsupgradedmessage" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_slasharguments" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="slashargumentswarning" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_database_tables_row_format" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="unsupporteddbtablerowformat" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
</CUSTOM_CHECKS>
|
||||
</MOODLE>
|
||||
</COMPATIBILITY_MATRIX>
|
||||
|
||||
+24
-33
@@ -88,6 +88,7 @@ core_component::get_core_subsystems();
|
||||
require_once($CFG->libdir.'/adminlib.php'); // various admin-only functions
|
||||
require_once($CFG->libdir.'/upgradelib.php'); // general upgrade/install related functions
|
||||
|
||||
$id = optional_param('id', '', PARAM_TEXT);
|
||||
$confirmupgrade = optional_param('confirmupgrade', 0, PARAM_BOOL);
|
||||
$confirmrelease = optional_param('confirmrelease', 0, PARAM_BOOL);
|
||||
$confirmplugins = optional_param('confirmplugincheck', 0, PARAM_BOOL);
|
||||
@@ -513,15 +514,7 @@ if (isguestuser()) {
|
||||
redirect(get_login_url());
|
||||
}
|
||||
$context = context_system::instance();
|
||||
|
||||
if (!has_capability('moodle/site:config', $context)) {
|
||||
// Do not throw exception display an empty page with administration menu if visible for current user.
|
||||
$PAGE->set_title($SITE->fullname);
|
||||
$PAGE->set_heading($SITE->fullname);
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->footer();
|
||||
exit;
|
||||
}
|
||||
require_capability('moodle/site:config', $context);
|
||||
|
||||
// check that site is properly customized
|
||||
$site = get_site();
|
||||
@@ -529,10 +522,14 @@ if (empty($site->shortname)) {
|
||||
// probably new installation - lets return to frontpage after this step
|
||||
// remove settings that we want uninitialised
|
||||
unset_config('registerauth');
|
||||
unset_config('timezone'); // Force admin to select timezone!
|
||||
redirect('upgradesettings.php?return=site');
|
||||
}
|
||||
|
||||
// Check if we are returning from moodle.org registration and if so, we mark that fact to remove reminders
|
||||
if (!empty($id) and $id == $CFG->siteidentifier) {
|
||||
set_config('registered', time());
|
||||
}
|
||||
|
||||
// setup critical warnings before printing admin tree block
|
||||
$insecuredataroot = is_dataroot_insecure(true);
|
||||
$SESSION->admin_critical_warning = ($insecuredataroot==INSECURE_DATAROOT_ERROR);
|
||||
@@ -558,43 +555,37 @@ if (isset($SESSION->pluginuninstallreturn)) {
|
||||
// Print default admin page with notifications.
|
||||
$errorsdisplayed = defined('WARN_DISPLAY_ERRORS_ENABLED');
|
||||
|
||||
// We make the assumption that at least one schedule task should run once per day.
|
||||
$lastcron = $DB->get_field_sql('SELECT MAX(lastruntime) FROM {task_scheduled}');
|
||||
$lastcron = $DB->get_field_sql('SELECT MAX(lastcron) FROM {modules}');
|
||||
$cronoverdue = ($lastcron < time() - 3600 * 24);
|
||||
$dbproblems = $DB->diagnose();
|
||||
$maintenancemode = !empty($CFG->maintenance_enabled);
|
||||
|
||||
// Available updates for Moodle core.
|
||||
// Available updates for Moodle core
|
||||
$updateschecker = \core\update\checker::instance();
|
||||
$availableupdates = array();
|
||||
$availableupdatesfetch = null;
|
||||
$availableupdates['core'] = $updateschecker->get_update_info('core',
|
||||
array('minmaturity' => $CFG->updateminmaturity, 'notifybuilds' => $CFG->updatenotifybuilds));
|
||||
|
||||
if (empty($CFG->disableupdatenotifications)) {
|
||||
// Only compute the update information when it is going to be displayed to the user.
|
||||
$availableupdates['core'] = $updateschecker->get_update_info('core',
|
||||
array('minmaturity' => $CFG->updateminmaturity, 'notifybuilds' => $CFG->updatenotifybuilds));
|
||||
|
||||
// Available updates for contributed plugins
|
||||
$pluginman = core_plugin_manager::instance();
|
||||
foreach ($pluginman->get_plugins() as $plugintype => $plugintypeinstances) {
|
||||
foreach ($plugintypeinstances as $pluginname => $plugininfo) {
|
||||
if (!empty($plugininfo->availableupdates)) {
|
||||
foreach ($plugininfo->availableupdates as $pluginavailableupdate) {
|
||||
if ($pluginavailableupdate->version > $plugininfo->versiondisk) {
|
||||
if (!isset($availableupdates[$plugintype.'_'.$pluginname])) {
|
||||
$availableupdates[$plugintype.'_'.$pluginname] = array();
|
||||
}
|
||||
$availableupdates[$plugintype.'_'.$pluginname][] = $pluginavailableupdate;
|
||||
// Available updates for contributed plugins
|
||||
$pluginman = core_plugin_manager::instance();
|
||||
foreach ($pluginman->get_plugins() as $plugintype => $plugintypeinstances) {
|
||||
foreach ($plugintypeinstances as $pluginname => $plugininfo) {
|
||||
if (!empty($plugininfo->availableupdates)) {
|
||||
foreach ($plugininfo->availableupdates as $pluginavailableupdate) {
|
||||
if ($pluginavailableupdate->version > $plugininfo->versiondisk) {
|
||||
if (!isset($availableupdates[$plugintype.'_'.$pluginname])) {
|
||||
$availableupdates[$plugintype.'_'.$pluginname] = array();
|
||||
}
|
||||
$availableupdates[$plugintype.'_'.$pluginname][] = $pluginavailableupdate;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// The timestamp of the most recent check for available updates
|
||||
$availableupdatesfetch = $updateschecker->get_last_timefetched();
|
||||
}
|
||||
|
||||
// The timestamp of the most recent check for available updates
|
||||
$availableupdatesfetch = $updateschecker->get_last_timefetched();
|
||||
|
||||
$buggyiconvnomb = (!function_exists('mb_convert_encoding') and @iconv('UTF-8', 'UTF-8//IGNORE', '100'.chr(130).'€') !== '100€');
|
||||
//check if the site is registered on Moodle.org
|
||||
$registered = $DB->count_records('registration_hubs', array('huburl' => HUB_MOODLEORGHUBURL, 'confirmed' => 1));
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php
|
||||
<?PHP
|
||||
|
||||
// Allows the admin to configure mnet stuff
|
||||
|
||||
|
||||
@@ -94,15 +94,6 @@ class mnet_review_host_form extends moodleform {
|
||||
$mform->setType('wwwroot', PARAM_URL);
|
||||
$mform->addRule('wwwroot', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
|
||||
|
||||
$options = array(
|
||||
mnet_peer::SSL_NONE => get_string('none'),
|
||||
mnet_peer::SSL_HOST => get_string('verifyhostonly', 'core_mnet'),
|
||||
mnet_peer::SSL_HOST_AND_PEER => get_string('verifyhostandpeer', 'core_mnet')
|
||||
);
|
||||
$mform->addElement('select', 'sslverification', get_string('sslverification', 'core_mnet'), $options);
|
||||
$mform->setDefault('sslverification', mnet_peer::SSL_HOST_AND_PEER);
|
||||
$mform->addHelpButton('sslverification', 'sslverification', 'core_mnet');
|
||||
|
||||
$themes = array('' => get_string('forceno'));
|
||||
foreach (array_keys(core_component::get_plugin_list('theme')) as $themename) {
|
||||
$themes[$themename] = get_string('pluginname', 'theme_'.$themename);
|
||||
|
||||
@@ -172,7 +172,6 @@ if ($formdata = $reviewform->get_data()) {
|
||||
$mnet_peer->public_key = $formdata->public_key;
|
||||
$credentials = $mnet_peer->check_credentials($mnet_peer->public_key);
|
||||
$mnet_peer->public_key_expires = $credentials['validTo_time_t'];
|
||||
$mnet_peer->sslverification = $formdata->sslverification;
|
||||
|
||||
if ($mnet_peer->commit()) {
|
||||
redirect(new moodle_url('/admin/mnet/peers.php', array('hostid' => $mnet_peer->id)), get_string('changessaved'));
|
||||
|
||||
@@ -34,12 +34,21 @@ if (!defined('MOODLE_INTERNAL')) {
|
||||
}
|
||||
|
||||
$strmnetservices = get_string('mnetservices', 'mnet');
|
||||
$strmnetlog = get_string('mnetlog', 'mnet');
|
||||
$strmnetedithost = get_string('reviewhostdetails', 'mnet');
|
||||
|
||||
$logurl = $CFG->wwwroot.
|
||||
'/report/log/index.php?chooselog=1&showusers=1&showcourses=1&host_course='.$mnet_peer->id.
|
||||
'%2F1&user='.'0'.
|
||||
'&date=0'.
|
||||
'&modid=&modaction=0&logformat=showashtml';
|
||||
$tabs = array();
|
||||
if (isset($mnet_peer->id) && $mnet_peer->id > 0) {
|
||||
$tabs[] = new tabobject('mnetdetails', 'peers.php?step=update&hostid='.$mnet_peer->id, $strmnetedithost, $strmnetedithost, false);
|
||||
$tabs[] = new tabobject('mnetservices', 'services.php?hostid='.$mnet_peer->id, $strmnetservices, $strmnetservices, false);
|
||||
if ($mnet_peer->application->name == 'moodle' && $mnet_peer->id != $CFG->mnet_all_hosts_id) {
|
||||
$tabs[] = new tabobject('mnetlog', $logurl, $strmnetlog, $strmnetlog, false);
|
||||
}
|
||||
$tabs[] = new tabobject('mnetprofilefields', 'profilefields.php?hostid=' . $mnet_peer->id, get_string('profilefields', 'mnet'), get_string('profilefields', 'mnet'), false);
|
||||
} else {
|
||||
$tabs[] = new tabobject('mnetdetails', '#', $strmnetedithost, $strmnetedithost, false);
|
||||
|
||||
@@ -66,19 +66,12 @@ if (!empty($hostid) && array_key_exists($hostid, $hosts)) {
|
||||
|
||||
$mnet_request->set_method('system/listServices');
|
||||
$mnet_request->send($mnet_peer);
|
||||
|
||||
$services = $mnet_request->response;
|
||||
$yesno = array('No', 'Yes');
|
||||
$servicenames = array();
|
||||
|
||||
echo $OUTPUT->heading(get_string('servicesavailableonhost', 'mnet', $host->wwwroot));
|
||||
|
||||
if (!empty($mnet_request->error)) {
|
||||
echo $OUTPUT->heading(get_string('error'), 3);
|
||||
echo html_writer::alist($mnet_request->error);
|
||||
$services = array();
|
||||
}
|
||||
|
||||
$table = new html_table();
|
||||
$table->head = array(
|
||||
get_string('serviceid', 'mnet'),
|
||||
@@ -134,7 +127,6 @@ if (!empty($hostid) && array_key_exists($hostid, $hosts)) {
|
||||
echo html_writer::table($table);
|
||||
|
||||
|
||||
$mnet_request = new mnet_xmlrpc_client();
|
||||
$mnet_request->set_method('system/listMethods');
|
||||
if (isset($servicename) && array_key_exists($servicename, $serviceinfo)) {
|
||||
echo $OUTPUT->heading(get_string('methodsavailableonhostinservice', 'mnet', (object)array('host' => $host->wwwroot, 'service' => $servicename)));
|
||||
@@ -147,11 +139,6 @@ if (!empty($hostid) && array_key_exists($hostid, $hosts)) {
|
||||
$mnet_request->send($mnet_peer);
|
||||
$methods = $mnet_request->response;
|
||||
|
||||
if (!empty($mnet_request->error)) {
|
||||
echo $OUTPUT->heading(get_string('error'), 3);
|
||||
echo html_writer::alist($mnet_request->error);
|
||||
$methods = array();
|
||||
}
|
||||
|
||||
$table = new html_table();
|
||||
$table->head = array(
|
||||
@@ -184,12 +171,6 @@ if (!empty($hostid) && array_key_exists($hostid, $hosts)) {
|
||||
|
||||
echo $OUTPUT->heading(get_string('methodsignature', 'mnet', $method));
|
||||
|
||||
if (!empty($mnet_request->error)) {
|
||||
echo $OUTPUT->heading(get_string('error'), 3);
|
||||
echo html_writer::alist($mnet_request->error);
|
||||
$signature = array();
|
||||
}
|
||||
|
||||
$table = new html_table();
|
||||
$table->head = array(
|
||||
get_string('position', 'mnet'),
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@
|
||||
echo '<div class="phpinfo">';
|
||||
|
||||
ob_start();
|
||||
phpinfo(INFO_GENERAL + INFO_CONFIGURATION + INFO_MODULES + INFO_VARIABLES);
|
||||
phpinfo(INFO_GENERAL + INFO_CONFIGURATION + INFO_MODULES);
|
||||
$html = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
|
||||
@@ -58,14 +58,17 @@ if (!empty($registeredhub) and $registeredhub->token == $token) {
|
||||
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading(get_string('registrationconfirmed', 'hub'), 3, 'main');
|
||||
$hublink = html_writer::tag('a', $hubname, array('href' => $url));
|
||||
|
||||
$registeredhub->token = $newtoken;
|
||||
$registeredhub->confirmed = 1;
|
||||
$registeredhub->hubname = $hubname;
|
||||
$registrationmanager->update_registeredhub($registeredhub);
|
||||
|
||||
// Display notification message.
|
||||
echo $OUTPUT->notification(get_string('registrationconfirmedon', 'hub'), 'notifysuccess');
|
||||
//display notficiation message
|
||||
$notificationmessage = $OUTPUT->notification(
|
||||
get_string('registrationconfirmedon', 'hub', $hublink), 'notifysuccess');
|
||||
echo $notificationmessage;
|
||||
|
||||
//display continue button
|
||||
$registrationpage = new moodle_url('/admin/registration/index.php');
|
||||
|
||||
@@ -22,9 +22,9 @@
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
|
||||
* @copyright (C) 1999 onwards Martin Dougiamas http://dougiamas.com
|
||||
*
|
||||
* On this page the administrator selects which hub he wants to register (except for moodle.net)
|
||||
* Admins can register with moodle.net via the site admin menu "Registration" link.
|
||||
* On this page the administrator can also unregister from any hubs including moodle.net.
|
||||
* On this page the administrator selects which hub he wants to register,
|
||||
* except for MOOCH. Admins can register with MOOCH with the top admin menu "Registration" link.
|
||||
* On this page the administrator can also unregister from any hubs, including MOOCH.
|
||||
*/
|
||||
|
||||
require('../../config.php');
|
||||
|
||||
+27
-28
@@ -53,30 +53,31 @@ class registration_manager {
|
||||
public function cron() {
|
||||
global $CFG;
|
||||
if (extension_loaded('xmlrpc')) {
|
||||
$function = 'hub_update_site_info';
|
||||
require_once($CFG->dirroot . "/webservice/xmlrpc/lib.php");
|
||||
//check if the last registration cron update was less than a week ago
|
||||
$lastcron = get_config('registration', 'crontime');
|
||||
if ($lastcron === false or $lastcron < strtotime("-7 day")) { //set to a week, see MDL-23704
|
||||
$function = 'hub_update_site_info';
|
||||
require_once($CFG->dirroot . "/webservice/xmlrpc/lib.php");
|
||||
|
||||
// Update all hubs where the site is registered.
|
||||
$hubs = $this->get_registered_on_hubs();
|
||||
if (empty($hubs)) {
|
||||
mtrace(get_string('registrationwarning', 'admin'));
|
||||
}
|
||||
foreach ($hubs as $hub) {
|
||||
// Update the registration.
|
||||
$siteinfo = $this->get_site_info($hub->huburl);
|
||||
$params = array('siteinfo' => $siteinfo);
|
||||
$serverurl = $hub->huburl . "/local/hub/webservice/webservices.php";
|
||||
$xmlrpcclient = new webservice_xmlrpc_client($serverurl, $hub->token);
|
||||
try {
|
||||
$result = $xmlrpcclient->call($function, $params);
|
||||
$this->update_registeredhub($hub); // To update timemodified.
|
||||
mtrace(get_string('siteupdatedcron', 'hub', $hub->hubname));
|
||||
} catch (Exception $e) {
|
||||
$errorparam = new stdClass();
|
||||
$errorparam->errormessage = $e->getMessage();
|
||||
$errorparam->hubname = $hub->hubname;
|
||||
mtrace(get_string('errorcron', 'hub', $errorparam));
|
||||
//update all hub where the site is registered on
|
||||
$hubs = $this->get_registered_on_hubs();
|
||||
foreach ($hubs as $hub) {
|
||||
//update the registration
|
||||
$siteinfo = $this->get_site_info($hub->huburl);
|
||||
$params = array('siteinfo' => $siteinfo);
|
||||
$serverurl = $hub->huburl . "/local/hub/webservice/webservices.php";
|
||||
$xmlrpcclient = new webservice_xmlrpc_client($serverurl, $hub->token);
|
||||
try {
|
||||
$result = $xmlrpcclient->call($function, $params);
|
||||
mtrace(get_string('siteupdatedcron', 'hub', $hub->hubname));
|
||||
} catch (Exception $e) {
|
||||
$errorparam = new stdClass();
|
||||
$errorparam->errormessage = $e->getMessage();
|
||||
$errorparam->hubname = $hub->hubname;
|
||||
mtrace(get_string('errorcron', 'hub', $errorparam));
|
||||
}
|
||||
}
|
||||
set_config('crontime', time(), 'registration');
|
||||
}
|
||||
} else {
|
||||
mtrace(get_string('errorcronnoxmlrpc', 'hub'));
|
||||
@@ -117,7 +118,6 @@ class registration_manager {
|
||||
*/
|
||||
public function add_registeredhub($hub) {
|
||||
global $DB;
|
||||
$hub->timemodified = time();
|
||||
$id = $DB->insert_record('registration_hubs', $hub);
|
||||
return $id;
|
||||
}
|
||||
@@ -171,16 +171,15 @@ class registration_manager {
|
||||
|
||||
/**
|
||||
* Update a registered hub (mostly use to update the confirmation status)
|
||||
* @param object $hub the hub
|
||||
* @param object $communication the hub
|
||||
*/
|
||||
public function update_registeredhub($hub) {
|
||||
public function update_registeredhub($communication) {
|
||||
global $DB;
|
||||
$hub->timemodified = time();
|
||||
$DB->update_record('registration_hubs', $hub);
|
||||
$DB->update_record('registration_hubs', $communication);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return all hubs where the site is registered
|
||||
* Return all hubs where the site is registered on
|
||||
*/
|
||||
public function get_registered_on_hubs() {
|
||||
global $DB;
|
||||
|
||||
@@ -39,8 +39,6 @@ require_once($CFG->dirroot . '/' . $CFG->admin . '/registration/forms.php');
|
||||
require_once($CFG->dirroot . '/webservice/lib.php');
|
||||
require_once($CFG->dirroot . '/' . $CFG->admin . '/registration/lib.php');
|
||||
|
||||
require_sesskey();
|
||||
|
||||
$huburl = required_param('huburl', PARAM_URL);
|
||||
$huburl = rtrim($huburl, "/");
|
||||
|
||||
@@ -118,7 +116,6 @@ if ($update and confirm_sesskey()) {
|
||||
$xmlrpcclient = new webservice_xmlrpc_client($serverurl, $registeredhub->token);
|
||||
try {
|
||||
$result = $xmlrpcclient->call($function, $params);
|
||||
$registrationmanager->update_registeredhub($registeredhub); // To update timemodified.
|
||||
} catch (Exception $e) {
|
||||
$error = $OUTPUT->notification(get_string('errorregistration', 'hub', $e->getMessage()));
|
||||
}
|
||||
@@ -178,20 +175,8 @@ if (!empty($error)) {
|
||||
echo $error;
|
||||
}
|
||||
|
||||
// Some Moodle.org registration explanation.
|
||||
//some Moodle.org resitration explanation
|
||||
if ($huburl == HUB_MOODLEORGHUBURL) {
|
||||
if (!empty($registeredhub->token)) {
|
||||
if ($registeredhub->timemodified == 0) {
|
||||
$registrationmessage = get_string('pleaserefreshregistrationunknown', 'admin');
|
||||
} else {
|
||||
$lastupdated = userdate($registeredhub->timemodified, get_string('strftimedate', 'langconfig'));
|
||||
$registrationmessage = get_string('pleaserefreshregistration', 'admin', $lastupdated);
|
||||
}
|
||||
} else {
|
||||
$registrationmessage = get_string('registrationwarning', 'admin');
|
||||
}
|
||||
echo $OUTPUT->notification($registrationmessage);
|
||||
|
||||
echo $OUTPUT->heading(get_string('registerwithmoodleorg', 'admin'));
|
||||
$renderer = $PAGE->get_renderer('core', 'register');
|
||||
echo $renderer->moodleorg_registration_message();
|
||||
|
||||
@@ -31,18 +31,18 @@
|
||||
class core_register_renderer extends plugin_renderer_base {
|
||||
|
||||
/**
|
||||
* Display message about the benefits of registering on Moodle.org
|
||||
* Display Moodle.org registration message about benefit to register on Moodle.org
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function moodleorg_registration_message() {
|
||||
$moodleorgstatslink = html_writer::link('http://moodle.net/stats',
|
||||
get_string('statsmoodleorg', 'admin'),
|
||||
array('target' => '_blank'));
|
||||
|
||||
$moodleorgregmsg = get_string('registermoodleorg', 'admin');
|
||||
$moodleorgurl = html_writer::link('http://moodle.org', 'Moodle.org');
|
||||
$moodleorgstatsurl = html_writer::link('http://moodle.org/stats', get_string('statsmoodleorg', 'admin'));
|
||||
$moochurl = html_writer::link(HUB_MOODLEORGHUBURL, get_string('moodleorghubname', 'admin'));
|
||||
$moodleorgregmsg = get_string('registermoodleorg', 'admin', $moodleorgurl);
|
||||
$items = array(get_string('registermoodleorgli1', 'admin'),
|
||||
get_string('registermoodleorgli2', 'admin', $moodleorgstatslink));
|
||||
get_string('registermoodleorgli2', 'admin', $moodleorgstatsurl),
|
||||
get_string('registermoodleorgli3', 'admin', $moochurl));
|
||||
$moodleorgregmsg .= html_writer::alist($items);
|
||||
return $moodleorgregmsg;
|
||||
}
|
||||
|
||||
+11
-22
@@ -721,8 +721,6 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
foreach ($updates['core'] as $update) {
|
||||
$updateinfo .= $this->moodle_available_update_info($update);
|
||||
}
|
||||
$updateinfo .= html_writer::tag('p', get_string('updateavailablerecommendation', 'core_admin'),
|
||||
array('class' => 'updateavailablerecommendation'));
|
||||
}
|
||||
unset($updates['core']);
|
||||
// If something has left in the $updates array now, it is updates for plugins.
|
||||
@@ -1041,28 +1039,19 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
}
|
||||
|
||||
foreach ($plugin->get_other_required_plugins() as $component => $requiredversion) {
|
||||
$ok = true;
|
||||
$otherplugin = $pluginman->get_plugin_info($component);
|
||||
$actions = array();
|
||||
|
||||
if (is_null($otherplugin)) {
|
||||
// The required plugin is not installed.
|
||||
$class = 'requires-failed requires-missing';
|
||||
$installurl = new moodle_url('https://moodle.org/plugins/view.php', array('plugin' => $component));
|
||||
$uploadurl = new moodle_url('/admin/tool/installaddon/');
|
||||
$actions[] = html_writer::link($installurl, get_string('dependencyinstall', 'core_plugin'));
|
||||
$actions[] = html_writer::link($uploadurl, get_string('dependencyupload', 'core_plugin'));
|
||||
|
||||
$ok = false;
|
||||
} else if ($requiredversion != ANY_VERSION and $otherplugin->versiondisk < $requiredversion) {
|
||||
// The required plugin is installed but needs to be updated.
|
||||
$class = 'requires-failed requires-outdated';
|
||||
if (!$otherplugin->is_standard()) {
|
||||
$updateurl = new moodle_url($this->page->url, array('sesskey' => sesskey(), 'fetchupdates' => 1));
|
||||
$actions[] = html_writer::link($updateurl, get_string('checkforupdates', 'core_plugin'));
|
||||
}
|
||||
$ok = false;
|
||||
}
|
||||
|
||||
} else {
|
||||
// Already installed plugin with sufficient version.
|
||||
if ($ok) {
|
||||
$class = 'requires-ok';
|
||||
} else {
|
||||
$class = 'requires-failed';
|
||||
}
|
||||
|
||||
if ($requiredversion != ANY_VERSION) {
|
||||
@@ -1070,11 +1059,11 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
} else {
|
||||
$str = 'otherplugin';
|
||||
}
|
||||
|
||||
$componenturl = new moodle_url('https://moodle.org/plugins/view.php?plugin='.$component);
|
||||
$componenturl = html_writer::tag('a', $component, array('href' => $componenturl->out()));
|
||||
$requires[] = html_writer::tag('li',
|
||||
html_writer::div(get_string($str, 'core_plugin',
|
||||
array('component' => $component, 'version' => $requiredversion)), 'component').
|
||||
html_writer::div(implode(' | ', $actions), 'actions'),
|
||||
get_string($str, 'core_plugin',
|
||||
array('component' => $componenturl, 'version' => $requiredversion)),
|
||||
array('class' => $class));
|
||||
}
|
||||
|
||||
|
||||
+2
-6
@@ -50,8 +50,7 @@ $table->set_attribute('class', 'admintable generaltable');
|
||||
$table->setup();
|
||||
|
||||
$plugins = array();
|
||||
$availableplugins = core_component::get_plugin_list('report');
|
||||
foreach ($availableplugins as $plugin => $plugindir) {
|
||||
foreach (core_component::get_plugin_list('report') as $plugin => $plugindir) {
|
||||
if (get_string_manager()->string_exists('pluginname', 'report_' . $plugin)) {
|
||||
$strpluginname = get_string('pluginname', 'report_' . $plugin);
|
||||
} else {
|
||||
@@ -81,10 +80,7 @@ foreach ($plugins as $plugin => $name) {
|
||||
$uninstall = html_writer::link($uninstallurl, $struninstall);
|
||||
}
|
||||
|
||||
$stores = array();
|
||||
if (isset($availableplugins[$plugin])) {
|
||||
$stores = $logmanager->get_supported_logstores('report_' . $plugin);
|
||||
}
|
||||
$stores = $logmanager->get_supported_logstores('report_' . $plugin);
|
||||
if ($stores === false) {
|
||||
$supportedstores = get_string('logstorenotrequired', 'admin');
|
||||
} else if (!empty($stores)) {
|
||||
|
||||
+4
-14
@@ -264,7 +264,6 @@ if (($action == 'edit') || ($action == 'new')) {
|
||||
$strshow = get_string('on', 'repository');
|
||||
$strhide = get_string('off', 'repository');
|
||||
$strdelete = get_string('disabled', 'repository');
|
||||
$struninstall = get_string('uninstallplugin', 'core_admin');
|
||||
|
||||
$actionchoicesforexisting = array(
|
||||
'show' => $strshow,
|
||||
@@ -287,9 +286,9 @@ if (($action == 'edit') || ($action == 'new')) {
|
||||
|
||||
// Table to list plug-ins
|
||||
$table = new html_table();
|
||||
$table->head = array(get_string('name'), get_string('isactive', 'repository'), get_string('order'), $settingsstr, $struninstall);
|
||||
$table->head = array(get_string('name'), get_string('isactive', 'repository'), get_string('order'), $settingsstr);
|
||||
|
||||
$table->colclasses = array('leftalign', 'centeralign', 'centeralign', 'centeralign', 'centeralign', 'centeralign');
|
||||
$table->colclasses = array('leftalign', 'centeralign', 'centeralign', 'centeralign', 'centeralign');
|
||||
$table->id = 'repositoriessetting';
|
||||
$table->data = array();
|
||||
$table->attributes['class'] = 'admintable generaltable';
|
||||
@@ -385,12 +384,7 @@ if (($action == 'edit') || ($action == 'new')) {
|
||||
|
||||
$updowncount++;
|
||||
|
||||
$uninstall = '';
|
||||
if ($uninstallurl = core_plugin_manager::instance()->get_uninstall_url('repository_' . $typename, 'manage')) {
|
||||
$uninstall = html_writer::link($uninstallurl, $struninstall);
|
||||
}
|
||||
|
||||
$table->data[] = array($i->get_readablename(), $OUTPUT->render($select), $updown, $settings, $uninstall);
|
||||
$table->data[] = array($i->get_readablename(), $OUTPUT->render($select), $updown, $settings);
|
||||
|
||||
if (!in_array($typename, $alreadyplugins)) {
|
||||
$alreadyplugins[] = $typename;
|
||||
@@ -406,11 +400,7 @@ if (($action == 'edit') || ($action == 'new')) {
|
||||
if (!in_array($plugin, $alreadyplugins)) {
|
||||
$select = new single_select(repository_action_url($plugin, 'repos'), 'action', $actionchoicesfornew, 'delete', null, 'applyto' . basename($plugin));
|
||||
$select->set_label(get_string('action'), array('class' => 'accesshide'));
|
||||
$uninstall = '';
|
||||
if ($uninstallurl = core_plugin_manager::instance()->get_uninstall_url('repository_' . $plugin, 'manage')) {
|
||||
$uninstall = html_writer::link($uninstallurl, $struninstall);
|
||||
}
|
||||
$table->data[] = array(get_string('pluginname', 'repository_'.$plugin), $OUTPUT->render($select), '', '', $uninstall);
|
||||
$table->data[] = array(get_string('pluginname', 'repository_'.$plugin), $OUTPUT->render($select), '', '');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -135,11 +135,6 @@ if ($roleid) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($user) && ($user->id != $USER->id)) {
|
||||
$PAGE->navigation->extend_for_user($user);
|
||||
$PAGE->navbar->includesettingsbase = true;
|
||||
}
|
||||
|
||||
$PAGE->set_pagelayout('admin');
|
||||
$PAGE->set_title($title);
|
||||
|
||||
|
||||
@@ -52,7 +52,6 @@ if (!has_any_capability(array('moodle/role:assign', 'moodle/role:safeoverride',
|
||||
$PAGE->set_url($url);
|
||||
|
||||
if ($context->contextlevel == CONTEXT_USER and $USER->id != $context->instanceid) {
|
||||
$PAGE->navbar->includesettingsbase = true;
|
||||
$PAGE->navigation->extend_for_user($user);
|
||||
$PAGE->set_context(context_course::instance($course->id));
|
||||
} else {
|
||||
|
||||
@@ -472,9 +472,7 @@ class core_role_define_role_table_advanced extends core_role_capability_table_wi
|
||||
}
|
||||
|
||||
protected function get_description_field($id) {
|
||||
return '<textarea class="form-textarea" id="'. s($id) .'" name="description" rows="10" cols="50">' .
|
||||
htmlspecialchars($this->role->description) .
|
||||
'</textarea>';
|
||||
return print_textarea(true, 10, 50, 50, 10, 'description', $this->role->description, 0, true);
|
||||
}
|
||||
|
||||
protected function get_archetype_field($id) {
|
||||
|
||||
@@ -41,24 +41,15 @@ class core_role_existing_role_holders extends core_role_assign_user_selector_bas
|
||||
list($sort, $sortparams) = users_order_by_sql('u', $search, $this->accesscontext);
|
||||
$params = array_merge($params, $sortparams);
|
||||
|
||||
$fields = "SELECT ra.id AS raid," . $this->required_fields_sql('u') . ",ra.contextid,ra.component ";
|
||||
$countfields = "SELECT COUNT(1) ";
|
||||
$sql = "FROM {role_assignments} ra
|
||||
$sql = "SELECT ra.id AS raid," . $this->required_fields_sql('u') . ",ra.contextid,ra.component
|
||||
FROM {role_assignments} ra
|
||||
JOIN {user} u ON u.id = ra.userid
|
||||
JOIN {context} ctx ON ra.contextid = ctx.id
|
||||
WHERE $wherecondition
|
||||
AND ctx.id $ctxcondition
|
||||
AND ra.roleid = :roleid";
|
||||
$order = " ORDER BY ctx.depth DESC, ra.component, $sort";
|
||||
|
||||
if (!$this->is_validating()) {
|
||||
$existinguserscount = $DB->count_records_sql($countfields . $sql, $params);
|
||||
if ($existinguserscount > $this->maxusersperpage) {
|
||||
return $this->too_many_results($search, $existinguserscount);
|
||||
}
|
||||
}
|
||||
|
||||
$contextusers = $DB->get_records_sql($fields . $sql . $order, $params);
|
||||
AND ra.roleid = :roleid
|
||||
ORDER BY ctx.depth DESC, ra.component, $sort";
|
||||
$contextusers = $DB->get_records_sql($sql, $params);
|
||||
|
||||
// No users at all.
|
||||
if (empty($contextusers)) {
|
||||
|
||||
@@ -48,12 +48,11 @@ class core_role_potential_assignees_below_course extends core_role_assign_user_s
|
||||
$fields = 'SELECT ' . $this->required_fields_sql('u');
|
||||
$countfields = 'SELECT COUNT(u.id)';
|
||||
|
||||
$sql = " FROM ($enrolsql) enrolled_users_view
|
||||
JOIN {user} u ON u.id = enrolled_users_view.id
|
||||
LEFT JOIN {role_assignments} ra ON (ra.userid = enrolled_users_view.id AND
|
||||
ra.roleid = :roleid AND ra.contextid = :contextid)
|
||||
WHERE ra.id IS NULL
|
||||
$wherecondition";
|
||||
$sql = " FROM {user} u
|
||||
LEFT JOIN {role_assignments} ra ON (ra.userid = u.id AND ra.roleid = :roleid AND ra.contextid = :contextid)
|
||||
WHERE u.id IN ($enrolsql)
|
||||
$wherecondition
|
||||
AND ra.id IS NULL";
|
||||
$params['contextid'] = $this->context->id;
|
||||
$params['roleid'] = $this->roleid;
|
||||
|
||||
|
||||
@@ -53,9 +53,9 @@ M.core_role.init_cap_table_filter = function(Y, tableid, contextid) {
|
||||
// Create the capability search input.
|
||||
this.input = Y.Node.create('<input type="text" id="'+this.table.get('id')+'capabilitysearch" value="'+Y.Escape.html(filtervalue)+'" />');
|
||||
// Create a label for the search input.
|
||||
this.label = Y.Node.create('<label for="'+this.input.get('id')+'">'+M.util.get_string('filter', 'moodle')+' </label>');
|
||||
this.label = Y.Node.create('<label for="'+this.input.get('id')+'">'+M.str.moodle.filter+' </label>');
|
||||
// Create a clear button to clear the input.
|
||||
this.button = Y.Node.create('<input type="button" value="'+M.util.get_string('clear', 'moodle')+'" />').set('disabled', filtervalue=='');
|
||||
this.button = Y.Node.create('<input type="button" value="'+M.str.moodle.clear+'" />').set('disabled', filtervalue=='');
|
||||
|
||||
// Tie it all together
|
||||
this.div.append(this.label).append(this.input).append(this.button);
|
||||
|
||||
@@ -59,9 +59,8 @@ require_capability('moodle/role:review', $context);
|
||||
$PAGE->set_url($url);
|
||||
|
||||
if ($context->contextlevel == CONTEXT_USER and $USER->id != $context->instanceid) {
|
||||
$PAGE->navbar->includesettingsbase = true;
|
||||
$PAGE->navigation->extend_for_user($user);
|
||||
$PAGE->set_context(context_user::instance($user->id));
|
||||
$PAGE->set_context(context_course::instance($course->id));
|
||||
} else {
|
||||
$PAGE->set_context($context);
|
||||
}
|
||||
|
||||
@@ -132,7 +132,7 @@ if ($courseid == SITEID) {
|
||||
$PAGE->set_heading($course->fullname.': '.$fullname);
|
||||
}
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading($title);
|
||||
echo $OUTPUT->heading($title, 3);
|
||||
echo $OUTPUT->box_start('generalbox boxaligncenter boxwidthnormal');
|
||||
|
||||
// Display them.
|
||||
|
||||
+3
-3
@@ -22,6 +22,7 @@ if ($data = data_submitted() and confirm_sesskey()) {
|
||||
if (admin_write_settings($data)) {
|
||||
$statusmsg = get_string('changessaved');
|
||||
}
|
||||
$adminroot = admin_get_root(true); //reload tree
|
||||
|
||||
if (!empty($adminroot->errors)) {
|
||||
$errormsg = get_string('errorwithsettings', 'admin');
|
||||
@@ -43,11 +44,10 @@ if ($errormsg !== '') {
|
||||
|
||||
$resultshtml = admin_search_settings_html($query); // case insensitive search only
|
||||
|
||||
echo '<form action="' . $PAGE->url->out(true) . '" method="post" id="adminsettings">';
|
||||
echo '<form action="search.php" method="post" id="adminsettings">';
|
||||
echo '<div>';
|
||||
echo '<input type="hidden" name="sesskey" value="'.sesskey().'" />';
|
||||
// HACK to prevent browsers from automatically inserting the user's password into the wrong fields.
|
||||
echo prevent_form_autofill_password();
|
||||
echo '<input type="hidden" name="query" value="'.s($query).'" />';
|
||||
echo '</div>';
|
||||
echo '<fieldset>';
|
||||
echo '<div class="clearer"><!-- --></div>';
|
||||
|
||||
+1
-4
@@ -48,6 +48,7 @@ if ($data = data_submitted() and confirm_sesskey()) {
|
||||
$errormsg = get_string('errorwithsettings', 'admin');
|
||||
$firsterror = reset($adminroot->errors);
|
||||
}
|
||||
$adminroot = admin_get_root(true); //reload tree
|
||||
$settingspage = $adminroot->locate($section, true);
|
||||
}
|
||||
|
||||
@@ -77,8 +78,6 @@ if (empty($SITE->fullname)) {
|
||||
echo html_writer::input_hidden_params($PAGE->url);
|
||||
echo '<input type="hidden" name="sesskey" value="'.sesskey().'" />';
|
||||
echo '<input type="hidden" name="return" value="'.$return.'" />';
|
||||
// HACK to prevent browsers from automatically inserting the user's password into the wrong fields.
|
||||
echo prevent_form_autofill_password();
|
||||
|
||||
echo $settingspage->output_html();
|
||||
|
||||
@@ -121,8 +120,6 @@ if (empty($SITE->fullname)) {
|
||||
echo html_writer::input_hidden_params($PAGE->url);
|
||||
echo '<input type="hidden" name="sesskey" value="'.sesskey().'" />';
|
||||
echo '<input type="hidden" name="return" value="'.$return.'" />';
|
||||
// HACK to prevent browsers from automatically inserting the user's password into the wrong fields.
|
||||
echo prevent_form_autofill_password();
|
||||
echo $OUTPUT->heading($settingspage->visiblename);
|
||||
|
||||
echo $settingspage->output_html();
|
||||
|
||||
@@ -23,17 +23,6 @@ if ($hassiteconfig or has_any_capability($capabilities, $systemcontext)) { // sp
|
||||
$temp->add(new admin_setting_configcheckbox('allowuserblockhiding', new lang_string('allowuserblockhiding', 'admin'), new lang_string('configallowuserblockhiding', 'admin'), 1));
|
||||
$temp->add(new admin_setting_configcheckbox('allowblockstodock', new lang_string('allowblockstodock', 'admin'), new lang_string('configallowblockstodock', 'admin'), 1));
|
||||
$temp->add(new admin_setting_configtextarea('custommenuitems', new lang_string('custommenuitems', 'admin'), new lang_string('configcustommenuitems', 'admin'), '', PARAM_TEXT, '50', '10'));
|
||||
$temp->add(new admin_setting_configtextarea(
|
||||
'customusermenuitems',
|
||||
new lang_string('customusermenuitems', 'admin'),
|
||||
new lang_string('configcustomusermenuitems', 'admin'),
|
||||
'grades,grades|/grade/report/mygrades.php|grades
|
||||
messages,message|/message/index.php|message
|
||||
preferences,moodle|/user/preferences.php|preferences',
|
||||
PARAM_TEXT,
|
||||
'50',
|
||||
'10'
|
||||
));
|
||||
$temp->add(new admin_setting_configcheckbox('enabledevicedetection', new lang_string('enabledevicedetection', 'admin'), new lang_string('configenabledevicedetection', 'admin'), 1));
|
||||
$temp->add(new admin_setting_devicedetectregex('devicedetectregex', new lang_string('devicedetectregex', 'admin'), new lang_string('devicedetectregex_desc', 'admin'), ''));
|
||||
$ADMIN->add('themes', $temp);
|
||||
@@ -64,8 +53,7 @@ preferences,moodle|/user/preferences.php|preferences',
|
||||
array('0' => new lang_string('default', 'calendar'),
|
||||
'%I:%M %p' => new lang_string('timeformat_12', 'calendar'),
|
||||
'%H:%M' => new lang_string('timeformat_24', 'calendar'))));
|
||||
$temp->add(new admin_setting_configselect('calendar_startwday', new lang_string('configstartwday', 'admin'),
|
||||
new lang_string('helpstartofweek', 'admin'), get_string('firstdayofweek', 'langconfig'),
|
||||
$temp->add(new admin_setting_configselect('calendar_startwday', new lang_string('configstartwday', 'admin'), new lang_string('helpstartofweek', 'admin'), 0,
|
||||
array(
|
||||
0 => new lang_string('sunday', 'calendar'),
|
||||
1 => new lang_string('monday', 'calendar'),
|
||||
@@ -76,24 +64,11 @@ preferences,moodle|/user/preferences.php|preferences',
|
||||
6 => new lang_string('saturday', 'calendar')
|
||||
)));
|
||||
$temp->add(new admin_setting_special_calendar_weekend());
|
||||
$options = array(365 => new lang_string('numyear', '', 1),
|
||||
270 => new lang_string('nummonths', '', 9),
|
||||
180 => new lang_string('nummonths', '', 6),
|
||||
150 => new lang_string('nummonths', '', 5),
|
||||
120 => new lang_string('nummonths', '', 4),
|
||||
90 => new lang_string('nummonths', '', 3),
|
||||
60 => new lang_string('nummonths', '', 2),
|
||||
30 => new lang_string('nummonth', '', 1),
|
||||
21 => new lang_string('numweeks', '', 3),
|
||||
14 => new lang_string('numweeks', '', 2),
|
||||
7 => new lang_string('numweek', '', 1),
|
||||
6 => new lang_string('numdays', '', 6),
|
||||
5 => new lang_string('numdays', '', 5),
|
||||
4 => new lang_string('numdays', '', 4),
|
||||
3 => new lang_string('numdays', '', 3),
|
||||
2 => new lang_string('numdays', '', 2),
|
||||
1 => new lang_string('numday', '', 1));
|
||||
$temp->add(new admin_setting_configselect('calendar_lookahead', new lang_string('configlookahead', 'admin'), new lang_string('helpupcominglookahead', 'admin'), 21, $options));
|
||||
$options = array();
|
||||
for ($i=1; $i<=99; $i++) {
|
||||
$options[$i] = $i;
|
||||
}
|
||||
$temp->add(new admin_setting_configselect('calendar_lookahead',new lang_string('configlookahead','admin'),new lang_string('helpupcominglookahead', 'admin'),21,$options));
|
||||
$options = array();
|
||||
for ($i=1; $i<=20; $i++) {
|
||||
$options[$i] = $i;
|
||||
@@ -141,14 +116,12 @@ preferences,moodle|/user/preferences.php|preferences',
|
||||
HOMEPAGE_MY => new lang_string('mymoodle', 'admin'),
|
||||
HOMEPAGE_USER => new lang_string('userpreference', 'admin')
|
||||
);
|
||||
$temp->add(new admin_setting_configselect('defaulthomepage', new lang_string('defaulthomepage', 'admin'),
|
||||
new lang_string('configdefaulthomepage', 'admin'), HOMEPAGE_MY, $choices));
|
||||
$temp->add(new admin_setting_configselect('defaulthomepage', new lang_string('defaulthomepage', 'admin'), new lang_string('configdefaulthomepage', 'admin'), HOMEPAGE_SITE, $choices));
|
||||
$temp->add(new admin_setting_configcheckbox('allowguestmymoodle', new lang_string('allowguestmymoodle', 'admin'), new lang_string('configallowguestmymoodle', 'admin'), 1));
|
||||
$temp->add(new admin_setting_configcheckbox('navshowfullcoursenames', new lang_string('navshowfullcoursenames', 'admin'), new lang_string('navshowfullcoursenames_help', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('navshowcategories', new lang_string('navshowcategories', 'admin'), new lang_string('confignavshowcategories', 'admin'), 1));
|
||||
$temp->add(new admin_setting_configcheckbox('navshowmycoursecategories', new lang_string('navshowmycoursecategories', 'admin'), new lang_string('navshowmycoursecategories_help', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('navshowallcourses', new lang_string('navshowallcourses', 'admin'), new lang_string('confignavshowallcourses', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('navexpandmycourses', new lang_string('navexpandmycourses', 'admin'), new lang_string('navexpandmycourses_desc', 'admin'), 1));
|
||||
$sortoptions = array(
|
||||
'sortorder' => new lang_string('sort_sortorder', 'admin'),
|
||||
'fullname' => new lang_string('sort_fullname', 'admin'),
|
||||
@@ -159,7 +132,6 @@ preferences,moodle|/user/preferences.php|preferences',
|
||||
$temp->add(new admin_setting_configtext('navcourselimit',new lang_string('navcourselimit','admin'),new lang_string('confignavcourselimit', 'admin'),20,PARAM_INT));
|
||||
$temp->add(new admin_setting_configcheckbox('usesitenameforsitepages', new lang_string('usesitenameforsitepages', 'admin'), new lang_string('configusesitenameforsitepages', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('linkadmincategories', new lang_string('linkadmincategories', 'admin'), new lang_string('linkadmincategories_help', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('linkcoursesections', new lang_string('linkcoursesections', 'admin'), new lang_string('linkcoursesections_help', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('navshowfrontpagemods', new lang_string('navshowfrontpagemods', 'admin'), new lang_string('navshowfrontpagemods_help', 'admin'), 1));
|
||||
$temp->add(new admin_setting_configcheckbox('navadduserpostslinks', new lang_string('navadduserpostslinks', 'admin'), new lang_string('navadduserpostslinks_help', 'admin'), 1));
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ if ($hassiteconfig or has_any_capability($capabilities, $systemcontext)) {
|
||||
$ADMIN->add('courses',
|
||||
new admin_externalpage('restorecourse', new lang_string('restorecourse', 'admin'),
|
||||
new moodle_url('/backup/restorefile.php', array('contextid' => context_system::instance()->id)),
|
||||
array('moodle/restore:restorecourse')
|
||||
array('moodle/course:create')
|
||||
)
|
||||
);
|
||||
|
||||
@@ -196,10 +196,6 @@ if ($hassiteconfig or has_any_capability($capabilities, $systemcontext)) {
|
||||
$temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_logs', new lang_string('generallogs','backup'), new lang_string('configgenerallogs','backup'), array('value'=>0, 'locked'=>0)));
|
||||
$temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_histories', new lang_string('generalhistories','backup'), new lang_string('configgeneralhistories','backup'), array('value'=>0, 'locked'=>0)));
|
||||
$temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_questionbank', new lang_string('generalquestionbank','backup'), new lang_string('configgeneralquestionbank','backup'), array('value'=>1, 'locked'=>0)));
|
||||
$temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_groups',
|
||||
new lang_string('generalgroups', 'backup'), new lang_string('configgeneralgroups', 'backup'),
|
||||
array('value' => 1, 'locked' => 0)));
|
||||
|
||||
$ADMIN->add('backups', $temp);
|
||||
|
||||
// Create a page for general import configuration and defaults.
|
||||
@@ -225,7 +221,7 @@ if ($hassiteconfig or has_any_capability($capabilities, $systemcontext)) {
|
||||
2 => new lang_string('storagecourseandexternal', 'backup')
|
||||
);
|
||||
$temp->add(new admin_setting_configselect('backup/backup_auto_storage', new lang_string('automatedstorage', 'backup'), new lang_string('automatedstoragehelp', 'backup'), 0, $storageoptions));
|
||||
$temp->add(new admin_setting_special_backup_auto_destination());
|
||||
$temp->add(new admin_setting_configdirectory('backup/backup_auto_destination', new lang_string('saveto'), new lang_string('backupsavetohelp'), ''));
|
||||
$keepoptoins = array(
|
||||
0 => new lang_string('all'), 1 => '1',
|
||||
2 => '2',
|
||||
@@ -275,8 +271,6 @@ if ($hassiteconfig or has_any_capability($capabilities, $systemcontext)) {
|
||||
$temp->add(new admin_setting_configcheckbox('backup/backup_auto_logs', new lang_string('generallogs', 'backup'), new lang_string('configgenerallogs', 'backup'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('backup/backup_auto_histories', new lang_string('generalhistories','backup'), new lang_string('configgeneralhistories','backup'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('backup/backup_auto_questionbank', new lang_string('generalquestionbank','backup'), new lang_string('configgeneralquestionbank','backup'), 1));
|
||||
$temp->add(new admin_setting_configcheckbox('backup/backup_auto_groups', new lang_string('generalgroups', 'backup'),
|
||||
new lang_string('configgeneralgroups', 'backup'), 1));
|
||||
|
||||
//$temp->add(new admin_setting_configcheckbox('backup/backup_auto_messages', new lang_string('messages', 'message'), new lang_string('backupmessageshelp','message'), 0));
|
||||
//$temp->add(new admin_setting_configcheckbox('backup/backup_auto_blogs', new lang_string('blogs', 'blog'), new lang_string('backupblogshelp','blog'), 0));
|
||||
|
||||
@@ -11,6 +11,7 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
|
||||
//TODO: Re-enable cc-import once re-implemented in 2.0.x
|
||||
//$temp->add(new admin_setting_configcheckbox('enableimsccimport', new lang_string('enable_cc_import', 'imscc'), new lang_string('enable_cc_import_description', 'imscc'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('enablesafebrowserintegration', new lang_string('enablesafebrowserintegration', 'admin'), new lang_string('configenablesafebrowserintegration', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('enablegroupmembersonly', new lang_string('enablegroupmembersonly', 'admin'), new lang_string('configenablegroupmembersonly', 'admin'), 0));
|
||||
|
||||
$temp->add(new admin_setting_configcheckbox('dndallowtextandlinks', new lang_string('dndallowtextandlinks', 'admin'), new lang_string('configdndallowtextandlinks', 'admin'), 0));
|
||||
// The CSS optimiser setting. When changed we need to reset the theme caches in order to ensure they are regenerated through the optimiser.
|
||||
@@ -18,6 +19,15 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
|
||||
$enablecssoptimiser->set_updatedcallback('theme_reset_all_caches');
|
||||
$temp->add($enablecssoptimiser);
|
||||
|
||||
// Backup archive .mbz format: switching to .tar.gz enables larger files, better
|
||||
// progress reporting and possibly better performance. This is an experimental
|
||||
// setting but if successful, should be removed and enabled by default in a future
|
||||
// version. Note: this setting controls newly-created backups only; restore always
|
||||
// supports both formats.
|
||||
$temp->add(new admin_setting_configcheckbox('enabletgzbackups',
|
||||
new lang_string('enabletgzbackups', 'admin'),
|
||||
new lang_string('enabletgzbackups_desc', 'admin'), 0));
|
||||
|
||||
$ADMIN->add('experimental', $temp);
|
||||
|
||||
// "debugging" settingpage
|
||||
|
||||
@@ -68,20 +68,9 @@ if (has_capability('moodle/grade:manage', $systemcontext)
|
||||
|
||||
$temp->add(new admin_setting_special_gradelimiting());
|
||||
|
||||
$temp->add(new admin_setting_configcheckbox('grade_report_showmin',
|
||||
get_string('minimum_show', 'grades'),
|
||||
get_string('minimum_show_help', 'grades'), '1'));
|
||||
|
||||
$temp->add(new admin_setting_special_gradepointmax());
|
||||
|
||||
$temp->add(new admin_setting_special_gradepointdefault());
|
||||
|
||||
$temp->add(new admin_setting_special_grademinmaxtouse());
|
||||
|
||||
$temp->add(new admin_setting_my_grades_report());
|
||||
|
||||
$temp->add(new admin_setting_configtext('gradereport_mygradeurl', new lang_string('externalurl', 'grades'),
|
||||
new lang_string('externalurl_desc', 'grades'), ''));
|
||||
}
|
||||
$ADMIN->add('grades', $temp);
|
||||
|
||||
@@ -103,9 +92,11 @@ if (has_capability('moodle/grade:manage', $systemcontext)
|
||||
GRADE_AGGREGATE_MODE =>new lang_string('aggregatemode', 'grades'),
|
||||
GRADE_AGGREGATE_SUM =>new lang_string('aggregatesum', 'grades'));
|
||||
|
||||
$defaultvisible = array(GRADE_AGGREGATE_SUM);
|
||||
$defaultvisible = array(GRADE_AGGREGATE_MEAN, GRADE_AGGREGATE_WEIGHTED_MEAN, GRADE_AGGREGATE_WEIGHTED_MEAN2,
|
||||
GRADE_AGGREGATE_EXTRACREDIT_MEAN, GRADE_AGGREGATE_MEDIAN, GRADE_AGGREGATE_MIN,
|
||||
GRADE_AGGREGATE_MAX, GRADE_AGGREGATE_MODE, GRADE_AGGREGATE_SUM);
|
||||
|
||||
$defaults = array('value' => GRADE_AGGREGATE_SUM, 'forced' => false, 'adv' => false);
|
||||
$defaults = array('value'=>GRADE_AGGREGATE_WEIGHTED_MEAN2, 'forced'=>false, 'adv'=>false);
|
||||
$temp->add(new admin_setting_gradecat_combo('grade_aggregation', new lang_string('aggregation', 'grades'), new lang_string('aggregation_help', 'grades'), $defaults, $options));
|
||||
|
||||
$temp->add(new admin_setting_configmultiselect('grade_aggregations_visible', new lang_string('aggregationsvisible', 'grades'),
|
||||
@@ -119,6 +110,8 @@ if (has_capability('moodle/grade:manage', $systemcontext)
|
||||
$defaults = array('value'=>0, 'forced'=>false, 'adv'=>true);
|
||||
$temp->add(new admin_setting_gradecat_combo('grade_aggregateoutcomes', new lang_string('aggregateoutcomes', 'grades'),
|
||||
new lang_string('aggregateoutcomes_help', 'grades'), $defaults, $options));
|
||||
$temp->add(new admin_setting_gradecat_combo('grade_aggregatesubcats', new lang_string('aggregatesubcats', 'grades'),
|
||||
new lang_string('aggregatesubcats_help', 'grades'), $defaults, $options));
|
||||
|
||||
$options = array(0 => new lang_string('none'));
|
||||
for ($i=1; $i<=20; $i++) {
|
||||
@@ -132,9 +125,6 @@ if (has_capability('moodle/grade:manage', $systemcontext)
|
||||
$defaults['forced'] = false;
|
||||
$temp->add(new admin_setting_gradecat_combo('grade_droplow', new lang_string('droplow', 'grades'),
|
||||
new lang_string('droplow_help', 'grades'), $defaults, $options));
|
||||
|
||||
$temp->add(new admin_setting_configcheckbox('grade_overridecat', new lang_string('overridecat', 'grades'),
|
||||
new lang_string('overridecat_help', 'grades'), 1));
|
||||
}
|
||||
$ADMIN->add('grades', $temp);
|
||||
|
||||
|
||||
@@ -4,8 +4,11 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
|
||||
|
||||
// "locations" settingpage
|
||||
$temp = new admin_settingpage('locationsettings', new lang_string('locationsettings', 'admin'));
|
||||
$temp->add(new admin_setting_servertimezone());
|
||||
$temp->add(new admin_setting_forcetimezone());
|
||||
$options = get_list_of_timezones();
|
||||
$options[99] = new lang_string('serverlocaltime');
|
||||
$temp->add(new admin_setting_configselect('timezone', new lang_string('timezone','admin'), new lang_string('configtimezone', 'admin'), 99, $options));
|
||||
$options[99] = new lang_string('timezonenotforced', 'admin');
|
||||
$temp->add(new admin_setting_configselect('forcetimezone', new lang_string('forcetimezone', 'admin'), new lang_string('helpforcetimezone', 'admin'), 99, $options));
|
||||
$temp->add(new admin_settings_country_select('country', new lang_string('country', 'admin'), new lang_string('configcountry', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configtext('defaultcity', new lang_string('defaultcity', 'admin'), new lang_string('defaultcity_help', 'admin'), ''));
|
||||
|
||||
|
||||
@@ -32,13 +32,6 @@ if ($hassiteconfig) {
|
||||
|
||||
// activity modules
|
||||
$ADMIN->add('modules', new admin_category('modsettings', new lang_string('activitymodules')));
|
||||
|
||||
$temp = new admin_settingpage('managemodulescommon', new lang_string('commonsettings', 'admin'));
|
||||
|
||||
$temp->add(new admin_setting_configcheckbox('requiremodintro',
|
||||
get_string('requiremodintro', 'admin'), get_string('requiremodintro_desc', 'admin'), 0));
|
||||
$ADMIN->add('modsettings', $temp);
|
||||
|
||||
$ADMIN->add('modsettings', new admin_page_managemods());
|
||||
foreach (core_plugin_manager::instance()->get_plugins_of_type('mod') as $plugin) {
|
||||
/** @var \core\plugininfo\mod $plugin */
|
||||
@@ -84,10 +77,6 @@ if ($hassiteconfig) {
|
||||
$temp->add(new admin_setting_configcheckbox('loginpageautofocus', new lang_string('loginpageautofocus', 'admin'), new lang_string('loginpageautofocus_help', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configselect('guestloginbutton', new lang_string('guestloginbutton', 'auth'),
|
||||
new lang_string('showguestlogin', 'auth'), '1', array('0'=>new lang_string('hide'), '1'=>new lang_string('show'))));
|
||||
$options = array(0 => get_string('no'), 1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 10 => 10, 20 => 20, 50 => 50);
|
||||
$temp->add(new admin_setting_configselect('limitconcurrentlogins',
|
||||
new lang_string('limitconcurrentlogins', 'core_auth'),
|
||||
new lang_string('limitconcurrentlogins_desc', 'core_auth'), 0, $options));
|
||||
$temp->add(new admin_setting_configtext('alternateloginurl', new lang_string('alternateloginurl', 'auth'),
|
||||
new lang_string('alternatelogin', 'auth', htmlspecialchars(get_login_url())), ''));
|
||||
$temp->add(new admin_setting_configtext('forgottenpasswordurl', new lang_string('forgottenpasswordurl', 'auth'),
|
||||
@@ -289,6 +278,9 @@ if ($hassiteconfig) {
|
||||
$ADMIN->add('webservicesettings', new admin_externalpage('webservicedocumentation', new lang_string('wsdocapi', 'webservice'), "$CFG->wwwroot/$CFG->admin/webservice/documentation.php", 'moodle/site:config', false));
|
||||
/// manage service
|
||||
$temp = new admin_settingpage('externalservices', new lang_string('externalservices', 'webservice'));
|
||||
$temp->add(new admin_setting_enablemobileservice('enablemobilewebservice',
|
||||
new lang_string('enablemobilewebservice', 'admin'),
|
||||
new lang_string('configenablemobilewebservice', 'admin', $enablemobiledoclink), 0));
|
||||
$temp->add(new admin_setting_heading('manageserviceshelpexplaination', new lang_string('information', 'webservice'), new lang_string('servicehelpexplanation', 'webservice')));
|
||||
$temp->add(new admin_setting_manageexternalservices());
|
||||
$ADMIN->add('webservicesettings', $temp);
|
||||
@@ -366,7 +358,7 @@ if ($hassiteconfig || has_capability('moodle/question:config', $systemcontext))
|
||||
2 => get_string('showmarkandmax', 'question'),
|
||||
);
|
||||
$settings->add(new admin_setting_configselect('question_preview/marks',
|
||||
get_string('marks', 'question'), '', 2, $marksoptions));
|
||||
get_string('marks', 'question'), '', 1, $marksoptions));
|
||||
|
||||
$settings->add(new admin_setting_configselect('question_preview/markdp',
|
||||
get_string('decimalplacesingrades', 'question'), '', 2, array(0, 1, 2, 3, 4, 5, 6, 7)));
|
||||
|
||||
@@ -35,8 +35,7 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
|
||||
$params = new stdClass();
|
||||
$params->bytes = $defaultuserquota;
|
||||
$params->displaysize = display_size($defaultuserquota);
|
||||
$temp->add(new admin_setting_configtext('userquota', new lang_string('userquota', 'admin'),
|
||||
new lang_string('configuserquota', 'admin', $params), $defaultuserquota, PARAM_INT, 30));
|
||||
$temp->add(new admin_setting_configtext('userquota', new lang_string('userquota', 'admin'), new lang_string('configuserquota', 'admin', $params), $defaultuserquota));
|
||||
|
||||
$temp->add(new admin_setting_configcheckbox('allowobjectembed', new lang_string('allowobjectembed', 'admin'), new lang_string('configallowobjectembed', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('enabletrusttext', new lang_string('enabletrusttext', 'admin'), new lang_string('configenabletrusttext', 'admin'), 0));
|
||||
@@ -56,8 +55,7 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
|
||||
|
||||
$temp->add(new admin_setting_configcheckbox('profilesforenrolledusersonly', new lang_string('profilesforenrolledusersonly','admin'),new lang_string('configprofilesforenrolledusersonly', 'admin'),'1'));
|
||||
|
||||
$temp->add(new admin_setting_configcheckbox('cronclionly', new lang_string('cronclionly', 'admin'), new lang_string
|
||||
('configcronclionly', 'admin'), 1));
|
||||
$temp->add(new admin_setting_configcheckbox('cronclionly', new lang_string('cronclionly', 'admin'), new lang_string('configcronclionly', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configpasswordunmask('cronremotepassword', new lang_string('cronremotepassword', 'admin'), new lang_string('configcronremotepassword', 'admin'), ''));
|
||||
|
||||
$options = array(0=>get_string('no'), 3=>3, 5=>5, 7=>7, 10=>10, 20=>20, 30=>30, 50=>50, 100=>100);
|
||||
@@ -72,11 +70,6 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
|
||||
$temp->add(new admin_setting_configtext('minpasswordupper', new lang_string('minpasswordupper', 'admin'), new lang_string('configminpasswordupper', 'admin'), 1, PARAM_INT));
|
||||
$temp->add(new admin_setting_configtext('minpasswordnonalphanum', new lang_string('minpasswordnonalphanum', 'admin'), new lang_string('configminpasswordnonalphanum', 'admin'), 1, PARAM_INT));
|
||||
$temp->add(new admin_setting_configtext('maxconsecutiveidentchars', new lang_string('maxconsecutiveidentchars', 'admin'), new lang_string('configmaxconsecutiveidentchars', 'admin'), 0, PARAM_INT));
|
||||
|
||||
$temp->add(new admin_setting_configtext('passwordreuselimit',
|
||||
new lang_string('passwordreuselimit', 'admin'),
|
||||
new lang_string('passwordreuselimit_desc', 'admin'), 0, PARAM_INT));
|
||||
|
||||
$pwresetoptions = array(
|
||||
300 => new lang_string('numminutes', '', 5),
|
||||
900 => new lang_string('numminutes', '', 15),
|
||||
@@ -93,9 +86,6 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
|
||||
1800,
|
||||
$pwresetoptions);
|
||||
$temp->add($adminsetting);
|
||||
$temp->add(new admin_setting_configcheckbox('passwordchangelogout',
|
||||
new lang_string('passwordchangelogout', 'admin'),
|
||||
new lang_string('passwordchangelogout_desc', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('groupenrolmentkeypolicy', new lang_string('groupenrolmentkeypolicy', 'admin'), new lang_string('groupenrolmentkeypolicy_desc', 'admin'), 1));
|
||||
$temp->add(new admin_setting_configcheckbox('disableuserimages', new lang_string('disableuserimages', 'admin'), new lang_string('configdisableuserimages', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('emailchangeconfirmation', new lang_string('emailchangeconfirmation', 'admin'), new lang_string('configemailchangeconfirmation', 'admin'), 1));
|
||||
|
||||
@@ -11,7 +11,6 @@ $temp = new admin_settingpage('systempaths', new lang_string('systempaths','admi
|
||||
$temp->add(new admin_setting_configexecutable('pathtodu', new lang_string('pathtodu', 'admin'), new lang_string('configpathtodu', 'admin'), ''));
|
||||
$temp->add(new admin_setting_configexecutable('aspellpath', new lang_string('aspellpath', 'admin'), new lang_string('edhelpaspellpath'), ''));
|
||||
$temp->add(new admin_setting_configexecutable('pathtodot', new lang_string('pathtodot', 'admin'), new lang_string('pathtodot_help', 'admin'), ''));
|
||||
$temp->add(new admin_setting_configexecutable('pathtogs', new lang_string('pathtogs', 'admin'), new lang_string('pathtogs_help', 'admin'), '/usr/bin/gs'));
|
||||
$ADMIN->add('server', $temp);
|
||||
|
||||
|
||||
@@ -153,19 +152,6 @@ $temp->add(new admin_setting_configselect('gradehistorylifetime', new lang_strin
|
||||
60 => new lang_string('numdays', '', 60),
|
||||
30 => new lang_string('numdays', '', 30))));
|
||||
|
||||
$temp->add(new admin_setting_configselect('tempdatafoldercleanup', new lang_string('tempdatafoldercleanup', 'admin'),
|
||||
new lang_string('configtempdatafoldercleanup', 'admin'), 168, array(
|
||||
1 => new lang_string('numhours', '', 1),
|
||||
3 => new lang_string('numhours', '', 3),
|
||||
6 => new lang_string('numhours', '', 6),
|
||||
9 => new lang_string('numhours', '', 9),
|
||||
12 => new lang_string('numhours', '', 12),
|
||||
18 => new lang_string('numhours', '', 18),
|
||||
24 => new lang_string('numhours', '', 24),
|
||||
48 => new lang_string('numdays', '', 2),
|
||||
168 => new lang_string('numdays', '', 7),
|
||||
)));
|
||||
|
||||
$ADMIN->add('server', $temp);
|
||||
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ $hassiteconfig = has_capability('moodle/site:config', $systemcontext);
|
||||
$ADMIN->add('root', new admin_externalpage('adminnotifications', new lang_string('notifications'), "$CFG->wwwroot/$CFG->admin/index.php"));
|
||||
|
||||
$ADMIN->add('root', new admin_externalpage('registrationmoodleorg', new lang_string('registration', 'admin'),
|
||||
"$CFG->wwwroot/$CFG->admin/registration/register.php?huburl=" . HUB_MOODLEORGHUBURL . "&hubname=Moodle.org&sesskey=" . sesskey()));
|
||||
"$CFG->wwwroot/$CFG->admin/registration/register.php?huburl=" . HUB_MOODLEORGHUBURL . "&hubname=Moodle.org"));
|
||||
$ADMIN->add('root', new admin_externalpage('registrationhub', new lang_string('registerwith', 'hub'),
|
||||
"$CFG->wwwroot/$CFG->admin/registration/register.php", 'moodle/site:config', true));
|
||||
$ADMIN->add('root', new admin_externalpage('registrationhubs', new lang_string('hubs', 'admin'),
|
||||
|
||||
@@ -24,44 +24,6 @@ if ($hassiteconfig
|
||||
$ADMIN->add('accounts', new admin_externalpage('editusers', new lang_string('userlist','admin'), "$CFG->wwwroot/$CFG->admin/user.php", array('moodle/user:update', 'moodle/user:delete')));
|
||||
$ADMIN->add('accounts', new admin_externalpage('userbulk', new lang_string('userbulk','admin'), "$CFG->wwwroot/$CFG->admin/user/user_bulk.php", array('moodle/user:update', 'moodle/user:delete')));
|
||||
$ADMIN->add('accounts', new admin_externalpage('addnewuser', new lang_string('addnewuser'), "$securewwwroot/user/editadvanced.php?id=-1", 'moodle/user:create'));
|
||||
|
||||
// "User default preferences" settingpage.
|
||||
$temp = new admin_settingpage('userdefaultpreferences', new lang_string('userdefaultpreferences', 'admin'));
|
||||
if ($ADMIN->fulltree) {
|
||||
$choices = array();
|
||||
$choices['0'] = new lang_string('emaildisplayno');
|
||||
$choices['1'] = new lang_string('emaildisplayyes');
|
||||
$choices['2'] = new lang_string('emaildisplaycourse');
|
||||
$temp->add(new admin_setting_configselect('defaultpreference_maildisplay', new lang_string('emaildisplay'),
|
||||
'', 2, $choices));
|
||||
|
||||
$choices = array();
|
||||
$choices['0'] = new lang_string('textformat');
|
||||
$choices['1'] = new lang_string('htmlformat');
|
||||
$temp->add(new admin_setting_configselect('defaultpreference_mailformat', new lang_string('emailformat'), '', 1, $choices));
|
||||
|
||||
$choices = array();
|
||||
$choices['0'] = new lang_string('emaildigestoff');
|
||||
$choices['1'] = new lang_string('emaildigestcomplete');
|
||||
$choices['2'] = new lang_string('emaildigestsubjects');
|
||||
$temp->add(new admin_setting_configselect('defaultpreference_maildigest', new lang_string('emaildigest'),
|
||||
new lang_string('emaildigest_help'), 0, $choices));
|
||||
|
||||
|
||||
$choices = array();
|
||||
$choices['1'] = new lang_string('autosubscribeyes');
|
||||
$choices['0'] = new lang_string('autosubscribeno');
|
||||
$temp->add(new admin_setting_configselect('defaultpreference_autosubscribe', new lang_string('autosubscribe'),
|
||||
'', 1, $choices));
|
||||
|
||||
$choices = array();
|
||||
$choices['0'] = new lang_string('trackforumsno');
|
||||
$choices['1'] = new lang_string('trackforumsyes');
|
||||
$temp->add(new admin_setting_configselect('defaultpreference_trackforums', new lang_string('trackforums'),
|
||||
'', 0, $choices));
|
||||
}
|
||||
$ADMIN->add('accounts', $temp);
|
||||
|
||||
$ADMIN->add('accounts', new admin_externalpage('profilefields', new lang_string('profilefields','admin'), "$CFG->wwwroot/user/profile/index.php", 'moodle/site:config'));
|
||||
$ADMIN->add('accounts', new admin_externalpage('cohorts', new lang_string('cohorts', 'cohort'), $CFG->wwwroot . '/cohort/index.php', array('moodle/cohort:manage', 'moodle/cohort:view')));
|
||||
|
||||
@@ -157,7 +119,6 @@ if ($hassiteconfig
|
||||
array('description' => new lang_string('description'),
|
||||
'city' => new lang_string('city'),
|
||||
'country' => new lang_string('country'),
|
||||
'timezone' => new lang_string('timezone'),
|
||||
'webpage' => new lang_string('webpage'),
|
||||
'icqnumber' => new lang_string('icqnumber'),
|
||||
'skypeid' => new lang_string('skypeid'),
|
||||
@@ -191,9 +152,6 @@ if ($hassiteconfig
|
||||
'institution' => new lang_string('institution'),
|
||||
)));
|
||||
$temp->add(new admin_setting_configtext('fullnamedisplay', new lang_string('fullnamedisplay', 'admin'), new lang_string('configfullnamedisplay', 'admin'), 'language', PARAM_TEXT, 50));
|
||||
$temp->add(new admin_setting_configtext('alternativefullnameformat', new lang_string('alternativefullnameformat', 'admin'),
|
||||
new lang_string('alternativefullnameformat_desc', 'admin'),
|
||||
'language', PARAM_RAW, 50));
|
||||
$temp->add(new admin_setting_configtext('maxusersperpage', new lang_string('maxusersperpage','admin'), new lang_string('configmaxusersperpage','admin'), 100, PARAM_INT));
|
||||
$temp->add(new admin_setting_configcheckbox('enablegravatar', new lang_string('enablegravatar', 'admin'), new lang_string('enablegravatar_help', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configtext('gravatardefaulturl', new lang_string('gravatardefaulturl', 'admin'), new lang_string('gravatardefaulturl_help', 'admin'), 'mm'));
|
||||
|
||||
@@ -114,30 +114,6 @@ class behat_admin extends behat_base {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the specified site settings. A table with | config | value | (optional)plugin | is expected.
|
||||
*
|
||||
* @Given /^the following config values are set as admin:$/
|
||||
* @param TableNode $table
|
||||
*/
|
||||
public function the_following_config_values_are_set_as_admin(TableNode $table) {
|
||||
|
||||
if (!$data = $table->getRowsHash()) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($data as $config => $value) {
|
||||
// Default plugin value is null.
|
||||
$plugin = null;
|
||||
|
||||
if (is_array($value)) {
|
||||
$plugin = $value[1];
|
||||
$value = $value[0];
|
||||
}
|
||||
set_config($config, $value, $plugin);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Waits with the provided params if we are running a JS session.
|
||||
*
|
||||
|
||||
@@ -9,7 +9,6 @@ Feature: Display extended course names
|
||||
| fullname | shortname | category |
|
||||
| Course fullname | C_shortname | 0 |
|
||||
And I log in as "admin"
|
||||
And I am on site homepage
|
||||
|
||||
Scenario: Courses list without extended course names (default value)
|
||||
Then I should see "Course fullname"
|
||||
@@ -20,5 +19,5 @@ Feature: Display extended course names
|
||||
And I click on "Courses" "link" in the "//div[@id='settingsnav']/descendant::li[contains(concat(' ', normalize-space(@class), ' '), ' type_setting ')][contains(., 'Appearance')]" "xpath_element"
|
||||
And I set the field "Display extended course names" to "1"
|
||||
When I press "Save changes"
|
||||
And I am on site homepage
|
||||
And I am on homepage
|
||||
Then I should see "C_shortname Course fullname"
|
||||
|
||||
@@ -7,10 +7,10 @@ Feature: An administrator can filter user accounts by role, cohort and other pro
|
||||
Background:
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email | auth | confirmed |
|
||||
| user1 | User | One | one@example.com | manual | 0 |
|
||||
| user2 | User | Two | two@example.com | ldap | 1 |
|
||||
| user3 | User | Three | three@example.com | manual | 1 |
|
||||
| user4 | User | Four | four@example.com | ldap | 0 |
|
||||
| user1 | User | One | one@asd.com | manual | 0 |
|
||||
| user2 | User | Two | two@asd.com | ldap | 1 |
|
||||
| user3 | User | Three | three@asd.com | manual | 1 |
|
||||
| user4 | User | Four | four@asd.com | ldap | 0 |
|
||||
And the following "cohorts" exist:
|
||||
| name | idnumber |
|
||||
| Cohort 1 | CH1 |
|
||||
@@ -23,8 +23,8 @@ Feature: An administrator can filter user accounts by role, cohort and other pro
|
||||
| user2 | C1 | student |
|
||||
| user3 | C1 | student |
|
||||
And I log in as "admin"
|
||||
And I add "User Two (two@example.com)" user to "CH1" cohort members
|
||||
And I add "User Three (three@example.com)" user to "CH1" cohort members
|
||||
And I add "User Two (two@asd.com)" user to "CH1" cohort members
|
||||
And I add "User Three (three@asd.com)" user to "CH1" cohort members
|
||||
And I follow "Browse list of users"
|
||||
|
||||
@javascript
|
||||
|
||||
@@ -9,18 +9,19 @@ Feature: Set admin settings value
|
||||
| fullname | shortname | category |
|
||||
| Course fullname | C_shortname | 0 |
|
||||
And I log in as "admin"
|
||||
And I am on site homepage
|
||||
And I should see "Course fullname"
|
||||
And I should not see "C_shortname Course fullname"
|
||||
|
||||
Scenario: set admin value with full name
|
||||
Given the following config values are set as admin:
|
||||
| courselistshortnames | 1 |
|
||||
And I am on site homepage
|
||||
Given I set the following administration settings values:
|
||||
| Display extended course names | 1 |
|
||||
When I press "Save changes"
|
||||
And I am on homepage
|
||||
Then I should see "C_shortname Course fullname"
|
||||
|
||||
Scenario: set admin value with short name
|
||||
Given the following config values are set as admin:
|
||||
Given I set the following administration settings values:
|
||||
| courselistshortnames | 1 |
|
||||
And I am on site homepage
|
||||
Then I should see "C_shortname Course fullname"
|
||||
When I press "Save changes"
|
||||
And I am on homepage
|
||||
Then I should see "C_shortname Course fullname"
|
||||
@@ -21,7 +21,7 @@ Feature: Upload users
|
||||
And I should see "Tom"
|
||||
And I should see "Jones"
|
||||
And I should see "verysecret"
|
||||
And I should see "jonest@example.com"
|
||||
And I should see "jonest@someplace.edu"
|
||||
And I should see "Reznor"
|
||||
And I should see "course1"
|
||||
And I should see "math102"
|
||||
@@ -32,8 +32,8 @@ Feature: Upload users
|
||||
And I follow "Browse list of users"
|
||||
And I should see "Tom Jones"
|
||||
And I should see "Trent Reznor"
|
||||
And I should see "reznor@example.com"
|
||||
And I am on site homepage
|
||||
And I should see "reznor@someplace.edu"
|
||||
And I am on homepage
|
||||
And I follow "Maths"
|
||||
And I expand "Users" node
|
||||
And I follow "Groups"
|
||||
|
||||
+2
-2
@@ -41,11 +41,11 @@
|
||||
}
|
||||
|
||||
require_once($CFG->dirroot.'/calendar/lib.php');
|
||||
$timezones = core_date::get_list_of_timezones(null, true);
|
||||
$timezones = get_list_of_timezones();
|
||||
|
||||
echo '<center><form action="timezone.php" method="post">';
|
||||
echo html_writer::label($strusers . ' (' . $strall . '): ', 'menuzone');
|
||||
echo html_writer::select($timezones, "zone", $current);
|
||||
echo html_writer::select($timezones, "zone", $current, array('99'=>get_string("serverlocaltime")));
|
||||
echo "<input type=\"hidden\" name=\"sesskey\" value=\"".sesskey()."\" />";
|
||||
echo '<input type="submit" value="'.s($strsavechanges).'" />';
|
||||
echo "</form></center>";
|
||||
|
||||
@@ -55,7 +55,7 @@ M.tool_assignmentupgrade = {
|
||||
assignmentsinput = Y.one('input.selectedassignments');
|
||||
assignmentsinput.set('value', selectedassignments.join(','));
|
||||
if (selectedassignments.length == 0) {
|
||||
alert(M.util.get_string('noassignmentsselected', 'tool_assignmentupgrade'));
|
||||
alert(M.str.tool_assignmentupgrade.noassignmentsselected);
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2015051100;
|
||||
$plugin->requires = 2015050500;
|
||||
$plugin->version = 2014051200;
|
||||
$plugin->requires = 2014050800;
|
||||
$plugin->component = 'tool_assignmentupgrade';
|
||||
$plugin->dependencies = array('mod_assign' => 2015050500);
|
||||
$plugin->dependencies = array('mod_assign' => 2014050800);
|
||||
|
||||
@@ -13,8 +13,8 @@ Feature: Manage availability conditions
|
||||
Then I should not see "Availability restrictions"
|
||||
|
||||
# Enable it and check I can now see and click on it.
|
||||
And the following config values are set as admin:
|
||||
| enableavailability | 1 |
|
||||
And I set the following administration settings values:
|
||||
| Enable conditional access | 1 |
|
||||
And I am on homepage
|
||||
And I navigate to "Manage restrictions" node in "Site administration > Plugins > Availability restrictions"
|
||||
|
||||
@@ -28,10 +28,10 @@ Feature: Manage availability conditions
|
||||
Given the following "courses" exist:
|
||||
| fullname | shortname | format |
|
||||
| Course 1 | C1 | topics |
|
||||
And the following config values are set as admin:
|
||||
| enableavailability | 1 |
|
||||
And I log in as "admin"
|
||||
And I am on site homepage
|
||||
And I set the following administration settings values:
|
||||
| Enable conditional access | 1 |
|
||||
And I am on homepage
|
||||
When I navigate to "Manage restrictions" node in "Site administration > Plugins > Availability restrictions"
|
||||
|
||||
# Check the icon is there (it should be a Hide icon, meaning is currently visible).
|
||||
@@ -47,7 +47,7 @@ Feature: Manage availability conditions
|
||||
|
||||
# OK, toggling works. Set the grade one to Hide and we'll go see if it actually worked.
|
||||
And I click on "input[title=Hide]" "css_element" in the "Restriction by grade" "table_row"
|
||||
And I am on site homepage
|
||||
And I am on homepage
|
||||
And I follow "Course 1"
|
||||
And I turn editing mode on
|
||||
And I add a "Page" to section "1"
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2015051100;
|
||||
$plugin->requires = 2015050500;
|
||||
$plugin->version = 2014051200;
|
||||
$plugin->requires = 2014050800;
|
||||
$plugin->component = 'tool_availabilityconditions';
|
||||
|
||||
@@ -40,113 +40,61 @@ define('CACHE_DISABLE_ALL', true);
|
||||
require_once(__DIR__ . '/../../../../lib/clilib.php');
|
||||
require_once(__DIR__ . '/../../../../lib/behat/lib.php');
|
||||
|
||||
list($options, $unrecognized) = cli_get_params(
|
||||
array(
|
||||
'parallel' => 0,
|
||||
'maxruns' => false,
|
||||
'help' => false,
|
||||
'fromrun' => 1,
|
||||
'torun' => 0,
|
||||
),
|
||||
array(
|
||||
'j' => 'parallel',
|
||||
'm' => 'maxruns',
|
||||
'h' => 'help',
|
||||
)
|
||||
);
|
||||
|
||||
// Checking run.php CLI script usage.
|
||||
$help = "
|
||||
Behat utilities to initialise behat tests
|
||||
|
||||
Usage:
|
||||
php init.php [--parallel=value [--maxruns=value] [--fromrun=value --torun=value]] [--help]
|
||||
|
||||
Options:
|
||||
-j, --parallel Number of parallel behat run to initialise
|
||||
-m, --maxruns Max parallel processes to be executed at one time.
|
||||
--fromrun Execute run starting from (Used for parallel runs on different vms)
|
||||
--torun Execute run till (Used for parallel runs on different vms)
|
||||
|
||||
-h, --help Print out this help
|
||||
|
||||
Example from Moodle root directory:
|
||||
\$ php admin/tool/behat/cli/init.php --parallel=2
|
||||
|
||||
More info in http://docs.moodle.org/dev/Acceptance_testing#Running_tests
|
||||
";
|
||||
|
||||
if (!empty($options['help'])) {
|
||||
echo $help;
|
||||
exit(0);
|
||||
}
|
||||
|
||||
// Check which util file to call.
|
||||
$utilfile = 'util_single_run.php';
|
||||
$paralleloption = "";
|
||||
// If parallel run then use utilparallel.
|
||||
if ($options['parallel'] && $options['parallel'] > 1) {
|
||||
$utilfile = 'util.php';
|
||||
$paralleloption = "";
|
||||
foreach ($options as $option => $value) {
|
||||
if ($value) {
|
||||
$paralleloption .= " --$option=\"$value\"";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Changing the cwd to admin/tool/behat/cli.
|
||||
$cwd = getcwd();
|
||||
$output = null;
|
||||
|
||||
// If behat dependencies not downloaded then do it first, else symfony/process can't be used.
|
||||
testing_update_composer_dependencies();
|
||||
|
||||
// Check whether the behat test environment needs to be updated.
|
||||
chdir(__DIR__);
|
||||
exec("php $utilfile --diag $paralleloption", $output, $code);
|
||||
|
||||
$output = null;
|
||||
exec("php util.php --diag", $output, $code);
|
||||
if ($code == 0) {
|
||||
echo "Behat test environment already installed\n";
|
||||
|
||||
} else if ($code == BEHAT_EXITCODE_INSTALL) {
|
||||
|
||||
testing_update_composer_dependencies();
|
||||
|
||||
// Behat and dependencies are installed and we need to install the test site.
|
||||
chdir(__DIR__);
|
||||
passthru("php $utilfile --install $paralleloption", $code);
|
||||
passthru("php util.php --install", $code);
|
||||
if ($code != 0) {
|
||||
chdir($cwd);
|
||||
exit($code);
|
||||
}
|
||||
|
||||
} else if ($code == BEHAT_EXITCODE_REINSTALL) {
|
||||
|
||||
testing_update_composer_dependencies();
|
||||
|
||||
// Test site data is outdated.
|
||||
chdir(__DIR__);
|
||||
passthru("php $utilfile --drop $paralleloption", $code);
|
||||
passthru("php util.php --drop", $code);
|
||||
if ($code != 0) {
|
||||
chdir($cwd);
|
||||
exit($code);
|
||||
}
|
||||
|
||||
chdir(__DIR__);
|
||||
passthru("php $utilfile --install $paralleloption", $code);
|
||||
passthru("php util.php --install", $code);
|
||||
if ($code != 0) {
|
||||
exit($code);
|
||||
}
|
||||
|
||||
} else if ($code == BEHAT_EXITCODE_COMPOSER) {
|
||||
// Missing Behat dependencies.
|
||||
|
||||
testing_update_composer_dependencies();
|
||||
|
||||
// Returning to admin/tool/behat/cli.
|
||||
chdir(__DIR__);
|
||||
passthru("php util.php --install", $code);
|
||||
if ($code != 0) {
|
||||
chdir($cwd);
|
||||
exit($code);
|
||||
}
|
||||
|
||||
} else {
|
||||
// Generic error, we just output it.
|
||||
echo implode("\n", $output)."\n";
|
||||
chdir($cwd);
|
||||
exit($code);
|
||||
}
|
||||
|
||||
// Enable editing mode according to config.php vars.
|
||||
chdir(__DIR__);
|
||||
passthru("php $utilfile --enable $paralleloption", $code);
|
||||
passthru("php util.php --enable", $code);
|
||||
if ($code != 0) {
|
||||
echo "Error enabling site" . PHP_EOL;
|
||||
chdir($cwd);
|
||||
exit($code);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,398 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Wrapper to run previously set-up behat tests in parallel.
|
||||
*
|
||||
* @package tool_behat
|
||||
* @copyright 2014 NetSpot Pty Ltd
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
if (isset($_SERVER['REMOTE_ADDR'])) {
|
||||
die(); // No access from web!
|
||||
}
|
||||
|
||||
define('BEHAT_UTIL', true);
|
||||
define('CLI_SCRIPT', true);
|
||||
define('ABORT_AFTER_CONFIG', true);
|
||||
define('CACHE_DISABLE_ALL', true);
|
||||
define('NO_OUTPUT_BUFFERING', true);
|
||||
|
||||
require_once(__DIR__ .'/../../../../config.php');
|
||||
require_once(__DIR__.'/../../../../lib/clilib.php');
|
||||
require_once(__DIR__.'/../../../../lib/behat/lib.php');
|
||||
require_once(__DIR__.'/../../../../lib/behat/classes/behat_command.php');
|
||||
require_once(__DIR__.'/../../../../lib/behat/classes/behat_config_manager.php');
|
||||
|
||||
error_reporting(E_ALL | E_STRICT);
|
||||
ini_set('display_errors', '1');
|
||||
ini_set('log_errors', '1');
|
||||
|
||||
list($options, $unrecognised) = cli_get_params(
|
||||
array(
|
||||
'stop-on-failure' => 0,
|
||||
'verbose' => false,
|
||||
'replace' => false,
|
||||
'help' => false,
|
||||
'tags' => '',
|
||||
'profile' => '',
|
||||
'feature' => '',
|
||||
'fromrun' => 1,
|
||||
'torun' => 0,
|
||||
'single-run' => false,
|
||||
),
|
||||
array(
|
||||
'h' => 'help',
|
||||
't' => 'tags',
|
||||
'p' => 'profile',
|
||||
's' => 'single-run',
|
||||
)
|
||||
);
|
||||
|
||||
// Checking run.php CLI script usage.
|
||||
$help = "
|
||||
Behat utilities to run behat tests in parallel
|
||||
|
||||
Usage:
|
||||
php run.php [--BEHAT_OPTION=\"value\"] [--feature=\"value\"] [--replace] [--fromrun=value --torun=value] [--help]
|
||||
|
||||
Options:
|
||||
--BEHAT_OPTION Any combination of behat option specified in http://behat.readthedocs.org/en/v2.5/guides/6.cli.html
|
||||
--feature Only execute specified feature file (Absolute path of feature file).
|
||||
--replace Replace args string with run process number, useful for output.
|
||||
--fromrun Execute run starting from (Used for parallel runs on different vms)
|
||||
--torun Execute run till (Used for parallel runs on different vms)
|
||||
|
||||
-h, --help Print out this help
|
||||
|
||||
Example from Moodle root directory:
|
||||
\$ php admin/tool/behat/cli/run.php --tags=\"@javascript\"
|
||||
|
||||
More info in http://docs.moodle.org/dev/Acceptance_testing#Running_tests
|
||||
";
|
||||
|
||||
if (!empty($options['help'])) {
|
||||
echo $help;
|
||||
exit(0);
|
||||
}
|
||||
|
||||
$parallelrun = behat_config_manager::get_parallel_test_runs($options['fromrun']);
|
||||
|
||||
// Default torun is maximum parallel runs.
|
||||
if (empty($options['torun'])) {
|
||||
$options['torun'] = $parallelrun;
|
||||
}
|
||||
|
||||
// Capture signals and ensure we clean symlinks.
|
||||
if (extension_loaded('pcntl')) {
|
||||
$disabled = explode(',', ini_get('disable_functions'));
|
||||
if (!in_array('pcntl_signal', $disabled)) {
|
||||
pcntl_signal(SIGTERM, "signal_handler");
|
||||
pcntl_signal(SIGINT, "signal_handler");
|
||||
}
|
||||
}
|
||||
|
||||
$time = microtime(true);
|
||||
array_walk($unrecognised, function (&$v) {
|
||||
if ($x = preg_filter("#^(-+\w+)=(.+)#", "\$1=\"\$2\"", $v)) {
|
||||
$v = $x;
|
||||
} else if (!preg_match("#^-#", $v)) {
|
||||
$v = escapeshellarg($v);
|
||||
}
|
||||
});
|
||||
$extraopts = $unrecognised;
|
||||
|
||||
$tags = '';
|
||||
|
||||
if ($options['profile']) {
|
||||
$profile = $options['profile'];
|
||||
if (!isset($CFG->behat_config[$profile])) {
|
||||
echo "Invalid profile passed: " . $profile;
|
||||
exit(1);
|
||||
}
|
||||
$extraopts[] = '--profile="' . $profile . '"';
|
||||
// By default, profile tags will be used.
|
||||
if (!empty($CFG->behat_config[$profile]['filters']['tags'])) {
|
||||
$tags = $CFG->behat_config[$profile]['filters']['tags'];
|
||||
}
|
||||
}
|
||||
|
||||
// Command line tags have precedence (std behat behavior).
|
||||
if ($options['tags']) {
|
||||
$tags = $options['tags'];
|
||||
$extraopts[] = '--tags="' . $tags . '"';
|
||||
}
|
||||
|
||||
// Feature should be added to last, for behat command.
|
||||
if ($options['feature']) {
|
||||
$extraopts[] = $options['feature'];
|
||||
// Only run 1 process as process.
|
||||
// Feature file is picked from absolute path provided, so no need to check for behat.yml.
|
||||
$options['torun'] = $options['fromrun'];
|
||||
}
|
||||
|
||||
// Set of options to pass to behat.
|
||||
$extraopts = implode(' ', $extraopts);
|
||||
|
||||
// If empty parallelrun then just check with user if it's a run single behat test.
|
||||
if (empty($parallelrun)) {
|
||||
$cwd = getcwd();
|
||||
chdir(__DIR__);
|
||||
$runtestscommand = behat_command::get_behat_command(false, false, true);
|
||||
$runtestscommand .= ' --config ' . behat_config_manager::get_behat_cli_config_filepath();
|
||||
$runtestscommand .= ' ' . $extraopts;
|
||||
echo "Running single behat site:" . PHP_EOL;
|
||||
passthru("php $runtestscommand", $code);
|
||||
chdir($cwd);
|
||||
exit($code);
|
||||
}
|
||||
|
||||
// Update config file if tags defined.
|
||||
if ($tags) {
|
||||
// Hack to set proper dataroot and wwwroot.
|
||||
$behatdataroot = $CFG->behat_dataroot;
|
||||
$behatwwwroot = $CFG->behat_wwwroot;
|
||||
for ($i = 1; $i <= $parallelrun; $i++) {
|
||||
$CFG->behatrunprocess = $i;
|
||||
|
||||
if (!empty($CFG->behat_parallel_run[$i - 1]['behat_wwwroot'])) {
|
||||
$CFG->behat_wwwroot = $CFG->behat_parallel_run[$i - 1]['behat_wwwroot'];
|
||||
} else {
|
||||
$CFG->behat_wwwroot = $behatwwwroot . "/" . BEHAT_PARALLEL_SITE_NAME . $i;
|
||||
}
|
||||
if (!empty($CFG->behat_parallel_run[$i - 1]['behat_dataroot'])) {
|
||||
$CFG->behat_dataroot = $CFG->behat_parallel_run[$i - 1]['behat_dataroot'];
|
||||
} else {
|
||||
$CFG->behat_dataroot = $behatdataroot . $i;
|
||||
}
|
||||
behat_config_manager::update_config_file('', true, $tags);
|
||||
}
|
||||
$CFG->behat_dataroot = $behatdataroot;
|
||||
$CFG->behat_wwwroot = $behatwwwroot;
|
||||
unset($CFG->behatrunprocess);
|
||||
}
|
||||
|
||||
$cmds = array();
|
||||
echo "Running " . ($options['torun'] - $options['fromrun'] + 1) . " parallel behat sites:" . PHP_EOL;
|
||||
|
||||
for ($i = $options['fromrun']; $i <= $options['torun']; $i++) {
|
||||
$CFG->behatrunprocess = $i;
|
||||
|
||||
// Options parameters to be added to each run.
|
||||
$myopts = !empty($options['replace']) ? str_replace($options['replace'], $i, $extraopts) : $extraopts;
|
||||
|
||||
$behatcommand = behat_command::get_behat_command(false, false, true);
|
||||
$behatconfigpath = behat_config_manager::get_behat_cli_config_filepath($i);
|
||||
|
||||
// Command to execute behat run.
|
||||
$cmds[BEHAT_PARALLEL_SITE_NAME . $i] = $behatcommand . ' --config ' . $behatconfigpath . " " . $myopts;
|
||||
echo "[" . BEHAT_PARALLEL_SITE_NAME . $i . "] " . $cmds[BEHAT_PARALLEL_SITE_NAME . $i] . PHP_EOL;
|
||||
}
|
||||
|
||||
if (empty($cmds)) {
|
||||
echo "No commands to execute " . PHP_EOL;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// Create site symlink if necessary.
|
||||
if (!behat_config_manager::create_parallel_site_links($options['fromrun'], $options['torun'])) {
|
||||
echo "Check permissions. If on windows, make sure you are running this command as admin" . PHP_EOL;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// Execute all commands.
|
||||
$processes = cli_execute_parallel($cmds, __DIR__);
|
||||
$stoponfail = empty($options['stop-on-failure']) ? false : true;
|
||||
|
||||
// Print header.
|
||||
print_process_start_info($processes);
|
||||
|
||||
// Print combined run o/p from processes.
|
||||
$exitcodes = print_combined_run_output($processes, $stoponfail);
|
||||
$time = round(microtime(true) - $time, 1);
|
||||
echo "Finished in " . gmdate("G\h i\m s\s", $time) . PHP_EOL . PHP_EOL;
|
||||
|
||||
|
||||
// Print exit info from each run.
|
||||
$status = false;
|
||||
foreach ($exitcodes as $exitcode) {
|
||||
$status = (bool)$status || (bool)$exitcode;
|
||||
}
|
||||
|
||||
// Run finished. Show exit code and output from individual process.
|
||||
$verbose = empty($options['verbose']) ? false : true;
|
||||
$verbose = $verbose || $status;
|
||||
|
||||
// Show exit code from each process, if any process failed.
|
||||
if ($verbose) {
|
||||
// Echo exit codes.
|
||||
echo "Exit codes for each behat run: " . PHP_EOL;
|
||||
ksort($exitcodes);
|
||||
foreach ($exitcodes as $run => $exitcode) {
|
||||
echo $run . ": " . $exitcode . PHP_EOL;
|
||||
}
|
||||
|
||||
// Show failed re-run commands.
|
||||
if ($status) {
|
||||
echo "To re-run failed processes, you can use following commands:" . PHP_EOL;
|
||||
foreach ($cmds as $name => $cmd) {
|
||||
if (!empty($exitcodes[$name])) {
|
||||
echo "[" . $name . "] " . $cmd . PHP_EOL;
|
||||
}
|
||||
}
|
||||
}
|
||||
echo PHP_EOL;
|
||||
}
|
||||
|
||||
print_each_process_info($processes, $verbose);
|
||||
|
||||
// Remove site symlink if necessary.
|
||||
behat_config_manager::drop_parallel_site_links();
|
||||
|
||||
exit((int) $status);
|
||||
|
||||
/**
|
||||
* Signal handler for terminal exit.
|
||||
*
|
||||
* @param int $signal signal number.
|
||||
*/
|
||||
function signal_handler($signal) {
|
||||
switch ($signal) {
|
||||
case SIGTERM:
|
||||
case SIGKILL:
|
||||
case SIGINT:
|
||||
// Remove site symlink if necessary.
|
||||
behat_config_manager::drop_parallel_site_links();
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints header from the first process.
|
||||
*
|
||||
* @param array $processes list of processes to loop though.
|
||||
*/
|
||||
function print_process_start_info($processes) {
|
||||
$printed = false;
|
||||
// Keep looping though processes, till we get first process o/p.
|
||||
while (!$printed) {
|
||||
usleep(10000);
|
||||
foreach ($processes as $name => $process) {
|
||||
// Exit if any process has stopped.
|
||||
if (!$process->isRunning()) {
|
||||
$printed = true;
|
||||
break;
|
||||
}
|
||||
|
||||
$op = explode(PHP_EOL, $process->getOutput());
|
||||
if (count($op) >= 3) {
|
||||
foreach ($op as $line) {
|
||||
if (trim($line) && (strpos($line, '.') !== 0)) {
|
||||
echo $line . PHP_EOL;
|
||||
}
|
||||
}
|
||||
$printed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Loop though all processes and print combined o/p
|
||||
*
|
||||
* @param array $processes list of processes to loop though.
|
||||
* @param bool $stoponfail Stop all processes and exit if failed.
|
||||
* @return array list of exit codes from all processes.
|
||||
*/
|
||||
function print_combined_run_output($processes, $stoponfail = false) {
|
||||
$exitcodes = array();
|
||||
$maxdotsonline = 70;
|
||||
$remainingprintlen = $maxdotsonline;
|
||||
$progresscount = 0;
|
||||
while (count($exitcodes) != count($processes)) {
|
||||
usleep(10000);
|
||||
foreach ($processes as $name => $process) {
|
||||
if ($process->isRunning()) {
|
||||
$op = $process->getIncrementalOutput();
|
||||
if (trim($op)) {
|
||||
$update = preg_filter('#^\s*([FS\.\-]+)(?:\s+\d+)?\s*$#', '$1', $op);
|
||||
// Exit process if anything fails.
|
||||
if ($stoponfail && (strpos($update, 'F') !== false)) {
|
||||
$process->stop(0);
|
||||
}
|
||||
|
||||
$strlentoprint = strlen($update);
|
||||
|
||||
// If not enough dots printed on line then just print.
|
||||
if ($strlentoprint < $remainingprintlen) {
|
||||
echo $update;
|
||||
$remainingprintlen = $remainingprintlen - $strlentoprint;
|
||||
} else if ($strlentoprint == $remainingprintlen) {
|
||||
$progresscount += $maxdotsonline;
|
||||
echo $update ." " . $progresscount . PHP_EOL;
|
||||
$remainingprintlen = $maxdotsonline;
|
||||
} else {
|
||||
while ($part = substr($update, 0, $remainingprintlen) > 0) {
|
||||
$progresscount += $maxdotsonline;
|
||||
echo $part . " " . $progresscount . PHP_EOL;
|
||||
$update = substr($update, $remainingprintlen);
|
||||
$remainingprintlen = $maxdotsonline;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$exitcodes[$name] = $process->getExitCode();
|
||||
if ($stoponfail && ($exitcodes[$name] != 0)) {
|
||||
foreach ($processes as $l => $p) {
|
||||
$exitcodes[$l] = -1;
|
||||
$process->stop(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo PHP_EOL;
|
||||
return $exitcodes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loop though all processes and print combined o/p
|
||||
*
|
||||
* @param array $processes list of processes to loop though.
|
||||
* @param bool $verbose Show verbose output for each process.
|
||||
*/
|
||||
function print_each_process_info($processes, $verbose = false) {
|
||||
foreach ($processes as $name => $process) {
|
||||
echo "**************** [" . $name . "] ****************" . PHP_EOL;
|
||||
if ($verbose) {
|
||||
echo $process->getOutput();
|
||||
echo $process->getErrorOutput();
|
||||
} else {
|
||||
$op = explode(PHP_EOL, $process->getOutput());
|
||||
foreach ($op as $line) {
|
||||
// Don't print progress .
|
||||
if (trim($line) && (strpos($line, '.') !== 0) && (strpos($line, 'Moodle ') !== 0) &&
|
||||
(strpos($line, 'Server OS ') !== 0) && (strpos($line, 'Started at ') !== 0) &&
|
||||
(strpos($line, 'Browser specific fixes ') !== 0)) {
|
||||
echo $line . PHP_EOL;
|
||||
}
|
||||
}
|
||||
}
|
||||
echo PHP_EOL;
|
||||
}
|
||||
}
|
||||
+69
-367
@@ -15,7 +15,7 @@
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* CLI tool with utilities to manage parallel Behat integration in Moodle
|
||||
* CLI tool with utilities to manage Behat integration in Moodle
|
||||
*
|
||||
* All CLI utilities uses $CFG->behat_dataroot and $CFG->prefix_dataroot as
|
||||
* $CFG->dataroot and $CFG->prefix
|
||||
@@ -30,61 +30,45 @@ if (isset($_SERVER['REMOTE_ADDR'])) {
|
||||
die(); // No access from web!.
|
||||
}
|
||||
|
||||
define('BEHAT_UTIL', true);
|
||||
define('CLI_SCRIPT', true);
|
||||
define('NO_OUTPUT_BUFFERING', true);
|
||||
define('IGNORE_COMPONENT_CACHE', true);
|
||||
define('ABORT_AFTER_CONFIG', true);
|
||||
|
||||
require_once(__DIR__ . '/../../../../config.php');
|
||||
// Basic functions.
|
||||
require_once(__DIR__ . '/../../../../lib/clilib.php');
|
||||
require_once(__DIR__ . '/../../../../lib/behat/lib.php');
|
||||
require_once(__DIR__ . '/../../../../lib/behat/classes/behat_command.php');
|
||||
require_once(__DIR__ . '/../../../../lib/behat/classes/behat_config_manager.php');
|
||||
|
||||
|
||||
// CLI options.
|
||||
list($options, $unrecognized) = cli_get_params(
|
||||
array(
|
||||
'help' => false,
|
||||
'install' => false,
|
||||
'drop' => false,
|
||||
'enable' => false,
|
||||
'disable' => false,
|
||||
'diag' => false,
|
||||
'parallel' => 0,
|
||||
'maxruns' => false,
|
||||
'updatesteps' => false,
|
||||
'fromrun' => 1,
|
||||
'torun' => 0,
|
||||
'help' => false,
|
||||
'install' => false,
|
||||
'drop' => false,
|
||||
'enable' => false,
|
||||
'disable' => false,
|
||||
'diag' => false
|
||||
),
|
||||
array(
|
||||
'h' => 'help',
|
||||
'j' => 'parallel',
|
||||
'm' => 'maxruns'
|
||||
'h' => 'help'
|
||||
)
|
||||
);
|
||||
|
||||
if ($options['install'] or $options['drop']) {
|
||||
define('CACHE_DISABLE_ALL', true);
|
||||
}
|
||||
|
||||
// Checking util.php CLI script usage.
|
||||
$help = "
|
||||
Behat utilities to manage the test environment
|
||||
|
||||
Usage:
|
||||
php util.php [--install|--drop|--enable|--disable|--diag|--updatesteps|--help] [--parallel=value [--maxruns=value]]
|
||||
|
||||
Options:
|
||||
--install Installs the test environment for acceptance tests
|
||||
--drop Drops the database tables and the dataroot contents
|
||||
--enable Enables test environment and updates tests list
|
||||
--disable Disables test environment
|
||||
--diag Get behat test environment status code
|
||||
--updatesteps Update feature step file.
|
||||
-j, --parallel Number of parallel behat run operation
|
||||
-m, --maxruns Max parallel processes to be executed at one time.
|
||||
--install Installs the test environment for acceptance tests
|
||||
--drop Drops the database tables and the dataroot contents
|
||||
--enable Enables test environment and updates tests list
|
||||
--disable Disables test environment
|
||||
--diag Get behat test environment status code
|
||||
|
||||
-h, --help Print out this help
|
||||
|
||||
Example from Moodle root directory:
|
||||
\$ php admin/tool/behat/cli/util.php --enable --parallel=4
|
||||
\$ php admin/tool/behat/cli/util.php --enable
|
||||
|
||||
More info in http://docs.moodle.org/dev/Acceptance_testing#Running_tests
|
||||
";
|
||||
@@ -94,348 +78,66 @@ if (!empty($options['help'])) {
|
||||
exit(0);
|
||||
}
|
||||
|
||||
$cwd = getcwd();
|
||||
// Describe this script.
|
||||
define('BEHAT_UTIL', true);
|
||||
define('CLI_SCRIPT', true);
|
||||
define('NO_OUTPUT_BUFFERING', true);
|
||||
define('IGNORE_COMPONENT_CACHE', true);
|
||||
|
||||
// For drop option check if parallel site.
|
||||
if ((empty($options['parallel'])) && ($options['drop']) || $options['updatesteps']) {
|
||||
// Get parallel run info from first run.
|
||||
$options['parallel'] = behat_config_manager::get_parallel_test_runs($options['fromrun']);
|
||||
// Only load CFG from config.php, stop ASAP in lib/setup.php.
|
||||
define('ABORT_AFTER_CONFIG', true);
|
||||
require_once(__DIR__ . '/../../../../config.php');
|
||||
|
||||
// Remove error handling overrides done in config.php.
|
||||
$CFG->debug = (E_ALL | E_STRICT);
|
||||
$CFG->debugdisplay = 1;
|
||||
error_reporting($CFG->debug);
|
||||
ini_set('display_errors', '1');
|
||||
ini_set('log_errors', '1');
|
||||
|
||||
// Finish moodle init.
|
||||
define('ABORT_AFTER_CONFIG_CANCEL', true);
|
||||
require("$CFG->dirroot/lib/setup.php");
|
||||
|
||||
raise_memory_limit(MEMORY_HUGE);
|
||||
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
require_once($CFG->libdir.'/upgradelib.php');
|
||||
require_once($CFG->libdir.'/clilib.php');
|
||||
require_once($CFG->libdir.'/installlib.php');
|
||||
require_once($CFG->libdir.'/testing/classes/test_lock.php');
|
||||
|
||||
if ($unrecognized) {
|
||||
$unrecognized = implode("\n ", $unrecognized);
|
||||
cli_error(get_string('cliunknowoption', 'admin', $unrecognized));
|
||||
}
|
||||
|
||||
// If not a parallel site then open single run.
|
||||
if (empty($options['parallel'])) {
|
||||
chdir(__DIR__);
|
||||
// Check if behat is initialised, if not exit.
|
||||
passthru("php util_single_run.php --diag", $status);
|
||||
if ($status) {
|
||||
exit ($status);
|
||||
}
|
||||
$cmd = commands_to_execute($options);
|
||||
$processes = cli_execute_parallel(array($cmd), __DIR__);
|
||||
$status = print_sequential_output($processes, false);
|
||||
chdir($cwd);
|
||||
exit($status);
|
||||
}
|
||||
// Behat utilities.
|
||||
require_once($CFG->libdir . '/behat/classes/util.php');
|
||||
require_once($CFG->libdir . '/behat/classes/behat_command.php');
|
||||
|
||||
// Default torun is maximum parallel runs.
|
||||
if (empty($options['torun'])) {
|
||||
$options['torun'] = $options['parallel'];
|
||||
}
|
||||
|
||||
$status = false;
|
||||
$cmds = commands_to_execute($options);
|
||||
|
||||
// Start executing commands either sequential/parallel for options provided.
|
||||
if ($options['diag'] || $options['enable'] || $options['disable']) {
|
||||
// Do it sequentially as it's fast and need to be displayed nicely.
|
||||
foreach (array_chunk($cmds, 1, true) as $cmd) {
|
||||
$processes = cli_execute_parallel($cmd, __DIR__);
|
||||
print_sequential_output($processes);
|
||||
}
|
||||
|
||||
} else if ($options['drop']) {
|
||||
$processes = cli_execute_parallel($cmds, __DIR__);
|
||||
$exitcodes = print_combined_drop_output($processes);
|
||||
foreach ($exitcodes as $exitcode) {
|
||||
$status = (bool)$status || (bool)$exitcode;
|
||||
}
|
||||
|
||||
} else if ($options['install']) {
|
||||
// This is intensive compared to behat itself so run them in chunk if option maxruns not set.
|
||||
if ($options['maxruns']) {
|
||||
foreach (array_chunk($cmds, $options['maxruns'], true) as $chunk) {
|
||||
$processes = cli_execute_parallel($chunk, __DIR__);
|
||||
$exitcodes = print_combined_install_output($processes);
|
||||
foreach ($exitcodes as $name => $exitcode) {
|
||||
if ($exitcode != 0) {
|
||||
echo "Failed process [[$name]]" . PHP_EOL;
|
||||
echo $processes[$name]->getOutput();
|
||||
echo PHP_EOL;
|
||||
echo $processes[$name]->getErrorOutput();
|
||||
echo PHP_EOL . PHP_EOL;
|
||||
}
|
||||
$status = (bool)$status || (bool)$exitcode;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$processes = cli_execute_parallel($cmds, __DIR__);
|
||||
$exitcodes = print_combined_install_output($processes);
|
||||
foreach ($exitcodes as $name => $exitcode) {
|
||||
if ($exitcode != 0) {
|
||||
echo "Failed process [[$name]]" . PHP_EOL;
|
||||
echo $processes[$name]->getOutput();
|
||||
echo PHP_EOL;
|
||||
echo $processes[$name]->getErrorOutput();
|
||||
echo PHP_EOL . PHP_EOL;
|
||||
}
|
||||
$status = (bool)$status || (bool)$exitcode;
|
||||
}
|
||||
}
|
||||
|
||||
} else if ($options['updatesteps']) {
|
||||
// Rewrite config file to ensure we have all the features covered.
|
||||
if (empty($options['parallel'])) {
|
||||
behat_config_manager::update_config_file();
|
||||
} else {
|
||||
// Update config file, ensuring we have up-to-date behat.yml.
|
||||
for ($i = $options['fromrun']; $i <= $options['torun']; $i++) {
|
||||
$CFG->behatrunprocess = $i;
|
||||
behat_config_manager::update_config_file();
|
||||
}
|
||||
unset($CFG->behatrunprocess);
|
||||
}
|
||||
|
||||
// Do it sequentially as it's fast and need to be displayed nicely.
|
||||
foreach (array_chunk($cmds, 1, true) as $cmd) {
|
||||
$processes = cli_execute_parallel($cmd, __DIR__);
|
||||
print_sequential_output($processes);
|
||||
}
|
||||
exit(0);
|
||||
|
||||
} else {
|
||||
// We should never reach here.
|
||||
echo $help;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// Ensure we have success status to show following information.
|
||||
if ($status) {
|
||||
echo "Unknown failure $status" . PHP_EOL;
|
||||
exit((int)$status);
|
||||
}
|
||||
|
||||
// Show command o/p (only one per time).
|
||||
// Run command (only one per time).
|
||||
if ($options['install']) {
|
||||
echo "Acceptance tests site installed for sites:".PHP_EOL;
|
||||
|
||||
// Display all sites which are installed/drop/diabled.
|
||||
for ($i = $options['fromrun']; $i <= $options['torun']; $i++) {
|
||||
if (empty($CFG->behat_parallel_run[$i - 1]['behat_wwwroot'])) {
|
||||
echo $CFG->behat_wwwroot . "/" . BEHAT_PARALLEL_SITE_NAME . $i . PHP_EOL;
|
||||
} else {
|
||||
echo $CFG->behat_parallel_run[$i - 1]['behat_wwwroot'] . PHP_EOL;
|
||||
}
|
||||
|
||||
}
|
||||
behat_util::install_site();
|
||||
mtrace("Acceptance tests site installed");
|
||||
} else if ($options['drop']) {
|
||||
echo "Acceptance tests site dropped for " . $options['parallel'] . " parallel sites" . PHP_EOL;
|
||||
|
||||
// Ensure no tests are running.
|
||||
test_lock::acquire('behat');
|
||||
behat_util::drop_site();
|
||||
mtrace("Acceptance tests site dropped");
|
||||
} else if ($options['enable']) {
|
||||
echo "Acceptance tests environment enabled on $CFG->behat_wwwroot, to run the tests use:" . PHP_EOL;
|
||||
echo behat_command::get_behat_command(true, true);
|
||||
echo PHP_EOL;
|
||||
|
||||
behat_util::start_test_mode();
|
||||
$runtestscommand = behat_command::get_behat_command(true) .
|
||||
' --config ' . behat_config_manager::get_behat_cli_config_filepath();
|
||||
mtrace("Acceptance tests environment enabled on $CFG->behat_wwwroot, to run the tests use:\n " . $runtestscommand);
|
||||
} else if ($options['disable']) {
|
||||
echo "Acceptance tests environment disabled for " . $options['parallel'] . " parallel sites" . PHP_EOL;
|
||||
|
||||
behat_util::stop_test_mode();
|
||||
mtrace("Acceptance tests environment disabled");
|
||||
} else if ($options['diag']) {
|
||||
// Valid option, so nothing to do.
|
||||
$code = behat_util::get_behat_status();
|
||||
exit($code);
|
||||
} else {
|
||||
echo $help;
|
||||
chdir($cwd);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
chdir($cwd);
|
||||
exit(0);
|
||||
|
||||
/**
|
||||
* Create commands to be executed for parallel run.
|
||||
*
|
||||
* @param array $options options provided by user.
|
||||
* @return array commands to be executed.
|
||||
*/
|
||||
function commands_to_execute($options) {
|
||||
$removeoptions = array('maxruns', 'fromrun', 'torun');
|
||||
$cmds = array();
|
||||
$extraoptions = $options;
|
||||
$extra = "";
|
||||
|
||||
// Remove extra options not in util_single_run.php.
|
||||
foreach ($removeoptions as $ro) {
|
||||
$extraoptions[$ro] = null;
|
||||
unset($extraoptions[$ro]);
|
||||
}
|
||||
|
||||
foreach ($extraoptions as $option => $value) {
|
||||
if ($options[$option]) {
|
||||
$extra .= " --$option";
|
||||
if ($value) {
|
||||
$extra .= "=$value";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($options['parallel'])) {
|
||||
$cmds = "php util_single_run.php " . $extra;
|
||||
} else {
|
||||
// Create commands which has to be executed for parallel site.
|
||||
for ($i = $options['fromrun']; $i <= $options['torun']; $i++) {
|
||||
$prefix = BEHAT_PARALLEL_SITE_NAME . $i;
|
||||
$cmds[$prefix] = "php util_single_run.php " . $extra . " --run=" . $i . " 2>&1";
|
||||
}
|
||||
}
|
||||
return $cmds;
|
||||
}
|
||||
|
||||
/**
|
||||
* Print drop output merging each run.
|
||||
*
|
||||
* @param array $processes list of processes.
|
||||
* @return array exit codes of each process.
|
||||
*/
|
||||
function print_combined_drop_output($processes) {
|
||||
$exitcodes = array();
|
||||
$maxdotsonline = 70;
|
||||
$remainingprintlen = $maxdotsonline;
|
||||
$progresscount = 0;
|
||||
echo "Dropping tables:" . PHP_EOL;
|
||||
|
||||
while (count($exitcodes) != count($processes)) {
|
||||
usleep(10000);
|
||||
foreach ($processes as $name => $process) {
|
||||
if ($process->isRunning()) {
|
||||
$op = $process->getIncrementalOutput();
|
||||
if (trim($op)) {
|
||||
$update = preg_filter('#^\s*([FS\.\-]+)(?:\s+\d+)?\s*$#', '$1', $op);
|
||||
$strlentoprint = strlen($update);
|
||||
|
||||
// If not enough dots printed on line then just print.
|
||||
if ($strlentoprint < $remainingprintlen) {
|
||||
echo $update;
|
||||
$remainingprintlen = $remainingprintlen - $strlentoprint;
|
||||
} else if ($strlentoprint == $remainingprintlen) {
|
||||
$progresscount += $maxdotsonline;
|
||||
echo $update . " " . $progresscount . PHP_EOL;
|
||||
$remainingprintlen = $maxdotsonline;
|
||||
} else {
|
||||
while ($part = substr($update, 0, $remainingprintlen) > 0) {
|
||||
$progresscount += $maxdotsonline;
|
||||
echo $part . " " . $progresscount . PHP_EOL;
|
||||
$update = substr($update, $remainingprintlen);
|
||||
$remainingprintlen = $maxdotsonline;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Process exited.
|
||||
$process->clearOutput();
|
||||
$exitcodes[$name] = $process->getExitCode();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo PHP_EOL;
|
||||
return $exitcodes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Print install output merging each run.
|
||||
*
|
||||
* @param array $processes list of processes.
|
||||
* @return array exit codes of each process.
|
||||
*/
|
||||
function print_combined_install_output($processes) {
|
||||
$exitcodes = array();
|
||||
$line = array();
|
||||
|
||||
// Check what best we can do to accommodate all parallel run o/p on single line.
|
||||
// Windows command line has length of 80 chars, so default we will try fit o/p in 80 chars.
|
||||
if (defined('BEHAT_MAX_CMD_LINE_OUTPUT') && BEHAT_MAX_CMD_LINE_OUTPUT) {
|
||||
$lengthofprocessline = (int)max(10, BEHAT_MAX_CMD_LINE_OUTPUT / count($processes));
|
||||
} else {
|
||||
$lengthofprocessline = (int)max(10, 80 / count($processes));
|
||||
}
|
||||
|
||||
echo "Installing behat site for " . count($processes) . " parallel behat run" . PHP_EOL;
|
||||
|
||||
// Show process name in first row.
|
||||
foreach ($processes as $name => $process) {
|
||||
// If we don't have enough space to show full run name then show runX.
|
||||
if ($lengthofprocessline < strlen($name + 2)) {
|
||||
$name = substr($name, -5);
|
||||
}
|
||||
// One extra padding as we are adding | separator for rest of the data.
|
||||
$line[$name] = str_pad('[' . $name . '] ', $lengthofprocessline + 1);
|
||||
}
|
||||
ksort($line);
|
||||
$tableheader = array_keys($line);
|
||||
echo implode("", $line) . PHP_EOL;
|
||||
|
||||
// Now print o/p from each process.
|
||||
while (count($exitcodes) != count($processes)) {
|
||||
usleep(50000);
|
||||
$poutput = array();
|
||||
// Create child process.
|
||||
foreach ($processes as $name => $process) {
|
||||
if ($process->isRunning()) {
|
||||
$output = $process->getIncrementalOutput();
|
||||
if (trim($output)) {
|
||||
$poutput[$name] = explode(PHP_EOL, $output);
|
||||
}
|
||||
} else {
|
||||
// Process exited.
|
||||
$exitcodes[$name] = $process->getExitCode();
|
||||
}
|
||||
}
|
||||
ksort($poutput);
|
||||
|
||||
// Get max depth of o/p before displaying.
|
||||
$maxdepth = 0;
|
||||
foreach ($poutput as $pout) {
|
||||
$pdepth = count($pout);
|
||||
$maxdepth = $pdepth >= $maxdepth ? $pdepth : $maxdepth;
|
||||
}
|
||||
|
||||
// Iterate over each process to get line to print.
|
||||
for ($i = 0; $i <= $maxdepth; $i++) {
|
||||
$pline = "";
|
||||
foreach ($tableheader as $name) {
|
||||
$po = empty($poutput[$name][$i]) ? "" : substr($poutput[$name][$i], 0, $lengthofprocessline - 1);
|
||||
$po = str_pad($po, $lengthofprocessline);
|
||||
$pline .= "|". $po;
|
||||
}
|
||||
if (trim(str_replace("|", "", $pline))) {
|
||||
echo $pline . PHP_EOL;
|
||||
}
|
||||
}
|
||||
unset($poutput);
|
||||
$poutput = null;
|
||||
|
||||
}
|
||||
echo PHP_EOL;
|
||||
return $exitcodes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Print install output merging showing one run at a time.
|
||||
* If any process fail then exit.
|
||||
*
|
||||
* @param array $processes list of processes.
|
||||
* @param bool $showprefix show prefix.
|
||||
* @return bool exitcode.
|
||||
*/
|
||||
function print_sequential_output($processes, $showprefix = true) {
|
||||
$status = false;
|
||||
foreach ($processes as $name => $process) {
|
||||
$shownname = false;
|
||||
while ($process->isRunning()) {
|
||||
$op = $process->getIncrementalOutput();
|
||||
if (trim($op)) {
|
||||
// Show name of the run once for sequential.
|
||||
if ($showprefix && !$shownname) {
|
||||
echo '[' . $name . '] ';
|
||||
$shownname = true;
|
||||
}
|
||||
echo $op;
|
||||
}
|
||||
}
|
||||
// If any error then exit.
|
||||
$exitcode = $process->getExitCode();
|
||||
if ($exitcode != 0) {
|
||||
exit($exitcode);
|
||||
}
|
||||
$status = $status || (bool)$exitcode;
|
||||
}
|
||||
return $status;
|
||||
}
|
||||
|
||||
@@ -1,277 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* CLI tool with utilities to manage Behat integration in Moodle
|
||||
*
|
||||
* All CLI utilities uses $CFG->behat_dataroot and $CFG->prefix_dataroot as
|
||||
* $CFG->dataroot and $CFG->prefix
|
||||
*
|
||||
* @package tool_behat
|
||||
* @copyright 2012 David Monllaó
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
|
||||
if (isset($_SERVER['REMOTE_ADDR'])) {
|
||||
die(); // No access from web!.
|
||||
}
|
||||
|
||||
// Basic functions.
|
||||
require_once(__DIR__ . '/../../../../lib/clilib.php');
|
||||
require_once(__DIR__ . '/../../../../lib/behat/lib.php');
|
||||
|
||||
// CLI options.
|
||||
list($options, $unrecognized) = cli_get_params(
|
||||
array(
|
||||
'help' => false,
|
||||
'install' => false,
|
||||
'parallel' => 0,
|
||||
'run' => '',
|
||||
'drop' => false,
|
||||
'enable' => false,
|
||||
'disable' => false,
|
||||
'diag' => false,
|
||||
'tags' => '',
|
||||
'updatesteps' => false,
|
||||
),
|
||||
array(
|
||||
'h' => 'help'
|
||||
)
|
||||
);
|
||||
|
||||
if ($options['install'] or $options['drop']) {
|
||||
define('CACHE_DISABLE_ALL', true);
|
||||
}
|
||||
|
||||
// Checking util_single_run.php CLI script usage.
|
||||
$help = "
|
||||
Behat utilities to manage the test environment
|
||||
|
||||
Usage:
|
||||
php util_single_run.php [--install|--drop|--enable|--disable|--diag|--updatesteps|--help]
|
||||
|
||||
Options:
|
||||
--install Installs the test environment for acceptance tests
|
||||
--drop Drops the database tables and the dataroot contents
|
||||
--enable Enables test environment and updates tests list
|
||||
--disable Disables test environment
|
||||
--diag Get behat test environment status code
|
||||
--updatesteps Update feature step file.
|
||||
|
||||
-h, --help Print out this help
|
||||
|
||||
Example from Moodle root directory:
|
||||
\$ php admin/tool/behat/cli/util_single_run.php --enable
|
||||
|
||||
More info in http://docs.moodle.org/dev/Acceptance_testing#Running_tests
|
||||
";
|
||||
|
||||
if (!empty($options['help'])) {
|
||||
echo $help;
|
||||
exit(0);
|
||||
}
|
||||
|
||||
// Describe this script.
|
||||
define('BEHAT_UTIL', true);
|
||||
define('CLI_SCRIPT', true);
|
||||
define('NO_OUTPUT_BUFFERING', true);
|
||||
define('IGNORE_COMPONENT_CACHE', true);
|
||||
|
||||
// Set run value, to be used by setup for configuring proper CFG variables.
|
||||
if ($options['run']) {
|
||||
define('BEHAT_CURRENT_RUN', $options['run']);
|
||||
}
|
||||
|
||||
// Only load CFG from config.php, stop ASAP in lib/setup.php.
|
||||
define('ABORT_AFTER_CONFIG', true);
|
||||
require_once(__DIR__ . '/../../../../config.php');
|
||||
|
||||
// Remove error handling overrides done in config.php.
|
||||
$CFG->debug = (E_ALL | E_STRICT);
|
||||
$CFG->debugdisplay = 1;
|
||||
error_reporting($CFG->debug);
|
||||
ini_set('display_errors', '1');
|
||||
ini_set('log_errors', '1');
|
||||
|
||||
// Finish moodle init.
|
||||
define('ABORT_AFTER_CONFIG_CANCEL', true);
|
||||
require("$CFG->dirroot/lib/setup.php");
|
||||
|
||||
raise_memory_limit(MEMORY_HUGE);
|
||||
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
require_once($CFG->libdir.'/upgradelib.php');
|
||||
require_once($CFG->libdir.'/clilib.php');
|
||||
require_once($CFG->libdir.'/installlib.php');
|
||||
require_once($CFG->libdir.'/testing/classes/test_lock.php');
|
||||
|
||||
if ($unrecognized) {
|
||||
$unrecognized = implode(PHP_EOL . " ", $unrecognized);
|
||||
cli_error(get_string('cliunknowoption', 'admin', $unrecognized));
|
||||
}
|
||||
|
||||
// Behat utilities.
|
||||
require_once($CFG->libdir . '/behat/classes/util.php');
|
||||
require_once($CFG->libdir . '/behat/classes/behat_command.php');
|
||||
require_once($CFG->libdir . '/behat/classes/behat_config_manager.php');
|
||||
|
||||
// Ensure run option is <= parallel run installed.
|
||||
if ($options['run']) {
|
||||
if (!$options['parallel']) {
|
||||
$options['parallel'] = behat_config_manager::get_parallel_test_runs();
|
||||
}
|
||||
if (empty($options['parallel']) || $options['run'] > $options['parallel']) {
|
||||
echo "Parallel runs can't be more then ".$options['parallel'].PHP_EOL;
|
||||
exit(1);
|
||||
}
|
||||
$CFG->behatrunprocess = $options['run'];
|
||||
}
|
||||
|
||||
// Run command (only one per time).
|
||||
if ($options['install']) {
|
||||
behat_util::install_site();
|
||||
|
||||
// This is only displayed once for parallel install.
|
||||
if (empty($options['run'])) {
|
||||
mtrace("Acceptance tests site installed");
|
||||
}
|
||||
|
||||
} else if ($options['drop']) {
|
||||
// Ensure no tests are running.
|
||||
test_lock::acquire('behat');
|
||||
behat_util::drop_site();
|
||||
// This is only displayed once for parallel install.
|
||||
if (empty($options['run'])) {
|
||||
mtrace("Acceptance tests site dropped");
|
||||
}
|
||||
|
||||
} else if ($options['enable']) {
|
||||
if (!empty($options['parallel'])) {
|
||||
// Save parallel site info for enable and install options.
|
||||
$filepath = behat_config_manager::get_parallel_test_file_path();
|
||||
if (!file_put_contents($filepath, $options['parallel'])) {
|
||||
behat_error(BEHAT_EXITCODE_PERMISSIONS, 'File ' . $filepath . ' can not be created');
|
||||
}
|
||||
}
|
||||
|
||||
// Enable test mode.
|
||||
behat_util::start_test_mode();
|
||||
|
||||
// This is only displayed once for parallel install.
|
||||
if (empty($options['run'])) {
|
||||
$runtestscommand = behat_command::get_behat_command(true, !empty($options['run']));
|
||||
|
||||
$runtestscommand .= ' --config ' . behat_config_manager::get_behat_cli_config_filepath();
|
||||
mtrace("Acceptance tests environment enabled on $CFG->behat_wwwroot, to run the tests use: " . PHP_EOL .
|
||||
$runtestscommand);
|
||||
}
|
||||
|
||||
} else if ($options['disable']) {
|
||||
behat_util::stop_test_mode();
|
||||
// This is only displayed once for parallel install.
|
||||
if (empty($options['run'])) {
|
||||
mtrace("Acceptance tests environment disabled");
|
||||
}
|
||||
|
||||
} else if ($options['diag']) {
|
||||
$code = behat_util::get_behat_status();
|
||||
exit($code);
|
||||
|
||||
} else if ($options['updatesteps']) {
|
||||
if (defined('BEHAT_FEATURE_STEP_FILE') && BEHAT_FEATURE_STEP_FILE) {
|
||||
$behatstepfile = BEHAT_FEATURE_STEP_FILE;
|
||||
} else {
|
||||
echo "BEHAT_FEATURE_STEP_FILE is not set, please ensure you set this to writable file" . PHP_EOL;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// Run behat command to get steps in feature files.
|
||||
$featurestepscmd = behat_command::get_behat_command(true);
|
||||
$featurestepscmd .= ' --config ' . behat_config_manager::get_behat_cli_config_filepath();
|
||||
$featurestepscmd .= ' --dry-run --format=moodle_step_count';
|
||||
$processes = cli_execute_parallel(array($featurestepscmd), __DIR__ . "/../../../../");
|
||||
$status = print_update_step_output(array_pop($processes), $behatstepfile);
|
||||
|
||||
exit($status);
|
||||
} else {
|
||||
echo $help;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
exit(0);
|
||||
|
||||
/**
|
||||
* Print update progress as dots for updating feature file step list.
|
||||
*
|
||||
* @param Process $process process executing update step command.
|
||||
* @param string $featurestepfile feature step file in which steps will be saved.
|
||||
* @return int exitcode.
|
||||
*/
|
||||
function print_update_step_output($process, $featurestepfile) {
|
||||
$printedlength = 0;
|
||||
|
||||
echo "Updating steps feature file for parallel behat runs" . PHP_EOL;
|
||||
|
||||
// Show progress while running command.
|
||||
while ($process->isRunning()) {
|
||||
usleep(10000);
|
||||
$op = $process->getIncrementalOutput();
|
||||
if (trim($op)) {
|
||||
echo ".";
|
||||
$printedlength++;
|
||||
if ($printedlength > 70) {
|
||||
$printedlength = 0;
|
||||
echo PHP_EOL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If any error then exit.
|
||||
$exitcode = $process->getExitCode();
|
||||
// Output err.
|
||||
if ($exitcode != 0) {
|
||||
echo $process->getErrorOutput();
|
||||
exit($exitcode);
|
||||
}
|
||||
|
||||
// Extract features with step info and save it in file.
|
||||
$featuresteps = $process->getOutput();
|
||||
$featuresteps = explode(PHP_EOL, $featuresteps);
|
||||
|
||||
$realroot = realpath(__DIR__.'/../../../../').'/';
|
||||
foreach ($featuresteps as $featurestep) {
|
||||
if (trim($featurestep)) {
|
||||
$step = explode("::", $featurestep);
|
||||
$step[0] = str_replace($realroot, '', $step[0]);
|
||||
$steps[$step[0]] = $step[1];
|
||||
}
|
||||
}
|
||||
|
||||
if ($existing = @json_decode(file_get_contents($featurestepfile), true)) {
|
||||
$steps = array_merge($existing, $steps);
|
||||
}
|
||||
arsort($steps);
|
||||
|
||||
if (!@file_put_contents($featurestepfile, json_encode($steps, JSON_PRETTY_PRINT))) {
|
||||
behat_error(BEHAT_EXITCODE_PERMISSIONS, 'File ' . $featurestepfile . ' can not be created');
|
||||
$exitcode = -1;
|
||||
}
|
||||
|
||||
echo PHP_EOL. "Updated step count in " . $featurestepfile . PHP_EOL;
|
||||
|
||||
return $exitcode;
|
||||
}
|
||||
@@ -165,7 +165,7 @@ class tool_behat_renderer extends plugin_renderer_base {
|
||||
// Info.
|
||||
$installurl = behat_command::DOCS_URL . '#Installation';
|
||||
$installlink = html_writer::tag('a', $installurl, array('href' => $installurl, 'target' => '_blank'));
|
||||
$writetestsurl = behat_command::DOCS_URL . '#Writing_features';
|
||||
$writetestsurl = behat_command::DOCS_URL . '#Writting_features';
|
||||
$writetestslink = html_writer::tag('a', $writetestsurl, array('href' => $writetestsurl, 'target' => '_blank'));
|
||||
$writestepsurl = behat_command::DOCS_URL . '#Adding_steps_definitions';
|
||||
$writestepslink = html_writer::tag('a', $writestepsurl, array('href' => $writestepsurl, 'target' => '_blank'));
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
@tool @tool_behat
|
||||
Feature: Page contents assertions
|
||||
In order to write good tests
|
||||
As a tests writer
|
||||
I need to check the page contents
|
||||
|
||||
@javascript
|
||||
Scenario: Basic contents assertions
|
||||
Given I log in as "admin"
|
||||
And I am on homepage
|
||||
And I expand "Users" node
|
||||
And I follow "Groups"
|
||||
And I press "Create group"
|
||||
And I set the following fields to these values:
|
||||
| Group name | I'm the name |
|
||||
| Group description | I'm the description |
|
||||
And I press "Save changes"
|
||||
When I follow "Overview"
|
||||
And I wait until the page is ready
|
||||
And I wait "2" seconds
|
||||
And I hover "#region-main .generaltable td span" "css_element"
|
||||
Then I should see "I'm the description"
|
||||
And "Grouping" "select" in the "region-main" "region" should be visible
|
||||
And "Group" "select" should be visible
|
||||
And "Messaging" "link" in the "Administration" "block" should not be visible
|
||||
And "Change password" "link" should not be visible
|
||||
And I should see "Filter groups by"
|
||||
And I should not see "Filter groupssss by"
|
||||
And I should see "Group members" in the "#region-main table th.c1" "css_element"
|
||||
And I should not see "Group membersssss" in the "#region-main table th.c1" "css_element"
|
||||
And I follow "Groups"
|
||||
And the "#groupeditform #showcreateorphangroupform" "css_element" should be enabled
|
||||
And the "#groupeditform #showeditgroupsettingsform" "css_element" should be disabled
|
||||
|
||||
@javascript
|
||||
Scenario: Locators inside specific DOM nodes using CSS selectors
|
||||
Given the following "courses" exist:
|
||||
| fullname | shortname | category |
|
||||
| Course 1 | C1 | 0 |
|
||||
And I log in as "admin"
|
||||
And I follow "Course 1"
|
||||
When I dock "Administration" block
|
||||
Then I should not see "Question bank" in the ".block-region" "css_element"
|
||||
And I click on "//div[@id='dock']/descendant::h2[normalize-space(.)='Administration']" "xpath_element"
|
||||
|
||||
@javascript
|
||||
Scenario: Locators inside specific DOM nodes using XPath
|
||||
Given the following "courses" exist:
|
||||
| fullname | shortname | category |
|
||||
| Course 1 | C1 | 0 |
|
||||
And I log in as "admin"
|
||||
When I dock "Administration" block
|
||||
Then I should not see "Turn editing on" in the ".block-region" "css_element"
|
||||
@@ -27,7 +27,6 @@ Feature: Set up contextual data for tests
|
||||
| Course 2 | COURSE2 | CAT3 |
|
||||
| Course 3 | COURSE3 | 0 |
|
||||
When I log in as "admin"
|
||||
And I am on site homepage
|
||||
Then I should see "Course 1"
|
||||
And I should see "Course 2"
|
||||
And I should see "Course 3"
|
||||
@@ -57,7 +56,6 @@ Feature: Set up contextual data for tests
|
||||
| Grouping 1 | C1 | GG1 |
|
||||
| Grouping 2 | C1 | GG2 |
|
||||
When I log in as "admin"
|
||||
And I am on site homepage
|
||||
And I follow "Course 1"
|
||||
And I expand "Users" node
|
||||
And I follow "Groups"
|
||||
@@ -71,8 +69,8 @@ Feature: Set up contextual data for tests
|
||||
Scenario: Role overrides
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher1 | Teacher | 1 | teacher1@example.com |
|
||||
| student1 | Student | 1 | student1@example.com |
|
||||
| teacher1 | Teacher | 1 | teacher1@asd.com |
|
||||
| student1 | Student | 1 | student1@asd.com |
|
||||
And the following "categories" exist:
|
||||
| name | category | idnumber |
|
||||
| Cat 1 | 0 | CAT1 |
|
||||
@@ -88,7 +86,6 @@ Feature: Set up contextual data for tests
|
||||
| mod/forum:editanypost | Allow | student | Course | C1 |
|
||||
| mod/forum:replynews | Prevent | editingteacher | Course | C1 |
|
||||
When I log in as "admin"
|
||||
And I am on site homepage
|
||||
And I follow "Course 1"
|
||||
And I expand "Users" node
|
||||
And I follow "Permissions"
|
||||
@@ -102,7 +99,7 @@ Feature: Set up contextual data for tests
|
||||
Scenario: Add course enrolments
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| student1 | Student | 1 | student1@example.com |
|
||||
| student1 | Student | 1 | student1@asd.com |
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname | format |
|
||||
| Course 1 | C1 | topics |
|
||||
@@ -120,11 +117,11 @@ Feature: Set up contextual data for tests
|
||||
| Custom student | custom2 | | |
|
||||
And the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| user1 | User | 1 | user1@example.com |
|
||||
| user2 | User | 2 | user2@example.com |
|
||||
| user3 | User | 3 | user3@example.com |
|
||||
| user4 | User | 4 | user4@example.com |
|
||||
| user5 | User | 5 | user5@example.com |
|
||||
| user1 | User | 1 | user1@moodlemoodle.com |
|
||||
| user2 | User | 2 | user2@moodlemoodle.com |
|
||||
| user3 | User | 3 | user3@moodlemoodle.com |
|
||||
| user4 | User | 4 | user4@moodlemoodle.com |
|
||||
| user5 | User | 5 | user5@moodlemoodle.com |
|
||||
And the following "categories" exist:
|
||||
| name | category | idnumber |
|
||||
| Cat 1 | 0 | CAT1 |
|
||||
@@ -141,27 +138,22 @@ Feature: Set up contextual data for tests
|
||||
| user3 | editingteacher | Course | C1 |
|
||||
| user5 | custom2 | System | |
|
||||
When I log in as "user1"
|
||||
And I am on site homepage
|
||||
Then I should see "Front page settings"
|
||||
And I log out
|
||||
And I log in as "user2"
|
||||
And I am on site homepage
|
||||
And I follow "Course 1"
|
||||
And I should see "Turn editing on"
|
||||
And I log out
|
||||
And I log in as "user3"
|
||||
And I am on site homepage
|
||||
And I follow "Course 1"
|
||||
And I should see "Turn editing on"
|
||||
And I log out
|
||||
And I log in as "user4"
|
||||
And I am on site homepage
|
||||
And I follow "Course 1"
|
||||
And I should see "Turn editing on"
|
||||
And I log out
|
||||
And I log in as "user5"
|
||||
And I should see "You are logged in as"
|
||||
And I am on site homepage
|
||||
And I follow "Course 1"
|
||||
And I should see "You can not enrol yourself in this course."
|
||||
|
||||
@@ -193,14 +185,7 @@ Feature: Set up contextual data for tests
|
||||
| url | Test url name | Test url description | C1 | url1 |
|
||||
| wiki | Test wiki name | Test wiki description | C1 | wiki1 |
|
||||
| workshop | Test workshop name | Test workshop description | C1 | workshop1 |
|
||||
And the following "scales" exist:
|
||||
| name | scale |
|
||||
| Test Scale 1 | Disappointing, Good, Very good, Excellent |
|
||||
And the following "activities" exist:
|
||||
| activity | name | intro | course | idnumber | grade |
|
||||
| assign | Test assignment name with scale | Test assignment description | C1 | assign1 | Test Scale 1 |
|
||||
When I log in as "admin"
|
||||
And I am on site homepage
|
||||
And I follow "Course 1"
|
||||
Then I should see "Test assignment name"
|
||||
# Assignment 2.2 module type is disabled by default
|
||||
@@ -229,17 +214,13 @@ Feature: Set up contextual data for tests
|
||||
And I should see "Test workshop name"
|
||||
And I follow "Test assignment name"
|
||||
And I should see "Test assignment description"
|
||||
And I follow "C1"
|
||||
And I follow "Test assignment name with scale"
|
||||
And I follow "Edit settings"
|
||||
And the field "Type" matches value "Scale"
|
||||
|
||||
@javascript
|
||||
Scenario: Add relations between users and groups
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| student1 | Student | 1 | student1@example.com |
|
||||
| student2 | Student | 2 | student2@example.com |
|
||||
| student1 | Student | 1 | student1@asd.com |
|
||||
| student2 | Student | 2 | student2@asd.com |
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname |
|
||||
| Course 1 | C1 |
|
||||
@@ -262,7 +243,6 @@ Feature: Set up contextual data for tests
|
||||
| grouping | group |
|
||||
| GG1 | G1 |
|
||||
When I log in as "admin"
|
||||
And I am on site homepage
|
||||
And I follow "Course 1"
|
||||
And I expand "Users" node
|
||||
And I follow "Groups"
|
||||
@@ -273,183 +253,24 @@ Feature: Set up contextual data for tests
|
||||
And I set the field "groups" to "Group 2 (1)"
|
||||
And the "members" select box should contain "Student 2"
|
||||
|
||||
Scenario: Add cohorts and cohort members with data generator
|
||||
Scenario: Add cohorts with data generator
|
||||
Given the following "categories" exist:
|
||||
| name | category | idnumber |
|
||||
| Cat 1 | 0 | CAT1 |
|
||||
And the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| student1 | Student | 1 | student1@example.com |
|
||||
| student2 | Student | 2 | student2@example.com |
|
||||
And the following "cohorts" exist:
|
||||
| name | idnumber |
|
||||
| System cohort A | CHSA |
|
||||
| System cohort 1 | CH01 |
|
||||
And the following "cohorts" exist:
|
||||
| name | idnumber | contextlevel | reference |
|
||||
| System cohort B | CHSB | System | |
|
||||
| Cohort in category | CHC | Category | CAT1 |
|
||||
| Empty cohort | CHE | Category | CAT1 |
|
||||
And the following "cohort members" exist:
|
||||
| user | cohort |
|
||||
| student1 | CHSA |
|
||||
| student2 | CHSB |
|
||||
| student1 | CHSB |
|
||||
| student1 | CHC |
|
||||
| System cohort 2 | CH02 | System | |
|
||||
| Cohort in category 1 | CH1 | Category | CAT1 |
|
||||
When I log in as "admin"
|
||||
And I navigate to "Cohorts" node in "Site administration > Users > Accounts"
|
||||
Then the following should exist in the "cohorts" table:
|
||||
| Name | Cohort size |
|
||||
| System cohort A | 1 |
|
||||
| System cohort B | 2 |
|
||||
Then I should see "System cohort 1"
|
||||
And I should see "System cohort 2"
|
||||
And I should not see "Cohort in category"
|
||||
And I follow "Courses"
|
||||
And I follow "Cat 1"
|
||||
And I follow "Cohorts"
|
||||
And I should see "Cohort in category 1"
|
||||
And I should not see "System cohort"
|
||||
And the following should exist in the "cohorts" table:
|
||||
| Name | Cohort size |
|
||||
| Cohort in category | 1 |
|
||||
| Empty cohort | 0 |
|
||||
|
||||
Scenario: Add grade categories with data generator
|
||||
Given the following "courses" exist:
|
||||
| fullname | shortname |
|
||||
| Course 1 | C1 |
|
||||
And the following "grade categories" exist:
|
||||
| fullname | course |
|
||||
| Grade category 1 | C1 |
|
||||
And the following "grade categories" exist:
|
||||
| fullname | course | gradecategory |
|
||||
| Grade sub category 2 | C1 | Grade category 1 |
|
||||
When I log in as "admin"
|
||||
And I am on site homepage
|
||||
And I follow "Courses"
|
||||
And I follow "Course 1"
|
||||
And I navigate to "Grades" node in "Course administration"
|
||||
Then I should see "Grade category 1"
|
||||
And I should see "Grade sub category 2"
|
||||
|
||||
Scenario: Add a bunch of grade items
|
||||
Given the following "courses" exist:
|
||||
| fullname | shortname |
|
||||
| Course 1 | C1 |
|
||||
And the following "grade categories" exist:
|
||||
| fullname | course |
|
||||
| Grade category 1 | C1 |
|
||||
And the following "grade categories" exist:
|
||||
| fullname | course | gradecategory |
|
||||
| Grade sub category 2 | C1 | Grade category 1 |
|
||||
And the following "grade items" exist:
|
||||
| itemname | course |
|
||||
| Test Grade Item 1 | C1 |
|
||||
And the following "grade items" exist:
|
||||
| itemname | course | gradecategory |
|
||||
| Test Grade Item 2 | C1 | Grade category 1 |
|
||||
| Test Grade Item 3 | C1 | Grade sub category 2 |
|
||||
When I log in as "admin"
|
||||
And I am on site homepage
|
||||
And I follow "Course 1"
|
||||
And I navigate to "Grades" node in "Course administration"
|
||||
And I expand "Setup" node
|
||||
And I follow "Categories and items"
|
||||
Then I should see "Test Grade Item 1"
|
||||
And I follow "Edit Test Grade Item 1"
|
||||
And I expand all fieldsets
|
||||
And I should see "Course 1"
|
||||
And I press "Cancel"
|
||||
And I should see "Grade category 1"
|
||||
And I should see "Test Grade Item 2"
|
||||
And I follow "Edit Test Grade Item 2"
|
||||
And I expand all fieldsets
|
||||
And I should see "Grade category 1"
|
||||
And I press "Cancel"
|
||||
And I should see "Grade sub category 2"
|
||||
And I should see "Test Grade Item 3"
|
||||
And I follow "Edit Test Grade Item 3"
|
||||
And I expand all fieldsets
|
||||
And I should see "Grade sub category 2"
|
||||
And I press "Cancel"
|
||||
|
||||
Scenario: Add a bunch of scales
|
||||
Given the following "courses" exist:
|
||||
| fullname | shortname |
|
||||
| Course 1 | C1 |
|
||||
And the following "scales" exist:
|
||||
| name | scale |
|
||||
| Test Scale 1 | Disappointing, Good, Very good, Excellent |
|
||||
When I log in as "admin"
|
||||
And I am on site homepage
|
||||
And I follow "Course 1"
|
||||
And I navigate to "Grades" node in "Course administration"
|
||||
And I follow "Scales"
|
||||
Then I should see "Test Scale 1"
|
||||
And I should see "Disappointing, Good, Very good, Excellent"
|
||||
|
||||
Scenario: Add a bunch of outcomes
|
||||
Given the following "courses" exist:
|
||||
| fullname | shortname |
|
||||
| Course 1 | C1 |
|
||||
And the following "scales" exist:
|
||||
| name | scale |
|
||||
| Test Scale 1 | Disappointing, Good, Very good, Excellent |
|
||||
And the following "grade outcomes" exist:
|
||||
| fullname | shortname | scale |
|
||||
| Grade outcome 1 | OT1 | Test Scale 1 |
|
||||
And the following "grade outcomes" exist:
|
||||
| fullname | shortname | course | scale |
|
||||
| Grade outcome 2 | OT2 | C1 | Test Scale 1 |
|
||||
And the following config values are set as admin:
|
||||
| enableoutcomes | 1 |
|
||||
When I log in as "admin"
|
||||
And I am on site homepage
|
||||
And I follow "Course 1"
|
||||
And I follow "Outcomes"
|
||||
Then I should see "Grade outcome 1" in the "#addoutcomes" "css_element"
|
||||
And I should see "Grade outcome 2" in the "#removeoutcomes" "css_element"
|
||||
And I follow "Edit outcomes"
|
||||
And the following should exist in the "generaltable" table:
|
||||
| Full name | Short name | Scale |
|
||||
| Grade outcome 2 | OT2 | Test Scale 1 |
|
||||
|
||||
Scenario: Add a bunch of outcome grade items
|
||||
Given the following "courses" exist:
|
||||
| fullname | shortname |
|
||||
| Course 1 | C1 |
|
||||
And the following "scales" exist:
|
||||
| name | scale |
|
||||
| Test Scale 1 | Disappointing, Good, Very good, Excellent |
|
||||
And the following "grade outcomes" exist:
|
||||
| fullname | shortname | course | scale |
|
||||
| Grade outcome 1 | OT1 | C1 | Test Scale 1 |
|
||||
And the following "grade categories" exist:
|
||||
| fullname | course |
|
||||
| Grade category 1 | C1 |
|
||||
And the following "grade items" exist:
|
||||
| itemname | course | outcome | gradecategory |
|
||||
| Test Outcome Grade Item 1 | C1 | OT1 | Grade category 1 |
|
||||
And the following config values are set as admin:
|
||||
| enableoutcomes | 1 |
|
||||
When I log in as "admin"
|
||||
And I am on site homepage
|
||||
And I follow "Course 1"
|
||||
And I navigate to "Grades" node in "Course administration"
|
||||
And I expand "Setup" node
|
||||
And I follow "Categories and items"
|
||||
Then I should see "Test Outcome Grade Item 1"
|
||||
And I follow "Edit Test Outcome Grade Item 1"
|
||||
And the field "Outcome" matches value "Grade outcome 1"
|
||||
And I expand all fieldsets
|
||||
And "//div[contains(@class, 'fitem')]/div[contains(@class, 'fitemtitle')]/div[contains(@class, fstaticlabel) and contains(., 'Grade category')]/../../div[contains(@class, 'felement') and contains(., 'Grade category 1')]" "xpath_element" should exist
|
||||
And I press "Cancel"
|
||||
|
||||
Scenario: Add a block
|
||||
Given the following "courses" exist:
|
||||
| fullname | shortname |
|
||||
| Course 1 | C1 |
|
||||
And the following "blocks" exist:
|
||||
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
|
||||
| online_users | Course | C1 | course-view-* | site-pre |
|
||||
When I log in as "admin"
|
||||
And I am on site homepage
|
||||
And I follow "Course 1"
|
||||
Then I should see "Online users"
|
||||
|
||||
@@ -7,7 +7,7 @@ Feature: Edit capabilities
|
||||
Background:
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher1 | Teacher | 1 | teacher1@example.com |
|
||||
| teacher1 | Teacher | 1 | teacher1@asd.com |
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname | category |
|
||||
| Course 1 | C1 | 0 |
|
||||
@@ -15,6 +15,7 @@ Feature: Edit capabilities
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
|
||||
@javascript
|
||||
Scenario: Default system capabilities modification
|
||||
Given I log in as "admin"
|
||||
And I set the following system permissions of "Teacher" role:
|
||||
@@ -29,6 +30,7 @@ Feature: Edit capabilities
|
||||
And "moodle/grade:managesharedforms" capability has "Prevent" permission
|
||||
And "moodle/course:request" capability has "Prohibit" permission
|
||||
|
||||
@javascript
|
||||
Scenario: Course capabilities overrides
|
||||
Given I log in as "teacher1"
|
||||
And I follow "Course 1"
|
||||
@@ -39,11 +41,11 @@ Feature: Edit capabilities
|
||||
| mod/forum:editanypost | Prevent |
|
||||
| mod/forum:addquestion | Allow |
|
||||
When I set the field "Advanced role override" to "Student (3)"
|
||||
And I press "Go"
|
||||
Then "mod/forum:deleteanypost" capability has "Prohibit" permission
|
||||
And "mod/forum:editanypost" capability has "Prevent" permission
|
||||
And "mod/forum:addquestion" capability has "Allow" permission
|
||||
|
||||
@javascript
|
||||
Scenario: Module capabilities overrides
|
||||
Given I log in as "teacher1"
|
||||
And I follow "Course 1"
|
||||
@@ -58,7 +60,6 @@ Feature: Edit capabilities
|
||||
| mod/forum:editanypost | Prevent |
|
||||
| mod/forum:addquestion | Allow |
|
||||
When I set the field "Advanced role override" to "Student (3)"
|
||||
And I press "Go"
|
||||
Then "mod/forum:deleteanypost" capability has "Prohibit" permission
|
||||
And "mod/forum:editanypost" capability has "Prevent" permission
|
||||
And "mod/forum:addquestion" capability has "Allow" permission
|
||||
|
||||
@@ -10,9 +10,9 @@ Feature: Verify that all form fields values can be get and set
|
||||
| Course 1 | C1 | 0 |
|
||||
And the following "users" exist:
|
||||
| username | email | firstname | lastname |
|
||||
| student1 | s1@example.com | Student | 1 |
|
||||
| student2 | s2@example.com | Student | 2 |
|
||||
| student3 | s3@example.com | Student | 3 |
|
||||
| student1 | s1@asd.com | Student | 1 |
|
||||
| student2 | s2@asd.com | Student | 2 |
|
||||
| student3 | s3@asd.com | Student | 3 |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| student1 | C1 | student |
|
||||
@@ -39,7 +39,7 @@ Feature: Verify that all form fields values can be get and set
|
||||
# Select (multi-select) - We will check "I set the field...".
|
||||
And I set the field "otagsadd" to "OT1, OT2, OT3, OT4, OT5"
|
||||
And I press "Add official tags"
|
||||
And I am on site homepage
|
||||
And I am on homepage
|
||||
And I follow "Course 1"
|
||||
And I turn editing mode on
|
||||
And I follow "Test this one"
|
||||
@@ -137,17 +137,6 @@ Feature: Verify that all form fields values can be get and set
|
||||
And I press "Save my choice"
|
||||
And the field "one" matches value "1"
|
||||
And the field "two" matches value ""
|
||||
# Check if field xpath set/match works.
|
||||
And I am on site homepage
|
||||
And I follow "Course 1"
|
||||
And I navigate to "Edit settings" node in "Course administration"
|
||||
And I set the field with xpath "//input[@id='id_idnumber']" to "Course id number"
|
||||
And the field with xpath "//input[@name='idnumber']" matches value "Course id number"
|
||||
And the field with xpath "//input[@name='idnumber']" does not match value ""
|
||||
And I press "Save and display"
|
||||
And I navigate to "Edit settings" node in "Course administration"
|
||||
And the field "Course ID number" matches value "Course id number"
|
||||
|
||||
|
||||
Scenario: with JS disabled all form fields getters and setters works as expected
|
||||
|
||||
@@ -170,7 +159,6 @@ Feature: Verify that all form fields values can be get and set
|
||||
And I add a "Lesson" to section "1"
|
||||
And I set the following fields to these values:
|
||||
| Name | Test lesson |
|
||||
| Description | Test lesson description |
|
||||
| available[enabled] | 1 |
|
||||
And I set the field "deadline[enabled]" to "1"
|
||||
# Checkbox (AJAX) - Checking "the field matches value" before saving.
|
||||
|
||||
@@ -7,14 +7,12 @@ Feature: Forms manipulation
|
||||
@javascript
|
||||
Scenario: Basic forms manipulation
|
||||
Given I log in as "admin"
|
||||
And I follow "Preferences" in the user menu
|
||||
And I follow "Edit profile"
|
||||
And I navigate to "Edit profile" node in "My profile settings"
|
||||
When I set the field "First name" to "Field value"
|
||||
And I set the field "Select a country" to "Japan"
|
||||
And I set the field "Text editor" to "Plain text area"
|
||||
And I set the field "Unmask" to "1"
|
||||
And I expand all fieldsets
|
||||
Then the field "First name" matches value "Field value"
|
||||
And the "Select a country" select box should contain "Japan"
|
||||
And the "Text editor" select box should contain "Plain text area"
|
||||
And the field "Unmask" matches value "1"
|
||||
And I set the field "Unmask" to ""
|
||||
And the field "Unmask" matches value ""
|
||||
@@ -26,7 +24,6 @@ Feature: Forms manipulation
|
||||
| fullname | shortname | category |
|
||||
| Course 1 | C1 | 0 |
|
||||
And I log in as "admin"
|
||||
And I am on site homepage
|
||||
And I follow "Course 1"
|
||||
And I turn editing mode on
|
||||
And I add a "Quiz" to section "1"
|
||||
|
||||
@@ -5,13 +5,12 @@ Feature: Transform steps arguments
|
||||
I need to apply some transformations to the steps arguments
|
||||
|
||||
Background:
|
||||
Given I am on site homepage
|
||||
Given I am on homepage
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname | category |
|
||||
| Course 1 | C1 | 0 |
|
||||
And I log in as "admin"
|
||||
And I follow "Preferences" in the user menu
|
||||
And I follow "Edit profile"
|
||||
And I navigate to "Edit profile" node in "My profile settings"
|
||||
|
||||
Scenario: Use nasty strings on steps arguments
|
||||
When I set the field "Surname" to "$NASTYSTRING1"
|
||||
@@ -46,6 +45,7 @@ Feature: Transform steps arguments
|
||||
And the field "Description" matches value "va\\"lue2"
|
||||
And the field "City/town" matches value "va\"lue3"
|
||||
|
||||
@javascript
|
||||
Scenario: Nasty strings with other contents
|
||||
When I set the field "First name" to "My Firstname $NASTYSTRING1"
|
||||
And I set the following fields to these values:
|
||||
|
||||
@@ -5,5 +5,5 @@ Feature: Set up the testing environment
|
||||
I need to use the test environment instead of the regular environment
|
||||
|
||||
Scenario: Accessing the site
|
||||
When I am on site homepage
|
||||
When I am on homepage
|
||||
Then I should see "Acceptance test site"
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2015051100; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2015050500; // Requires this Moodle version
|
||||
$plugin->version = 2014051200; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2014050800; // Requires this Moodle version
|
||||
$plugin->component = 'tool_behat'; // Full name of the plugin (used for diagnostics)
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2015051100; // The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->requires = 2015050500; // Requires this Moodle version.
|
||||
$plugin->version = 2014051200; // The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->requires = 2014050800; // Requires this Moodle version.
|
||||
$plugin->component = 'tool_capability'; // Full name of the plugin (used for diagnostics).
|
||||
|
||||
admin/tool/capability/yui/build/moodle-tool_capability-search/moodle-tool_capability-search-debug.js
Vendored
+1
@@ -83,6 +83,7 @@ SEARCH.prototype = {
|
||||
div.append(label).append(this.input);
|
||||
|
||||
this.select.insert(div, 'before');
|
||||
this.select.one('option').setStyle('display', 'none');
|
||||
|
||||
this.input.on('keyup', this.typed, this);
|
||||
this.select.on('change', this.validate, this);
|
||||
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
YUI.add("moodle-tool_capability-search",function(e,t){var n=function(){n.superclass.constructor.apply(this,arguments)};n.prototype={form:null,select:null,selectoptions:{},input:null,button:null,lastsearch:null,initializer:function(){this.form=e.one("#capability-overview-form"),this.select=this.form.one("select[data-search=capability]"),this.select.setStyle("minWidth",this.select.get("offsetWidth")),this.select.get("options").each(function(e){var t=e.get("value");this.selectoptions[t]=e},this),this.button=this.form.all("input[type=submit]"),this.lastsearch=this.form.one("input[name=search]");var t=e.Node.create('<div id="capabilitysearchui"></div>'),n=e.Node.create('<label for="capabilitysearch">'+this.get("strsearch")+"</label>");this.input=e.Node.create('<input type="text" id="capabilitysearch" />'),t.append(n).append(this.input),this.select.insert(t,"before"),this.input.on("keyup",this.typed,this),this.select.on("change",this.validate,this),this.lastsearch&&(this.input.set("value",this.lastsearch.get("value")),this.typed(),this.select.one("option[selected]")&&this.select.set("scrollTop",this.select.one("option[selected]").get("getX"))),this.validate()},validate:function(){this.button.set("disabled",this.select.get("value")==="")},typed:function(){var e=this.input.get("value"),t=0,n=null,r;this.lastsearch&&this.lastsearch.set("value",e),this.select.all("option").remove();for(r in this.selectoptions)r.indexOf(e)>=0&&(t++,n=this.selectoptions[r],this.select.append(this.selectoptions[r]));t===0?this.input.addClass("error"):(this.input.removeClass("error"),t===1&&n.set("selected",!0)),this.validate()}},e.extend(n,e.Base,n.prototype,{NAME:"tool_capability-search",ATTRS:{strsearch:{}}}),M.tool_capability=M.tool_capability||{},M.tool_capability.init_capability_search=function(e){new n(e)}},"@VERSION@",{requires:["base","node"]});
|
||||
YUI.add("moodle-tool_capability-search",function(e,t){var n=function(){n.superclass.constructor.apply(this,arguments)};n.prototype={form:null,select:null,selectoptions:{},input:null,button:null,lastsearch:null,initializer:function(){this.form=e.one("#capability-overview-form"),this.select=this.form.one("select[data-search=capability]"),this.select.setStyle("minWidth",this.select.get("offsetWidth")),this.select.get("options").each(function(e){var t=e.get("value");this.selectoptions[t]=e},this),this.button=this.form.all("input[type=submit]"),this.lastsearch=this.form.one("input[name=search]");var t=e.Node.create('<div id="capabilitysearchui"></div>'),n=e.Node.create('<label for="capabilitysearch">'+this.get("strsearch")+"</label>");this.input=e.Node.create('<input type="text" id="capabilitysearch" />'),t.append(n).append(this.input),this.select.insert(t,"before"),this.select.one("option").setStyle("display","none"),this.input.on("keyup",this.typed,this),this.select.on("change",this.validate,this),this.lastsearch&&(this.input.set("value",this.lastsearch.get("value")),this.typed(),this.select.one("option[selected]")&&this.select.set("scrollTop",this.select.one("option[selected]").get("getX"))),this.validate()},validate:function(){this.button.set("disabled",this.select.get("value")==="")},typed:function(){var e=this.input.get("value"),t=0,n=null,r;this.lastsearch&&this.lastsearch.set("value",e),this.select.all("option").remove();for(r in this.selectoptions)r.indexOf(e)>=0&&(t++,n=this.selectoptions[r],this.select.append(this.selectoptions[r]));t===0?this.input.addClass("error"):(this.input.removeClass("error"),t===1&&n.set("selected",!0)),this.validate()}},e.extend(n,e.Base,n.prototype,{NAME:"tool_capability-search",ATTRS:{strsearch:{}}}),M.tool_capability=M.tool_capability||{},M.tool_capability.init_capability_search=function(e){new n(e)}},"@VERSION@",{requires:["base","node"]});
|
||||
|
||||
Vendored
+1
@@ -83,6 +83,7 @@ SEARCH.prototype = {
|
||||
div.append(label).append(this.input);
|
||||
|
||||
this.select.insert(div, 'before');
|
||||
this.select.one('option').setStyle('display', 'none');
|
||||
|
||||
this.input.on('keyup', this.typed, this);
|
||||
this.select.on('change', this.validate, this);
|
||||
|
||||
@@ -81,6 +81,7 @@ SEARCH.prototype = {
|
||||
div.append(label).append(this.input);
|
||||
|
||||
this.select.insert(div, 'before');
|
||||
this.select.one('option').setStyle('display', 'none');
|
||||
|
||||
this.input.on('keyup', this.typed, this);
|
||||
this.select.on('change', this.validate, this);
|
||||
|
||||
@@ -48,11 +48,5 @@ function xmldb_tool_customlang_upgrade($oldversion) {
|
||||
// Moodle v2.7.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ if ($translatorsubmitted) {
|
||||
$checkin = optional_param('savecheckin', false, PARAM_RAW);
|
||||
|
||||
if ($checkin === false) {
|
||||
$nexturl = new moodle_url($PAGE->url, array('p' => $currentpage));
|
||||
$nexturl = $PAGE->url;
|
||||
} else {
|
||||
$nexturl = new moodle_url('/admin/tool/customlang/index.php', array('action'=>'checkin', 'lng' => $lng, 'sesskey'=>sesskey()));
|
||||
}
|
||||
|
||||
@@ -133,7 +133,6 @@ class tool_customlang_renderer extends plugin_renderer_base {
|
||||
$output .= html_writer::start_tag('div');
|
||||
$output .= html_writer::empty_tag('input', array('type'=>'hidden', 'name'=>'translatorsubmitted', 'value'=>1));
|
||||
$output .= html_writer::empty_tag('input', array('type'=>'hidden', 'name'=>'sesskey', 'value'=>sesskey()));
|
||||
$output .= html_writer::empty_tag('input', array('type'=>'hidden', 'name'=>'p', 'value'=>$translator->currentpage));
|
||||
$save1 = html_writer::empty_tag('input', array('type'=>'submit', 'name'=>'savecontinue', 'value'=>get_string('savecontinue', 'tool_customlang')));
|
||||
$save2 = html_writer::empty_tag('input', array('type'=>'submit', 'name'=>'savecheckin', 'value'=>get_string('savecheckin', 'tool_customlang')));
|
||||
$output .= html_writer::tag('fieldset', $save1.$save2, array('class'=>'buttonsbar'));
|
||||
|
||||
@@ -25,6 +25,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2015051100;
|
||||
$plugin->requires = 2015050500;
|
||||
$plugin->version = 2014051200;
|
||||
$plugin->requires = 2014050800;
|
||||
$plugin->component = 'tool_customlang'; // Full name of the plugin (used for diagnostics)
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2015051100; // The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->requires = 2015050500; // Requires this Moodle version.
|
||||
$plugin->version = 2014051200; // The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->requires = 2014050800; // Requires this Moodle version.
|
||||
$plugin->component = 'tool_dbtransfer'; // Full name of the plugin (used for diagnostics).
|
||||
|
||||
@@ -1,122 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Class with static back-end methods used by the file type tool.
|
||||
*
|
||||
* @package tool_filetypes
|
||||
* @copyright 2014 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
namespace tool_filetypes;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* Class with static back-end methods used by the file type tool.
|
||||
*
|
||||
* @package tool_filetypes
|
||||
* @copyright 2014 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class utils {
|
||||
/**
|
||||
* Checks if the given file type extension is invalid.
|
||||
* The added file type extension must be unique and must not begin with a dot.
|
||||
*
|
||||
* @param string $extension Extension of the file type to add
|
||||
* @param string $oldextension Extension prior to update (empty string if adding new type)
|
||||
* @return bool True if it the file type trying to add already exists
|
||||
*/
|
||||
public static function is_extension_invalid($extension, $oldextension = '') {
|
||||
$extension = trim($extension);
|
||||
if ($extension === '' || $extension[0] === '.') {
|
||||
return true;
|
||||
}
|
||||
|
||||
$mimeinfo = get_mimetypes_array();
|
||||
if ($oldextension !== '') {
|
||||
unset($mimeinfo[$oldextension]);
|
||||
}
|
||||
|
||||
return array_key_exists($extension, $mimeinfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if we are allowed to turn on the 'default icon' option. You can
|
||||
* only have one of these for a given MIME type.
|
||||
*
|
||||
* @param string $mimetype MIME type
|
||||
* @param string $oldextension File extension name (before any change)
|
||||
*/
|
||||
public static function is_defaulticon_allowed($mimetype, $oldextension = '') {
|
||||
$mimeinfo = get_mimetypes_array();
|
||||
if ($oldextension !== '') {
|
||||
unset($mimeinfo[$oldextension]);
|
||||
}
|
||||
foreach ($mimeinfo as $extension => $values) {
|
||||
if ($values['type'] !== $mimetype) {
|
||||
continue;
|
||||
}
|
||||
if (!empty($values['defaulticon'])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all unique file type icons from a specific path, not including
|
||||
* sub-directories.
|
||||
*
|
||||
* Icon files such as pdf.png, pdf-24.png and pdf-36.png etc. are counted as
|
||||
* the same icon type.
|
||||
*
|
||||
* The resultant array has both key and value set to the icon name prefix,
|
||||
* such as 'pdf' => 'pdf'.
|
||||
*
|
||||
* @param string $path The path of the icon path
|
||||
* @return array An array of unique file icons within the given path
|
||||
*/
|
||||
public static function get_icons_from_path($path) {
|
||||
$icons = array();
|
||||
if ($handle = @opendir($path)) {
|
||||
while (($file = readdir($handle)) !== false) {
|
||||
$matches = array();
|
||||
if (preg_match('~(.+?)(?:-24|-32|-48|-64|-72|-80|-96|-128|-256)?\.(?:gif|png)$~',
|
||||
$file, $matches)) {
|
||||
$key = $matches[1];
|
||||
$icons[$key] = $key;
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
ksort($icons);
|
||||
return $icons;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets unique file type icons from pix/f folder.
|
||||
*
|
||||
* @return array An array of unique file type icons e.g. 'pdf' => 'pdf'
|
||||
*/
|
||||
public static function get_file_icons() {
|
||||
global $CFG;
|
||||
$path = $CFG->dirroot . '/pix/f';
|
||||
return self::get_icons_from_path($path);
|
||||
}
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Delete a file type with a confirmation box.
|
||||
*
|
||||
* @package tool_filetypes
|
||||
* @copyright 2014 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
require(__DIR__ . '/../../../config.php');
|
||||
require_once($CFG->libdir . '/adminlib.php');
|
||||
|
||||
admin_externalpage_setup('tool_filetypes');
|
||||
|
||||
$extension = required_param('extension', PARAM_ALPHANUMEXT);
|
||||
$redirecturl = new \moodle_url('/admin/tool/filetypes/index.php');
|
||||
|
||||
if (optional_param('delete', 0, PARAM_INT)) {
|
||||
require_sesskey();
|
||||
|
||||
// Delete the file type from the config.
|
||||
core_filetypes::delete_type($extension);
|
||||
redirect($redirecturl);
|
||||
}
|
||||
|
||||
// Page settings.
|
||||
$title = get_string('deletefiletypes', 'tool_filetypes');
|
||||
|
||||
$context = context_system::instance();
|
||||
$PAGE->set_url(new \moodle_url('/admin/tool/filetypes/delete.php', array('extension' => $extension)));
|
||||
$PAGE->navbar->add($title);
|
||||
$PAGE->set_context($context);
|
||||
$PAGE->set_pagelayout('admin');
|
||||
$PAGE->set_title($SITE->fullname. ': ' . $title);
|
||||
|
||||
// Display the page.
|
||||
echo $OUTPUT->header();
|
||||
|
||||
$message = get_string('delete_confirmation', 'tool_filetypes', $extension);
|
||||
$deleteurl = new \moodle_url('delete.php', array('extension' => $extension, 'delete' => 1));
|
||||
$yesbutton = new single_button($deleteurl, get_string('yes'));
|
||||
$nobutton = new single_button($redirecturl, get_string('no'), 'get');
|
||||
echo $OUTPUT->confirm($message, $yesbutton, $nobutton);
|
||||
|
||||
echo $OUTPUT->footer();
|
||||
@@ -1,111 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Display the file type updating page.
|
||||
*
|
||||
* @package tool_filetypes
|
||||
* @copyright 2014 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
require(__DIR__ . '/../../../config.php');
|
||||
require_once($CFG->libdir . '/adminlib.php');
|
||||
require_once('edit_form.php');
|
||||
|
||||
admin_externalpage_setup('tool_filetypes');
|
||||
|
||||
$oldextension = optional_param('oldextension', '', PARAM_ALPHANUMEXT);
|
||||
$mform = new tool_filetypes_form('edit.php', array('oldextension' => $oldextension));
|
||||
$title = get_string('addfiletypes', 'tool_filetypes');
|
||||
|
||||
if ($oldextension) {
|
||||
// This is editing an existing filetype, load data to the form.
|
||||
$mimetypes = get_mimetypes_array();
|
||||
if (!array_key_exists($oldextension, $mimetypes)) {
|
||||
throw new moodle_exception('error_notfound', 'tool_filetypes');
|
||||
}
|
||||
$typeinfo = $mimetypes[$oldextension];
|
||||
$formdata = array(
|
||||
'extension' => $oldextension,
|
||||
'mimetype' => $typeinfo['type'],
|
||||
'icon' => $typeinfo['icon'],
|
||||
'oldextension' => $oldextension,
|
||||
'description' => '',
|
||||
'groups' => '',
|
||||
'corestring' => '',
|
||||
'defaulticon' => 0
|
||||
);
|
||||
if (!empty($typeinfo['customdescription'])) {
|
||||
$formdata['description'] = $typeinfo['customdescription'];
|
||||
}
|
||||
if (!empty($typeinfo['groups'])) {
|
||||
$formdata['groups'] = implode(', ', $typeinfo['groups']);
|
||||
}
|
||||
if (!empty($typeinfo['string'])) {
|
||||
$formdata['corestring'] = $typeinfo['string'];
|
||||
}
|
||||
if (!empty($typeinfo['defaulticon'])) {
|
||||
$formdata['defaulticon'] = 1;
|
||||
}
|
||||
|
||||
$mform->set_data($formdata);
|
||||
$title = get_string('editfiletypes', 'tool_filetypes');
|
||||
}
|
||||
|
||||
$backurl = new \moodle_url('/admin/tool/filetypes/index.php');
|
||||
if ($mform->is_cancelled()) {
|
||||
redirect($backurl);
|
||||
} else if ($data = $mform->get_data()) {
|
||||
// Convert the groups value back into an array.
|
||||
$data->groups = trim($data->groups);
|
||||
if ($data->groups) {
|
||||
$data->groups = preg_split('~,\s*~', $data->groups);
|
||||
} else {
|
||||
$data->groups = array();
|
||||
}
|
||||
if (empty($data->defaulticon)) {
|
||||
$data->defaulticon = 0;
|
||||
}
|
||||
if (empty($data->corestring)) {
|
||||
$data->corestring = '';
|
||||
}
|
||||
if (empty($data->description)) {
|
||||
$data->description = '';
|
||||
}
|
||||
if ($data->oldextension) {
|
||||
// Update an existing file type.
|
||||
core_filetypes::update_type($data->oldextension, $data->extension, $data->mimetype, $data->icon,
|
||||
$data->groups, $data->corestring, $data->description, (bool)$data->defaulticon);
|
||||
} else {
|
||||
// Add a new file type entry.
|
||||
core_filetypes::add_type($data->extension, $data->mimetype, $data->icon,
|
||||
$data->groups, $data->corestring, $data->description, (bool)$data->defaulticon);
|
||||
}
|
||||
redirect($backurl);
|
||||
}
|
||||
|
||||
// Page settings.
|
||||
$context = context_system::instance();
|
||||
$PAGE->set_url(new \moodle_url('/admin/tool/filetypes/edit.php', array('oldextension' => $oldextension)));
|
||||
$PAGE->navbar->add($oldextension ? s($oldextension) : $title);
|
||||
$PAGE->set_context($context);
|
||||
$PAGE->set_pagelayout('admin');
|
||||
$PAGE->set_title($SITE->fullname. ': ' . $title);
|
||||
|
||||
// Display the page.
|
||||
echo $OUTPUT->header();
|
||||
$mform->display();
|
||||
echo $OUTPUT->footer();
|
||||
@@ -1,152 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Customised file types editing form.
|
||||
*
|
||||
* @package tool_filetypes
|
||||
* @copyright 2014 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
require_once($CFG->dirroot . '/lib/formslib.php');
|
||||
|
||||
/**
|
||||
* Form for adding a new custom file type or updating an existing custom file type.
|
||||
*
|
||||
* @package tool_filetypes
|
||||
* @copyright 2014 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class tool_filetypes_form extends moodleform {
|
||||
|
||||
public function definition() {
|
||||
global $CFG;
|
||||
$mform = $this->_form;
|
||||
$oldextension = $this->_customdata['oldextension'];
|
||||
|
||||
$mform->addElement('text', 'extension', get_string('extension', 'tool_filetypes'));
|
||||
$mform->setType('extension', PARAM_ALPHANUMEXT);
|
||||
$mform->addRule('extension', null, 'required', null, 'client');
|
||||
$mform->addHelpButton('extension', 'extension', 'tool_filetypes');
|
||||
|
||||
$mform->addElement('text', 'mimetype', get_string('mimetype', 'tool_filetypes'));
|
||||
$mform->setType('mimetype', PARAM_RAW);
|
||||
$mform->addRule('mimetype', null, 'required', null, 'client');
|
||||
$mform->addHelpButton('mimetype', 'mimetype', 'tool_filetypes');
|
||||
|
||||
$fileicons = \tool_filetypes\utils::get_file_icons();
|
||||
$mform->addElement('select', 'icon',
|
||||
get_string('icon', 'tool_filetypes'), $fileicons);
|
||||
$mform->addHelpButton('icon', 'icon', 'tool_filetypes');
|
||||
|
||||
$mform->addElement('text', 'groups', get_string('groups', 'tool_filetypes'));
|
||||
$mform->setType('groups', PARAM_RAW);
|
||||
$mform->addHelpButton('groups', 'groups', 'tool_filetypes');
|
||||
|
||||
$mform->addElement('select', 'descriptiontype', get_string('descriptiontype', 'tool_filetypes'),
|
||||
array('' => get_string('descriptiontype_default', 'tool_filetypes'),
|
||||
'custom' => get_string('descriptiontype_custom', 'tool_filetypes'),
|
||||
'lang' => get_string('descriptiontype_lang', 'tool_filetypes')));
|
||||
|
||||
$mform->addElement('text', 'description', get_string('description', 'tool_filetypes'));
|
||||
$mform->setType('description', PARAM_TEXT);
|
||||
$mform->addHelpButton('description', 'description', 'tool_filetypes');
|
||||
$mform->disabledIf('description', 'descriptiontype', 'ne', 'custom');
|
||||
|
||||
$mform->addElement('text', 'corestring', get_string('corestring', 'tool_filetypes'));
|
||||
$mform->setType('corestring', PARAM_ALPHANUMEXT);
|
||||
$mform->addHelpButton('corestring', 'corestring', 'tool_filetypes');
|
||||
$mform->disabledIf('corestring', 'descriptiontype', 'ne', 'lang');
|
||||
|
||||
$mform->addElement('checkbox', 'defaulticon', get_string('defaulticon', 'tool_filetypes'));
|
||||
$mform->addHelpButton('defaulticon', 'defaulticon', 'tool_filetypes');
|
||||
|
||||
$mform->addElement('hidden', 'oldextension', $oldextension);
|
||||
$mform->setType('oldextension', PARAM_RAW);
|
||||
$this->add_action_buttons(true, get_string('savechanges'));
|
||||
}
|
||||
|
||||
public function set_data($data) {
|
||||
// Set up the description type.
|
||||
if (!empty($data['corestring'])) {
|
||||
$data['descriptiontype'] = 'lang';
|
||||
} else if (!empty($data['description'])) {
|
||||
$data['descriptiontype'] = 'custom';
|
||||
} else {
|
||||
$data['descriptiontype'] = '';
|
||||
}
|
||||
|
||||
// Call parent.
|
||||
parent::set_data($data);
|
||||
}
|
||||
|
||||
public function get_data() {
|
||||
$data = parent::get_data();
|
||||
|
||||
// Update the data to handle the descriptiontype dropdown. (The type
|
||||
// is not explicitly stored, we just set or unset relevant fields.)
|
||||
if ($data) {
|
||||
switch ($data->descriptiontype) {
|
||||
case 'lang' :
|
||||
unset($data->description);
|
||||
break;
|
||||
case 'custom' :
|
||||
unset($data->corestring);
|
||||
break;
|
||||
default:
|
||||
unset($data->description);
|
||||
unset($data->corestring);
|
||||
break;
|
||||
}
|
||||
unset($data->descriptiontype);
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function validation($data, $files) {
|
||||
$errors = parent::validation($data, $files);
|
||||
|
||||
// Check the extension isn't already in use.
|
||||
$oldextension = $data['oldextension'];
|
||||
$extension = trim($data['extension']);
|
||||
if (\tool_filetypes\utils::is_extension_invalid($extension, $oldextension)) {
|
||||
$errors['extension'] = get_string('error_extension', 'tool_filetypes', $extension);
|
||||
}
|
||||
|
||||
// Check the 'default icon' setting doesn't conflict with an existing one.
|
||||
if (!empty($data['defaulticon']) && !\tool_filetypes\utils::is_defaulticon_allowed(
|
||||
$data['mimetype'], $oldextension)) {
|
||||
$errors['defaulticon'] = get_string('error_defaulticon', 'tool_filetypes', $extension);
|
||||
}
|
||||
|
||||
// If you choose 'lang' or 'custom' descriptiontype, you must fill something in the field.
|
||||
switch ($data['descriptiontype']) {
|
||||
case 'lang' :
|
||||
if (!trim($data['corestring'])) {
|
||||
$errors['corestring'] = get_string('required');
|
||||
}
|
||||
break;
|
||||
case 'custom' :
|
||||
if (!trim($data['description'])) {
|
||||
$errors['description'] = get_string('required');
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return $errors;
|
||||
}
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Display the custom file type settings page.
|
||||
*
|
||||
* @package tool_filetypes
|
||||
* @copyright 2014 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
require(__DIR__ . '/../../../config.php');
|
||||
require_once($CFG->libdir . '/adminlib.php');
|
||||
|
||||
admin_externalpage_setup('tool_filetypes');
|
||||
|
||||
// Page settings.
|
||||
$title = get_string('pluginname', 'tool_filetypes');
|
||||
|
||||
$context = context_system::instance();
|
||||
$PAGE->set_url(new \moodle_url('/admin/tool/filetypes/index.php'));
|
||||
$PAGE->set_context($context);
|
||||
$PAGE->set_pagelayout('admin');
|
||||
$PAGE->set_title($SITE->fullname. ': ' . $title);
|
||||
|
||||
$renderer = $PAGE->get_renderer('tool_filetypes');
|
||||
|
||||
// Is it restricted because set in config.php?
|
||||
$restricted = array_key_exists('customfiletypes', $CFG->config_php_settings);
|
||||
|
||||
// Display the page.
|
||||
echo $renderer->header();
|
||||
echo $renderer->edit_table(get_mimetypes_array(), core_filetypes::get_deleted_types(),
|
||||
$restricted);
|
||||
echo $renderer->footer();
|
||||
@@ -1,69 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Strings for custom file types.
|
||||
*
|
||||
* @package tool_filetypes
|
||||
* @copyright 2014 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
$string['addfiletypes'] = 'Add a new file type';
|
||||
$string['corestring'] = 'Alternative language string';
|
||||
$string['corestring_help'] = 'This setting can be used to select a different language string from the core mimetypes.php language file. Generally it should be left blank. For custom types, use the description field.';
|
||||
$string['defaulticon'] = 'Default icon for MIME type';
|
||||
$string['defaulticon_help'] = 'If there are multiple file extensions with the same MIME type, select this option for one of the extensions so that its icon will be used when determining an icon from the MIME type.';
|
||||
$string['delete_confirmation'] = 'Are you absolutely sure you want to remove <strong>.{$a}</strong>?';
|
||||
$string['deletea'] = 'Delete {$a}';
|
||||
$string['deletefiletypes'] = 'Delete a file type';
|
||||
$string['description'] = 'Custom description';
|
||||
$string['description_help'] = 'Simple file type description, e.g. ‘Kindle ebook’. If your site supports multiple languages and uses the multi-language filter, you can enter multi-language tags in this field to supply a description in different languages.';
|
||||
$string['descriptiontype'] = 'Description type';
|
||||
$string['descriptiontype_help'] = 'There are three possible ways to specify a description.
|
||||
|
||||
* Default behaviour uses the MIME type. If there is a language string in mimetypes.php corresponding to that MIME type, it will be used; otherwise the MIME type itself will be displayed to users.
|
||||
* You can specify a custom description on this form.
|
||||
* You can specify the name of a languge string in mimetypes.php to use instead of the MIME type.';
|
||||
$string['descriptiontype_default'] = 'Default (MIME type or corresponding language string if available)';
|
||||
$string['descriptiontype_custom'] = 'Custom description specified in this form';
|
||||
$string['descriptiontype_lang'] = 'Alternative language string (from mimetypes.php)';
|
||||
$string['displaydescription'] = 'Description';
|
||||
$string['editfiletypes'] = 'Edit an existing file type';
|
||||
$string['emptylist'] = 'There are no file types defined.';
|
||||
$string['error_addentry'] = 'The file type extension, description, MIME type, and icon must not contain line feed and semicolon characters.';
|
||||
$string['error_defaulticon'] = 'Another file extension with the same MIME type is already marked as the default icon.';
|
||||
$string['error_extension'] = 'The file type extension <strong>{$a}</strong> already exists or is invalid. File extensions must be unique and must not contain special characters.';
|
||||
$string['error_notfound'] = 'The file type with extension {$a} cannot be found.';
|
||||
$string['extension'] = 'Extension';
|
||||
$string['extension_help'] = 'File name extension without the dot, e.g. ‘mobi’';
|
||||
$string['groups'] = 'Type groups';
|
||||
$string['groups_help'] = 'Optional list of file type groups that this type belongs to. These are generic categories such as ‘document’ and ‘image’.';
|
||||
$string['icon'] = 'File icon';
|
||||
$string['icon_help'] = 'Icon filename.
|
||||
|
||||
The list of icons is taken from the /pix/f directory inside your Moodle installation. You can add custom icons to this folder if required.';
|
||||
$string['mimetype'] = 'MIME type';
|
||||
$string['mimetype_help'] = 'MIME type associated with this file type, e.g. ‘application/x-mobipocket-ebook’';
|
||||
$string['pluginname'] = 'File types';
|
||||
$string['revert'] = 'Restore {$a} to Moodle defaults';
|
||||
$string['revert_confirmation'] = 'Are you sure you want to restore <strong>.{$a}</strong> to Moodle defaults, discarding your changes?';
|
||||
$string['revertfiletype'] = 'Restore a file type';
|
||||
$string['source'] = 'Type';
|
||||
$string['source_custom'] = 'Custom';
|
||||
$string['source_deleted'] = 'Deleted';
|
||||
$string['source_modified'] = 'Modified';
|
||||
$string['source_standard'] = 'Standard';
|
||||
@@ -1,179 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Renderer.
|
||||
*
|
||||
* @package tool_filetypes
|
||||
* @copyright 2014 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* Class containing the renderer functions for displaying file types.
|
||||
*
|
||||
* @package tool_filetypes
|
||||
* @copyright 2014 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class tool_filetypes_renderer extends plugin_renderer_base {
|
||||
|
||||
/**
|
||||
* Renderer for displaying the file type edit table.
|
||||
*
|
||||
* @param array $filetypes An array of file type objects (from get_mimetypes_array)
|
||||
* @param array $deleted An array of deleted file types
|
||||
* @param bool $restricted If true, cannot be edited because set in config.php.
|
||||
* @return string HTML code
|
||||
*/
|
||||
public function edit_table(array $filetypes, array $deleted, $restricted) {
|
||||
// Get combined array of all types, with deleted marker.
|
||||
$combined = array_merge($filetypes, $deleted);
|
||||
foreach ($deleted as $ext => $value) {
|
||||
$combined[$ext]['deleted'] = true;
|
||||
}
|
||||
ksort($combined);
|
||||
|
||||
$out = $this->heading(get_string('pluginname', 'tool_filetypes'));
|
||||
if ($restricted) {
|
||||
$out .= html_writer::div(
|
||||
html_writer::div(get_string('configoverride', 'admin'), 'form-overridden'),
|
||||
'', array('id' => 'adminsettings'));
|
||||
}
|
||||
if (count($combined) > 1) {
|
||||
// Display the file type table if any file types exist (other than 'xxx').
|
||||
$table = new html_table();
|
||||
$headings = new html_table_row();
|
||||
$headings->cells = array();
|
||||
$headings->cells[] = new html_table_cell(get_string('extension', 'tool_filetypes'));
|
||||
if (!$restricted) {
|
||||
$headings->cells[] =
|
||||
new html_table_cell(html_writer::span(get_string('edit'), 'accesshide'));
|
||||
}
|
||||
$headings->cells[] = new html_table_cell(get_string('source', 'tool_filetypes'));
|
||||
$headings->cells[] = new html_table_cell(get_string('mimetype', 'tool_filetypes'));
|
||||
$headings->cells[] = new html_table_cell(get_string('groups', 'tool_filetypes'));
|
||||
$headings->cells[] = new html_table_cell(get_string('displaydescription', 'tool_filetypes'));
|
||||
foreach ($headings->cells as $cell) {
|
||||
$cell->header = true;
|
||||
}
|
||||
$table->data = array($headings);
|
||||
foreach ($combined as $extension => $filetype) {
|
||||
if ($extension === 'xxx') {
|
||||
continue;
|
||||
}
|
||||
$row = new html_table_row();
|
||||
$row->cells = array();
|
||||
|
||||
// First cell has icon and extension.
|
||||
$icon = $this->pix_icon('f/' . $filetype['icon'], '');
|
||||
$row->cells[] = new html_table_cell($icon . ' ' . html_writer::span(s($extension)));
|
||||
|
||||
// Reset URL and button if needed.
|
||||
$reverturl = new \moodle_url('/admin/tool/filetypes/revert.php',
|
||||
array('extension' => $extension));
|
||||
$revertbutton = html_writer::link($reverturl, $this->pix_icon('t/restore',
|
||||
get_string('revert', 'tool_filetypes', s($extension))));
|
||||
if ($restricted) {
|
||||
$revertbutton = '';
|
||||
}
|
||||
|
||||
// Rest is different for deleted items.
|
||||
if (!empty($filetype['deleted'])) {
|
||||
// Show deleted standard types differently.
|
||||
if (!$restricted) {
|
||||
$row->cells[] = new html_table_cell('');
|
||||
}
|
||||
$source = new html_table_cell(get_string('source_deleted', 'tool_filetypes') .
|
||||
' ' . $revertbutton);
|
||||
$source->attributes = array('class' => 'nonstandard');
|
||||
$row->cells[] = $source;
|
||||
|
||||
// Other cells are blank.
|
||||
$row->cells[] = new html_table_cell('');
|
||||
$row->cells[] = new html_table_cell('');
|
||||
$row->cells[] = new html_table_cell('');
|
||||
$row->attributes = array('class' => 'deleted');
|
||||
} else {
|
||||
if (!$restricted) {
|
||||
// Edit icons. For accessibility, the name of these links should
|
||||
// be different for each row, so we have to include the extension.
|
||||
$editurl = new \moodle_url('/admin/tool/filetypes/edit.php',
|
||||
array('oldextension' => $extension));
|
||||
$editbutton = html_writer::link($editurl, $this->pix_icon('t/edit',
|
||||
get_string('edita', '', s($extension))));
|
||||
$deleteurl = new \moodle_url('/admin/tool/filetypes/delete.php',
|
||||
array('extension' => $extension));
|
||||
$deletebutton = html_writer::link($deleteurl, $this->pix_icon('t/delete',
|
||||
get_string('deletea', 'tool_filetypes', s($extension))));
|
||||
$row->cells[] = new html_table_cell($editbutton . ' ' . $deletebutton);
|
||||
}
|
||||
|
||||
// Source.
|
||||
$sourcestring = 'source_';
|
||||
if (!empty($filetype['custom'])) {
|
||||
$sourcestring .= 'custom';
|
||||
} else if (!empty($filetype['modified'])) {
|
||||
$sourcestring .= 'modified';
|
||||
} else {
|
||||
$sourcestring .= 'standard';
|
||||
}
|
||||
$source = new html_table_cell(get_string($sourcestring, 'tool_filetypes') .
|
||||
($sourcestring === 'source_modified' ? ' ' . $revertbutton : ''));
|
||||
if ($sourcestring !== 'source_standard') {
|
||||
$source->attributes = array('class' => 'nonstandard');
|
||||
}
|
||||
$row->cells[] = $source;
|
||||
|
||||
// MIME type.
|
||||
$mimetype = html_writer::div(s($filetype['type']), 'mimetype');
|
||||
if (!empty($filetype['defaulticon'])) {
|
||||
// Include the 'default for MIME type' info in the MIME type cell.
|
||||
$mimetype .= html_writer::div(html_writer::tag('i',
|
||||
get_string('defaulticon', 'tool_filetypes')));
|
||||
}
|
||||
$row->cells[] = new html_table_cell($mimetype);
|
||||
|
||||
// Groups.
|
||||
$groups = !empty($filetype['groups']) ? implode(', ', $filetype['groups']) : '';
|
||||
$row->cells[] = new html_table_cell(s($groups));
|
||||
|
||||
// Description.
|
||||
$description = get_mimetype_description(array('filename' => 'a.' . $extension));
|
||||
// Don't show the description if it's just a copy of the MIME type,
|
||||
// it makes the table ugly with the long duplicate text; leave blank instead.
|
||||
if ($description === $filetype['type']) {
|
||||
$description = '';
|
||||
}
|
||||
$row->cells[] = new html_table_cell($description);
|
||||
}
|
||||
|
||||
$table->data[] = $row;
|
||||
}
|
||||
$out .= html_writer::table($table);
|
||||
} else {
|
||||
$out .= html_writer::tag('div', get_string('emptylist', 'tool_filetypes'));
|
||||
}
|
||||
// Displaying the 'Add' button.
|
||||
if (!$restricted) {
|
||||
$out .= $this->single_button(new moodle_url('/admin/tool/filetypes/edit.php',
|
||||
array('name' => 'add')), get_string('addfiletypes', 'tool_filetypes'), 'get');
|
||||
}
|
||||
return $out;
|
||||
}
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Resets a file type to the default Moodle values.
|
||||
*
|
||||
* @package tool_filetypes
|
||||
* @copyright 2014 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
require(__DIR__ . '/../../../config.php');
|
||||
require_once($CFG->libdir . '/adminlib.php');
|
||||
|
||||
admin_externalpage_setup('tool_filetypes');
|
||||
|
||||
$extension = required_param('extension', PARAM_RAW);
|
||||
$redirecturl = new \moodle_url('/admin/tool/filetypes/index.php');
|
||||
|
||||
if (optional_param('revert', 0, PARAM_INT)) {
|
||||
require_sesskey();
|
||||
|
||||
// Reset the file type in config.
|
||||
core_filetypes::revert_type_to_default($extension);
|
||||
redirect($redirecturl);
|
||||
}
|
||||
|
||||
// Page settings.
|
||||
$title = get_string('revertfiletype', 'tool_filetypes');
|
||||
|
||||
$context = context_system::instance();
|
||||
$PAGE->set_url(new \moodle_url('/admin/tool/filetypes/revert.php', array('extension' => $extension)));
|
||||
$PAGE->navbar->add($title);
|
||||
$PAGE->set_context($context);
|
||||
$PAGE->set_pagelayout('admin');
|
||||
$PAGE->set_title($SITE->fullname. ': ' . $title);
|
||||
|
||||
// Display the page.
|
||||
echo $OUTPUT->header();
|
||||
|
||||
$message = get_string('revert_confirmation', 'tool_filetypes', $extension);
|
||||
$reverturl = new \moodle_url('revert.php', array('extension' => $extension, 'revert' => 1));
|
||||
$yesbutton = new single_button($reverturl, get_string('yes'));
|
||||
$nobutton = new single_button($redirecturl, get_string('no'), 'get');
|
||||
echo $OUTPUT->confirm($message, $yesbutton, $nobutton);
|
||||
|
||||
echo $OUTPUT->footer();
|
||||
@@ -1,31 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Configure the setting page of the custom file type as an external page.
|
||||
*
|
||||
* @package tool_filetypes
|
||||
* @copyright 2014 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die;
|
||||
|
||||
if ($hassiteconfig) {
|
||||
$ADMIN->add('server', new admin_externalpage('tool_filetypes',
|
||||
new lang_string('pluginname', 'tool_filetypes'),
|
||||
$CFG->wwwroot . '/admin/tool/filetypes/index.php'));
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
/**
|
||||
* Styles for admin tool page.
|
||||
*/
|
||||
|
||||
/* Fix bad default table wrap (caused by the long mimetype field). */
|
||||
.path-admin-tool-filetypes .generaltable .c0,
|
||||
.path-admin-tool-filetypes .generaltable .c1,
|
||||
.path-admin-tool-filetypes .generaltable .c2,
|
||||
.path-admin-tool-filetypes .generaltable th {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* Formatting for deleted lines. */
|
||||
.path-admin-tool-filetypes .generaltable .deleted .c0 img {
|
||||
opacity: 0.2;
|
||||
}
|
||||
|
||||
.path-admin-tool-filetypes .generaltable .deleted .c0 span {
|
||||
text-decoration: line-through;
|
||||
}
|
||||
|
||||
/* Custom types show bold */
|
||||
.path-admin-tool-filetypes .generaltable .nonstandard {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/* Spacing around the 'Defined in config.php' stripe */
|
||||
.path-admin-tool-filetypes .form-overridden {
|
||||
display: inline-block;
|
||||
margin-bottom: 1em;
|
||||
padding: 4px 6px;
|
||||
}
|
||||
@@ -1,136 +0,0 @@
|
||||
@tool @tool_filetypes
|
||||
Feature: Add customised file types
|
||||
In order to support a file mime type which doesn't exist in Moodle
|
||||
As an administrator
|
||||
I need to add a new customised file type
|
||||
|
||||
Scenario: Add a new file type
|
||||
Given I log in as "admin"
|
||||
And I navigate to "File types" node in "Site administration > Server"
|
||||
And I press "Add"
|
||||
# Try setting all the form fields, not just the optional ones.
|
||||
And I set the following fields to these values:
|
||||
| Extension | frog |
|
||||
| MIME type | application/x-frog |
|
||||
| File icon | archive |
|
||||
| Type groups | document |
|
||||
| Description type | Custom description specified in this form |
|
||||
| Custom description | Froggy file |
|
||||
| Default icon for MIME type | 1 |
|
||||
When I press "Save changes"
|
||||
Then I should see "Froggy file" in the "application/x-frog" "table_row"
|
||||
And I should see "document" in the "application/x-frog" "table_row"
|
||||
And I should see "frog" in the "application/x-frog" "table_row"
|
||||
And "//img[contains(@src, 'archive')]" "xpath_element" should exist in the "application/x-frog" "table_row"
|
||||
|
||||
Scenario: Update an existing file type
|
||||
Given I log in as "admin"
|
||||
And I navigate to "File types" node in "Site administration > Server"
|
||||
When I click on "Edit 7z" "link"
|
||||
And I set the following fields to these values:
|
||||
| Extension | doc |
|
||||
And I press "Save changes"
|
||||
Then I should see "File extensions must be unique"
|
||||
And I set the following fields to these values:
|
||||
| Extension | frog |
|
||||
And I press "Save changes"
|
||||
And I should see "frog" in the "application/x-7z-compressed" "table_row"
|
||||
|
||||
Scenario: Change the text option (was buggy)
|
||||
Given I log in as "admin"
|
||||
And I navigate to "File types" node in "Site administration > Server"
|
||||
When I click on "Edit 7z" "link"
|
||||
And I set the following fields to these values:
|
||||
| Description type | Custom description specified in this form |
|
||||
| Custom description | New description for 7z |
|
||||
And I press "Save changes"
|
||||
Then I should see "New description" in the "application/x-7z-compressed" "table_row"
|
||||
And I click on "Edit 7z" "link"
|
||||
And I set the field "Description type" to "Default"
|
||||
And I press "Save changes"
|
||||
And I should not see "New description" in the "application/x-7z-compressed" "table_row"
|
||||
|
||||
Scenario: Try to select a text option without entering a value.
|
||||
Given I log in as "admin"
|
||||
And I navigate to "File types" node in "Site administration > Server"
|
||||
When I click on "Edit dmg" "link"
|
||||
And I set the field "Description type" to "Custom description"
|
||||
And I press "Save changes"
|
||||
Then I should see "Required"
|
||||
And I set the field "Description type" to "Alternative language string"
|
||||
And I press "Save changes"
|
||||
And I should see "Required"
|
||||
And I set the field "Description type" to "Default"
|
||||
And I press "Save changes"
|
||||
# Check we're back on the main page now.
|
||||
And "dmg" "table_row" should exist
|
||||
|
||||
Scenario: Delete an existing file type
|
||||
Given I log in as "admin"
|
||||
And I navigate to "File types" node in "Site administration > Server"
|
||||
When I click on "Delete 7z" "link"
|
||||
Then I should see "Are you absolutely sure you want to remove .7z?"
|
||||
And I press "Yes"
|
||||
And I should see "Deleted" in the "7z" "table_row"
|
||||
|
||||
Scenario: Delete a custom file type
|
||||
Given I log in as "admin"
|
||||
And I navigate to "File types" node in "Site administration > Server"
|
||||
And I press "Add"
|
||||
And I set the following fields to these values:
|
||||
| Extension | frog |
|
||||
| MIME type | application/x-frog |
|
||||
And I press "Save changes"
|
||||
When I click on "Delete frog" "link"
|
||||
And I press "Yes"
|
||||
Then I should not see "frog"
|
||||
|
||||
Scenario: Revert changes to deleted file type
|
||||
Given I log in as "admin"
|
||||
And I navigate to "File types" node in "Site administration > Server"
|
||||
When I click on "Delete 7z" "link"
|
||||
And I press "Yes"
|
||||
And I follow "Restore 7z to Moodle defaults"
|
||||
And I press "Yes"
|
||||
Then I should not see "Deleted" in the "7z" "table_row"
|
||||
|
||||
Scenario: Revert changes to updated file type
|
||||
Given I log in as "admin"
|
||||
And I navigate to "File types" node in "Site administration > Server"
|
||||
And I click on "Edit 7z" "link"
|
||||
And I set the following fields to these values:
|
||||
| File icon | document |
|
||||
And I press "Save changes"
|
||||
When I follow "Restore 7z to Moodle defaults"
|
||||
And I press "Yes"
|
||||
Then "//img[contains(@src, 'archive')]" "xpath_element" should exist in the "7z" "table_row"
|
||||
|
||||
@javascript @_file_upload
|
||||
Scenario: Create a resource activity which contains a customised file type
|
||||
Given the following "courses" exist:
|
||||
| fullname | shortname |
|
||||
| Course 1 | C1 |
|
||||
And I log in as "admin"
|
||||
And I navigate to "File types" node in "Site administration > Server"
|
||||
And I press "Add"
|
||||
And I set the following fields to these values:
|
||||
| Extension | frog |
|
||||
| MIME type | application/x-frog |
|
||||
| File icon | archive |
|
||||
| Description type | Custom description specified in this form |
|
||||
| Custom description | Froggy file |
|
||||
And I press "Save changes"
|
||||
# Create a resource activity and add it to a course
|
||||
And I am on site homepage
|
||||
And I follow "Course 1"
|
||||
And I turn editing mode on
|
||||
When I add a "File" to section "1"
|
||||
And I set the following fields to these values:
|
||||
| Name | An example of customised file type |
|
||||
| Description | File description |
|
||||
And I upload "admin/tool/filetypes/tests/fixtures/test.frog" file to "Select files" filemanager
|
||||
And I expand all fieldsets
|
||||
And I set the field "Show type" to "1"
|
||||
And I press "Save and return to course"
|
||||
Then I should see "Froggy file"
|
||||
And the "src" attribute of ".modtype_resource a img" "css_element" should contain "archive"
|
||||
BIN
Binary file not shown.
|
Before Width: | Height: | Size: 67 B |
BIN
Binary file not shown.
|
Before Width: | Height: | Size: 67 B |
@@ -1 +0,0 @@
|
||||
This is not a real file format.
|
||||
BIN
Binary file not shown.
|
Before Width: | Height: | Size: 43 B |
@@ -1,86 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Unit tests for the custom file types.
|
||||
*
|
||||
* @package tool_filetypes
|
||||
* @copyright 2014 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
use tool_filetypes\utils;
|
||||
|
||||
/**
|
||||
* Unit tests for the custom file types.
|
||||
*
|
||||
* @package tool_filetypes
|
||||
* @copyright 2014 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class tool_filetypes_test extends advanced_testcase {
|
||||
/**
|
||||
* Tests is_extension_invalid() function.
|
||||
*/
|
||||
public function test_is_extension_invalid() {
|
||||
// The pdf file extension already exists in default moodle minetypes.
|
||||
$this->assertTrue(utils::is_extension_invalid('pdf'));
|
||||
|
||||
// The frog extension does not.
|
||||
$this->assertFalse(utils::is_extension_invalid('frog'));
|
||||
|
||||
// However you could use the pdf extension when editing the pdf extension.
|
||||
$this->assertFalse(utils::is_extension_invalid('pdf', 'pdf'));
|
||||
|
||||
// Blank extension is invalid.
|
||||
$this->assertTrue(utils::is_extension_invalid(''));
|
||||
|
||||
// Extensions with dot are invalid.
|
||||
$this->assertTrue(utils::is_extension_invalid('.frog'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests is_defaulticon_allowed() function.
|
||||
*/
|
||||
public function test_is_defaulticon_allowed() {
|
||||
// You ARE allowed to set a default icon for a MIME type that hasn't
|
||||
// been used yet.
|
||||
$this->assertTrue(utils::is_defaulticon_allowed('application/x-frog'));
|
||||
|
||||
// You AREN'T allowed to set default icon for text/plain as there is
|
||||
// already a type that has that set.
|
||||
$this->assertFalse(utils::is_defaulticon_allowed('text/plain'));
|
||||
|
||||
// But you ARE still allowed to set it when actually editing txt, which
|
||||
// is the default.
|
||||
$this->assertTrue(utils::is_defaulticon_allowed('text/plain', 'txt'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests get_icons_from_path() function.
|
||||
*/
|
||||
public function test_get_icons_from_path() {
|
||||
// Get icons from the fixtures folder.
|
||||
$icons = utils::get_icons_from_path(__DIR__ . '/fixtures');
|
||||
|
||||
// The icons are returned alphabetically and with keys === values.
|
||||
// For the icon with numbers after the name, only the base name is
|
||||
// returned and only one of it.
|
||||
$this->assertEquals(array('frog' => 'frog', 'zombie' => 'zombie'), $icons);
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Version details.
|
||||
*
|
||||
* @package tool_filetypes
|
||||
* @copyright 2014 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2015051100;
|
||||
$plugin->requires = 2015050500;
|
||||
$plugin->component = 'tool_filetypes';
|
||||
@@ -83,21 +83,6 @@ class tool_generator_course_backend extends tool_generator_backend {
|
||||
*/
|
||||
private $shortname;
|
||||
|
||||
/**
|
||||
* @var string Course fullname.
|
||||
*/
|
||||
private $fullname = "";
|
||||
|
||||
/**
|
||||
* @var string Course summary.
|
||||
*/
|
||||
private $summary = "";
|
||||
|
||||
/**
|
||||
* @var string Course summary format, defaults to FORMAT_HTML.
|
||||
*/
|
||||
private $summaryformat = FORMAT_HTML;
|
||||
|
||||
/**
|
||||
* @var testing_data_generator Data generator
|
||||
*/
|
||||
@@ -122,38 +107,11 @@ class tool_generator_course_backend extends tool_generator_backend {
|
||||
* @param int|bool $filesizelimit The max number of bytes for a generated file
|
||||
* @param bool $progress True if progress information should be displayed
|
||||
*/
|
||||
public function __construct(
|
||||
$shortname,
|
||||
$size,
|
||||
$fixeddataset = false,
|
||||
$filesizelimit = false,
|
||||
$progress = true,
|
||||
$fullname = null,
|
||||
$summary = null,
|
||||
$summaryformat = FORMAT_HTML) {
|
||||
public function __construct($shortname, $size, $fixeddataset = false, $filesizelimit = false, $progress = true) {
|
||||
|
||||
// Set parameters.
|
||||
$this->shortname = $shortname;
|
||||
|
||||
// We can't allow fullname to be set to an empty string.
|
||||
if (empty($fullname)) {
|
||||
$this->fullname = get_string(
|
||||
'fullname',
|
||||
'tool_generator',
|
||||
array(
|
||||
'size' => get_string('shortsize_' . $size, 'tool_generator')
|
||||
)
|
||||
);
|
||||
} else {
|
||||
$this->fullname = $fullname;
|
||||
}
|
||||
|
||||
// Summary, on the other hand, should be empty-able.
|
||||
if (!is_null($summary)) {
|
||||
$this->summary = $summary;
|
||||
$this->summaryformat = $summaryformat;
|
||||
}
|
||||
|
||||
parent::__construct($size, $fixeddataset, $filesizelimit, $progress);
|
||||
}
|
||||
|
||||
@@ -250,17 +208,10 @@ class tool_generator_course_backend extends tool_generator_backend {
|
||||
*/
|
||||
private function create_course() {
|
||||
$this->log('createcourse', $this->shortname);
|
||||
$courserecord = array(
|
||||
'shortname' => $this->shortname,
|
||||
'fullname' => $this->fullname,
|
||||
'numsections' => self::$paramsections[$this->size],
|
||||
'startdate' => usergetmidnight(time())
|
||||
);
|
||||
if (strlen($this->summary) > 0) {
|
||||
$courserecord['summary'] = $this->summary;
|
||||
$courserecord['summary_format'] = $this->summaryformat;
|
||||
}
|
||||
|
||||
$courserecord = array('shortname' => $this->shortname,
|
||||
'fullname' => get_string('fullname', 'tool_generator',
|
||||
array('size' => get_string('shortsize_' . $this->size, 'tool_generator'))),
|
||||
'numsections' => self::$paramsections[$this->size]);
|
||||
return $this->generator->create_course($courserecord, array('createsections' => true));
|
||||
}
|
||||
|
||||
@@ -357,7 +308,8 @@ class tool_generator_course_backend extends tool_generator_backend {
|
||||
$username = 'tool_generator_' . $textnumber;
|
||||
|
||||
// Create user account.
|
||||
$record = array('username' => $username, 'idnumber' => $number);
|
||||
$record = array('firstname' => get_string('firstname', 'tool_generator'),
|
||||
'lastname' => $number, 'username' => $username);
|
||||
|
||||
// We add a user password if it has been specified.
|
||||
if (!empty($CFG->tool_generator_users_password)) {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user