Compare commits
896 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ef0ee34df0 | |||
| 7330bdebff | |||
| 3fb5bd96e8 | |||
| 28c8ac2c4a | |||
| b9d8d54be2 | |||
| e5636247a1 | |||
| 728ece64e4 | |||
| eecdbbf315 | |||
| 6b1e9b0cd4 | |||
| 864ea90d6d | |||
| 7442e32e87 | |||
| abfc156859 | |||
| 857f80ef77 | |||
| 3efe930987 | |||
| a77f82dacf | |||
| ed9e1428d1 | |||
| 730440dcf4 | |||
| c6465439d0 | |||
| 25488a1120 | |||
| 602a3bd3de | |||
| d57ce0312a | |||
| bdff56f737 | |||
| 5b2f2af6cd | |||
| 6a37f9898e | |||
| 76f9954066 | |||
| ce3b9d2f59 | |||
| f96b8a1c67 | |||
| 5d4abb97b2 | |||
| 7ffe38cebf | |||
| 0fc189a4b4 | |||
| 013de6d5d4 | |||
| 41a19bffee | |||
| ee8f17db89 | |||
| e7fa4cde7b | |||
| 51214dd2d1 | |||
| e6499fb8a4 | |||
| d5c7462a6a | |||
| 4d4867503c | |||
| 71037bf26c | |||
| db4e2c4cd4 | |||
| 6b25f55ec9 | |||
| 0bd4dca7be | |||
| 9b1cc0bb86 | |||
| edf55404ff | |||
| 36f74f56d8 | |||
| 51294319af | |||
| c89fa51c0e | |||
| e7198624aa | |||
| 971b916b44 | |||
| 65a90d2d9b | |||
| 379a3fcee3 | |||
| ed0a48b2c1 | |||
| a97718eaed | |||
| 5ee96bbcf1 | |||
| 158eb2af96 | |||
| 42e5f933b6 | |||
| 08066a2ab2 | |||
| 8ee37654e5 | |||
| 5fbf4638ab | |||
| c7db26dab9 | |||
| 0f73fa60b9 | |||
| b174b543d8 | |||
| 233f8b265a | |||
| aa5916d94c | |||
| 2db5aef32e | |||
| 0e0bbd9922 | |||
| e274eece15 | |||
| 0483a5ad93 | |||
| 7c9f70acd4 | |||
| 5f98c897b4 | |||
| 9334d95009 | |||
| ede0d15765 | |||
| ff7b9d9d8f | |||
| 1998e85cf1 | |||
| e2f19c6b33 | |||
| 96942337fb | |||
| ebe9c36cb5 | |||
| 24d6ab75fc | |||
| 82403a6f38 | |||
| 41a10883b6 | |||
| 235847ecd5 | |||
| 8102409895 | |||
| 0710e4944f | |||
| 1b6b3b66df | |||
| aafe8337df | |||
| e3caf032d7 | |||
| 25c950b63b | |||
| d1ac630093 | |||
| 193cb51042 | |||
| 05636776e3 | |||
| 3bcd0f23ff | |||
| 15378769f2 | |||
| 5e9d6beaa3 | |||
| a43aa9fbf1 | |||
| 3f4a9df9f7 | |||
| 9f5ac013a3 | |||
| 77da718f1b | |||
| 652413ce70 | |||
| 29b3c5dfc6 | |||
| 28ac492db3 | |||
| fa0016a8a2 | |||
| 0f678757a4 | |||
| 8895425e41 | |||
| f76c4edf01 | |||
| 6e1688f7ba | |||
| 9f3a4cbbcf | |||
| 590a9dc30a | |||
| 31ab685057 | |||
| 2dfed6304e | |||
| 823640c16d | |||
| 06a8eb06f3 | |||
| 4f88b83de9 | |||
| 6fcf292760 | |||
| f23808515b | |||
| fd9233c1b9 | |||
| 759e616eb6 | |||
| a0815efa5d | |||
| 25d981659b | |||
| ce7c5de2e9 | |||
| bfb99b7e1d | |||
| 90e7406e29 | |||
| 2f31445ff8 | |||
| 0b420fab17 | |||
| a413d15875 | |||
| ba0f2d978b | |||
| 3c60db1a84 | |||
| a00bff10e5 | |||
| a837a7c721 | |||
| 19cb367592 | |||
| dfbde06b40 | |||
| a1b2b00736 | |||
| 0ec77cdea6 | |||
| acbd69f7ee | |||
| 47e4397538 | |||
| 08e9a32e5f | |||
| 9a8544daf6 | |||
| 0a1c3118ba | |||
| 782e32e3e4 | |||
| 577efa89cd | |||
| c644877218 | |||
| a63fd3a6a8 | |||
| 53a09b3886 | |||
| 07b9d5e9df | |||
| c9c9a4a76b | |||
| a5be87d234 | |||
| a70818530e | |||
| 6279184e14 | |||
| 11a788e420 | |||
| c0aac4e36f | |||
| 7a27c83bc0 | |||
| efdbd1bd1d | |||
| 28e5849960 | |||
| 761a10f8d5 | |||
| aebc072dd4 | |||
| 3c78500c9f | |||
| 624feb24f2 | |||
| a1f3fe6617 | |||
| 4ba46b8618 | |||
| 58ce5122b2 | |||
| 38a69deafa | |||
| f47b4fec8f | |||
| ec5dc1fab7 | |||
| 5ce1ff33ce | |||
| 98c5ac4358 | |||
| c1e725bbd1 | |||
| f10763ebc0 | |||
| 5eb9a4f631 | |||
| e2b27417dc | |||
| 8ebaf4bd74 | |||
| 7aaf82deb6 | |||
| 83fffcb97a | |||
| a5a7dd624f | |||
| b41b2b2e18 | |||
| 4acc62f2c4 | |||
| e32b3de09e | |||
| 7082e945b2 | |||
| ab4ec7a21c | |||
| 4e4fabd197 | |||
| 7ca837ef2c | |||
| 8ef741eeca | |||
| 764d330c3e | |||
| a95a356322 | |||
| dfc8d1d7f5 | |||
| fdf33244b5 | |||
| 3b6aa4f70c | |||
| a7695377d7 | |||
| dc606a57a7 | |||
| a82e15de84 | |||
| 80e5c694d3 | |||
| 39790f906c | |||
| aa083d663b | |||
| 2a2176186d | |||
| ae4ce123e5 | |||
| 8f71903132 | |||
| b269650d8a | |||
| 684424a6e6 | |||
| 4974d22b8d | |||
| 472b07b8e7 | |||
| de5c64fa7c | |||
| 98d135fea3 | |||
| 27ebbdd703 | |||
| 79405669f9 | |||
| 82d0300757 | |||
| 905b88c69c | |||
| 155771cb4b | |||
| a1b52cb282 | |||
| e29585b206 | |||
| 7e00410338 | |||
| 270cd52103 | |||
| a3b0030e04 | |||
| 824fef6892 | |||
| b70d618c04 | |||
| 256731fd39 | |||
| b1f5a038f3 | |||
| d088fbebac | |||
| 4947703a0b | |||
| 066bfe30b0 | |||
| ce296e211f | |||
| e719c59c0e | |||
| 82bef99867 | |||
| b954cb004c | |||
| c5a229c2f1 | |||
| 93289de65e | |||
| b207d05e48 | |||
| e28eb21659 | |||
| 5dce0f2a1a | |||
| 90c15466d8 | |||
| c78f073a41 | |||
| cb5639ca1c | |||
| 2ad02f9c91 | |||
| fa0b936d59 | |||
| fa10d60b15 | |||
| 8ded044775 | |||
| b7f4097043 | |||
| 5f38edeefd | |||
| 74d357b1c2 | |||
| 839b58679d | |||
| 79efe4f22b | |||
| 18a28dde45 | |||
| 94776f1bfa | |||
| 9a13b1108f | |||
| 52b3120916 | |||
| 3a1ade2544 | |||
| 1ab256742d | |||
| 3a98e73a54 | |||
| bdeb5d0bf1 | |||
| 9b62fec54a | |||
| cfd46e76c6 | |||
| 1c4b2c0b8d | |||
| e262d58d6c | |||
| 97eb0e4473 | |||
| 4f6e4f8d86 | |||
| 814a6297ec | |||
| 4d7f209923 | |||
| 1d8d52cdd9 | |||
| c5609f6dc5 | |||
| e008e04db1 | |||
| 6b23bd16da | |||
| 20a93a61db | |||
| e82aee6895 | |||
| 04224a6dc7 | |||
| 90ace35a9d | |||
| 414fcf2584 | |||
| c81672b56d | |||
| eb97871058 | |||
| d07b03422d | |||
| 960dfcae59 | |||
| 9eb88a59dd | |||
| 9681639337 | |||
| 115707c2b5 | |||
| d9613f122f | |||
| ade2c99109 | |||
| ee7d0bbfcf | |||
| 646f774a0f | |||
| 83bfad45a5 | |||
| 408b3ee93f | |||
| 06b2987aad | |||
| 227164c9b6 | |||
| ff04a96ba2 | |||
| b006c3f9ff | |||
| 866bbb05f7 | |||
| b98bc5cb98 | |||
| b8e91060b1 | |||
| 7a6ad10586 | |||
| e73eb478c4 | |||
| 91e6e56014 | |||
| 250611b579 | |||
| 5ccfa40292 | |||
| bd538db810 | |||
| e205c062b1 | |||
| 9cb75a10bf | |||
| c18481fab8 | |||
| c22d036916 | |||
| cac73cf1ec | |||
| d4f1027e54 | |||
| a4ea4e2b1a | |||
| d86801bed7 | |||
| a3e2211c5f | |||
| 8b080d52ff | |||
| 68575baff3 | |||
| 7e71efabf9 | |||
| 4caa3de6db | |||
| b88bb98ab7 | |||
| fc27206268 | |||
| 929b5b3210 | |||
| 9b4e4b7f64 | |||
| ff71f55265 | |||
| 8f89ca5780 | |||
| 32418eeee0 | |||
| 0469922b5f | |||
| 1cbda6fabd | |||
| eef0d3043c | |||
| 1f77f14fb9 | |||
| 574111a94e | |||
| 66b74e5aa5 | |||
| 81efab0cbb | |||
| 9717c4b19c | |||
| d6d18a2b7b | |||
| 8d8e51b073 | |||
| 2d73ec85ea | |||
| b61b21d7ee | |||
| a45dbb214b | |||
| f973e5f968 | |||
| 3e1eb36d77 | |||
| 3677e0c1aa | |||
| 133e38fdbb | |||
| 7c5074ce82 | |||
| a7029b542e | |||
| ff66e9daa8 | |||
| b12cc0679f | |||
| cfd4b8a3f5 | |||
| ee7bb53ccd | |||
| 5f074a6bb0 | |||
| 4f02d0074a | |||
| 1605660ad2 | |||
| 62415470ae | |||
| e35e70f83d | |||
| 8a073e4364 | |||
| 8de9100136 | |||
| b53af0f2a6 | |||
| 5b860c69a2 | |||
| 37b0d3adad | |||
| da2e9d519b | |||
| 6cfed595c9 | |||
| df25d33379 | |||
| 9fade08632 | |||
| e53eb2a208 | |||
| 2998a4cb30 | |||
| 0b8749c892 | |||
| e1882ddaef | |||
| bb2e1de1c2 | |||
| 4c4fc6d629 | |||
| 217d839ded | |||
| cd554c4287 | |||
| 15fac63956 | |||
| dc842aaa36 | |||
| ef967ae424 | |||
| 8279060aca | |||
| 2ab17fbdeb | |||
| 4a45541511 | |||
| 9b93e7b472 | |||
| aafc6872e4 | |||
| d073c81248 | |||
| 74aa973e8e | |||
| 9c1c9d8954 | |||
| 40e8488c8d | |||
| 9a57b4bc0b | |||
| ba541f01b6 | |||
| 64156342ad | |||
| ebc09cc3ad | |||
| 5af6a32866 | |||
| cbfbe43604 | |||
| f0040e7daf | |||
| 893139fd12 | |||
| f5d810b4f3 | |||
| e5ee31453a | |||
| 05297cc0a8 | |||
| 66e46b4859 | |||
| 4768a4768b | |||
| b4918e7d8a | |||
| 65e9de16c2 | |||
| 1e8b6e0087 | |||
| 9d649ad7a3 | |||
| ff48f6f0e7 | |||
| f5191afd30 | |||
| a6a14f2155 | |||
| bf2c42e8ee | |||
| b31c53a372 | |||
| f9d14c4cd7 | |||
| 79c8b9fcae | |||
| 33d83d755a | |||
| 4a2ac9676a | |||
| 30354dc0d2 | |||
| e906a85cc3 | |||
| 7b0e78bf83 | |||
| 24607ba326 | |||
| eb8f1fef79 | |||
| 5a0cf2cda0 | |||
| 58dd0d506e | |||
| 22a09b7d40 | |||
| 020705cca0 | |||
| e5eddec0b7 | |||
| 7269154b44 | |||
| 1e65c37e97 | |||
| b3eacbd5da | |||
| 56f0dc64ed | |||
| f4075b7127 | |||
| 1b696dcde0 | |||
| 0deddeed2f | |||
| 8c75f05721 | |||
| fc33a35857 | |||
| 5725c1850f | |||
| c7d4465070 | |||
| b4eed40953 | |||
| 08a491e16d | |||
| 53a26c87d6 | |||
| a377868a50 | |||
| 7e343b7304 | |||
| 4d2984c136 | |||
| 6719aa5ec5 | |||
| d9dcb97bbe | |||
| 51bced46a7 | |||
| a893680091 | |||
| 67a75acaff | |||
| 6060234de5 | |||
| 892173b3f3 | |||
| bc7a77f14d | |||
| a2fb18da50 | |||
| cdd7fe6a48 | |||
| fe7bf6425a | |||
| 495a02bb5a | |||
| a27c1faa9f | |||
| 6b4ae63ac8 | |||
| 0e088aec08 | |||
| 378240d57d | |||
| d339d41274 | |||
| 4b6c90cb17 | |||
| 543397a50d | |||
| 0047b06264 | |||
| 134462ae28 | |||
| 52a027398e | |||
| 02b5deb65a | |||
| e71ac727e3 | |||
| 8c5dd5e5eb | |||
| 704ecfea00 | |||
| 8aaad0d2b6 | |||
| 0078652172 | |||
| 8d5b7ed598 | |||
| b4de89cc95 | |||
| d9aa7cbb6f | |||
| 750f660990 | |||
| 7e3c5c34d6 | |||
| 9a093f57a1 | |||
| 69d44a56fe | |||
| 41391dfd9d | |||
| 61d35d7b9d | |||
| 963e29f6b2 | |||
| 8772689453 | |||
| 4cbc5af3a6 | |||
| 5cf42ac843 | |||
| bc936e8ac8 | |||
| 5bb7f7e0dc | |||
| 135634fbd3 | |||
| 6f70004a0d | |||
| d99f765ee6 | |||
| 87f4750d75 | |||
| a3fa0ca96f | |||
| 895e16ff28 | |||
| 93073173ce | |||
| 5c283bb713 | |||
| e86b3c7335 | |||
| 52d8541b5b | |||
| 99a57908f5 | |||
| ebe415f889 | |||
| f0d61c012d | |||
| d829440fed | |||
| e57bc1637c | |||
| 708e0804b8 | |||
| 3a8e16ecab | |||
| 9fe6a6f42b | |||
| 7f5a384c99 | |||
| 836399115b | |||
| adb28ab708 | |||
| c783a874f0 | |||
| 883ea035af | |||
| c56a930df8 | |||
| 28abbabae5 | |||
| 2010db2cd4 | |||
| bf6527407d | |||
| 2424069da2 | |||
| 8d1293da86 | |||
| 396b5cc75b | |||
| 49a9cc9bd1 | |||
| 5bf8b2e969 | |||
| 9ce83d0908 | |||
| 0f399f7f74 | |||
| 5726fe6263 | |||
| e3e938b861 | |||
| 3dd7b4f805 | |||
| cf3f46344e | |||
| 0cb1903bfd | |||
| 8571b889f3 | |||
| ec9f2a7d3f | |||
| 97e9098927 | |||
| 44b74479cb | |||
| 6a4e20e239 | |||
| adf125a30b | |||
| 3db84ae082 | |||
| 025000a221 | |||
| a90069245d | |||
| ddc72f06ef | |||
| 55f4cb7299 | |||
| 9d904936c8 | |||
| 560672aaa1 | |||
| 5aee2507d4 | |||
| 1f5b61e1db | |||
| c15270df73 | |||
| 5e10746ae7 | |||
| 84510e3b82 | |||
| a9df6656b8 | |||
| b33cc5d748 | |||
| 74b0aca7eb | |||
| e9ca5e144c | |||
| be6128fcd5 | |||
| 424c3248c7 | |||
| 81de3795fa | |||
| f29b93ad61 | |||
| e71a5333a3 | |||
| 910dc3393c | |||
| 5ac473e356 | |||
| 93b6f3c79e | |||
| 10beedc18f | |||
| 83797afa91 | |||
| d3220e229e | |||
| f2b1768da6 | |||
| e200f7a382 | |||
| 2d92ee0ad5 | |||
| a6cf46f473 | |||
| 1c5052e29f | |||
| 5c7d7dec73 | |||
| 61dde025a1 | |||
| b10fec1750 | |||
| a4c14b94ca | |||
| 072ce9a5e7 | |||
| 2347fe5450 | |||
| 43d6e05c24 | |||
| b3e24b7f60 | |||
| 2a8d78c00f | |||
| 69be43879e | |||
| 5d2169e053 | |||
| 996c1d5b15 | |||
| 206b1f6d6d | |||
| 997731210c | |||
| 83e305fa8c | |||
| 50809576b5 | |||
| 2d2faf8087 | |||
| 5f41d7ce6b | |||
| adcddcf776 | |||
| 15d16015b7 | |||
| 6acf61d35e | |||
| 8d7c3b0d50 | |||
| 4902bfaf3e | |||
| 9c5c2dbf5a | |||
| dd7e948dba | |||
| ae20e634d7 | |||
| c25dbc446a | |||
| 12c847fed9 | |||
| 04b53e0e0c | |||
| 6a8e8ac25e | |||
| f01cac675a | |||
| 6d69cf1045 | |||
| 3aa576a8ef | |||
| cc8ba5f12a | |||
| 303ea5f34e | |||
| 63e764faba | |||
| e74f735a99 | |||
| ae5884f8e6 | |||
| 2490febd82 | |||
| df1914d111 | |||
| 6e39ee0c82 | |||
| 13e8736049 | |||
| d868e5331c | |||
| 829897be3e | |||
| 20b9e53010 | |||
| 5470f3859f | |||
| 9cd60b20d0 | |||
| bd8dbfdbc3 | |||
| 21bb4f142c | |||
| 7809633d79 | |||
| 7f574aadff | |||
| 9c099d21eb | |||
| 8ee06a7b17 | |||
| 22c5c2f04c | |||
| 83818b0452 | |||
| e81efe7691 | |||
| a256d06cfd | |||
| ef483684d3 | |||
| 147c966a46 | |||
| a3a8490d3a | |||
| e9623e55e3 | |||
| ae1baf9042 | |||
| be7a37d442 | |||
| e646b89f8b | |||
| a0f5d96f1e | |||
| 45c0583312 | |||
| 05a423d850 | |||
| 12869bfdb1 | |||
| 909f01f17e | |||
| d8a4219d47 | |||
| c56dbe9c28 | |||
| d0e04db7fb | |||
| 2e96609a93 | |||
| 207f2c8880 | |||
| 2f7a48c0a9 | |||
| ad2d2f19a3 | |||
| 834f172c77 | |||
| 8703e6530c | |||
| 40d3bc442f | |||
| 3c790ba117 | |||
| f10d0d2745 | |||
| 668505a9e4 | |||
| b1915ed987 | |||
| bccff20039 | |||
| 736ce96319 | |||
| 4a6fb4a2ca | |||
| d06e9d3bef | |||
| 06805cb54f | |||
| fff8b97ebc | |||
| 26023575ba | |||
| 1a815ef7d4 | |||
| 9fc09121a8 | |||
| 26f9407892 | |||
| 4701b68a51 | |||
| a80eba9500 | |||
| 1ac6fd0322 | |||
| 1562e8d3eb | |||
| 139a8556e8 | |||
| 856be66774 | |||
| 3675c98506 | |||
| 43ed2ccbf2 | |||
| 5fbc32ebdb | |||
| 9f00dabf86 | |||
| 51d311f703 | |||
| 3ef86b3909 | |||
| 6085ca703d | |||
| bdb2677b79 | |||
| 8a630a771c | |||
| 409e4794d7 | |||
| 30ce0cd396 | |||
| e5a0c16bd3 | |||
| 6afd79df8d | |||
| 9f2e956580 | |||
| 4bc1b2151e | |||
| 79f0a612c4 | |||
| 66a437aca8 | |||
| 3b70fdaaf3 | |||
| 08f6d5de07 | |||
| 39d505664e | |||
| 286348d97f | |||
| e5bb9741b6 | |||
| c7f545bbb0 | |||
| b2a803d5d1 | |||
| 8eb717f993 | |||
| f37e3f357d | |||
| b1b09903b0 | |||
| 2470b6ea89 | |||
| cc2aca7c23 | |||
| d66fe9c1aa | |||
| 6203fc19f2 | |||
| 64c03072a9 | |||
| 780dc00ce5 | |||
| 75ceca0bf5 | |||
| db13e21956 | |||
| 42515a2e58 | |||
| ced275af37 | |||
| 6eb703ad69 | |||
| c4bc562172 | |||
| 45d1c530d2 | |||
| e6caeefe0c | |||
| b8351f4c24 | |||
| fb64bae5e2 | |||
| 9f8ef4294a | |||
| 503c8dddcc | |||
| 40daab14a4 | |||
| 01426638cb | |||
| f5940bfb5f | |||
| ae3dd7efdb | |||
| 35c2c697ce | |||
| 4ec1b7b094 | |||
| a2afdf4691 | |||
| 738e1d3556 | |||
| c673cdfee7 | |||
| b4d2e7f267 | |||
| 4bc526cc8a | |||
| 7ed7cabf5f | |||
| d33dffe53a | |||
| 19b1ff816f | |||
| 40f2d64856 | |||
| d6c8107249 | |||
| fcf15debfc | |||
| eadcc99eea | |||
| 102fe39706 | |||
| 3e6e38b2e3 | |||
| d04814641b | |||
| b4d09c2db0 | |||
| 2fc28aa794 | |||
| c5f2967a64 | |||
| 9a7713304c | |||
| 85c39e437b | |||
| e37014fafb | |||
| 77492a3e62 | |||
| b01548ecba | |||
| dd75bf89ff | |||
| 307d961277 | |||
| bc7ac30669 | |||
| 56dc43f3d2 | |||
| fa4e8ee5c9 | |||
| efdb216ca9 | |||
| 62f68371df | |||
| 3690a9db9f | |||
| 952292945c | |||
| ac184c9db2 | |||
| 8e60097af8 | |||
| 786f04f485 | |||
| 310cf52b37 | |||
| 3893b5fa32 | |||
| f5a134213d | |||
| 7ac9576825 | |||
| b5036ee20c | |||
| 1abaa0c22e | |||
| 9a734d1862 | |||
| a108795999 | |||
| 7ef639c709 | |||
| cb891e57f0 | |||
| b470112643 | |||
| 4e14b95f0e | |||
| 4d32c0c6d0 | |||
| 0e44ba37cf | |||
| 5259c6b402 | |||
| ed52eb4c88 | |||
| 77325154af | |||
| b136969308 | |||
| 47d9d4cd00 | |||
| 61ae30255c | |||
| e2a2209ed6 | |||
| 1cf504414d | |||
| 2d6dfcde3e | |||
| 1cb0536bcb | |||
| 217c5d8208 | |||
| d8be1d9ac5 | |||
| 88c5d93aa1 | |||
| cbb87c9568 | |||
| 7d2f938cf0 | |||
| eb1931ccd1 | |||
| 5f717f7aac | |||
| 64c5119637 | |||
| dad1bc64c5 | |||
| 812fa23e82 | |||
| fe0d1d488b | |||
| d76bc30606 | |||
| 39177fd3a7 | |||
| 0c94afe7af | |||
| b14196043d | |||
| 2f6a01e094 | |||
| c68fa5fcbb | |||
| 4f7ec48046 | |||
| fe0f1f5c19 | |||
| f098ca6d97 | |||
| 8aac99eb3d | |||
| 1affdad829 | |||
| f497fd1de8 | |||
| 0a44a45fea | |||
| fdc93e4092 | |||
| add7675e51 | |||
| 20f8cd8551 | |||
| 7ac884d457 | |||
| 4bbbd50202 | |||
| e6175024e6 | |||
| c21a04f63e | |||
| ad3bbeb5c0 | |||
| 18d2aac902 | |||
| 5546df9078 | |||
| d0e29366de | |||
| 78da7d9529 | |||
| ea04def291 | |||
| 6ba3f5d72a | |||
| 2153633aac | |||
| d6ece9f7f0 | |||
| a69c78724e | |||
| 7968f77edb | |||
| 6d7583c9b2 | |||
| 6dae822543 | |||
| 451044df4e | |||
| 9daaa37aac | |||
| 1880d3684c | |||
| dcef51b614 | |||
| 66d40a5dae | |||
| 9e56dabab6 | |||
| 168e14feee | |||
| 137778af00 | |||
| d4d848343b | |||
| 7f3fca8ff1 | |||
| a01d727a31 | |||
| d149d894a0 | |||
| 4c1ac80799 | |||
| 1e9c117f50 | |||
| 55b02e02e6 | |||
| cead41882b | |||
| 44e5ac93bc | |||
| b451ddf416 | |||
| 46d1d519f8 | |||
| c18fe9ec19 | |||
| f5af9b62e8 | |||
| ace15cee6d | |||
| addedcb142 | |||
| e55207d9d7 | |||
| 4743fdf290 | |||
| 5ffad8a406 | |||
| 00b965f609 | |||
| 5f9aa41321 | |||
| 5c1adaddba | |||
| 390896d3d9 | |||
| eab8b262be | |||
| 5464179b31 | |||
| 99a4c833b6 | |||
| da920040ad | |||
| fdbd1d7a9d | |||
| bb68dfc002 | |||
| 72cf8c6ca3 | |||
| a1554ea241 | |||
| 749db57b4c | |||
| 3b62f94787 | |||
| 13d5afea34 | |||
| 025bd122a6 | |||
| 7ce782e654 | |||
| c3208c17d1 | |||
| 0f4ea5911c | |||
| b955d07c33 | |||
| 60ee7cebc7 | |||
| 6508a3c68e | |||
| 9e2bc0490f | |||
| a2aceccdbe | |||
| d3ec6a9dcf | |||
| 80140c4592 | |||
| 7a2b15647e | |||
| bf5a6920bc | |||
| 295b622b0b | |||
| aa5b71c005 | |||
| 5ad8fa096d | |||
| ab077b368c | |||
| 5e946b2ceb | |||
| ca3b210680 | |||
| 2834f79e73 | |||
| bf752eb38b | |||
| 5018c28e43 | |||
| 2f874214ba | |||
| 981e960d34 | |||
| 7843fb7e14 | |||
| dbc251e25c | |||
| bdfb46a2d0 | |||
| 9da8b39169 | |||
| b642702aa2 | |||
| 740d260ce7 | |||
| ffe199b1fa | |||
| d583059471 | |||
| 5af5a205a3 | |||
| 6c816ca22c | |||
| f6240d9eea | |||
| 49d367d47e | |||
| f068ae74db | |||
| dd7b9d1dce | |||
| c7232a325a | |||
| be335eb8db | |||
| ff8cadd271 | |||
| a34073eeb8 | |||
| 223f133f88 | |||
| a47b6805be | |||
| 99b936835d | |||
| 8bd0487a4b | |||
| 600ad57d35 | |||
| 7628ac73f4 | |||
| 64b4fbebd8 | |||
| 52454bedee | |||
| 8f74fa4366 | |||
| 02e45bf269 | |||
| 28fccc09ce | |||
| 7ed24ca351 | |||
| e98f145ccc | |||
| 904f5815c7 | |||
| d29a7827c4 | |||
| 5cd5271673 | |||
| 005e784e22 | |||
| c20f615105 | |||
| 685badbb2b | |||
| eef55a6333 | |||
| fa28975f25 |
@@ -33,5 +33,3 @@ composer.lock
|
||||
/behat.yml
|
||||
*/yui/build/*/*-coverage.js
|
||||
/lib/yuilib/*/build/*/*-coverage.js
|
||||
# lib/yuilib/version/module/module-coverage.js
|
||||
/lib/yuilib/*/*/*-coverage.js
|
||||
|
||||
@@ -142,14 +142,14 @@ function print_auth_lock_options($auth, $user_fields, $helptext, $retrieveopts,
|
||||
$fieldname = $field;
|
||||
if ($fieldname === 'lang') {
|
||||
$fieldname = get_string('language');
|
||||
} elseif (!empty($customfields) && in_array($field, $customfields)) {
|
||||
// If custom field then pick name from database.
|
||||
$fieldshortname = str_replace('profile_field_', '', $fieldname);
|
||||
$fieldname = $customfieldname[$fieldshortname]->name;
|
||||
} elseif (preg_match('/^(.+?)(\d+)$/', $fieldname, $matches)) {
|
||||
$fieldname = get_string($matches[1]) . ' ' . $matches[2];
|
||||
} elseif ($fieldname == 'url') {
|
||||
$fieldname = get_string('webpage');
|
||||
} elseif (!empty($customfields) && in_array($field, $customfields)) {
|
||||
// If custom field then pick name from database.
|
||||
$fieldshortname = str_replace('profile_field_', '', $fieldname);
|
||||
$fieldname = $customfieldname[$fieldshortname]->name;
|
||||
} else {
|
||||
$fieldname = get_string($fieldname);
|
||||
}
|
||||
|
||||
+20
-19
@@ -17,7 +17,7 @@
|
||||
/**
|
||||
* This file is used to display a categories sub categories, external pages, and settings.
|
||||
*
|
||||
* @since Moodle 2.3
|
||||
* @since 2.3
|
||||
* @package admin
|
||||
* @copyright 2011 Sam Hemelryk
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
@@ -97,26 +97,27 @@ foreach ($settingspage->children as $childpage) {
|
||||
$outputhtml .= $OUTPUT->heading(html_writer::link($childpage->url, $childpage->visiblename), 3);
|
||||
} else if ($childpage instanceof admin_settingpage) {
|
||||
$outputhtml .= $OUTPUT->heading(html_writer::link(new moodle_url('/'.$CFG->admin.'/settings.php', array('section' => $childpage->name)), $childpage->visiblename), 3);
|
||||
// If its a settings page and has settings lets display them.
|
||||
if (!empty($childpage->settings)) {
|
||||
$outputhtml .= html_writer::start_tag('fieldset', array('class' => 'adminsettings'));
|
||||
foreach ($childpage->settings as $setting) {
|
||||
if (empty($setting->nosave)) {
|
||||
$savebutton = true;
|
||||
}
|
||||
$fullname = $setting->get_full_name();
|
||||
if (array_key_exists($fullname, $adminroot->errors)) {
|
||||
$data = $adminroot->errors[$fullname]->data;
|
||||
} else {
|
||||
$data = $setting->get_setting();
|
||||
}
|
||||
$outputhtml .= html_writer::tag('div', '<!-- -->', array('class' => 'clearer'));
|
||||
$outputhtml .= $setting->output_html($data);
|
||||
}
|
||||
$outputhtml .= html_writer::end_tag('fieldset');
|
||||
}
|
||||
} else if ($childpage instanceof admin_category) {
|
||||
$outputhtml .= $OUTPUT->heading(html_writer::link(new moodle_url('/'.$CFG->admin.'/category.php', array('category' => $childpage->name)), get_string('admincategory', 'admin', $childpage->visiblename)), 3);
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
if (!empty($childpage->settings)) {
|
||||
$outputhtml .= html_writer::start_tag('fieldset', array('class' => 'adminsettings'));
|
||||
foreach ($childpage->settings as $setting) {
|
||||
if (empty($setting->nosave)) {
|
||||
$savebutton = true;
|
||||
}
|
||||
$fullname = $setting->get_full_name();
|
||||
if (array_key_exists($fullname, $adminroot->errors)) {
|
||||
$data = $adminroot->errors[$fullname]->data;
|
||||
} else {
|
||||
$data = $setting->get_setting();
|
||||
}
|
||||
$outputhtml .= html_writer::tag('div', '<!-- -->', array('class' => 'clearer'));
|
||||
$outputhtml .= $setting->output_html($data);
|
||||
}
|
||||
$outputhtml .= html_writer::end_tag('fieldset');
|
||||
}
|
||||
}
|
||||
if ($savebutton) {
|
||||
|
||||
@@ -1,119 +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 allows to do backup.
|
||||
*
|
||||
* @package core
|
||||
* @subpackage cli
|
||||
* @copyright 2013 Lancaster University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
define('CLI_SCRIPT', 1);
|
||||
|
||||
require(dirname(dirname(dirname(__FILE__))).'/config.php');
|
||||
require_once($CFG->libdir.'/clilib.php');
|
||||
require_once($CFG->dirroot . '/backup/util/includes/backup_includes.php');
|
||||
|
||||
// Now get cli options.
|
||||
list($options, $unrecognized) = cli_get_params(array(
|
||||
'courseid' => false,
|
||||
'courseshortname' => '',
|
||||
'destination' => '',
|
||||
'help' => false,
|
||||
), array('h' => 'help'));
|
||||
|
||||
if ($unrecognized) {
|
||||
$unrecognized = implode("\n ", $unrecognized);
|
||||
cli_error(get_string('cliunknowoption', 'admin', $unrecognized));
|
||||
}
|
||||
|
||||
if ($options['help'] || !($options['courseid'] || $options['courseshortname'])) {
|
||||
$help = <<<EOL
|
||||
Perform backup of the given course.
|
||||
|
||||
Options:
|
||||
--courseid=INTEGER Course ID for backup.
|
||||
--courseshortname=STRING Course shortname for backup.
|
||||
--destination=STRING Path where to store backup file. If not set the backup
|
||||
will be stored within the course backup file area.
|
||||
-h, --help Print out this help.
|
||||
|
||||
Example:
|
||||
\$sudo -u www-data /usr/bin/php admin/cli/backup.php --courseid=2 --destination=/moodle/backup/\n
|
||||
EOL;
|
||||
|
||||
echo $help;
|
||||
die;
|
||||
}
|
||||
|
||||
$admin = get_admin();
|
||||
if (!$admin) {
|
||||
mtrace("Error: No admin account was found");
|
||||
die;
|
||||
}
|
||||
|
||||
// Do we need to store backup somewhere else?
|
||||
$dir = rtrim($options['destination'], '/');
|
||||
if (!empty($dir)) {
|
||||
if (!file_exists($dir) || !is_dir($dir) || !is_writable($dir)) {
|
||||
mtrace("Destination directory does not exists or not writable.");
|
||||
die;
|
||||
}
|
||||
}
|
||||
|
||||
// Check that the course exists.
|
||||
if ($options['courseid']) {
|
||||
$course = $DB->get_record('course', array('id' => $options['courseid']), '*', MUST_EXIST);
|
||||
} else if ($options['courseshortname']) {
|
||||
$course = $DB->get_record('course', array('shortname' => $options['courseshortname']), '*', MUST_EXIST);
|
||||
}
|
||||
|
||||
cli_heading('Performing backup...');
|
||||
$bc = new backup_controller(backup::TYPE_1COURSE, $course->id, backup::FORMAT_MOODLE,
|
||||
backup::INTERACTIVE_YES, backup::MODE_GENERAL, $admin->id);
|
||||
// Set the default filename.
|
||||
$format = $bc->get_format();
|
||||
$type = $bc->get_type();
|
||||
$id = $bc->get_id();
|
||||
$users = $bc->get_plan()->get_setting('users')->get_value();
|
||||
$anonymised = $bc->get_plan()->get_setting('anonymize')->get_value();
|
||||
$filename = backup_plan_dbops::get_default_backup_filename($format, $type, $id, $users, $anonymised);
|
||||
$bc->get_plan()->get_setting('filename')->set_value($filename);
|
||||
|
||||
// Execution.
|
||||
$bc->finish_ui();
|
||||
$bc->execute_plan();
|
||||
$results = $bc->get_results();
|
||||
$file = $results['backup_destination']; // May be empty if file already moved to target location.
|
||||
|
||||
// Do we need to store backup somewhere else?
|
||||
if (!empty($dir)) {
|
||||
if ($file) {
|
||||
mtrace("Writing " . $dir.'/'.$filename);
|
||||
if ($file->copy_content_to($dir.'/'.$filename)) {
|
||||
$file->delete();
|
||||
mtrace("Backup completed.");
|
||||
} else {
|
||||
mtrace("Destination directory does not exist or is not writable. Leaving the backup in the course backup file area.");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
mtrace("Backup completed, the new file is listed in the backup area of the given course");
|
||||
}
|
||||
$bc->destroy();
|
||||
exit(0);
|
||||
+11
-3
@@ -142,10 +142,10 @@ define('PHPUNIT_TEST', false);
|
||||
define('IGNORE_COMPONENT_CACHE', true);
|
||||
|
||||
// Check that PHP is of a sufficient version
|
||||
if (version_compare(phpversion(), "5.4.4") < 0) {
|
||||
if (version_compare(phpversion(), "5.3.3") < 0) {
|
||||
$phpversion = phpversion();
|
||||
// do NOT localise - lang strings would not work here and we CAN NOT move it after installib
|
||||
fwrite(STDERR, "Moodle 2.7 or later requires at least PHP 5.4.4 (currently using version $phpversion).\n");
|
||||
fwrite(STDERR, "Moodle 2.5 or later requires at least PHP 5.3.3 (currently using version $phpversion).\n");
|
||||
fwrite(STDERR, "Please upgrade your server software or install older Moodle version.\n");
|
||||
exit(1);
|
||||
}
|
||||
@@ -201,9 +201,17 @@ if (defined('COMPONENT_CLASSLOADER')) {
|
||||
require($CFG->dirroot.'/version.php');
|
||||
$CFG->target_release = $release;
|
||||
|
||||
\core\session\manager::init_empty_session();
|
||||
$_SESSION = array();
|
||||
$_SESSION['SESSION'] = new stdClass();
|
||||
$_SESSION['SESSION']->lang = $CFG->lang;
|
||||
$_SESSION['USER'] = new stdClass();
|
||||
$_SESSION['USER']->id = 0;
|
||||
$_SESSION['USER']->mnethostid = 1;
|
||||
|
||||
global $SESSION;
|
||||
global $USER;
|
||||
$SESSION = &$_SESSION['SESSION'];
|
||||
$USER = &$_SESSION['USER'];
|
||||
|
||||
global $COURSE;
|
||||
$COURSE = new stdClass();
|
||||
|
||||
@@ -62,10 +62,10 @@ Example:
|
||||
";
|
||||
|
||||
// Check that PHP is of a sufficient version
|
||||
if (version_compare(phpversion(), "5.4.4") < 0) {
|
||||
if (version_compare(phpversion(), "5.3.3") < 0) {
|
||||
$phpversion = phpversion();
|
||||
// do NOT localise - lang strings would not work here and we CAN NOT move it after installib
|
||||
fwrite(STDERR, "Moodle 2.7 or later requires at least PHP 5.4.4 (currently using version $phpversion).\n");
|
||||
fwrite(STDERR, "Moodle 2.5 or later requires at least PHP 5.3.3 (currently using version $phpversion).\n");
|
||||
fwrite(STDERR, "Please upgrade your server software or install older Moodle version.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
+1
-1
@@ -108,7 +108,7 @@ switch ($action) {
|
||||
echo $OUTPUT->header();
|
||||
|
||||
// This may take a long time.
|
||||
core_php_time_limit::raise();
|
||||
set_time_limit(0);
|
||||
|
||||
// Disable plugin to prevent concurrent cron execution.
|
||||
unset($enabled[$enrol]);
|
||||
|
||||
@@ -102,7 +102,7 @@ if ($contents = load_environment_xml()) {
|
||||
}
|
||||
|
||||
// Get the results of the environment check.
|
||||
list($envstatus, $environment_results) = check_moodle_environment($version, ENV_SELECT_NEWER);
|
||||
list($envstatus, $environment_results) = check_moodle_environment($version);
|
||||
|
||||
// Display the page.
|
||||
$output = $PAGE->get_renderer('core', 'admin');
|
||||
|
||||
@@ -0,0 +1,151 @@
|
||||
<?php
|
||||
/** This expects the output from a command like
|
||||
* clamscan -r --infected --no-summary <files> 2>&1 | php -d error_log=/path/to/log thisfile.php
|
||||
* also it's important that the output of clamscan prints the FULL PATH to each infected file, so use absolute paths for area to scan
|
||||
* also it should be run as root, or whatever the webserver runs as so that it has the right permissions in the quarantine dir etc.
|
||||
* php -d error_log=/path/to/log thisfile.php will override the default error log for php cli, which is stderr, so if you want this script to just print stuff out, use php thisfile.php instead.
|
||||
*/
|
||||
|
||||
die('TODO: MDL-19380');
|
||||
|
||||
$fd = fopen('php://stdin','r');
|
||||
if (!$fd) {
|
||||
exit();
|
||||
}
|
||||
|
||||
require_once(dirname(dirname(__FILE__)).'/config.php');
|
||||
require_once($CFG->libdir.'/eventslib.php');
|
||||
require_once($CFG->dirroot.'/lib/uploadlib.php'); // contains virus handling stuff.
|
||||
|
||||
$site = get_site();
|
||||
|
||||
while(!feof($fd)) {
|
||||
$entry = fgets($fd);
|
||||
if (strlen(trim($entry)) == 0) {
|
||||
continue;
|
||||
}
|
||||
if (!$file = validate_line($entry)) {
|
||||
continue;
|
||||
}
|
||||
$bits = explode('/',$file);
|
||||
$a->filename = $bits[count($bits)-1];
|
||||
|
||||
if (!$log = $DB->get_record("log", array("module"=>"upload", "info"=>$file, "action"=>"upload"))) {
|
||||
$a->action = clam_handle_infected_file($file,0,false);
|
||||
clam_replace_infected_file($file);
|
||||
notify_admins_unknown($file,$a);
|
||||
continue;
|
||||
}
|
||||
$action = clam_handle_infected_file($file,$log->userid,true);
|
||||
clam_replace_infected_file($file);
|
||||
|
||||
$ctxselect = ', ' . context_helper::get_preload_record_columns_sql('ctx');
|
||||
$ctxjoin = "LEFT JOIN {context} ctx ON (ctx.instanceid = c.id AND ctx.contextlevel = :contextlevel)";
|
||||
$sql = "SELECT c.id, c.fullname $ctxselect FROM {course} c $ctxjoin WHERE c.id = :courseid";
|
||||
$course = $DB->get_record_sql($sql, array('courseid' => $log->course, 'contextlevel' => CONTEXT_COURSE));
|
||||
context_helper::preload_from_record($course);
|
||||
|
||||
$user = $DB->get_record("user", array("id"=>$log->userid));
|
||||
$subject = get_string('virusfoundsubject','moodle',format_string($site->fullname));
|
||||
$a->date = userdate($log->time);
|
||||
|
||||
$a->action = $action;
|
||||
$a->course = format_string($course->fullname, true, array('context' => context_course::instance($course->id)));
|
||||
$a->user = fullname($user);
|
||||
|
||||
notify_user($user,$subject,$a);
|
||||
notify_admins($user,$subject,$a);
|
||||
}
|
||||
fclose($fd);
|
||||
|
||||
|
||||
function notify_user($user,$subject,$a) {
|
||||
|
||||
if (!$user) {
|
||||
return false;
|
||||
}
|
||||
$body = get_string('virusfoundlater','moodle',$a);
|
||||
|
||||
$eventdata = new stdClass();
|
||||
$eventdata->modulename = 'moodle';
|
||||
$eventdata->userfrom = get_admin();
|
||||
$eventdata->userto = $user;
|
||||
$eventdata->subject = $subject;
|
||||
$eventdata->fullmessage = $body;
|
||||
$eventdata->fullmessageformat = FORMAT_PLAIN;
|
||||
$eventdata->fullmessagehtml = '';
|
||||
$eventdata->smallmessage = '';
|
||||
message_send($eventdata);
|
||||
}
|
||||
|
||||
|
||||
function notify_admins($user,$subject,$a) {
|
||||
|
||||
$admins = get_admins();
|
||||
|
||||
$body = get_string('virusfoundlateradmin','moodle',$a);
|
||||
foreach ($admins as $admin) {
|
||||
$eventdata = new stdClass();
|
||||
$eventdata->modulename = 'moodle';
|
||||
$eventdata->userfrom = get_admin();
|
||||
$eventdata->userto = $admin;
|
||||
$eventdata->subject = $subject;
|
||||
$eventdata->fullmessage = $body;
|
||||
$eventdata->fullmessageformat = FORMAT_PLAIN;
|
||||
$eventdata->fullmessagehtml = '';
|
||||
$eventdata->smallmessage = '';
|
||||
message_send($eventdata);
|
||||
}
|
||||
}
|
||||
|
||||
function notify_admins_unknown($file,$a) {
|
||||
|
||||
global $site;
|
||||
|
||||
$admins = get_admins();
|
||||
$subject = get_string('virusfoundsubject','moodle',format_string($site->fullname));
|
||||
$body = get_string('virusfoundlateradminnolog','moodle',$a);
|
||||
foreach ($admins as $admin) {
|
||||
$eventdata = new stdClass();
|
||||
$eventdata->modulename = 'moodle';
|
||||
$eventdata->userfrom = get_admin();
|
||||
$eventdata->userto = $admin;
|
||||
$eventdata->subject = $subject;
|
||||
$eventdata->fullmessage = $body;
|
||||
$eventdata->fullmessageformat = FORMAT_PLAIN;
|
||||
$eventdata->fullmessagehtml = '';
|
||||
$eventdata->smallmessage = '';
|
||||
message_send($eventdata);
|
||||
}
|
||||
}
|
||||
|
||||
function validate_line($line) {
|
||||
global $CFG;
|
||||
if (strpos($line,"FOUND") === false) {
|
||||
return false;
|
||||
}
|
||||
$index = strpos($line,":");
|
||||
$file = substr($line,0,$index);
|
||||
if (!(strpos($file,$CFG->dataroot) === false)) {
|
||||
if (!file_exists($file)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ($file{0} == "/") {
|
||||
$file = $CFG->dataroot.$file;
|
||||
}
|
||||
else {
|
||||
$file = $CFG->dataroot."/".$file;
|
||||
}
|
||||
if (!file_exists($file)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// clean up
|
||||
$file = preg_replace('/\.\//','/',$file);
|
||||
$file = preg_replace('/\/\//','/',$file);
|
||||
return $file;
|
||||
}
|
||||
|
||||
|
||||
+21
-28
@@ -30,10 +30,10 @@ if (!file_exists('../config.php')) {
|
||||
}
|
||||
|
||||
// Check that PHP is of a sufficient version as soon as possible
|
||||
if (version_compare(phpversion(), '5.4.4') < 0) {
|
||||
if (version_compare(phpversion(), '5.3.3') < 0) {
|
||||
$phpversion = phpversion();
|
||||
// do NOT localise - lang strings would not work here and we CAN NOT move it to later place
|
||||
echo "Moodle 2.7 or later requires at least PHP 5.4.4 (currently using version $phpversion).<br />";
|
||||
echo "Moodle 2.5 or later requires at least PHP 5.3.3 (currently using version $phpversion).<br />";
|
||||
echo "Please upgrade your server software or install older Moodle version.";
|
||||
die();
|
||||
}
|
||||
@@ -45,13 +45,6 @@ if (!function_exists('iconv')) {
|
||||
die();
|
||||
}
|
||||
|
||||
// Make sure php5-json is available.
|
||||
if (!function_exists('json_encode') || !function_exists('json_decode')) {
|
||||
// This also shouldn't happen.
|
||||
echo 'Moodle requires the json PHP extension. Please install or enable the json extension.';
|
||||
die();
|
||||
}
|
||||
|
||||
define('NO_OUTPUT_BUFFERING', true);
|
||||
|
||||
if ((isset($_GET['cache']) and $_GET['cache'] === '0')
|
||||
@@ -126,6 +119,10 @@ if (ini_get_bool('session.auto_start')) {
|
||||
print_error('phpvaroff', 'debug', '', (object)array('name'=>'session.auto_start', 'link'=>$documentationlink));
|
||||
}
|
||||
|
||||
if (ini_get_bool('magic_quotes_runtime')) {
|
||||
print_error('phpvaroff', 'debug', '', (object)array('name'=>'magic_quotes_runtime', 'link'=>$documentationlink));
|
||||
}
|
||||
|
||||
if (!ini_get_bool('file_uploads')) {
|
||||
print_error('phpvaron', 'debug', '', (object)array('name'=>'file_uploads', 'link'=>$documentationlink));
|
||||
}
|
||||
@@ -237,13 +234,6 @@ if (!core_tables_exist()) {
|
||||
// Check version of Moodle code on disk compared with database
|
||||
// and upgrade if possible.
|
||||
|
||||
if (!$cache) {
|
||||
// Do not try to do anything fancy in non-cached mode,
|
||||
// this prevents themes from fetching data from non-existent tables.
|
||||
$PAGE->set_pagelayout('maintenance');
|
||||
$PAGE->set_popup_notification_allowed(false);
|
||||
}
|
||||
|
||||
$stradministration = get_string('administration');
|
||||
$PAGE->set_context(context_system::instance());
|
||||
|
||||
@@ -274,6 +264,9 @@ if (!$cache and $version > $CFG->version) { // upgrade
|
||||
// We then purge the regular caches.
|
||||
purge_all_caches();
|
||||
|
||||
$PAGE->set_pagelayout('maintenance');
|
||||
$PAGE->set_popup_notification_allowed(false);
|
||||
|
||||
/** @var core_admin_renderer $output */
|
||||
$output = $PAGE->get_renderer('core', 'admin');
|
||||
|
||||
@@ -351,6 +344,8 @@ if (!$cache and $version > $CFG->version) { // upgrade
|
||||
// Always verify plugin dependencies!
|
||||
$failed = array();
|
||||
if (!core_plugin_manager::instance()->all_plugins_ok($version, $failed)) {
|
||||
$PAGE->set_pagelayout('maintenance');
|
||||
$PAGE->set_popup_notification_allowed(false);
|
||||
$reloadurl = new moodle_url('/admin/index.php', array('confirmupgrade' => 1, 'confirmrelease' => 1, 'cache' => 0));
|
||||
echo $output->unsatisfied_dependencies_page($version, $failed, $reloadurl);
|
||||
die();
|
||||
@@ -378,9 +373,14 @@ if (!$cache and moodle_needs_upgrading()) {
|
||||
if (!$PAGE->headerprinted) {
|
||||
// means core upgrade or installation was not already done
|
||||
|
||||
/** @var core_admin_renderer $output */
|
||||
$output = $PAGE->get_renderer('core', 'admin');
|
||||
|
||||
if (!$confirmplugins) {
|
||||
$strplugincheck = get_string('plugincheck');
|
||||
|
||||
$PAGE->set_pagelayout('maintenance');
|
||||
$PAGE->set_popup_notification_allowed(false);
|
||||
$PAGE->navbar->add($strplugincheck);
|
||||
$PAGE->set_title($strplugincheck);
|
||||
$PAGE->set_heading($strplugincheck);
|
||||
@@ -395,9 +395,6 @@ if (!$cache and moodle_needs_upgrading()) {
|
||||
redirect($PAGE->url);
|
||||
}
|
||||
|
||||
/** @var core_admin_renderer $output */
|
||||
$output = $PAGE->get_renderer('core', 'admin');
|
||||
|
||||
$deployer = \core\update\deployer::instance();
|
||||
if ($deployer->enabled()) {
|
||||
$deployer->initialize($PAGE->url, $PAGE->url);
|
||||
@@ -421,8 +418,8 @@ if (!$cache and moodle_needs_upgrading()) {
|
||||
// Make sure plugin dependencies are always checked.
|
||||
$failed = array();
|
||||
if (!core_plugin_manager::instance()->all_plugins_ok($version, $failed)) {
|
||||
/** @var core_admin_renderer $output */
|
||||
$output = $PAGE->get_renderer('core', 'admin');
|
||||
$PAGE->set_pagelayout('maintenance');
|
||||
$PAGE->set_popup_notification_allowed(false);
|
||||
$reloadurl = new moodle_url('/admin/index.php', array('cache' => 0));
|
||||
echo $output->unsatisfied_dependencies_page($version, $failed, $reloadurl);
|
||||
die();
|
||||
@@ -589,14 +586,10 @@ $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));
|
||||
// Check if there are any cache warnings.
|
||||
$cachewarnings = cache_helper::warnings();
|
||||
|
||||
admin_externalpage_setup('adminnotifications');
|
||||
|
||||
/* @var core_admin_renderer $output */
|
||||
$output = $PAGE->get_renderer('core', 'admin');
|
||||
|
||||
echo $output->admin_notifications_page($maturity, $insecuredataroot, $errorsdisplayed, $cronoverdue, $dbproblems,
|
||||
$maintenancemode, $availableupdates, $availableupdatesfetch, $buggyiconvnomb,
|
||||
$registered, $cachewarnings);
|
||||
echo $output->admin_notifications_page($maturity, $insecuredataroot, $errorsdisplayed,
|
||||
$cronoverdue, $dbproblems, $maintenancemode, $availableupdates, $availableupdatesfetch, $buggyiconvnomb,
|
||||
$registered);
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@
|
||||
/**
|
||||
* This file contains functions used by the admin pages
|
||||
*
|
||||
* @since Moodle 2.1
|
||||
* @since 2.1
|
||||
* @package admin
|
||||
* @copyright 2011 Andrew Davis
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
|
||||
+25
-59
@@ -303,13 +303,12 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
* @param bool $buggyiconvnomb warn iconv problems
|
||||
* @param array|null $availableupdates array of \core\update\info objects or null
|
||||
* @param int|null $availableupdatesfetch timestamp of the most recent updates fetch or null (unknown)
|
||||
* @param string[] $cachewarnings An array containing warnings from the Cache API.
|
||||
*
|
||||
* @return string HTML to output.
|
||||
*/
|
||||
public function admin_notifications_page($maturity, $insecuredataroot, $errorsdisplayed,
|
||||
$cronoverdue, $dbproblems, $maintenancemode, $availableupdates, $availableupdatesfetch,
|
||||
$buggyiconvnomb, $registered, array $cachewarnings = array()) {
|
||||
$buggyiconvnomb, $registered) {
|
||||
global $CFG;
|
||||
$output = '';
|
||||
|
||||
@@ -322,7 +321,6 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
$output .= $this->cron_overdue_warning($cronoverdue);
|
||||
$output .= $this->db_problems($dbproblems);
|
||||
$output .= $this->maintenance_mode_warning($maintenancemode);
|
||||
$output .= $this->cache_warnings($cachewarnings);
|
||||
$output .= $this->registration_warning($registered);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -564,23 +562,11 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
* @return string HTML to output.
|
||||
*/
|
||||
public function cron_overdue_warning($cronoverdue) {
|
||||
global $CFG;
|
||||
if (!$cronoverdue) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if (empty($CFG->cronclionly)) {
|
||||
$url = new moodle_url('/admin/cron.php');
|
||||
if (!empty($CFG->cronremotepassword)) {
|
||||
$url = new moodle_url('/admin/cron.php', array('password' => $CFG->cronremotepassword));
|
||||
}
|
||||
|
||||
return $this->warning(get_string('cronwarning', 'admin', $url->out()) . ' ' .
|
||||
$this->help_icon('cron', 'admin'));
|
||||
}
|
||||
|
||||
// $CFG->cronclionly is not empty: cron can run only from CLI.
|
||||
return $this->warning(get_string('cronwarningcli', 'admin') . ' ' .
|
||||
return $this->warning(get_string('cronwarning', 'admin') . ' ' .
|
||||
$this->help_icon('cron', 'admin'));
|
||||
}
|
||||
|
||||
@@ -597,19 +583,6 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
return $this->warning($dbproblems);
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders cache warnings if there are any.
|
||||
*
|
||||
* @param string[] $cachewarnings
|
||||
* @return string
|
||||
*/
|
||||
public function cache_warnings(array $cachewarnings) {
|
||||
if (!count($cachewarnings)) {
|
||||
return '';
|
||||
}
|
||||
return join("\n", array_map(array($this, 'warning'), $cachewarnings));
|
||||
}
|
||||
|
||||
/**
|
||||
* Render an appropriate message if the site in in maintenance mode.
|
||||
* @param bool $maintenancemode
|
||||
@@ -637,10 +610,10 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
}
|
||||
|
||||
$maturitylevel = get_string('maturity' . $maturity, 'admin');
|
||||
return $this->warning(
|
||||
return $this->box(
|
||||
$this->container(get_string('maturitycorewarning', 'admin', $maturitylevel)) .
|
||||
$this->container($this->doc_link('admin/versions', get_string('morehelp'))),
|
||||
'error');
|
||||
'generalbox maturitywarning');
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -655,8 +628,10 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
return '';
|
||||
}
|
||||
|
||||
$warning = (get_string('testsiteupgradewarning', 'admin', $testsite));
|
||||
return $this->warning($warning, 'error');
|
||||
return $this->box(
|
||||
$this->container(get_string('testsiteupgradewarning', 'admin', $testsite)),
|
||||
'generalbox testsitewarning'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -688,16 +663,11 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
return ''; // No worries.
|
||||
}
|
||||
|
||||
$level = 'warning';
|
||||
|
||||
if ($maturity == MATURITY_ALPHA) {
|
||||
$level = 'error';
|
||||
}
|
||||
|
||||
$maturitylevel = get_string('maturity' . $maturity, 'admin');
|
||||
$warningtext = get_string('maturitycoreinfo', 'admin', $maturitylevel);
|
||||
$warningtext .= ' ' . $this->doc_link('admin/versions', get_string('morehelp'));
|
||||
return $this->warning($warningtext, $level);
|
||||
return $this->box(
|
||||
get_string('maturitycoreinfo', 'admin', $maturitylevel) . ' ' .
|
||||
$this->doc_link('admin/versions', get_string('morehelp')),
|
||||
'generalbox adminwarning maturityinfo maturity'.$maturity);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -712,7 +682,7 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
*/
|
||||
protected function available_updates($updates, $fetch) {
|
||||
|
||||
$updateinfo = '';
|
||||
$updateinfo = $this->box_start('generalbox adminwarning availableupdatesinfo');
|
||||
$someupdateavailable = false;
|
||||
if (is_array($updates)) {
|
||||
if (is_array($updates['core'])) {
|
||||
@@ -749,7 +719,9 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
}
|
||||
$updateinfo .= $this->container_end();
|
||||
|
||||
return $this->warning($updateinfo);
|
||||
$updateinfo .= $this->box_end();
|
||||
|
||||
return $updateinfo;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1204,14 +1176,13 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
get_string('displayname', 'core_plugin'),
|
||||
get_string('source', 'core_plugin'),
|
||||
get_string('version', 'core_plugin'),
|
||||
get_string('release', 'core_plugin'),
|
||||
get_string('availability', 'core_plugin'),
|
||||
get_string('actions', 'core_plugin'),
|
||||
get_string('notes','core_plugin'),
|
||||
);
|
||||
$table->headspan = array(1, 1, 1, 1, 1, 2, 1);
|
||||
$table->headspan = array(1, 1, 1, 1, 2, 1);
|
||||
$table->colclasses = array(
|
||||
'pluginname', 'source', 'version', 'release', 'availability', 'settings', 'uninstall', 'notes'
|
||||
'pluginname', 'source', 'version', 'availability', 'settings', 'uninstall', 'notes'
|
||||
);
|
||||
|
||||
foreach ($plugininfo as $type => $plugins) {
|
||||
@@ -1267,7 +1238,6 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
}
|
||||
|
||||
$version = new html_table_cell($plugin->versiondb);
|
||||
$release = new html_table_cell($plugin->release);
|
||||
|
||||
$isenabled = $plugin->is_enabled();
|
||||
if (is_null($isenabled)) {
|
||||
@@ -1313,7 +1283,7 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
$notes = new html_table_cell($requiredby.$updateinfo);
|
||||
|
||||
$row->cells = array(
|
||||
$pluginname, $source, $version, $release, $availability, $settings, $uninstall, $notes
|
||||
$pluginname, $source, $version, $availability, $settings, $uninstall, $notes
|
||||
);
|
||||
$table->data[] = $row;
|
||||
}
|
||||
@@ -1385,7 +1355,7 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
* configuration and how it suits Moodle needs.
|
||||
*
|
||||
* @param boolean $result final result of the check (true/false)
|
||||
* @param environment_results[] $environment_results array of results gathered
|
||||
* @param array $environment_results array of results gathered
|
||||
* @return string HTML to output.
|
||||
*/
|
||||
public function environment_check_table($result, $environment_results) {
|
||||
@@ -1397,10 +1367,9 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
get_string('name'),
|
||||
get_string('info'),
|
||||
get_string('report'),
|
||||
get_string('plugin'),
|
||||
get_string('status'),
|
||||
);
|
||||
$servertable->colclasses = array('centeralign name', 'centeralign info', 'leftalign report', 'leftalign plugin', 'centeralign status');
|
||||
$servertable->colclasses = array('centeralign name', 'centeralign status', 'leftalign report', 'centeralign info');
|
||||
$servertable->attributes['class'] = 'admintable environmenttable generaltable';
|
||||
$servertable->id = 'serverstatus';
|
||||
|
||||
@@ -1410,10 +1379,9 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
$othertable->head = array(
|
||||
get_string('info'),
|
||||
get_string('report'),
|
||||
get_string('plugin'),
|
||||
get_string('status'),
|
||||
);
|
||||
$othertable->colclasses = array('aligncenter info', 'alignleft report', 'alignleft plugin', 'aligncenter status');
|
||||
$othertable->colclasses = array('aligncenter info', 'alignleft report', 'aligncenter status');
|
||||
$othertable->attributes['class'] = 'admintable environmenttable generaltable';
|
||||
$othertable->id = 'otherserverstatus';
|
||||
|
||||
@@ -1429,7 +1397,6 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
$type = $environment_result->getPart();
|
||||
$info = $environment_result->getInfo();
|
||||
$status = $environment_result->getStatus();
|
||||
$plugin = $environment_result->getPluginName();
|
||||
$error_code = $environment_result->getErrorCode();
|
||||
// Process Report field
|
||||
$rec = new stdClass();
|
||||
@@ -1506,8 +1473,7 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
if (!empty($info)){
|
||||
$linkparts[] = $info;
|
||||
}
|
||||
// Plugin environments do not have docs pages yet.
|
||||
if (empty($CFG->docroot) or $environment_result->plugin) {
|
||||
if (empty($CFG->docroot)) {
|
||||
$report = get_string($stringtouse, 'admin', $rec);
|
||||
} else {
|
||||
$report = $this->doc_link(join($linkparts, '/'), get_string($stringtouse, 'admin', $rec));
|
||||
@@ -1533,9 +1499,9 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
|
||||
// Add the row to the table
|
||||
if ($environment_result->getPart() == 'custom_check'){
|
||||
$otherdata[$messagetype][] = array ($info, $report, $plugin, $status);
|
||||
$otherdata[$messagetype][] = array ($info, $report, $status);
|
||||
} else {
|
||||
$serverdata[$messagetype][] = array ($type, $info, $report, $plugin, $status);
|
||||
$serverdata[$messagetype][] = array ($type, $info, $report, $status);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-15
@@ -41,9 +41,8 @@ echo $OUTPUT->heading(get_string('reports'));
|
||||
$struninstall = get_string('uninstallplugin', 'core_admin');
|
||||
|
||||
$table = new flexible_table('reportplugins_administration_table');
|
||||
$table->define_columns(array('name', 'logstoressupported', 'version', 'uninstall'));
|
||||
$table->define_headers(array(get_string('plugin'), get_string('logstoressupported', 'admin'), get_string('version'),
|
||||
$struninstall));
|
||||
$table->define_columns(array('name', 'version', 'uninstall'));
|
||||
$table->define_headers(array(get_string('plugin'), get_string('version'), $struninstall));
|
||||
$table->define_baseurl($PAGE->url);
|
||||
$table->set_attribute('id', 'reportplugins');
|
||||
$table->set_attribute('class', 'admintable generaltable');
|
||||
@@ -72,23 +71,12 @@ foreach ($installed as $config) {
|
||||
}
|
||||
}
|
||||
|
||||
$logmanager = get_log_manager();
|
||||
|
||||
foreach ($plugins as $plugin => $name) {
|
||||
$uninstall = '';
|
||||
if ($uninstallurl = core_plugin_manager::instance()->get_uninstall_url('report_'.$plugin, 'manage')) {
|
||||
$uninstall = html_writer::link($uninstallurl, $struninstall);
|
||||
}
|
||||
|
||||
$stores = $logmanager->get_supported_logstores('report_' . $plugin);
|
||||
if ($stores === false) {
|
||||
$supportedstores = get_string('logstorenotrequired', 'admin');
|
||||
} else if (!empty($stores)) {
|
||||
$supportedstores = implode(', ', $stores);
|
||||
} else {
|
||||
$supportedstores = get_string('nosupportedlogstore', 'admin');;
|
||||
}
|
||||
|
||||
if (!isset($versions[$plugin])) {
|
||||
if (file_exists("$CFG->dirroot/report/$plugin/version.php")) {
|
||||
// not installed yet
|
||||
@@ -108,7 +96,7 @@ foreach ($plugins as $plugin => $name) {
|
||||
}
|
||||
}
|
||||
|
||||
$table->add_data(array($name, $supportedstores, $version, $uninstall));
|
||||
$table->add_data(array($name, $version, $uninstall));
|
||||
}
|
||||
|
||||
$table->print_html();
|
||||
|
||||
@@ -176,7 +176,7 @@ if ($roleid) {
|
||||
// Show UI for assigning a particular role to users.
|
||||
// Print a warning if we are assigning system roles.
|
||||
if ($context->contextlevel == CONTEXT_SYSTEM) {
|
||||
echo $OUTPUT->notification(get_string('globalroleswarning', 'core_role'));
|
||||
echo $OUTPUT->box(get_string('globalroleswarning', 'core_role'));
|
||||
}
|
||||
|
||||
// Print the form.
|
||||
@@ -251,7 +251,7 @@ if ($roleid) {
|
||||
|
||||
// Print a warning if we are assigning system roles.
|
||||
if ($context->contextlevel == CONTEXT_SYSTEM) {
|
||||
echo $OUTPUT->notification(get_string('globalroleswarning', 'core_role'));
|
||||
echo $OUTPUT->box(get_string('globalroleswarning', 'core_role'));
|
||||
}
|
||||
|
||||
// Print instruction.
|
||||
|
||||
@@ -74,16 +74,8 @@ abstract class core_role_capability_table_base {
|
||||
public function display() {
|
||||
if (count($this->capabilities) > self::NUM_CAPS_FOR_SEARCH) {
|
||||
global $PAGE;
|
||||
$jsmodule = array(
|
||||
'name' => 'rolescapfilter',
|
||||
'fullpath' => '/admin/roles/module.js',
|
||||
'strings' => array(
|
||||
array('filter', 'moodle'),
|
||||
array('clear', 'moodle'), ),
|
||||
'requires' => array('node', 'cookie', 'escape')
|
||||
);
|
||||
$PAGE->requires->js_init_call('M.core_role.init_cap_table_filter', array($this->id, $this->context->id), false,
|
||||
$jsmodule);
|
||||
$PAGE->requires->strings_for_js(array('filter', 'clear'), 'moodle');
|
||||
$PAGE->requires->js_init_call('M.core_role.init_cap_table_filter', array($this->id, $this->context->id));
|
||||
}
|
||||
echo '<table class="' . implode(' ', $this->classes) . '" id="' . $this->id . '">' . "\n<thead>\n";
|
||||
echo '<tr><th class="name" align="left" scope="col">' . get_string('capability', 'core_role') . '</th>';
|
||||
|
||||
@@ -75,8 +75,7 @@ switch ($action) {
|
||||
$a->id = $roleid;
|
||||
$a->name = $roles[$roleid]->name;
|
||||
$a->shortname = $roles[$roleid]->shortname;
|
||||
$a->count = $DB->count_records_select('role_assignments',
|
||||
'roleid = ?', array($roleid), 'COUNT(DISTINCT userid)');
|
||||
$a->count = $DB->count_records('role_assignments', array('roleid'=>$roleid));
|
||||
|
||||
$formcontinue = new single_button(new moodle_url($baseurl, $optionsyes), get_string('yes'));
|
||||
$formcancel = new single_button(new moodle_url($baseurl), get_string('no'), 'get');
|
||||
|
||||
@@ -51,7 +51,7 @@ M.core_role.init_cap_table_filter = function(Y, tableid, contextid) {
|
||||
marginRight : 'auto'
|
||||
});
|
||||
// Create the capability search input.
|
||||
this.input = Y.Node.create('<input type="text" id="'+this.table.get('id')+'capabilitysearch" value="'+Y.Escape.html(filtervalue)+'" />');
|
||||
this.input = Y.Node.create('<input type="text" id="'+this.table.get('id')+'capabilitysearch" value="'+filtervalue+'" />');
|
||||
// Create a label for the search input.
|
||||
this.label = Y.Node.create('<label for="'+this.input.get('id')+'">'+M.str.moodle.filter+' </label>');
|
||||
// Create a clear button to clear the input.
|
||||
|
||||
@@ -139,6 +139,7 @@ if (optional_param('savechanges', false, PARAM_BOOL) && confirm_sesskey()) {
|
||||
array(
|
||||
'context' => $context,
|
||||
'objectid' => $roleid,
|
||||
'courseid' => $courseid
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
@@ -191,9 +191,6 @@ if ($hassiteconfig or has_any_capability($capabilities, $systemcontext)) { // sp
|
||||
// "documentation" settingpage
|
||||
$temp = new admin_settingpage('documentation', new lang_string('moodledocs'));
|
||||
$temp->add(new admin_setting_configtext('docroot', new lang_string('docroot', 'admin'), new lang_string('configdocroot', 'admin'), 'http://docs.moodle.org', PARAM_URL));
|
||||
$ltemp = array('' => get_string('forceno'));
|
||||
$ltemp += get_string_manager()->get_list_of_translations(true);
|
||||
$temp->add(new admin_setting_configselect('doclang', get_string('doclang', 'admin'), get_string('configdoclang', 'admin'), '', $ltemp));
|
||||
$temp->add(new admin_setting_configcheckbox('doctonewwindow', new lang_string('doctonewwindow', 'admin'), new lang_string('configdoctonewwindow', 'admin'), 0));
|
||||
$ADMIN->add('appearance', $temp);
|
||||
|
||||
@@ -220,6 +217,7 @@ if ($hassiteconfig or has_any_capability($capabilities, $systemcontext)) { // sp
|
||||
$ADMIN->add('appearance', $temp);
|
||||
|
||||
$temp = new admin_settingpage('ajax', new lang_string('ajaxuse'));
|
||||
$temp->add(new admin_setting_configcheckbox('enableajax', new lang_string('enableajax', 'admin'), new lang_string('configenableajax', 'admin'), 1));
|
||||
$temp->add(new admin_setting_configcheckbox('useexternalyui', new lang_string('useexternalyui', 'admin'), new lang_string('configuseexternalyui', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('yuicomboloading', new lang_string('yuicomboloading', 'admin'), new lang_string('configyuicomboloading', 'admin'), 1));
|
||||
$setting = new admin_setting_configcheckbox('cachejs', new lang_string('cachejs', 'admin'), new lang_string('cachejs_help', 'admin'), 1);
|
||||
|
||||
@@ -26,8 +26,7 @@ $capabilities = array(
|
||||
'moodle/backup:backupcourse',
|
||||
'moodle/category:manage',
|
||||
'moodle/course:create',
|
||||
'moodle/site:approvecourse',
|
||||
'moodle/restore:restorecourse'
|
||||
'moodle/site:approvecourse'
|
||||
);
|
||||
if ($hassiteconfig or has_any_capability($capabilities, $systemcontext)) {
|
||||
// Speedup for non-admins, add all caps used on this page.
|
||||
@@ -43,12 +42,6 @@ if ($hassiteconfig or has_any_capability($capabilities, $systemcontext)) {
|
||||
array('moodle/category:manage')
|
||||
)
|
||||
);
|
||||
$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/course:create')
|
||||
)
|
||||
);
|
||||
|
||||
// Course Default Settings Page.
|
||||
// NOTE: these settings must be applied after all other settings because they depend on them.
|
||||
|
||||
@@ -27,6 +27,9 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
|
||||
$temp->add(new admin_setting_configcheckbox('enabletgzbackups',
|
||||
new lang_string('enabletgzbackups', 'admin'),
|
||||
new lang_string('enabletgzbackups_desc', 'admin'), 0));
|
||||
$temp->add(new admin_setting_php_extension_enabled('zlibenabled',
|
||||
get_string('zlibenabled', 'admin'),
|
||||
get_string('enabletgzbackups_nozlib', 'admin'), 'zlib'));
|
||||
|
||||
$ADMIN->add('experimental', $temp);
|
||||
|
||||
@@ -41,46 +44,48 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
|
||||
$temp->add(new admin_setting_configcheckbox('debugpageinfo', new lang_string('debugpageinfo', 'admin'), new lang_string('configdebugpageinfo', 'admin'), 0));
|
||||
$ADMIN->add('development', $temp);
|
||||
|
||||
// "Profiling" settingpage (conditionally if the 'xhprof' extension is available only).
|
||||
$xhprofenabled = extension_loaded('xhprof') && function_exists('xhprof_enable');
|
||||
$temp = new admin_settingpage('profiling', new lang_string('profiling', 'admin'), 'moodle/site:config', !$xhprofenabled);
|
||||
// Main profiling switch.
|
||||
$temp->add(new admin_setting_configcheckbox('profilingenabled', new lang_string('profilingenabled', 'admin'), new lang_string('profilingenabled_help', 'admin'), false));
|
||||
// List of URLs that will be automatically profiled.
|
||||
$temp->add(new admin_setting_configtextarea('profilingincluded', new lang_string('profilingincluded', 'admin'), new lang_string('profilingincluded_help', 'admin'), ''));
|
||||
// List of URLs that won't be profiled ever.
|
||||
$temp->add(new admin_setting_configtextarea('profilingexcluded', new lang_string('profilingexcluded', 'admin'), new lang_string('profilingexcluded_help', 'admin'), ''));
|
||||
// Allow random profiling each XX requests.
|
||||
$temp->add(new admin_setting_configtext('profilingautofrec', new lang_string('profilingautofrec', 'admin'), new lang_string('profilingautofrec_help', 'admin'), 0, PARAM_INT));
|
||||
// Allow PROFILEME/DONTPROFILEME GPC.
|
||||
$temp->add(new admin_setting_configcheckbox('profilingallowme', new lang_string('profilingallowme', 'admin'), new lang_string('profilingallowme_help', 'admin'), false));
|
||||
// Allow PROFILEALL/PROFILEALLSTOP GPC.
|
||||
$temp->add(new admin_setting_configcheckbox('profilingallowall', new lang_string('profilingallowall', 'admin'), new lang_string('profilingallowall_help', 'admin'), false));
|
||||
// TODO: Allow to skip PHP functions (XHPROF_FLAGS_NO_BUILTINS)
|
||||
// TODO: Allow to skip call_user functions (ignored_functions array)
|
||||
// Specify the life time (in minutes) of profiling runs.
|
||||
$temp->add(new admin_setting_configselect('profilinglifetime', new lang_string('profilinglifetime', 'admin'), new lang_string('profilinglifetime_help', 'admin'), 24*60, array(
|
||||
0 => new lang_string('neverdeleteruns', 'admin'),
|
||||
30*24*60 => new lang_string('numdays', '', 30),
|
||||
15*24*60 => new lang_string('numdays', '', 15),
|
||||
7*24*60 => new lang_string('numdays', '', 7),
|
||||
4*24*60 => new lang_string('numdays', '', 4),
|
||||
2*24*60 => new lang_string('numdays', '', 2),
|
||||
24*60 => new lang_string('numhours', '', 24),
|
||||
16*80 => new lang_string('numhours', '', 16),
|
||||
8*60 => new lang_string('numhours', '', 8),
|
||||
4*60 => new lang_string('numhours', '', 4),
|
||||
2*60 => new lang_string('numhours', '', 2),
|
||||
60 => new lang_string('numminutes', '', 60),
|
||||
30 => new lang_string('numminutes', '', 30),
|
||||
15 => new lang_string('numminutes', '', 15))));
|
||||
// Define the prefix to be added to imported profiling runs.
|
||||
$temp->add(new admin_setting_configtext('profilingimportprefix',
|
||||
new lang_string('profilingimportprefix', 'admin'),
|
||||
new lang_string('profilingimportprefix_desc', 'admin'), '(I)', PARAM_TAG, 10));
|
||||
// "profiling" settingpage (conditionally if the 'xhprof' extension is available only)
|
||||
if (extension_loaded('xhprof') && function_exists('xhprof_enable')) {
|
||||
$temp = new admin_settingpage('profiling', new lang_string('profiling', 'admin'));
|
||||
// Main profiling switch
|
||||
$temp->add(new admin_setting_configcheckbox('profilingenabled', new lang_string('profilingenabled', 'admin'), new lang_string('profilingenabled_help', 'admin'), false));
|
||||
// List of URLs that will be automatically profiled
|
||||
$temp->add(new admin_setting_configtextarea('profilingincluded', new lang_string('profilingincluded', 'admin'), new lang_string('profilingincluded_help', 'admin'), ''));
|
||||
// List of URLs that won't be profiled ever
|
||||
$temp->add(new admin_setting_configtextarea('profilingexcluded', new lang_string('profilingexcluded', 'admin'), new lang_string('profilingexcluded_help', 'admin'), ''));
|
||||
// Allow random profiling each XX requests
|
||||
$temp->add(new admin_setting_configtext('profilingautofrec', new lang_string('profilingautofrec', 'admin'), new lang_string('profilingautofrec_help', 'admin'), 0, PARAM_INT));
|
||||
// Allow PROFILEME/DONTPROFILEME GPC
|
||||
$temp->add(new admin_setting_configcheckbox('profilingallowme', new lang_string('profilingallowme', 'admin'), new lang_string('profilingallowme_help', 'admin'), false));
|
||||
// Allow PROFILEALL/PROFILEALLSTOP GPC
|
||||
$temp->add(new admin_setting_configcheckbox('profilingallowall', new lang_string('profilingallowall', 'admin'), new lang_string('profilingallowall_help', 'admin'), false));
|
||||
// TODO: Allow to skip PHP functions (XHPROF_FLAGS_NO_BUILTINS)
|
||||
// TODO: Allow to skip call_user functions (ignored_functions array)
|
||||
// Specify the life time (in minutes) of profiling runs
|
||||
$temp->add(new admin_setting_configselect('profilinglifetime', new lang_string('profilinglifetime', 'admin'), new lang_string('profilinglifetime_help', 'admin'), 24*60, array(
|
||||
0 => new lang_string('neverdeleteruns', 'admin'),
|
||||
30*24*60 => new lang_string('numdays', '', 30),
|
||||
15*24*60 => new lang_string('numdays', '', 15),
|
||||
7*24*60 => new lang_string('numdays', '', 7),
|
||||
4*24*60 => new lang_string('numdays', '', 4),
|
||||
2*24*60 => new lang_string('numdays', '', 2),
|
||||
24*60 => new lang_string('numhours', '', 24),
|
||||
16*80 => new lang_string('numhours', '', 16),
|
||||
8*60 => new lang_string('numhours', '', 8),
|
||||
4*60 => new lang_string('numhours', '', 4),
|
||||
2*60 => new lang_string('numhours', '', 2),
|
||||
60 => new lang_string('numminutes', '', 60),
|
||||
30 => new lang_string('numminutes', '', 30),
|
||||
15 => new lang_string('numminutes', '', 15))));
|
||||
// Define the prefix to be added to imported profiling runs.
|
||||
$temp->add(new admin_setting_configtext('profilingimportprefix',
|
||||
new lang_string('profilingimportprefix', 'admin'),
|
||||
new lang_string('profilingimportprefix_desc', 'admin'), '(I)', PARAM_TAG, 10));
|
||||
|
||||
// Add the 'profiling' page to admin block
|
||||
$ADMIN->add('development', $temp);
|
||||
}
|
||||
|
||||
// Add the 'profiling' page to admin block.
|
||||
$ADMIN->add('development', $temp);
|
||||
|
||||
// Web service test clients DO NOT COMMIT : THE EXTERNAL WEB PAGE IS NOT AN ADMIN PAGE !!!!!
|
||||
$ADMIN->add('development', new admin_externalpage('testclient', new lang_string('testclient', 'webservice'), "$CFG->wwwroot/$CFG->admin/webservice/testclient.php"));
|
||||
|
||||
@@ -67,10 +67,6 @@ if (has_capability('moodle/grade:manage', $systemcontext)
|
||||
$temp->add(new admin_setting_special_gradeexport());
|
||||
|
||||
$temp->add(new admin_setting_special_gradelimiting());
|
||||
|
||||
$temp->add(new admin_setting_special_gradepointmax());
|
||||
|
||||
$temp->add(new admin_setting_special_gradepointdefault());
|
||||
}
|
||||
$ADMIN->add('grades', $temp);
|
||||
|
||||
|
||||
@@ -25,9 +25,6 @@
|
||||
*/
|
||||
|
||||
if ($hassiteconfig) {
|
||||
/* @var admin_root $ADMIN */
|
||||
$ADMIN->locate('modules')->set_sorting(true);
|
||||
|
||||
$ADMIN->add('modules', new admin_page_pluginsoverview());
|
||||
|
||||
// activity modules
|
||||
@@ -72,7 +69,6 @@ if ($hassiteconfig) {
|
||||
$temp->add(new admin_setting_manageauths());
|
||||
$temp->add(new admin_setting_heading('manageauthscommonheading', new lang_string('commonsettings', 'admin'), ''));
|
||||
$temp->add(new admin_setting_special_registerauth());
|
||||
$temp->add(new admin_setting_configcheckbox('authloginviaemail', new lang_string('authloginviaemail', 'core_auth'), new lang_string('authloginviaemail_desc', 'core_auth'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('authpreventaccountcreation', new lang_string('authpreventaccountcreation', 'admin'), new lang_string('authpreventaccountcreation_help', 'admin'), 0));
|
||||
$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'),
|
||||
@@ -146,7 +142,31 @@ if ($hassiteconfig) {
|
||||
// "filtersettings" settingpage
|
||||
$temp = new admin_settingpage('commonfiltersettings', new lang_string('commonfiltersettings', 'admin'));
|
||||
if ($ADMIN->fulltree) {
|
||||
$cachetimes = array(
|
||||
604800 => new lang_string('numdays','',7),
|
||||
86400 => new lang_string('numdays','',1),
|
||||
43200 => new lang_string('numhours','',12),
|
||||
10800 => new lang_string('numhours','',3),
|
||||
7200 => new lang_string('numhours','',2),
|
||||
3600 => new lang_string('numhours','',1),
|
||||
2700 => new lang_string('numminutes','',45),
|
||||
1800 => new lang_string('numminutes','',30),
|
||||
900 => new lang_string('numminutes','',15),
|
||||
600 => new lang_string('numminutes','',10),
|
||||
540 => new lang_string('numminutes','',9),
|
||||
480 => new lang_string('numminutes','',8),
|
||||
420 => new lang_string('numminutes','',7),
|
||||
360 => new lang_string('numminutes','',6),
|
||||
300 => new lang_string('numminutes','',5),
|
||||
240 => new lang_string('numminutes','',4),
|
||||
180 => new lang_string('numminutes','',3),
|
||||
120 => new lang_string('numminutes','',2),
|
||||
60 => new lang_string('numminutes','',1),
|
||||
30 => new lang_string('numseconds','',30),
|
||||
0 => new lang_string('no')
|
||||
);
|
||||
$items = array();
|
||||
$items[] = new admin_setting_configselect('cachetext', new lang_string('cachetext', 'admin'), new lang_string('configcachetext', 'admin'), 60, $cachetimes);
|
||||
$items[] = new admin_setting_configselect('filteruploadedfiles', new lang_string('filteruploadedfiles', 'admin'), new lang_string('configfilteruploadedfiles', 'admin'), 0,
|
||||
array('0' => new lang_string('none'), '1' => new lang_string('allfiles'), '2' => new lang_string('htmlfilesonly')));
|
||||
$items[] = new admin_setting_configcheckbox('filtermatchoneperpage', new lang_string('filtermatchoneperpage', 'admin'), new lang_string('configfiltermatchoneperpage', 'admin'), 0);
|
||||
@@ -236,10 +256,7 @@ if ($hassiteconfig) {
|
||||
|
||||
// Add common settings page
|
||||
$temp = new admin_settingpage('managerepositoriescommon', new lang_string('commonrepositorysettings', 'repository'));
|
||||
$temp->add(new admin_setting_configtext('repositorycacheexpire', new lang_string('cacheexpire', 'repository'), new lang_string('configcacheexpire', 'repository'), 120, PARAM_INT));
|
||||
$temp->add(new admin_setting_configtext('repositorygetfiletimeout', new lang_string('getfiletimeout', 'repository'), new lang_string('configgetfiletimeout', 'repository'), 30, PARAM_INT));
|
||||
$temp->add(new admin_setting_configtext('repositorysyncfiletimeout', new lang_string('syncfiletimeout', 'repository'), new lang_string('configsyncfiletimeout', 'repository'), 1, PARAM_INT));
|
||||
$temp->add(new admin_setting_configtext('repositorysyncimagetimeout', new lang_string('syncimagetimeout', 'repository'), new lang_string('configsyncimagetimeout', 'repository'), 3, PARAM_INT));
|
||||
$temp->add(new admin_setting_configtext('repositorycacheexpire', new lang_string('cacheexpire', 'repository'), new lang_string('configcacheexpire', 'repository'), 120));
|
||||
$temp->add(new admin_setting_configcheckbox('repositoryallowexternallinks', new lang_string('allowexternallinks', 'repository'), new lang_string('configallowexternallinks', 'repository'), 1));
|
||||
$temp->add(new admin_setting_configcheckbox('legacyfilesinnewcourses', new lang_string('legacyfilesinnewcourses', 'admin'), new lang_string('legacyfilesinnewcourses_help', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('legacyfilesaddallowed', new lang_string('legacyfilesaddallowed', 'admin'), new lang_string('legacyfilesaddallowed_help', 'admin'), 1));
|
||||
|
||||
@@ -108,8 +108,10 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
|
||||
|
||||
// "notifications" settingpage
|
||||
$temp = new admin_settingpage('notifications', new lang_string('notifications', 'admin'));
|
||||
$temp->add(new admin_setting_configcheckbox('displayloginfailures', new lang_string('displayloginfailures', 'admin'),
|
||||
new lang_string('configdisplayloginfailures', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configselect('displayloginfailures', new lang_string('displayloginfailures', 'admin'), new lang_string('configdisplayloginfailures', 'admin'), '', array('' => new lang_string('nobody'),
|
||||
'admin' => new lang_string('administrators'),
|
||||
'teacher' => new lang_string('administratorsandteachers'),
|
||||
'everybody' => new lang_string('everybody'))));
|
||||
$temp->add(new admin_setting_users_with_capability('notifyloginfailures', new lang_string('notifyloginfailures', 'admin'), new lang_string('confignotifyloginfailures', 'admin'), array(), 'moodle/site:config'));
|
||||
$options = array();
|
||||
for ($i = 1; $i <= 100; $i++) {
|
||||
|
||||
@@ -93,7 +93,6 @@ $options = array(
|
||||
GETREMOTEADDR_SKIP_HTTP_X_FORWARDED_FOR => 'HTTP_CLIENT, REMOTE_ADDR',
|
||||
GETREMOTEADDR_SKIP_HTTP_X_FORWARDED_FOR|GETREMOTEADDR_SKIP_HTTP_CLIENT_IP => 'REMOTE_ADDR');
|
||||
$temp->add(new admin_setting_configselect('getremoteaddrconf', new lang_string('getremoteaddrconf', 'admin'), new lang_string('configgetremoteaddrconf', 'admin'), 0, $options));
|
||||
|
||||
$temp->add(new admin_setting_heading('webproxy', new lang_string('webproxy', 'admin'), new lang_string('webproxyinfo', 'admin')));
|
||||
$temp->add(new admin_setting_configtext('proxyhost', new lang_string('proxyhost', 'admin'), new lang_string('configproxyhost', 'admin'), '', PARAM_HOST));
|
||||
$temp->add(new admin_setting_configtext('proxyport', new lang_string('proxyport', 'admin'), new lang_string('configproxyport', 'admin'), 0, PARAM_INT));
|
||||
@@ -137,6 +136,21 @@ $temp->add(new admin_setting_configselect('deleteincompleteusers', new lang_stri
|
||||
48 => new lang_string('numdays', '', 2),
|
||||
24 => new lang_string('numdays', '', 1))));
|
||||
|
||||
$temp->add(new admin_setting_configcheckbox('logguests', new lang_string('logguests', 'admin'),
|
||||
new lang_string('logguests_help', 'admin'), 1));
|
||||
$temp->add(new admin_setting_configselect('loglifetime', new lang_string('loglifetime', 'admin'), new lang_string('configloglifetime', 'admin'), 0, array(0 => new lang_string('neverdeletelogs'),
|
||||
1000 => new lang_string('numdays', '', 1000),
|
||||
365 => new lang_string('numdays', '', 365),
|
||||
180 => new lang_string('numdays', '', 180),
|
||||
150 => new lang_string('numdays', '', 150),
|
||||
120 => new lang_string('numdays', '', 120),
|
||||
90 => new lang_string('numdays', '', 90),
|
||||
60 => new lang_string('numdays', '', 60),
|
||||
35 => new lang_string('numdays', '', 35),
|
||||
10 => new lang_string('numdays', '', 10),
|
||||
5 => new lang_string('numdays', '', 5),
|
||||
2 => new lang_string('numdays', '', 2))));
|
||||
|
||||
|
||||
$temp->add(new admin_setting_configcheckbox('disablegradehistory', new lang_string('disablegradehistory', 'grades'),
|
||||
new lang_string('disablegradehistory_help', 'grades'), 0));
|
||||
@@ -181,8 +195,6 @@ if (PHP_INT_SIZE === 8) {
|
||||
$temp->add(new admin_setting_configselect('extramemorylimit', new lang_string('extramemorylimit', 'admin'),
|
||||
new lang_string('configextramemorylimit', 'admin'), '512M',
|
||||
$memoryoptions));
|
||||
$temp->add(new admin_setting_configtext('maxtimelimit', new lang_string('maxtimelimit', 'admin'),
|
||||
new lang_string('maxtimelimit_desc', 'admin'), 0, PARAM_INT));
|
||||
|
||||
$temp->add(new admin_setting_configtext('curlcache', new lang_string('curlcache', 'admin'),
|
||||
new lang_string('configcurlcache', 'admin'), 120, PARAM_INT));
|
||||
|
||||
@@ -44,8 +44,8 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
|
||||
new lang_string('configcompletiondefault', 'completion'), 1, $options));
|
||||
|
||||
$optionalsubsystems->add($checkbox = new admin_setting_configcheckbox('enableavailability',
|
||||
new lang_string('enableavailability', 'availability'),
|
||||
new lang_string('enableavailability_desc', 'availability'), 0));
|
||||
new lang_string('enableavailability','condition'),
|
||||
new lang_string('configenableavailability','condition'), 0));
|
||||
$checkbox->set_affects_modinfo(true);
|
||||
|
||||
$optionalsubsystems->add(new admin_setting_configcheckbox('enableplagiarism', new lang_string('enableplagiarism','plagiarism'), new lang_string('configenableplagiarism','plagiarism'), 0));
|
||||
|
||||
@@ -127,7 +127,6 @@ if ($hassiteconfig
|
||||
'msnid' => new lang_string('msnid'),
|
||||
'firstaccess' => new lang_string('firstaccess'),
|
||||
'lastaccess' => new lang_string('lastaccess'),
|
||||
'lastip' => new lang_string('lastip'),
|
||||
'mycourses' => new lang_string('mycourses'),
|
||||
'groups' => new lang_string('groups'),
|
||||
'suspended' => new lang_string('suspended', 'auth'),
|
||||
|
||||
@@ -80,8 +80,7 @@ class behat_admin extends behat_base {
|
||||
// Single element settings.
|
||||
try {
|
||||
$fieldxpath = "//*[self::input | self::textarea | self::select][not(./@type = 'submit' or ./@type = 'image' or ./@type = 'hidden')]" .
|
||||
"[@id=//label[contains(normalize-space(.), $label)]/@for or " .
|
||||
"@id=//span[contains(normalize-space(.), $label)]/preceding-sibling::label[1]/@for]";
|
||||
"[@id=//label[contains(normalize-space(.), $label)]/@for]";
|
||||
$fieldnode = $this->find('xpath', $fieldxpath, $exception);
|
||||
|
||||
$formfieldtypenode = $this->find('xpath', $fieldxpath . "/ancestor::div[@class='form-setting']" .
|
||||
@@ -90,7 +89,7 @@ class behat_admin extends behat_base {
|
||||
} catch (ElementNotFoundException $e) {
|
||||
|
||||
// Multi element settings, interacting only the first one.
|
||||
$fieldxpath = "//*[label[.= $label]|span[.= $label]]/ancestor::div[contains(concat(' ', normalize-space(@class), ' '), ' form-item ')]" .
|
||||
$fieldxpath = "//descendant::label[.= $label]/ancestor::div[contains(concat(' ', normalize-space(@class), ' '), ' form-item ')]" .
|
||||
"/descendant::div[@class='form-group']/descendant::*[self::input | self::textarea | self::select][not(./@type = 'submit' or ./@type = 'image' or ./@type = 'hidden')]";
|
||||
$fieldnode = $this->find('xpath', $fieldxpath);
|
||||
|
||||
@@ -126,4 +125,17 @@ class behat_admin extends behat_base {
|
||||
$this->getSession()->wait($timeout, $javascript);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Will be deprecated in 2.7. Goes to notification page.
|
||||
*
|
||||
* @Given /^I go to notifications page$/
|
||||
* @return Given[]
|
||||
*/
|
||||
public function i_go_to_notifications_page() {
|
||||
return array(
|
||||
new Given('I expand "' . get_string('administrationsite') . '" node'),
|
||||
new Given('I follow "' . get_string('notifications') . '"')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ Feature: Display extended course names
|
||||
I need to display courses short names along with courses full names
|
||||
|
||||
Background:
|
||||
Given the following "courses" exist:
|
||||
Given the following "courses" exists:
|
||||
| fullname | shortname | category |
|
||||
| Course fullname | C_shortname | 0 |
|
||||
And I log in as "admin"
|
||||
@@ -17,7 +17,7 @@ Feature: Display extended course names
|
||||
Scenario: Courses list with extended course names
|
||||
Given I expand "Site administration" node
|
||||
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"
|
||||
And I check "Display extended course names"
|
||||
When I press "Save changes"
|
||||
And I am on homepage
|
||||
Then I should see "C_shortname Course fullname"
|
||||
|
||||
@@ -5,31 +5,31 @@ Feature: An administrator can filter user accounts by role, cohort and other pro
|
||||
I need to filter the users account list using different filter
|
||||
|
||||
Background:
|
||||
Given the following "users" exist:
|
||||
Given the following "users" exists:
|
||||
| username | firstname | lastname | email | auth | confirmed |
|
||||
| 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:
|
||||
| user2 | User | Two | one@asd.com | ldap | 1 |
|
||||
| user3 | User | Three | one@asd.com | manual | 1 |
|
||||
| user4 | User | Four | one@asd.com | ldap | 0 |
|
||||
And the following "cohorts" exists:
|
||||
| name | idnumber |
|
||||
| Cohort 1 | CH1 |
|
||||
And the following "courses" exist:
|
||||
And the following "courses" exists:
|
||||
| fullname | shortname | category |
|
||||
| Course 1 | C1 | 0 |
|
||||
And the following "course enrolments" exist:
|
||||
And the following "course enrolments" exists:
|
||||
| user | course | role |
|
||||
| user1 | C1 | student |
|
||||
| user2 | C1 | student |
|
||||
| user3 | C1 | student |
|
||||
And I log in as "admin"
|
||||
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 add "user2" user to "CH1" cohort
|
||||
And I add "user3" user to "CH1" cohort
|
||||
And I follow "Browse list of users"
|
||||
|
||||
@javascript
|
||||
Scenario: Filter user accounts by role and cohort
|
||||
When I set the following fields to these values:
|
||||
When I fill the moodle form with:
|
||||
| courserole_rl | Student |
|
||||
| courserole_ct | any category |
|
||||
| courserole | C1 |
|
||||
@@ -38,7 +38,7 @@ Feature: An administrator can filter user accounts by role, cohort and other pro
|
||||
And I should see "User Two"
|
||||
And I should see "User Three"
|
||||
And I should not see "User Four"
|
||||
And I set the following fields to these values:
|
||||
And I fill the moodle form with:
|
||||
| cohort | CH1 |
|
||||
And I press "Add filter"
|
||||
And I should not see "User One"
|
||||
@@ -53,14 +53,14 @@ Feature: An administrator can filter user accounts by role, cohort and other pro
|
||||
|
||||
@javascript
|
||||
Scenario: Filter user accounts by confirm and authentication method
|
||||
When I set the following fields to these values:
|
||||
When I fill the moodle form with:
|
||||
| Confirmed | No |
|
||||
And I press "Add filter"
|
||||
Then I should see "User One"
|
||||
And I should not see "User Two"
|
||||
And I should not see "User Three"
|
||||
And I should see "User Four"
|
||||
And I set the following fields to these values:
|
||||
And I fill the moodle form with:
|
||||
| Authentication | manual |
|
||||
And I press "Add filter"
|
||||
And I should see "User One"
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
@core @core_admin
|
||||
Feature: Set admin settings value
|
||||
In order to set admin settings value
|
||||
As an admin
|
||||
I need to set admin setting value and verify it is applied
|
||||
|
||||
Background:
|
||||
Given the following "courses" exist:
|
||||
| fullname | shortname | category |
|
||||
| Course fullname | C_shortname | 0 |
|
||||
And I log in as "admin"
|
||||
And I should see "Course fullname"
|
||||
And I should not see "C_shortname Course fullname"
|
||||
|
||||
Scenario: set admin value with full name
|
||||
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 I set the following administration settings values:
|
||||
| courselistshortnames | 1 |
|
||||
When I press "Save changes"
|
||||
And I am on homepage
|
||||
Then I should see "C_shortname Course fullname"
|
||||
@@ -1,4 +1,4 @@
|
||||
@core @core_admin @_file_upload
|
||||
@core @core_admin @_only_local @_file_upload
|
||||
Feature: Upload users
|
||||
In order to add users to the system
|
||||
As an admin
|
||||
@@ -6,15 +6,19 @@ Feature: Upload users
|
||||
|
||||
@javascript
|
||||
Scenario: Upload users enrolling them on courses and groups
|
||||
Given the following "courses" exist:
|
||||
Given the following "courses" exists:
|
||||
| fullname | shortname | category |
|
||||
| Maths | math102 | 0 |
|
||||
And the following "groups" exist:
|
||||
And the following "groups" exists:
|
||||
| name | course | idnumber |
|
||||
| Section 1 | math102 | S1 |
|
||||
| Section 3 | math102 | S3 |
|
||||
And I log in as "admin"
|
||||
And I navigate to "Upload users" node in "Site administration > Users > Accounts"
|
||||
And I collapse "Front page settings" node
|
||||
And I expand "Site administration" node
|
||||
And I expand "Users" node
|
||||
And I expand "Accounts" node
|
||||
And I follow "Upload users"
|
||||
When I upload "lib/tests/fixtures/upload_users.csv" file to "File" filemanager
|
||||
And I press "Upload users"
|
||||
Then I should see "Upload users preview"
|
||||
@@ -37,5 +41,5 @@ Feature: Upload users
|
||||
And I follow "Maths"
|
||||
And I expand "Users" node
|
||||
And I follow "Groups"
|
||||
And I set the field "groups" to "Section 1 (1)"
|
||||
And I select "Section 1 (1)" from "groups"
|
||||
And the "members" select box should contain "Tom Jones"
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2014051200;
|
||||
$plugin->requires = 2014050800;
|
||||
$plugin->version = 2013110500;
|
||||
$plugin->requires = 2013110500;
|
||||
$plugin->component = 'tool_assignmentupgrade';
|
||||
$plugin->dependencies = array('mod_assign' => 2014050800);
|
||||
$plugin->dependencies = array('mod_assign' => 2013110500);
|
||||
|
||||
@@ -1,124 +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/>.
|
||||
|
||||
/**
|
||||
* Provides an overview of installed availability conditions.
|
||||
*
|
||||
* You can also enable/disable them from this screen.
|
||||
*
|
||||
* @package tool_availabilityconditions
|
||||
* @copyright 2014 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
require_once(__DIR__ . '/../../../config.php');
|
||||
require_once($CFG->libdir . '/adminlib.php');
|
||||
require_once($CFG->libdir . '/tablelib.php');
|
||||
|
||||
admin_externalpage_setup('manageavailability');
|
||||
|
||||
// Get sorted list of all availability condition plugins.
|
||||
$plugins = array();
|
||||
foreach (core_component::get_plugin_list('availability') as $plugin => $plugindir) {
|
||||
if (get_string_manager()->string_exists('pluginname', 'availability_' . $plugin)) {
|
||||
$strpluginname = get_string('pluginname', 'availability_' . $plugin);
|
||||
} else {
|
||||
$strpluginname = $plugin;
|
||||
}
|
||||
$plugins[$plugin] = $strpluginname;
|
||||
}
|
||||
core_collator::asort($plugins);
|
||||
|
||||
// Do plugin actions.
|
||||
$pageurl = new moodle_url('/' . $CFG->admin . '/tool/availabilityconditions/');
|
||||
if (($plugin = optional_param('plugin', '', PARAM_PLUGIN))) {
|
||||
require_sesskey();
|
||||
if (!array_key_exists($plugin, $plugins)) {
|
||||
print_error('invalidcomponent', 'error', $pageurl);
|
||||
}
|
||||
$action = required_param('action', PARAM_ALPHA);
|
||||
switch ($action) {
|
||||
case 'hide' :
|
||||
set_config('disabled', 1, 'availability_' . $plugin);
|
||||
break;
|
||||
case 'show' :
|
||||
unset_config('disabled', 'availability_' . $plugin);
|
||||
break;
|
||||
}
|
||||
core_plugin_manager::reset_caches();
|
||||
|
||||
// Always redirect back after an action.
|
||||
redirect($pageurl);
|
||||
}
|
||||
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading(get_string('manageplugins', 'availability'));
|
||||
|
||||
// Show a table of installed availability conditions.
|
||||
$table = new flexible_table('availabilityconditions_administration_table');
|
||||
$table->define_columns(array('name', 'version', 'enable'));
|
||||
$table->define_headers(array(get_string('plugin'),
|
||||
get_string('version'), get_string('hide') . '/' . get_string('show')));
|
||||
$table->define_baseurl($PAGE->url);
|
||||
$table->set_attribute('id', 'availabilityconditions');
|
||||
$table->set_attribute('class', 'admintable generaltable');
|
||||
$table->setup();
|
||||
|
||||
$enabledlist = core\plugininfo\availability::get_enabled_plugins();
|
||||
foreach ($plugins as $plugin => $name) {
|
||||
|
||||
// Get version or ? if unknown.
|
||||
$version = get_config('availability_' . $plugin);
|
||||
if (!empty($version->version)) {
|
||||
$version = $version->version;
|
||||
} else {
|
||||
$version = '?';
|
||||
}
|
||||
|
||||
// Get enabled status and use to grey out name if necessary.
|
||||
$enabled = in_array($plugin, $enabledlist);
|
||||
if ($enabled) {
|
||||
$enabledaction = 'hide';
|
||||
$enabledstr = get_string('hide');
|
||||
$class = '';
|
||||
} else {
|
||||
$enabledaction = 'show';
|
||||
$enabledstr = get_string('show');
|
||||
$class = 'dimmed_text';
|
||||
}
|
||||
$namespan = html_writer::span($name, $class);
|
||||
|
||||
// Make enable control. This is a POST request (using a form control rather
|
||||
// than just a link) because it makes a database change.
|
||||
$enablecontrol = html_writer::tag('form', html_writer::div(
|
||||
html_writer::empty_tag('input', array('type' => 'hidden',
|
||||
'name' => 'sesskey', 'value' => sesskey())) .
|
||||
html_writer::empty_tag('input', array('type' => 'hidden',
|
||||
'name' => 'plugin', 'value' => $plugin)) .
|
||||
html_writer::empty_tag('input', array('type' => 'hidden',
|
||||
'name' => 'action', 'value' => $enabledaction)) .
|
||||
html_writer::empty_tag('input', array('type' => 'image',
|
||||
'src' => $OUTPUT->pix_url('t/' . $enabledaction), 'alt' => $enabledstr,
|
||||
'title' => $enabledstr))
|
||||
), array(
|
||||
'method' => 'post', 'action' => './'));
|
||||
|
||||
$table->add_data(array($namespan, $version, $enablecontrol));
|
||||
}
|
||||
|
||||
$table->print_html();
|
||||
|
||||
echo $OUTPUT->footer();
|
||||
@@ -1,26 +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 availability conditions options.
|
||||
*
|
||||
* @package core_availability
|
||||
* @copyright 2014 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
$string['manageplugins'] = 'Manage restrictions';
|
||||
$string['pluginname'] = 'Availability condition management';
|
||||
@@ -1,37 +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/>.
|
||||
|
||||
/**
|
||||
* Adds settings links to admin tree.
|
||||
*
|
||||
* @package tool_availabilityconditions
|
||||
* @copyright 2014 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
if ($hassiteconfig && !empty($CFG->enableavailability)) {
|
||||
$ADMIN->add('modules', new admin_category('availabilitysettings',
|
||||
new lang_string('type_availability_plural', 'plugin')));
|
||||
$ADMIN->add('availabilitysettings', new admin_externalpage('manageavailability',
|
||||
new lang_string('manageplugins', 'tool_availabilityconditions'),
|
||||
$CFG->wwwroot . '/' . $CFG->admin . '/tool/availabilityconditions/'));
|
||||
foreach (core_plugin_manager::instance()->get_plugins_of_type('availability') as $plugin) {
|
||||
/** @var \core\plugininfo\format $plugin */
|
||||
$plugin->load_settings($ADMIN, 'availabilitysettings', $hassiteconfig);
|
||||
}
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
@tool @tool_availabilityconditions
|
||||
Feature: Manage availability conditions
|
||||
In order to control availability restrictions
|
||||
As an administrator
|
||||
I need to see the list of restrictions and hide or show them
|
||||
|
||||
@javascript
|
||||
Scenario: Display list of availability conditions
|
||||
# Check the report doesn't show when not enabled.
|
||||
Given I log in as "admin"
|
||||
And I expand "Site administration" node
|
||||
When I expand "Plugins" node
|
||||
Then I should not see "Availability restrictions"
|
||||
|
||||
# Enable it and check I can now see and click on it.
|
||||
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"
|
||||
|
||||
# Having clicked on it, I should also see the list of plugins.
|
||||
And I should see "Restriction by date"
|
||||
And I should see "Restriction by grades"
|
||||
|
||||
@javascript
|
||||
Scenario: Hide and show conditions
|
||||
# Get to the right page
|
||||
Given the following "courses" exist:
|
||||
| fullname | shortname | format |
|
||||
| Course 1 | C1 | topics |
|
||||
And I log in as "admin"
|
||||
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).
|
||||
Then "input[title=Hide]" "css_element" should exist in the "Restriction by date" "table_row"
|
||||
|
||||
# Click the icon. It should toggle to hidden (title=Show).
|
||||
And I click on "input[title=Hide]" "css_element" in the "Restriction by date" "table_row"
|
||||
And "input[title=Show]" "css_element" should exist in the "Restriction by date" "table_row"
|
||||
|
||||
# Toggle it back to visible (title=Hide).
|
||||
And I click on "input[title=Show]" "css_element" in the "Restriction by date" "table_row"
|
||||
And "input[title=Hide]" "css_element" should exist in the "Restriction by date" "table_row"
|
||||
|
||||
# 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 homepage
|
||||
And I follow "Course 1"
|
||||
And I turn editing mode on
|
||||
And I add a "Page" to section "1"
|
||||
And I expand all fieldsets
|
||||
And I click on "Add restriction..." "button"
|
||||
And "Add restriction..." "dialogue" should be visible
|
||||
And "Date" "button" should exist in the "Add restriction..." "dialogue"
|
||||
And "Grade" "button" should not exist in the "Add restriction..." "dialogue"
|
||||
@@ -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
|
||||
*
|
||||
* @package tool_availabilityconditions
|
||||
* @copyright 2014 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2014051200;
|
||||
$plugin->requires = 2014050800;
|
||||
$plugin->component = 'tool_availabilityconditions';
|
||||
@@ -78,29 +78,85 @@ if (!empty($options['help'])) {
|
||||
exit(0);
|
||||
}
|
||||
|
||||
// Describe this script.
|
||||
|
||||
// Checking $CFG->behat_* vars and values.
|
||||
define('BEHAT_UTIL', true);
|
||||
define('CLI_SCRIPT', true);
|
||||
define('ABORT_AFTER_CONFIG', true);
|
||||
define('NO_OUTPUT_BUFFERING', true);
|
||||
define('IGNORE_COMPONENT_CACHE', true);
|
||||
|
||||
// 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);
|
||||
error_reporting(E_ALL | E_STRICT);
|
||||
ini_set('display_errors', '1');
|
||||
ini_set('log_errors', '1');
|
||||
|
||||
// Finish moodle init.
|
||||
// Getting $CFG data.
|
||||
require_once(__DIR__ . '/../../../../config.php');
|
||||
|
||||
// When we use the utilities we don't know how the site
|
||||
// will be accessed, so if neither $CFG->behat_switchcompletely or
|
||||
// $CFG->behat_wwwroot are set we must think that the site will
|
||||
// be accessed using the built-in server which is set by default
|
||||
// to localhost:8000. We need to do this to prevent uses of the production
|
||||
// wwwroot when the site is being installed / dropped...
|
||||
$CFG->behat_wwwroot = behat_get_wwwroot();
|
||||
|
||||
// Checking the integrity of the provided $CFG->behat_* vars
|
||||
// to prevent conflicts with production and phpunit environments.
|
||||
behat_check_config_vars();
|
||||
|
||||
// Create behat_dataroot if it doesn't exists.
|
||||
if (!file_exists($CFG->behat_dataroot)) {
|
||||
if (!mkdir($CFG->behat_dataroot, $CFG->directorypermissions)) {
|
||||
behat_error(BEHAT_EXITCODE_PERMISSIONS, '$CFG->behat_dataroot directory can not be created');
|
||||
}
|
||||
}
|
||||
if (!is_dir($CFG->behat_dataroot) || !is_writable($CFG->behat_dataroot)) {
|
||||
behat_error(BEHAT_EXITCODE_PERMISSIONS, '$CFG->behat_dataroot directory has no permissions or is not a directory');
|
||||
}
|
||||
|
||||
// Check that the directory does not contains other things.
|
||||
if (!file_exists("$CFG->behat_dataroot/behattestdir.txt")) {
|
||||
if ($dh = opendir($CFG->behat_dataroot)) {
|
||||
while (($file = readdir($dh)) !== false) {
|
||||
if ($file === 'behat' or $file === '.' or $file === '..' or $file === '.DS_Store') {
|
||||
continue;
|
||||
}
|
||||
behat_error(BEHAT_EXITCODE_CONFIG, '$CFG->behat_dataroot directory is not empty, ensure this is the directory where you want to install behat test dataroot');
|
||||
}
|
||||
closedir($dh);
|
||||
unset($dh);
|
||||
unset($file);
|
||||
}
|
||||
|
||||
// Now we create dataroot directory structure for behat tests.
|
||||
testing_initdataroot($CFG->behat_dataroot, 'behat');
|
||||
}
|
||||
|
||||
// Overrides vars with behat-test ones.
|
||||
$vars = array('wwwroot', 'prefix', 'dataroot');
|
||||
foreach ($vars as $var) {
|
||||
$CFG->{$var} = $CFG->{'behat_' . $var};
|
||||
}
|
||||
|
||||
// Clean $CFG extra values before performing any action.
|
||||
behat_clean_init_config();
|
||||
|
||||
$CFG->noemailever = true;
|
||||
$CFG->passwordsaltmain = 'moodle';
|
||||
|
||||
$CFG->themerev = 1;
|
||||
$CFG->jsrev = 1;
|
||||
|
||||
// Unset cache and temp directories to reset them again with the new $CFG->dataroot.
|
||||
unset($CFG->cachedir);
|
||||
unset($CFG->localcachedir);
|
||||
unset($CFG->tempdir);
|
||||
|
||||
// Continues setup.
|
||||
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');
|
||||
@@ -129,7 +185,7 @@ if ($options['install']) {
|
||||
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);
|
||||
mtrace("Acceptance tests environment enabled, to run the tests use:\n " . $runtestscommand);
|
||||
} else if ($options['disable']) {
|
||||
behat_util::stop_test_mode();
|
||||
mtrace("Acceptance tests environment disabled");
|
||||
|
||||
@@ -27,11 +27,6 @@ require_once($CFG->libdir.'/adminlib.php');
|
||||
require_once($CFG->dirroot . '/' . $CFG->admin . '/tool/behat/locallib.php');
|
||||
require_once($CFG->libdir . '/behat/classes/behat_config_manager.php');
|
||||
|
||||
// This page usually takes an exceedingly long time to load, so we need to
|
||||
// increase the time limit. At present it takes about a minute on some
|
||||
// systems, but let's allow room for expansion.
|
||||
core_php_time_limit::raise(300);
|
||||
|
||||
$filter = optional_param('filter', '', PARAM_ALPHANUMEXT);
|
||||
$type = optional_param('type', false, PARAM_ALPHAEXT);
|
||||
$component = optional_param('component', '', PARAM_ALPHAEXT);
|
||||
|
||||
@@ -22,22 +22,17 @@
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
$string['aim'] = 'This administration tool helps developers and test writers to create .feature files describing Moodle\'s functionalities and run them automatically. Step definitions available for use in .feature files are listed below.';
|
||||
$string['aim'] = 'This administration tool helps developers and test writers to create .feature files describing Moodle\'s functionalities and run them automatically.';
|
||||
$string['allavailablesteps'] = 'All the available steps definitions';
|
||||
$string['errorbehatcommand'] = 'Error running behat CLI command. Try running "{$a} --help" manually from CLI to find out more about the problem.';
|
||||
$string['errorcomposer'] = 'Composer dependencies are not installed.';
|
||||
$string['errordataroot'] = '$CFG->behat_dataroot is not set or is invalid.';
|
||||
$string['errorsetconfig'] = '$CFG->behat_dataroot, $CFG->behat_prefix and $CFG->behat_wwwroot need to be set in config.php.';
|
||||
$string['erroruniqueconfig'] = '$CFG->behat_dataroot, $CFG->behat_prefix and $CFG->behat_wwwroot values need to be different than $CFG->dataroot, $CFG->prefix, $CFG->wwwroot, $CFG->phpunit_dataroot and $CFG->phpunit_prefix values.';
|
||||
$string['fieldvalueargument'] = 'Field value arguments';
|
||||
$string['fieldvalueargument_help'] = 'This argument should be completed by a field value, there are many field types, simple ones like checkboxes, selects or textareas or complex ones like date selectors. You can check <a href="http://docs.moodle.org/dev/Acceptance_testing#Providing_values_to_steps" target="_blank">Field values</a> to see the expected field value depending on the field type you provide.';
|
||||
$string['giveninfo'] = 'Given. Processes to set up the environment';
|
||||
$string['infoheading'] = 'Info';
|
||||
$string['installinfo'] = 'Read {$a} for installation and tests execution info';
|
||||
$string['moreinfoin'] = 'More info in {$a}';
|
||||
$string['newstepsinfo'] = 'Read {$a} for info about how to add new steps definitions';
|
||||
$string['newtestsinfo'] = 'Read {$a} for info about how to write new tests';
|
||||
$string['nostepsdefinitions'] = 'There aren\'t steps definitions matching this filters';
|
||||
$string['pluginname'] = 'Acceptance testing';
|
||||
$string['runclitool'] = 'To list the steps definitions you need to run the Behat CLI tool to create the $CFG->behat_dataroot directory. Go to your moodle dirroot and run "{$a}"';
|
||||
$string['stepsdefinitionscomponent'] = 'Area';
|
||||
$string['stepsdefinitionscontains'] = 'Contains';
|
||||
$string['stepsdefinitionsfilters'] = 'Steps definitions';
|
||||
@@ -46,7 +41,6 @@ $string['theninfo'] = 'Then. Checkings to ensure the outcomes are the expected o
|
||||
$string['unknownexceptioninfo'] = 'There was a problem with Selenium or your browser. Please ensure you are using the latest version of Selenium. Error:';
|
||||
$string['viewsteps'] = 'Filter';
|
||||
$string['wheninfo'] = 'When. Actions that provokes an event';
|
||||
$string['wrongbehatsetup'] = 'Something is wrong with the behat setup and so step definitions cannot be listed: <b>{$a->errormsg}</b><br/><br/>Please check:<ul>
|
||||
<li>$CFG->behat_dataroot, $CFG->behat_prefix and $CFG->behat_wwwroot are set in config.php with different values from $CFG->dataroot, $CFG->prefix and $CFG->wwwroot.</li>
|
||||
<li>You ran "{$a->behatinit}" from your Moodle root directory.</li>
|
||||
<li>Dependencies are installed in vendor/ and {$a->behatcommand} file has execution permissions.</li></ul>';
|
||||
$string['wrongbehatsetup'] = 'Something is wrong with behat setup, ensure:<ul>
|
||||
<li>You ran "php admin/tool/behat/cli/init.php" from your moodle root directory</li>
|
||||
<li>vendor/bin/behat file has execution permissions</li></ul>';
|
||||
|
||||
@@ -45,7 +45,37 @@ class tool_behat_renderer extends plugin_renderer_base {
|
||||
*/
|
||||
public function render_stepsdefinitions($stepsdefinitions, $form) {
|
||||
|
||||
$html = $this->generic_info();
|
||||
$title = get_string('pluginname', 'tool_behat');
|
||||
|
||||
// Header.
|
||||
$html = $this->output->header();
|
||||
$html .= $this->output->heading($title);
|
||||
|
||||
// Info.
|
||||
$installurl = behat_command::DOCS_URL . '#Installation';
|
||||
$installlink = html_writer::tag('a', $installurl, array('href' => $installurl, 'target' => '_blank'));
|
||||
$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'));
|
||||
$infos = array(
|
||||
get_string('installinfo', 'tool_behat', $installlink),
|
||||
get_string('newtestsinfo', 'tool_behat', $writetestslink),
|
||||
get_string('newstepsinfo', 'tool_behat', $writestepslink)
|
||||
);
|
||||
|
||||
// List of steps.
|
||||
$html .= $this->output->box_start();
|
||||
$html .= html_writer::tag('h1', get_string('infoheading', 'tool_behat'));
|
||||
$html .= html_writer::tag('div', get_string('aim', 'tool_behat'));
|
||||
$html .= html_writer::empty_tag('div');
|
||||
$html .= html_writer::empty_tag('ul');
|
||||
$html .= html_writer::empty_tag('li');
|
||||
$html .= implode(html_writer::end_tag('li') . html_writer::empty_tag('li'), $infos);
|
||||
$html .= html_writer::end_tag('li');
|
||||
$html .= html_writer::end_tag('ul');
|
||||
$html .= html_writer::end_tag('div');
|
||||
$html .= $this->output->box_end();
|
||||
|
||||
// Form.
|
||||
ob_start();
|
||||
@@ -84,33 +114,6 @@ class tool_behat_renderer extends plugin_renderer_base {
|
||||
$stepsdefinitions
|
||||
);
|
||||
|
||||
$stepsdefinitions = preg_replace_callback('/(FIELD_VALUE_STRING)/',
|
||||
function ($matches) {
|
||||
global $CFG;
|
||||
|
||||
// Creating a link to a popup with the help.
|
||||
$url = new moodle_url(
|
||||
'/help.php',
|
||||
array(
|
||||
'component' => 'tool_behat',
|
||||
'identifier' => 'fieldvalueargument',
|
||||
'lang' => current_language()
|
||||
)
|
||||
);
|
||||
|
||||
// Note: this title is displayed only if JS is disabled,
|
||||
// otherwise the link will have the new ajax tooltip.
|
||||
$title = get_string('fieldvalueargument', 'tool_behat');
|
||||
$title = get_string('helpprefix2', '', trim($title, ". \t"));
|
||||
|
||||
$attributes = array('href' => $url, 'title' => $title,
|
||||
'aria-haspopup' => 'true', 'target' => '_blank');
|
||||
|
||||
$output = html_writer::tag('a', 'FIELD_VALUE_STRING', $attributes);
|
||||
return html_writer::tag('span', $output, array('class' => 'helptooltip'));
|
||||
},
|
||||
$stepsdefinitions
|
||||
);
|
||||
}
|
||||
|
||||
// Steps definitions.
|
||||
@@ -120,75 +123,4 @@ class tool_behat_renderer extends plugin_renderer_base {
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders an error message adding the generic info about the tool purpose and setup.
|
||||
*
|
||||
* @param string $msg The error message
|
||||
* @return string HTML
|
||||
*/
|
||||
public function render_error($msg) {
|
||||
|
||||
$html = $this->generic_info();
|
||||
|
||||
$a = new stdClass();
|
||||
$a->errormsg = $msg;
|
||||
$a->behatcommand = behat_command::get_behat_command();
|
||||
$a->behatinit = 'php admin' . DIRECTORY_SEPARATOR . 'tool' . DIRECTORY_SEPARATOR .
|
||||
'behat' . DIRECTORY_SEPARATOR . 'cli' . DIRECTORY_SEPARATOR . 'init.php';
|
||||
|
||||
$msg = get_string('wrongbehatsetup', 'tool_behat', $a);
|
||||
|
||||
// Error box including generic error string + specific error msg.
|
||||
$html .= $this->output->box_start('box errorbox');
|
||||
$html .= html_writer::tag('div', $msg);
|
||||
$html .= $this->output->box_end();
|
||||
|
||||
$html .= $this->output->footer();
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generic info about the tool.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function generic_info() {
|
||||
|
||||
$title = get_string('pluginname', 'tool_behat');
|
||||
|
||||
// Header.
|
||||
$html = $this->output->header();
|
||||
$html .= $this->output->heading($title);
|
||||
|
||||
// Info.
|
||||
$installurl = behat_command::DOCS_URL . '#Installation';
|
||||
$installlink = html_writer::tag('a', $installurl, array('href' => $installurl, 'target' => '_blank'));
|
||||
$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'));
|
||||
$infos = array(
|
||||
get_string('installinfo', 'tool_behat', $installlink),
|
||||
get_string('newtestsinfo', 'tool_behat', $writetestslink),
|
||||
get_string('newstepsinfo', 'tool_behat', $writestepslink)
|
||||
);
|
||||
|
||||
// List of steps.
|
||||
$html .= $this->output->box_start();
|
||||
$html .= html_writer::tag('h3', get_string('infoheading', 'tool_behat'));
|
||||
$html .= html_writer::tag('div', get_string('aim', 'tool_behat'));
|
||||
$html .= html_writer::start_tag('div');
|
||||
$html .= html_writer::start_tag('ul');
|
||||
$html .= html_writer::start_tag('li');
|
||||
$html .= implode(html_writer::end_tag('li') . html_writer::start_tag('li'), $infos);
|
||||
$html .= html_writer::end_tag('li');
|
||||
$html .= html_writer::end_tag('ul');
|
||||
$html .= html_writer::end_tag('div');
|
||||
$html .= $this->output->box_end();
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ Feature: Page contents assertions
|
||||
And I expand "Users" node
|
||||
And I follow "Groups"
|
||||
And I press "Create group"
|
||||
And I set the following fields to these values:
|
||||
And I fill the moodle form with:
|
||||
| Group name | I'm the name |
|
||||
| Group description | I'm the description |
|
||||
And I press "Save changes"
|
||||
@@ -34,20 +34,20 @@ Feature: Page contents assertions
|
||||
|
||||
@javascript
|
||||
Scenario: Locators inside specific DOM nodes using CSS selectors
|
||||
Given the following "courses" exist:
|
||||
Given the following "courses" exists:
|
||||
| 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"
|
||||
Then I should not see "Question bank" in the "region-pre" "region"
|
||||
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:
|
||||
Given the following "courses" exists:
|
||||
| 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"
|
||||
Then I should not see "Turn editing on" in the "region-pre" "region"
|
||||
|
||||
@@ -5,7 +5,7 @@ Feature: Set up contextual data for tests
|
||||
I need to fill the database with fixtures
|
||||
|
||||
Scenario: Add a bunch of users
|
||||
Given the following "users" exist:
|
||||
Given the following "users" exists:
|
||||
| username | password | firstname | lastname |
|
||||
| testuser | testuser | | |
|
||||
| testuser2 | testuser2 | TestFirstname | TestLastname |
|
||||
@@ -16,12 +16,12 @@ Feature: Set up contextual data for tests
|
||||
|
||||
@javascript
|
||||
Scenario: Add a bunch of courses and categories
|
||||
Given the following "categories" exist:
|
||||
Given the following "categories" exists:
|
||||
| name | category | idnumber |
|
||||
| Cat 1 | 0 | CAT1 |
|
||||
| Cat 2 | CAT1 | CAT2 |
|
||||
| Cat 3 | CAT1 | CAT3 |
|
||||
And the following "courses" exist:
|
||||
And the following "courses" exists:
|
||||
| fullname | shortname | category |
|
||||
| Course 1 | COURSE1 | CAT3 |
|
||||
| Course 2 | COURSE2 | CAT3 |
|
||||
@@ -44,14 +44,14 @@ Feature: Set up contextual data for tests
|
||||
|
||||
@javascript
|
||||
Scenario: Add a bunch of groups and groupings
|
||||
Given the following "courses" exist:
|
||||
Given the following "courses" exists:
|
||||
| fullname | shortname |
|
||||
| Course 1 | C1 |
|
||||
And the following "groups" exist:
|
||||
And the following "groups" exists:
|
||||
| name | course | idnumber |
|
||||
| Group 1 | C1 | G1 |
|
||||
| Group 2 | C1 | G2 |
|
||||
And the following "groupings" exist:
|
||||
And the following "groupings" exists:
|
||||
| name | course | idnumber |
|
||||
| Grouping 1 | C1 | GG1 |
|
||||
| Grouping 2 | C1 | GG2 |
|
||||
@@ -67,21 +67,21 @@ Feature: Set up contextual data for tests
|
||||
|
||||
@javascript
|
||||
Scenario: Role overrides
|
||||
Given the following "users" exist:
|
||||
Given the following "users" exists:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher1 | Teacher | 1 | teacher1@asd.com |
|
||||
| student1 | Student | 1 | student1@asd.com |
|
||||
And the following "categories" exist:
|
||||
And the following "categories" exists:
|
||||
| name | category | idnumber |
|
||||
| Cat 1 | 0 | CAT1 |
|
||||
And the following "courses" exist:
|
||||
And the following "courses" exists:
|
||||
| fullname | shortname |
|
||||
| Course 1 | C1 |
|
||||
And the following "course enrolments" exist:
|
||||
And the following "course enrolments" exists:
|
||||
| user | course | role |
|
||||
| student1 | C1 | student |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
And the following "permission overrides" exist:
|
||||
And the following "permission overrides" exists:
|
||||
| capability | permission | role | contextlevel | reference |
|
||||
| mod/forum:editanypost | Allow | student | Course | C1 |
|
||||
| mod/forum:replynews | Prevent | editingteacher | Course | C1 |
|
||||
@@ -89,21 +89,21 @@ Feature: Set up contextual data for tests
|
||||
And I follow "Course 1"
|
||||
And I expand "Users" node
|
||||
And I follow "Permissions"
|
||||
And I set the field "Advanced role override" to "Student (1)"
|
||||
And I select "Student (1)" from "Advanced role override"
|
||||
Then "mod/forum:editanypost" capability has "Allow" permission
|
||||
And I press "Cancel"
|
||||
And I set the field "Advanced role override" to "Teacher (1)"
|
||||
And I select "Teacher (1)" from "Advanced role override"
|
||||
And "mod/forum:replynews" capability has "Prevent" permission
|
||||
And I press "Cancel"
|
||||
|
||||
Scenario: Add course enrolments
|
||||
Given the following "users" exist:
|
||||
Given the following "users" exists:
|
||||
| username | firstname | lastname | email |
|
||||
| student1 | Student | 1 | student1@asd.com |
|
||||
And the following "courses" exist:
|
||||
And the following "courses" exists:
|
||||
| fullname | shortname | format |
|
||||
| Course 1 | C1 | topics |
|
||||
And the following "course enrolments" exist:
|
||||
And the following "course enrolments" exists:
|
||||
| user | course | role |
|
||||
| student1 | C1 | student |
|
||||
When I log in as "student1"
|
||||
@@ -111,32 +111,22 @@ Feature: Set up contextual data for tests
|
||||
Then I should see "Topic 1"
|
||||
|
||||
Scenario: Add role assigns
|
||||
Given the following "roles" exist:
|
||||
| name | shortname | description | archetype |
|
||||
| Custom editing teacher | custom1 | My custom role 1 | editingteacher |
|
||||
| Custom student | custom2 | | |
|
||||
And the following "users" exist:
|
||||
Given the following "users" exists:
|
||||
| username | firstname | lastname | email |
|
||||
| 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:
|
||||
And the following "categories" exists:
|
||||
| name | category | idnumber |
|
||||
| Cat 1 | 0 | CAT1 |
|
||||
And the following "courses" exist:
|
||||
And the following "courses" exists:
|
||||
| fullname | shortname | category |
|
||||
| Course 1 | C1 | CAT1 |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| user4 | C1 | custom1 |
|
||||
And the following "role assigns" exist:
|
||||
And the following "role assigns" exists:
|
||||
| user | role | contextlevel | reference |
|
||||
| user1 | manager | System | |
|
||||
| user2 | editingteacher | Category | CAT1 |
|
||||
| user3 | editingteacher | Course | C1 |
|
||||
| user5 | custom2 | System | |
|
||||
When I log in as "user1"
|
||||
Then I should see "Front page settings"
|
||||
And I log out
|
||||
@@ -147,21 +137,12 @@ Feature: Set up contextual data for tests
|
||||
And I log in as "user3"
|
||||
And I follow "Course 1"
|
||||
And I should see "Turn editing on"
|
||||
And I log out
|
||||
And I log in as "user4"
|
||||
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 follow "Course 1"
|
||||
And I should see "You can not enrol yourself in this course."
|
||||
|
||||
Scenario: Add modules
|
||||
Given the following "courses" exist:
|
||||
Given the following "courses" exists:
|
||||
| fullname | shortname |
|
||||
| Course 1 | C1 |
|
||||
And the following "activities" exist:
|
||||
And the following "activities" exists:
|
||||
| activity | name | intro | course | idnumber |
|
||||
| assign | Test assignment name | Test assignment description | C1 | assign1 |
|
||||
| assignment | Test assignment22 name | Test assignment22 description | C1 | assignment1 |
|
||||
@@ -217,29 +198,29 @@ Feature: Set up contextual data for tests
|
||||
|
||||
@javascript
|
||||
Scenario: Add relations between users and groups
|
||||
Given the following "users" exist:
|
||||
Given the following "users" exists:
|
||||
| username | firstname | lastname | email |
|
||||
| student1 | Student | 1 | student1@asd.com |
|
||||
| student2 | Student | 2 | student2@asd.com |
|
||||
And the following "courses" exist:
|
||||
And the following "courses" exists:
|
||||
| fullname | shortname |
|
||||
| Course 1 | C1 |
|
||||
And the following "groups" exist:
|
||||
And the following "groups" exists:
|
||||
| name | course | idnumber |
|
||||
| Group 1 | C1 | G1 |
|
||||
| Group 2 | C1 | G2 |
|
||||
And the following "groupings" exist:
|
||||
And the following "groupings" exists:
|
||||
| name | course | idnumber |
|
||||
| Grouping 1 | C1 | GG1 |
|
||||
And the following "course enrolments" exist:
|
||||
And the following "course enrolments" exists:
|
||||
| user | course | role |
|
||||
| student1 | C1 | student |
|
||||
| student2 | C1 | student |
|
||||
And the following "group members" exist:
|
||||
And the following "group members" exists:
|
||||
| user | group |
|
||||
| student1 | G1 |
|
||||
| student2 | G2 |
|
||||
And the following "grouping groups" exist:
|
||||
And the following "grouping groups" exists:
|
||||
| grouping | group |
|
||||
| GG1 | G1 |
|
||||
When I log in as "admin"
|
||||
@@ -248,29 +229,7 @@ Feature: Set up contextual data for tests
|
||||
And I follow "Groups"
|
||||
Then the "groups" select box should contain "Group 1 (1)"
|
||||
And the "groups" select box should contain "Group 2 (1)"
|
||||
And I set the field "groups" to "Group 1 (1)"
|
||||
And I select "Group 1 (1)" from "groups"
|
||||
And the "members" select box should contain "Student 1"
|
||||
And I set the field "groups" to "Group 2 (1)"
|
||||
And I select "Group 2 (1)" from "groups"
|
||||
And the "members" select box should contain "Student 2"
|
||||
|
||||
Scenario: Add cohorts with data generator
|
||||
Given the following "categories" exist:
|
||||
| name | category | idnumber |
|
||||
| Cat 1 | 0 | CAT1 |
|
||||
And the following "cohorts" exist:
|
||||
| name | idnumber |
|
||||
| System cohort 1 | CH01 |
|
||||
And the following "cohorts" exist:
|
||||
| name | idnumber | contextlevel | reference |
|
||||
| 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 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"
|
||||
|
||||
@@ -5,13 +5,13 @@ Feature: Edit capabilities
|
||||
I need to allow/deny the existing capabilities at different levels
|
||||
|
||||
Background:
|
||||
Given the following "users" exist:
|
||||
Given the following "users" exists:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher1 | Teacher | 1 | teacher1@asd.com |
|
||||
And the following "courses" exist:
|
||||
And the following "courses" exists:
|
||||
| fullname | shortname | category |
|
||||
| Course 1 | C1 | 0 |
|
||||
And the following "course enrolments" exist:
|
||||
And the following "course enrolments" exists:
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
|
||||
@@ -40,7 +40,7 @@ Feature: Edit capabilities
|
||||
| mod/forum:deleteanypost | Prohibit |
|
||||
| mod/forum:editanypost | Prevent |
|
||||
| mod/forum:addquestion | Allow |
|
||||
When I set the field "Advanced role override" to "Student (3)"
|
||||
When I select "Student (3)" from "Advanced role override"
|
||||
Then "mod/forum:deleteanypost" capability has "Prohibit" permission
|
||||
And "mod/forum:editanypost" capability has "Prevent" permission
|
||||
And "mod/forum:addquestion" capability has "Allow" permission
|
||||
@@ -59,7 +59,7 @@ Feature: Edit capabilities
|
||||
| mod/forum:deleteanypost | Prohibit |
|
||||
| mod/forum:editanypost | Prevent |
|
||||
| mod/forum:addquestion | Allow |
|
||||
When I set the field "Advanced role override" to "Student (3)"
|
||||
When I select "Student (3)" from "Advanced role override"
|
||||
Then "mod/forum:deleteanypost" capability has "Prohibit" permission
|
||||
And "mod/forum:editanypost" capability has "Prevent" permission
|
||||
And "mod/forum:addquestion" capability has "Allow" permission
|
||||
|
||||
@@ -5,39 +5,39 @@ Feature: Verify that all form fields values can be get and set
|
||||
I need to verify it all works in real moodle forms
|
||||
|
||||
Background:
|
||||
Given the following "courses" exist:
|
||||
Given the following "courses" exists:
|
||||
| fullname | shortname | category |
|
||||
| Course 1 | C1 | 0 |
|
||||
And the following "users" exist:
|
||||
And the following "users" exists:
|
||||
| username | email | firstname | lastname |
|
||||
| student1 | s1@asd.com | Student | 1 |
|
||||
| student2 | s2@asd.com | Student | 2 |
|
||||
| student3 | s3@asd.com | Student | 3 |
|
||||
And the following "course enrolments" exist:
|
||||
And the following "course enrolments" exists:
|
||||
| user | course | role |
|
||||
| student1 | C1 | student |
|
||||
| student2 | C1 | student |
|
||||
| student3 | C1 | student |
|
||||
| admin | C1 | editingteacher |
|
||||
And the following "groups" exist:
|
||||
And the following "groups" exists:
|
||||
| name | description | course | idnumber |
|
||||
| Group 1 | G1 description | C1 | G1 |
|
||||
| Group 2 | G1 description | C1 | G2 |
|
||||
And the following "group members" exist:
|
||||
And the following "group members" exists:
|
||||
| user | group |
|
||||
| student1 | G1 |
|
||||
| student2 | G1 |
|
||||
| student2 | G2 |
|
||||
| student3 | G2 |
|
||||
And the following "activities" exist:
|
||||
And the following "activities" exists:
|
||||
| activity | course | idnumber | name | intro | firstpagetitle | wikimode | visible |
|
||||
| wiki | C1 | wiki1 | Test this one | Test this one | Test this one | collaborative | 0 |
|
||||
And I log in as "admin"
|
||||
And I expand "Site administration" node
|
||||
And I expand "Appearance" node
|
||||
And I follow "Manage tags"
|
||||
# Select (multi-select) - We will check "I set the field...".
|
||||
And I set the field "otagsadd" to "OT1, OT2, OT3, OT4, OT5"
|
||||
# Select (multi-select) - We will check "I fill in...".
|
||||
And I fill in "otagsadd" with "OT1, OT2, OT3, OT4, OT5"
|
||||
And I press "Add official tags"
|
||||
And I am on homepage
|
||||
And I follow "Course 1"
|
||||
@@ -55,8 +55,8 @@ Feature: Verify that all form fields values can be get and set
|
||||
And the "tags[officialtags][]" select box should not contain "OT6"
|
||||
And the "tags[officialtags][]" select box should not contain "OT7"
|
||||
And the "tags[officialtags][]" select box should not contain "OT6, OT7"
|
||||
# Text (textarea & editor) & Select (multi-select) - Checking "I set the following fields to these values".
|
||||
When I set the following fields to these values:
|
||||
# Text (textarea & editor) & Select (multi-select) - Checking "I fill the moodle form with".
|
||||
When I fill the moodle form with:
|
||||
| HTML format | Student page contents to be tagged |
|
||||
| tags[officialtags][] | OT1, OT3, OT5 |
|
||||
And I press "Save"
|
||||
@@ -67,8 +67,8 @@ Feature: Verify that all form fields values can be get and set
|
||||
And I should not see "OT2" in the ".wiki-tags" "css_element"
|
||||
And I should not see "OT4" in the ".wiki-tags" "css_element"
|
||||
And I follow "Edit"
|
||||
# Select (multi-select) - Checking "I set the field".
|
||||
And I set the field "tags[officialtags][]" to "OT2, OT4"
|
||||
# Select (multi-select) - Checking "I select from".
|
||||
And I select "OT2, OT4" from "tags[officialtags][]"
|
||||
And I press "Save"
|
||||
And I should see "OT2" in the ".wiki-tags" "css_element"
|
||||
And I should see "OT4" in the ".wiki-tags" "css_element"
|
||||
@@ -76,40 +76,40 @@ Feature: Verify that all form fields values can be get and set
|
||||
And I should not see "OT3" in the ".wiki-tags" "css_element"
|
||||
And I should not see "OT5" in the ".wiki-tags" "css_element"
|
||||
And I follow "Edit"
|
||||
# Select (multi-select) - Checking "the field matches value" and "the field does not match value".
|
||||
And the field "tags[officialtags][]" matches value "OT2, OT4"
|
||||
# Select (multi-select) - Checking "the field should match" and "the field does not match value".
|
||||
And the "tags[officialtags][]" field should match "OT2, OT4" value
|
||||
And the field "tags[officialtags][]" does not match value "OT4"
|
||||
And the field "tags[officialtags][]" does not match value "OT2"
|
||||
And the field "tags[officialtags][]" does not match value "OT1, OT3, OT5"
|
||||
And I press "Cancel"
|
||||
And I follow "Edit settings"
|
||||
And I expand all fieldsets
|
||||
# Checkbox - Checking "I set the field".
|
||||
And I set the field "Display description on course page" to "1"
|
||||
# Checkbox - Checking "I set the following fields to these values:".
|
||||
And I set the following fields to these values:
|
||||
# Checkbox - Checking "I check".
|
||||
And I check "Display description on course page"
|
||||
# Checkbox - Checking "I fill the moodle form with:".
|
||||
And I fill the moodle form with:
|
||||
| Force format | 1 |
|
||||
# Checkbox - Checking "the field matches value" and "the field does not match value".
|
||||
And the field "Display description on course page" matches value "1"
|
||||
# Checkbox - Checking "the field should match" and "the field does not match value".
|
||||
And the "Display description on course page" field should match "1" value
|
||||
And the field "Display description on course page" does not match value ""
|
||||
And I press "Save and return to course"
|
||||
And I should see "Test this one"
|
||||
And I follow "Test this one"
|
||||
And I follow "Edit settings"
|
||||
# Checkbox - Checking "the field matches value" and "the following fields match these values".
|
||||
# Checkbox - Checking "the field should match" and "the following fields match these values".
|
||||
And the following fields match these values:
|
||||
| Display description on course page | 1 |
|
||||
| Default format | HTML |
|
||||
| Wiki name | Test this one |
|
||||
And the field "Force format" matches value "1"
|
||||
# Select (simple) - Checking "I set the following fields to these values:".
|
||||
And I set the following fields to these values:
|
||||
And the "Force format" field should match "1" value
|
||||
# Select (simple) - Checking "I fill the moodle form with:".
|
||||
And I fill the moodle form with:
|
||||
| Default format | NWiki |
|
||||
| Display description on course page | |
|
||||
# Checkbox - Checking "I set the field" to uncheck.
|
||||
And I set the field "Force format" to ""
|
||||
# Select (simple) - Checking "I set the field".
|
||||
And I set the field "Group mode" to "Separate groups"
|
||||
# Checkbox - Checking "I uncheck".
|
||||
And I uncheck "Force format"
|
||||
# Select (simple) - Checking "I select from".
|
||||
And I select "Separate groups" from "Group mode"
|
||||
And I press "Save and display"
|
||||
And I follow "Edit settings"
|
||||
And the following fields match these values:
|
||||
@@ -124,7 +124,7 @@ Feature: Verify that all form fields values can be get and set
|
||||
| Force format | 1 |
|
||||
And I press "Cancel"
|
||||
And I follow "Course 1"
|
||||
# Radio - Checking "I set the field" and "the field matches value".
|
||||
# Radio - Checking "I check" and "the field should match".
|
||||
And I add a "Choice" to section "1" and I fill the form with:
|
||||
| Choice name | Test choice name |
|
||||
| Description | Test choice description |
|
||||
@@ -133,10 +133,10 @@ Feature: Verify that all form fields values can be get and set
|
||||
| Option 2 | two |
|
||||
| Option 3 | three |
|
||||
And I follow "Test choice name"
|
||||
And I set the field "one" to "1"
|
||||
And I check "one"
|
||||
And I press "Save my choice"
|
||||
And the field "one" matches value "1"
|
||||
And the field "two" matches value ""
|
||||
And the "one" field should match "1" value
|
||||
And the "two" field should match "" value
|
||||
|
||||
Scenario: with JS disabled all form fields getters and setters works as expected
|
||||
|
||||
@@ -145,29 +145,29 @@ Feature: Verify that all form fields values can be get and set
|
||||
Then I follow "Course 1"
|
||||
And I expand "Users" node
|
||||
And I follow "Groups"
|
||||
# Select (multi-select & AJAX) - Checking "I set the field" and "select box should contain".
|
||||
And I set the field "groups" to "Group 2"
|
||||
# Select (multi-select & AJAX) - Checking "I select from" and "select box should contain".
|
||||
And I select "Group 2" from "groups"
|
||||
And the "members" select box should contain "Student 2"
|
||||
And the "members" select box should contain "Student 3"
|
||||
And the "members" select box should not contain "Student 1"
|
||||
And I set the field "groups" to "Group 1"
|
||||
And I select "Group 1" from "groups"
|
||||
And the "members" select box should contain "Student 1"
|
||||
And the "members" select box should contain "Student 2"
|
||||
And the "members" select box should not contain "Student 3"
|
||||
# Checkbox (AJAX) - Checking "I set the field" and "I set the following fields to these values".
|
||||
# Checkbox (AJAX) - Checking "I check" and "I fill the moodle form with".
|
||||
And I follow "Course 1"
|
||||
And I add a "Lesson" to section "1"
|
||||
And I set the following fields to these values:
|
||||
And I fill the moodle form with:
|
||||
| Name | Test lesson |
|
||||
| available[enabled] | 1 |
|
||||
And I set the field "deadline[enabled]" to "1"
|
||||
# Checkbox (AJAX) - Checking "the field matches value" before saving.
|
||||
And the field "available[enabled]" matches value "1"
|
||||
And I check "deadline[enabled]"
|
||||
# Checkbox (AJAX) - Checking "field should match" before saving.
|
||||
And the "available[enabled]" field should match "1" value
|
||||
And the "available[day]" "field" should be enabled
|
||||
And the field "deadline[enabled]" matches value "1"
|
||||
And the "deadline[enabled]" field should match "1" value
|
||||
And I press "Save and display"
|
||||
And I follow "Edit settings"
|
||||
And the field "available[enabled]" matches value "1"
|
||||
And the "available[enabled]" field should match "1" value
|
||||
And the "available[day]" "field" should be enabled
|
||||
And the field "deadline[enabled]" matches value "1"
|
||||
And the "deadline[enabled]" field should match "1" value
|
||||
And I press "Cancel"
|
||||
|
||||
@@ -7,7 +7,9 @@ Feature: List the system steps definitions
|
||||
Background:
|
||||
Given I am on homepage
|
||||
And I log in as "admin"
|
||||
And I navigate to "Acceptance testing" node in "Site administration > Development"
|
||||
And I expand "Site administration" node
|
||||
And I expand "Development" node
|
||||
And I follow "Acceptance testing"
|
||||
|
||||
@javascript
|
||||
Scenario: Accessing the list
|
||||
@@ -16,14 +18,14 @@ Feature: List the system steps definitions
|
||||
|
||||
@javascript
|
||||
Scenario: Filtering by type
|
||||
Given I set the field "Type" to "Then. Checkings to ensure the outcomes are the expected ones"
|
||||
Given I select "Then. Checkings to ensure the outcomes are the expected ones" from "Type"
|
||||
When I press "Filter"
|
||||
Then I should see "Checks, that page contains specified text."
|
||||
And I should not see "Opens Moodle homepage."
|
||||
|
||||
@javascript
|
||||
Scenario: Filtering by keyword
|
||||
Given I set the field "Contains" to "homepage"
|
||||
Given I fill in "Contains" with "homepage"
|
||||
When I press "Filter"
|
||||
Then I should see "Opens Moodle homepage."
|
||||
|
||||
|
||||
@@ -7,20 +7,21 @@ Feature: Forms manipulation
|
||||
@javascript
|
||||
Scenario: Basic forms manipulation
|
||||
Given I log in as "admin"
|
||||
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 "Text editor" to "Plain text area"
|
||||
And I set the field "Unmask" to "1"
|
||||
Then the field "First name" matches value "Field value"
|
||||
And I follow "Admin User"
|
||||
And I follow "Edit profile"
|
||||
When I fill in "First name" with "Field value"
|
||||
And I select "Plain text area" from "Text editor"
|
||||
And I check "Unmask"
|
||||
Then the "First name" field should match "Field value" value
|
||||
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 ""
|
||||
And the "Unmask" checkbox should be checked
|
||||
And I uncheck "Unmask"
|
||||
And the "Unmask" checkbox should not be checked
|
||||
And I press "Update profile"
|
||||
|
||||
@javascript
|
||||
Scenario: Expand all fieldsets and advanced elements
|
||||
Given the following "courses" exist:
|
||||
Given the following "courses" exists:
|
||||
| fullname | shortname | category |
|
||||
| Course 1 | C1 | 0 |
|
||||
And I log in as "admin"
|
||||
|
||||
@@ -6,54 +6,55 @@ Feature: Transform steps arguments
|
||||
|
||||
Background:
|
||||
Given I am on homepage
|
||||
And the following "courses" exist:
|
||||
And the following "courses" exists:
|
||||
| fullname | shortname | category |
|
||||
| Course 1 | C1 | 0 |
|
||||
And I log in as "admin"
|
||||
And I navigate to "Edit profile" node in "My profile settings"
|
||||
And I follow "Admin User"
|
||||
And I follow "Edit profile"
|
||||
|
||||
Scenario: Use nasty strings on steps arguments
|
||||
When I set the field "Surname" to "$NASTYSTRING1"
|
||||
And I set the field "Description" to "$NASTYSTRING2"
|
||||
And I set the field "City/town" to "$NASTYSTRING3"
|
||||
When I fill in "Surname" with "$NASTYSTRING1"
|
||||
And I fill in "Description" with "$NASTYSTRING2"
|
||||
And I fill in "City/town" with "$NASTYSTRING3"
|
||||
And I press "Update profile"
|
||||
And I follow "Edit profile"
|
||||
Then I should not see "NASTYSTRING"
|
||||
And the field "Surname" matches value "$NASTYSTRING1"
|
||||
And the field "City/town" matches value "$NASTYSTRING3"
|
||||
And the "Surname" field should match "$NASTYSTRING1" value
|
||||
And the "City/town" field should match "$NASTYSTRING3" value
|
||||
|
||||
Scenario: Use nasty strings on table nodes
|
||||
When I set the following fields to these values:
|
||||
When I fill the moodle form with:
|
||||
| Surname | $NASTYSTRING1 |
|
||||
| Description | $NASTYSTRING2 |
|
||||
| City/town | $NASTYSTRING3 |
|
||||
And I press "Update profile"
|
||||
And I follow "Edit profile"
|
||||
Then I should not see "NASTYSTRING"
|
||||
And the field "Surname" matches value "$NASTYSTRING1"
|
||||
And the field "City/town" matches value "$NASTYSTRING3"
|
||||
And the "Surname" field should match "$NASTYSTRING1" value
|
||||
And the "City/town" field should match "$NASTYSTRING3" value
|
||||
|
||||
Scenario: Use double quotes
|
||||
When I set the following fields to these values:
|
||||
When I fill the moodle form with:
|
||||
| First name | va"lue1 |
|
||||
| Description | va\"lue2 |
|
||||
And I set the field "City/town" to "va\"lue3"
|
||||
And I fill in "City/town" with "va\"lue3"
|
||||
And I press "Update profile"
|
||||
And I follow "Edit profile"
|
||||
Then I should not see "NASTYSTRING"
|
||||
And the field "First name" matches value "va\"lue1"
|
||||
And the field "Description" matches value "va\\"lue2"
|
||||
And the field "City/town" matches value "va\"lue3"
|
||||
And the "First name" field should match "va\"lue1" value
|
||||
And the "Description" field should match "va\\"lue2" value
|
||||
And the "City/town" field should match "va\"lue3" value
|
||||
|
||||
@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:
|
||||
When I fill in "First name" with "My Firstname $NASTYSTRING1"
|
||||
And I fill the moodle form with:
|
||||
| Surname | My Surname $NASTYSTRING2 |
|
||||
And I press "Update profile"
|
||||
And I follow "Edit profile"
|
||||
Then I should not see "NASTYSTRING"
|
||||
And I should see "My Firstname"
|
||||
And I should see "My Surname"
|
||||
And the field "First name" matches value "My Firstname $NASTYSTRING1"
|
||||
And the field "Surname" matches value "My Surname $NASTYSTRING2"
|
||||
And the "First name" field should match "My Firstname $NASTYSTRING1" value
|
||||
And the "Surname" field should match "My Surname $NASTYSTRING2" value
|
||||
|
||||
@@ -1,193 +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 behat manager.
|
||||
*
|
||||
* @package tool_behat
|
||||
* @copyright 2012 David Monllaó
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
global $CFG;
|
||||
require_once($CFG->dirroot . '/' . $CFG->admin .'/tool/behat/locallib.php');
|
||||
require_once($CFG->libdir . '/behat/classes/util.php');
|
||||
require_once($CFG->libdir . '/behat/classes/behat_config_manager.php');
|
||||
|
||||
/**
|
||||
* Behat manager tests.
|
||||
*
|
||||
* @package tool_behat
|
||||
* @copyright 2012 David Monllaó
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class tool_behat_manager_testcase extends advanced_testcase {
|
||||
|
||||
/**
|
||||
* behat_config_manager tests.
|
||||
*/
|
||||
public function test_merge_configs() {
|
||||
|
||||
// Simple default config.
|
||||
$array1 = array(
|
||||
'the' => 'same',
|
||||
'simple' => 'value',
|
||||
'array' => array(
|
||||
'one' => 'arrayvalue1',
|
||||
'two' => 'arrayvalue2'
|
||||
)
|
||||
);
|
||||
|
||||
// Simple override.
|
||||
$array2 = array(
|
||||
'simple' => 'OVERRIDDEN1',
|
||||
'array' => array(
|
||||
'one' => 'OVERRIDDEN2'
|
||||
),
|
||||
'newprofile' => array(
|
||||
'anotherlevel' => array(
|
||||
'andanotherone' => array(
|
||||
'list1',
|
||||
'list2'
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$array = testable_behat_config_manager::merge_config($array1, $array2);
|
||||
|
||||
// Overrides are applied.
|
||||
$this->assertEquals('OVERRIDDEN1', $array['simple']);
|
||||
$this->assertEquals('OVERRIDDEN2', $array['array']['one']);
|
||||
|
||||
// Other values are respected.
|
||||
$this->assertNotEmpty($array['array']['two']);
|
||||
|
||||
// Completely new nodes are added.
|
||||
$this->assertNotEmpty($array['newprofile']);
|
||||
$this->assertNotEmpty($array['newprofile']['anotherlevel']['andanotherone']);
|
||||
$this->assertEquals('list1', $array['newprofile']['anotherlevel']['andanotherone'][0]);
|
||||
$this->assertEquals('list2', $array['newprofile']['anotherlevel']['andanotherone'][1]);
|
||||
|
||||
// Complex override changing vectors to scalars and scalars to vectors.
|
||||
$array2 = array(
|
||||
'simple' => array(
|
||||
'simple' => 'should',
|
||||
'be' => 'overridden',
|
||||
'by' => 'this-array'
|
||||
),
|
||||
'array' => 'one'
|
||||
);
|
||||
|
||||
$array = testable_behat_config_manager::merge_config($array1, $array2);
|
||||
|
||||
// Overrides applied.
|
||||
$this->assertNotEmpty($array['simple']);
|
||||
$this->assertNotEmpty($array['array']);
|
||||
$this->assertTrue(is_array($array['simple']));
|
||||
$this->assertFalse(is_array($array['array']));
|
||||
|
||||
// Other values are maintained.
|
||||
$this->assertEquals('same', $array['the']);
|
||||
}
|
||||
|
||||
/**
|
||||
* behat_config_manager tests.
|
||||
*/
|
||||
public function test_config_file_contents() {
|
||||
global $CFG;
|
||||
|
||||
// Skip tests if behat is not installed.
|
||||
$vendorpath = $CFG->dirroot . '/vendor';
|
||||
if (!file_exists($vendorpath . '/autoload.php') || !is_dir($vendorpath . '/behat')) {
|
||||
$this->markTestSkipped('Behat not installed.');
|
||||
}
|
||||
|
||||
// Add some fake test url.
|
||||
$CFG->behat_wwwroot = 'http://example.com/behat';
|
||||
|
||||
// To avoid user value at config.php level.
|
||||
unset($CFG->behat_config);
|
||||
|
||||
// List.
|
||||
$features = array(
|
||||
'feature1',
|
||||
'feature2',
|
||||
'feature3'
|
||||
);
|
||||
|
||||
// Associative array.
|
||||
$stepsdefinitions = array(
|
||||
'micarro' => '/me/lo/robaron',
|
||||
'anoche' => '/cuando/yo/dormia'
|
||||
);
|
||||
|
||||
$contents = testable_behat_config_manager::get_config_file_contents($features, $stepsdefinitions);
|
||||
|
||||
// YAML decides when is is necessary to wrap strings between single quotes, so not controlled
|
||||
// values like paths should not be asserted including the key name as they would depend on the
|
||||
// directories values.
|
||||
$this->assertContains($CFG->dirroot . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'behat' . DIRECTORY_SEPARATOR . 'features', $contents);
|
||||
|
||||
// Not quoted strings.
|
||||
$this->assertContains('micarro: /me/lo/robaron', $contents);
|
||||
$this->assertContains('class: behat_init_context', $contents);
|
||||
|
||||
// YAML uses single quotes to wrap URL strings.
|
||||
$this->assertContains("base_url: '" . $CFG->behat_wwwroot . "'", $contents);
|
||||
|
||||
// Lists.
|
||||
$this->assertContains('- feature1', $contents);
|
||||
$this->assertContains('- feature3', $contents);
|
||||
|
||||
unset($CFG->behat_wwwroot);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows access to internal methods without exposing them.
|
||||
*
|
||||
* @package tool_behat
|
||||
* @copyright 2012 David Monllaó
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class testable_behat_config_manager extends behat_config_manager {
|
||||
|
||||
/**
|
||||
* Allow access to protected method
|
||||
* @see parent::merge_config()
|
||||
* @param mixed $config
|
||||
* @param mixed $localconfig
|
||||
* @return mixed
|
||||
*/
|
||||
public static function merge_config($config, $localconfig) {
|
||||
return parent::merge_config($config, $localconfig);
|
||||
}
|
||||
|
||||
/**
|
||||
* Allow access to protected method
|
||||
* @see parent::get_config_file_contents()
|
||||
* @param array $features
|
||||
* @param array $stepsdefinitions
|
||||
* @return string
|
||||
*/
|
||||
public static function get_config_file_contents($features, $stepsdefinitions) {
|
||||
return parent::get_config_file_contents($features, $stepsdefinitions);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,194 @@
|
||||
<?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 admin/tool/behat.
|
||||
*
|
||||
* @package tool_behat
|
||||
* @copyright 2012 David Monllaó
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
global $CFG;
|
||||
require_once($CFG->dirroot . '/' . $CFG->admin .'/tool/behat/locallib.php');
|
||||
require_once($CFG->libdir . '/behat/classes/util.php');
|
||||
require_once($CFG->libdir . '/behat/classes/behat_config_manager.php');
|
||||
|
||||
/**
|
||||
* Allows access to internal methods without exposing them.
|
||||
*
|
||||
* @package tool_behat
|
||||
* @copyright 2012 David Monllaó
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class testable_behat_config_manager extends behat_config_manager {
|
||||
|
||||
/**
|
||||
* Allow access to protected method
|
||||
* @see parent::merge_config()
|
||||
* @param mixed $config
|
||||
* @param mixed $localconfig
|
||||
* @return mixed
|
||||
*/
|
||||
public static function merge_config($config, $localconfig) {
|
||||
return parent::merge_config($config, $localconfig);
|
||||
}
|
||||
|
||||
/**
|
||||
* Allow access to protected method
|
||||
* @see parent::get_config_file_contents()
|
||||
* @param array $features
|
||||
* @param array $stepsdefinitions
|
||||
* @return string
|
||||
*/
|
||||
public static function get_config_file_contents($features, $stepsdefinitions) {
|
||||
return parent::get_config_file_contents($features, $stepsdefinitions);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Tool behat tests.
|
||||
*
|
||||
* @package tool_behat
|
||||
* @copyright 2012 David Monllaó
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class tool_behat_testcase extends advanced_testcase {
|
||||
|
||||
/**
|
||||
* behat_config_manager tests.
|
||||
*/
|
||||
public function test_merge_configs() {
|
||||
|
||||
// Simple default config.
|
||||
$array1 = array(
|
||||
'the' => 'same',
|
||||
'simple' => 'value',
|
||||
'array' => array(
|
||||
'one' => 'arrayvalue1',
|
||||
'two' => 'arrayvalue2'
|
||||
)
|
||||
);
|
||||
|
||||
// Simple override.
|
||||
$array2 = array(
|
||||
'simple' => 'OVERRIDDEN1',
|
||||
'array' => array(
|
||||
'one' => 'OVERRIDDEN2'
|
||||
),
|
||||
'newprofile' => array(
|
||||
'anotherlevel' => array(
|
||||
'andanotherone' => array(
|
||||
'list1',
|
||||
'list2'
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$array = testable_behat_config_manager::merge_config($array1, $array2);
|
||||
|
||||
// Overriddes are applied.
|
||||
$this->assertEquals('OVERRIDDEN1', $array['simple']);
|
||||
$this->assertEquals('OVERRIDDEN2', $array['array']['one']);
|
||||
|
||||
// Other values are respected.
|
||||
$this->assertNotEmpty($array['array']['two']);
|
||||
|
||||
// Completely new nodes are added.
|
||||
$this->assertNotEmpty($array['newprofile']);
|
||||
$this->assertNotEmpty($array['newprofile']['anotherlevel']['andanotherone']);
|
||||
$this->assertEquals('list1', $array['newprofile']['anotherlevel']['andanotherone'][0]);
|
||||
$this->assertEquals('list2', $array['newprofile']['anotherlevel']['andanotherone'][1]);
|
||||
|
||||
// Complex override changing vectors to scalars and scalars to vectors.
|
||||
$array2 = array(
|
||||
'simple' => array(
|
||||
'simple' => 'should',
|
||||
'be' => 'overridden',
|
||||
'by' => 'this-array'
|
||||
),
|
||||
'array' => 'one'
|
||||
);
|
||||
|
||||
$array = testable_behat_config_manager::merge_config($array1, $array2);
|
||||
|
||||
// Overrides applied.
|
||||
$this->assertNotEmpty($array['simple']);
|
||||
$this->assertNotEmpty($array['array']);
|
||||
$this->assertTrue(is_array($array['simple']));
|
||||
$this->assertFalse(is_array($array['array']));
|
||||
|
||||
// Other values are maintained.
|
||||
$this->assertEquals('same', $array['the']);
|
||||
}
|
||||
|
||||
/**
|
||||
* behat_config_manager tests.
|
||||
*/
|
||||
public function test_config_file_contents() {
|
||||
global $CFG;
|
||||
|
||||
// Skip tests if behat is not installed.
|
||||
$vendorpath = $CFG->dirroot . '/vendor';
|
||||
if (!file_exists($vendorpath . '/autoload.php') || !is_dir($vendorpath . '/behat')) {
|
||||
$this->markTestSkipped('Behat not installed.');
|
||||
}
|
||||
|
||||
// To avoid user value at config.php level.
|
||||
unset($CFG->behat_config);
|
||||
|
||||
// List.
|
||||
$features = array(
|
||||
'feature1',
|
||||
'feature2',
|
||||
'feature3'
|
||||
);
|
||||
|
||||
// Associative array.
|
||||
$stepsdefinitions = array(
|
||||
'micarro' => '/me/lo/robaron',
|
||||
'anoche' => '/cuando/yo/dormia'
|
||||
);
|
||||
|
||||
$contents = testable_behat_config_manager::get_config_file_contents($features, $stepsdefinitions);
|
||||
|
||||
// YAML decides when is is necessary to wrap strings between single quotes, so not controlled
|
||||
// values like paths should not be asserted including the key name as they would depend on the
|
||||
// directories values.
|
||||
$this->assertContains($CFG->dirroot . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'behat' . DIRECTORY_SEPARATOR . 'features', $contents);
|
||||
|
||||
// If it was empty should be filled by behat_config_manager::get_config_file_contents().
|
||||
$this->assertNotNull($CFG->behat_wwwroot);
|
||||
|
||||
// Not quoted strings.
|
||||
$this->assertContains('micarro: /me/lo/robaron', $contents);
|
||||
$this->assertContains('class: behat_init_context', $contents);
|
||||
|
||||
// YAML uses single quotes to wrap URL strings.
|
||||
$this->assertContains("base_url: '" . $CFG->behat_wwwroot . "'", $contents);
|
||||
|
||||
// Lists.
|
||||
$this->assertContains('- feature1', $contents);
|
||||
$this->assertContains('- feature3', $contents);
|
||||
|
||||
unset($CFG->behat_wwwroot);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
This files describes API changes in the tool_behat code.
|
||||
|
||||
=== 2.7 ===
|
||||
* Constants behat_base::cap_allow, behat_base::cap_prevent and
|
||||
behat_base::cap_prohibit have been removed in favour of the
|
||||
lang/en/role.php language strings 'allow', 'prevent' and 'prohibit'.
|
||||
* @_only_local tag used in .feature files replaced by @_file_upload tag
|
||||
* @_alerts tag used in .feature files replaced by @_alert tag
|
||||
@@ -24,6 +24,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$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)
|
||||
$plugin->version = 2013110501;
|
||||
$plugin->requires = 2013110500; // Requires Moodle 2.5.
|
||||
$plugin->component = 'tool_behat';
|
||||
|
||||
@@ -1,83 +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/>.
|
||||
|
||||
/**
|
||||
* The tool_capability report viewed event.
|
||||
*
|
||||
* @package tool_capability
|
||||
* @copyright 2014 Petr Skoda
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
namespace tool_capability\event;
|
||||
|
||||
/**
|
||||
* The tool_capability report viewed event class.
|
||||
*
|
||||
* @package tool_capability
|
||||
* @since Moodle 2.7
|
||||
* @copyright 2014 Petr Skoda
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class report_viewed extends \core\event\base {
|
||||
|
||||
/**
|
||||
* Init method.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function init() {
|
||||
$this->data['crud'] = 'r';
|
||||
$this->data['edulevel'] = self::LEVEL_OTHER;
|
||||
$this->context = \context_system::instance();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return localised event name.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_name() {
|
||||
return get_string('eventreportviewed', 'tool_capability');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns description of what happened.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_description() {
|
||||
return "The user with id '$this->userid' viewed the capability overview report.";
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the legacy event log data.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function get_legacy_logdata() {
|
||||
return array(SITEID, 'admin', 'tool capability', 'tool/capability/index.php');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns relevant URL.
|
||||
*
|
||||
* @return \moodle_url
|
||||
*/
|
||||
public function get_url() {
|
||||
return new \moodle_url('/admin/tool/capability/index.php');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ if ($data = $form->get_data()) {
|
||||
}
|
||||
}
|
||||
|
||||
\tool_capability\event\report_viewed::create()->trigger();
|
||||
add_to_log(SITEID, "admin", "tool capability", "tool/capability/index.php", count($capabilities));
|
||||
|
||||
$renderer = $PAGE->get_renderer('tool_capability');
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
|
||||
$string['capabilitylabel'] = 'Capability:';
|
||||
$string['capabilityreport'] = 'Capability overview';
|
||||
$string['eventreportviewed'] = 'Report viewed';
|
||||
$string['forroles'] = 'For roles {$a}';
|
||||
$string['getreport'] = 'Get the overview';
|
||||
$string['changeoverrides'] = 'Change overrides in this context';
|
||||
|
||||
@@ -1,65 +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/>.
|
||||
|
||||
/**
|
||||
* Tests for capability overview events.
|
||||
*
|
||||
* @package tool_capability
|
||||
* @copyright 2014 Petr Skoda
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* Class for capability overview events.
|
||||
*
|
||||
* @package tool_capability
|
||||
* @copyright 2014 Petr Skoda
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
|
||||
*/
|
||||
class tool_capability_events_testcase extends advanced_testcase {
|
||||
|
||||
/**
|
||||
* Setup testcase.
|
||||
*/
|
||||
public function setUp() {
|
||||
$this->setAdminUser();
|
||||
$this->resetAfterTest();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the report viewed event.
|
||||
*/
|
||||
public function test_report_viewed() {
|
||||
$event = \tool_capability\event\report_viewed::create();
|
||||
|
||||
// Trigger and capture the event.
|
||||
$sink = $this->redirectEvents();
|
||||
$event->trigger();
|
||||
$events = $sink->get_events();
|
||||
$event = reset($events);
|
||||
|
||||
$this->assertInstanceOf('\tool_capability\event\report_viewed', $event);
|
||||
$this->assertEquals(context_system::instance(), $event->get_context());
|
||||
$expected = array(SITEID, "admin", "tool capability", "tool/capability/index.php");
|
||||
$this->assertEventLegacyLogData($expected, $event);
|
||||
$this->assertEventContextNotUsed($event);
|
||||
$url = new moodle_url('/admin/tool/capability/index.php');
|
||||
$this->assertEquals($url, $event->get_url());
|
||||
$event->get_name();
|
||||
}
|
||||
}
|
||||
@@ -24,6 +24,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2014051200; // The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->requires = 2014050800; // Requires this Moodle version.
|
||||
$plugin->version = 2013110500; // The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->requires = 2013110500; // 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
+8
-3
@@ -9,10 +9,10 @@ YUI.add('moodle-tool_capability-search', function (Y, NAME) {
|
||||
/**
|
||||
* Constructs a new capability search manager.
|
||||
*
|
||||
* @namespace M.tool_capability
|
||||
* @namespace M.tool_capability.search
|
||||
* @class Search
|
||||
* @constructor
|
||||
* @extends Base
|
||||
* @extends Y.Base
|
||||
*/
|
||||
var SEARCH = function() {
|
||||
SEARCH.superclass.constructor.apply(this, arguments);
|
||||
@@ -144,12 +144,17 @@ Y.extend(SEARCH, Y.Base, SEARCH.prototype, {
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Core namespace.
|
||||
* @static
|
||||
* @class tool_capability
|
||||
*/
|
||||
M.tool_capability = M.tool_capability || {};
|
||||
|
||||
/**
|
||||
* Initialises capability search functionality.
|
||||
* @static
|
||||
* @method M.tool_capability.init_capability_search
|
||||
* @method init_capability_search
|
||||
* @param {Object} options
|
||||
*/
|
||||
M.tool_capability.init_capability_search = function(options) {
|
||||
|
||||
Vendored
+8
-3
@@ -9,10 +9,10 @@ YUI.add('moodle-tool_capability-search', function (Y, NAME) {
|
||||
/**
|
||||
* Constructs a new capability search manager.
|
||||
*
|
||||
* @namespace M.tool_capability
|
||||
* @namespace M.tool_capability.search
|
||||
* @class Search
|
||||
* @constructor
|
||||
* @extends Base
|
||||
* @extends Y.Base
|
||||
*/
|
||||
var SEARCH = function() {
|
||||
SEARCH.superclass.constructor.apply(this, arguments);
|
||||
@@ -144,12 +144,17 @@ Y.extend(SEARCH, Y.Base, SEARCH.prototype, {
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Core namespace.
|
||||
* @static
|
||||
* @class tool_capability
|
||||
*/
|
||||
M.tool_capability = M.tool_capability || {};
|
||||
|
||||
/**
|
||||
* Initialises capability search functionality.
|
||||
* @static
|
||||
* @method M.tool_capability.init_capability_search
|
||||
* @method init_capability_search
|
||||
* @param {Object} options
|
||||
*/
|
||||
M.tool_capability.init_capability_search = function(options) {
|
||||
|
||||
+8
-3
@@ -7,10 +7,10 @@
|
||||
/**
|
||||
* Constructs a new capability search manager.
|
||||
*
|
||||
* @namespace M.tool_capability
|
||||
* @namespace M.tool_capability.search
|
||||
* @class Search
|
||||
* @constructor
|
||||
* @extends Base
|
||||
* @extends Y.Base
|
||||
*/
|
||||
var SEARCH = function() {
|
||||
SEARCH.superclass.constructor.apply(this, arguments);
|
||||
@@ -142,12 +142,17 @@ Y.extend(SEARCH, Y.Base, SEARCH.prototype, {
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Core namespace.
|
||||
* @static
|
||||
* @class tool_capability
|
||||
*/
|
||||
M.tool_capability = M.tool_capability || {};
|
||||
|
||||
/**
|
||||
* Initialises capability search functionality.
|
||||
* @static
|
||||
* @method M.tool_capability.init_capability_search
|
||||
* @method init_capability_search
|
||||
* @param {Object} options
|
||||
*/
|
||||
M.tool_capability.init_capability_search = function(options) {
|
||||
|
||||
@@ -45,8 +45,5 @@ function xmldb_tool_customlang_upgrade($oldversion) {
|
||||
// Moodle v2.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.7.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ if ($action === 'checkout') {
|
||||
$progressbar->create(); // prints the HTML code of the progress bar
|
||||
|
||||
// we may need a bit of extra execution time and memory here
|
||||
core_php_time_limit::raise(HOURSECS);
|
||||
@set_time_limit(HOURSECS);
|
||||
raise_memory_limit(MEMORY_EXTRA);
|
||||
tool_customlang_utils::checkout($lng, $progressbar);
|
||||
|
||||
|
||||
@@ -25,6 +25,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2014051200;
|
||||
$plugin->requires = 2014050800;
|
||||
$plugin->version = 2013110500;
|
||||
$plugin->requires = 2013110500;
|
||||
$plugin->component = 'tool_customlang'; // Full name of the plugin (used for diagnostics)
|
||||
|
||||
@@ -50,7 +50,7 @@ require_once($CFG->libdir.'/dtllib.php');
|
||||
* @return does not return, calls die()
|
||||
*/
|
||||
function tool_dbtransfer_export_xml_database($description, $mdb) {
|
||||
core_php_time_limit::raise();
|
||||
@set_time_limit(0);
|
||||
|
||||
\core\session\manager::write_close(); // Release session.
|
||||
|
||||
@@ -77,7 +77,7 @@ function tool_dbtransfer_export_xml_database($description, $mdb) {
|
||||
* @return void
|
||||
*/
|
||||
function tool_dbtransfer_transfer_database(moodle_database $sourcedb, moodle_database $targetdb, progress_trace $feedback = null) {
|
||||
core_php_time_limit::raise();
|
||||
@set_time_limit(0);
|
||||
|
||||
\core\session\manager::write_close(); // Release session.
|
||||
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2014051200; // The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->requires = 2014050800; // Requires this Moodle version.
|
||||
$plugin->version = 2013110500; // The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->requires = 2013110500; // Requires this Moodle version.
|
||||
$plugin->component = 'tool_dbtransfer'; // Full name of the plugin (used for diagnostics).
|
||||
|
||||
@@ -177,7 +177,7 @@ abstract class tool_generator_backend {
|
||||
|
||||
// Update time limit so PHP doesn't time out.
|
||||
if (!CLI_SCRIPT) {
|
||||
core_php_time_limit::raise(120);
|
||||
set_time_limit(120);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,10 +36,6 @@ class tool_generator_course_backend extends tool_generator_backend {
|
||||
* @var array Number of sections in course
|
||||
*/
|
||||
private static $paramsections = array(1, 10, 100, 500, 1000, 2000);
|
||||
/**
|
||||
* @var array Number of assignments in course
|
||||
*/
|
||||
private static $paramassignments = array(1, 10, 100, 500, 1000, 2000);
|
||||
/**
|
||||
* @var array Number of Page activities in course
|
||||
*/
|
||||
@@ -183,7 +179,6 @@ class tool_generator_course_backend extends tool_generator_backend {
|
||||
// Make course.
|
||||
$this->course = $this->create_course();
|
||||
$this->create_users();
|
||||
$this->create_assignments();
|
||||
$this->create_pages();
|
||||
$this->create_small_files();
|
||||
$this->create_big_files();
|
||||
@@ -323,26 +318,6 @@ class tool_generator_course_backend extends tool_generator_backend {
|
||||
$this->end_log();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a number of Assignment activities.
|
||||
*/
|
||||
private function create_assignments() {
|
||||
// Set up generator.
|
||||
$assigngenerator = $this->generator->get_plugin_generator('mod_assign');
|
||||
|
||||
// Create assignments.
|
||||
$number = self::$paramassignments[$this->size];
|
||||
$this->log('createassignments', $number, true);
|
||||
for ($i = 0; $i < $number; $i++) {
|
||||
$record = array('course' => $this->course);
|
||||
$options = array('section' => $this->get_target_section());
|
||||
$assigngenerator->create_instance($record, $options);
|
||||
$this->dot($i, $number);
|
||||
}
|
||||
|
||||
$this->end_log();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a number of Page activities.
|
||||
*/
|
||||
|
||||
@@ -71,7 +71,6 @@ $string['pluginname'] = 'Development data generator';
|
||||
$string['progress_checkaccounts'] = 'Checking user accounts ({$a})';
|
||||
$string['progress_coursecompleted'] = 'Course completed ({$a}s)';
|
||||
$string['progress_createaccounts'] = 'Creating user accounts ({$a->from} - {$a->to})';
|
||||
$string['progress_createassignments'] = 'Creating assignments ({$a})';
|
||||
$string['progress_createbigfiles'] = 'Creating big files ({$a})';
|
||||
$string['progress_createcourse'] = 'Creating course {$a}';
|
||||
$string['progress_createforum'] = 'Creating forum ({$a} posts)';
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2014051200;
|
||||
$plugin->requires = 2014050800;
|
||||
$plugin->version = 2013110500;
|
||||
$plugin->requires = 2013110500;
|
||||
$plugin->component = 'tool_generator';
|
||||
|
||||
@@ -240,6 +240,25 @@ class problem_000005 extends problem_base {
|
||||
}
|
||||
}
|
||||
|
||||
class problem_000006 extends problem_base {
|
||||
function title() {
|
||||
return 'PHP: magic_quotes_runtime is enabled';
|
||||
}
|
||||
function exists() {
|
||||
return (ini_get_bool('magic_quotes_runtime'));
|
||||
}
|
||||
function severity() {
|
||||
return SEVERITY_SIGNIFICANT;
|
||||
}
|
||||
function description() {
|
||||
return 'Your PHP configuration includes an enabled setting, magic_quotes_runtime, that <strong>must be disabled</strong> in order for Moodle to work correctly. Notable symptoms arising from this misconfiguration include strange display errors whenever a text field that includes single or double quotes is processed.';
|
||||
}
|
||||
function solution() {
|
||||
global $CFG;
|
||||
return '<p>There are two ways you can solve this problem:</p><ol><li>If you have access to your main <strong>php.ini</strong> file, then find the line that looks like this: <pre>magic_quotes_runtime = On</pre> and change it to <pre>magic_quotes_runtime = Off</pre> and then restart your web server. Be warned that this, as any other PHP setting change, might affect other web applications running on the server.</li><li>Finally, you may be able to change this setting just for your site by creating or editing the file <strong>'.$CFG->dirroot.'/.htaccess</strong> to contain this line: <pre>php_value magic_quotes_runtime "Off"</pre></li></ol>';
|
||||
}
|
||||
}
|
||||
|
||||
class problem_000007 extends problem_base {
|
||||
function title() {
|
||||
return 'PHP: file_uploads is disabled';
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2014051200; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2014050800; // Requires this Moodle version
|
||||
$plugin->version = 2013110500; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2013110500; // Requires this Moodle version
|
||||
$plugin->component = 'tool_health'; // Full name of the plugin (used for diagnostics)
|
||||
|
||||
$plugin->maturity = MATURITY_ALPHA; // this version's maturity level
|
||||
|
||||
@@ -57,7 +57,7 @@ if (data_submitted() and $confirm and confirm_sesskey()) {
|
||||
|
||||
echo $OUTPUT->notification('Please be patient and wait for this to complete...', 'notifysuccess');
|
||||
|
||||
core_php_time_limit::raise();
|
||||
set_time_limit(0);
|
||||
|
||||
foreach ($rs as $table) {
|
||||
$DB->set_debug(true);
|
||||
|
||||
@@ -25,6 +25,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2014051200; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2014050800; // Requires this Moodle version
|
||||
$plugin->version = 2013110500; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2013110500; // Requires this Moodle version
|
||||
$plugin->component = 'tool_innodb'; // Full name of the plugin (used for diagnostics)
|
||||
|
||||
@@ -28,20 +28,20 @@ defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$string['acknowledgement'] = 'Acknowledgement';
|
||||
$string['acknowledgementmust'] = 'You must acknowledge this';
|
||||
$string['acknowledgementtext'] = 'I understand that it is my responsibility to have full backups of this site prior to installing additional plugins. I accept and understand that plugins (especially but not only those originating in unofficial sources) may contain security holes, can make the site unavailable, or cause private data leaks or loss.';
|
||||
$string['featuredisabled'] = 'The plugin installer is disabled on this site.';
|
||||
$string['installaddon'] = 'Install plugin!';
|
||||
$string['installaddons'] = 'Install plugins';
|
||||
$string['installexception'] = 'Oops... An error occurred while trying to install the plugin. Turn debugging mode on to see details of the error.';
|
||||
$string['installfromrepo'] = 'Install plugins from the Moodle plugins directory';
|
||||
$string['installfromrepo_help'] = 'You will be redirected to the Moodle plugins directory to search for and install a plugin. Note that your site full name, URL and Moodle version will be sent as well, to make the installation process easier for you.';
|
||||
$string['installfromzip'] = 'Install plugin from ZIP file';
|
||||
$string['installfromzip_help'] = 'An alternative to installing a plugin directly from the Moodle plugins directory is to upload a ZIP package of the plugin. The ZIP package should have the same structure as a package downloaded from the Moodle plugins directory.';
|
||||
$string['acknowledgementtext'] = 'I understand that it is my responsibility to have full backups of this site prior to installing add-ons. I accept and understand that add-ons (especially but not only those originating in unofficial sources) may contain security holes, can make the site unavailable, or cause private data leaks or loss.';
|
||||
$string['featuredisabled'] = 'The add-on installer is disabled on this site.';
|
||||
$string['installaddon'] = 'Install add-on!';
|
||||
$string['installaddons'] = 'Install add-ons';
|
||||
$string['installexception'] = 'Oops... An error occurred while trying to install the add-on. Turn debugging mode on to see details of the error.';
|
||||
$string['installfromrepo'] = 'Install add-ons from the Moodle plugins directory';
|
||||
$string['installfromrepo_help'] = 'You will be redirected to the Moodle plugins directory to search for and install an add-on. Note that your site full name, URL and Moodle version will be sent as well, to make the installation process easier for you.';
|
||||
$string['installfromzip'] = 'Install add-on from ZIP file';
|
||||
$string['installfromzip_help'] = 'An alternative to installing an add-on directly from the Moodle plugins directory is to upload a ZIP package of the add-on. The ZIP package should have the same structure as a package downloaded from the Moodle plugins directory.';
|
||||
$string['installfromzipfile'] = 'ZIP package';
|
||||
$string['installfromzipfile_help'] = 'The plugin ZIP package must contain just one directory, named to match the plugin. The ZIP will be extracted into an appropriate location for the plugin type. If the package has been downloaded from the Moodle plugins directory then it will have this structure.';
|
||||
$string['installfromziprootdir'] = 'Rename the root directory';
|
||||
$string['installfromziprootdir_help'] = 'Some ZIP packages, such as those generated by Github, may contain an incorrect root directory name. If so, the correct name may be entered here.';
|
||||
$string['installfromzipsubmit'] = 'Install plugin from the ZIP file';
|
||||
$string['installfromzipsubmit'] = 'Install add-on from the ZIP file';
|
||||
$string['installfromziptype'] = 'Plugin type';
|
||||
$string['installfromziptype_help'] = 'Choose the correct type of plugin you are about to install. Warning: The installation procedure can fail badly if an incorrect plugin type is specified.';
|
||||
$string['permcheck'] = 'Make sure the plugin type root location is writable by the web server process.';
|
||||
@@ -49,54 +49,54 @@ $string['permcheckerror'] = 'Error while checking for write permission';
|
||||
$string['permcheckprogress'] = 'Checking for write permission ...';
|
||||
$string['permcheckresultno'] = 'Plugin type location <em>{$a->path}</em> is not writable';
|
||||
$string['permcheckresultyes'] = 'Plugin type location <em>{$a->path}</em> is writable';
|
||||
$string['pluginname'] = 'Plugin installer';
|
||||
$string['remoterequestalreadyinstalled'] = 'There is a request to install plugin {$a->name} ({$a->component}) version {$a->version} from the Moodle plugins directory on this site. However, this plugin is <strong>already installed</strong> on the site.';
|
||||
$string['remoterequestconfirm'] = 'There is a request to install plugin <strong>{$a->name}</strong> ({$a->component}) version {$a->version} from the Moodle plugins directory on this site. If you continue, the plugin ZIP package will be downloaded for validation. Nothing will be installed yet.';
|
||||
$string['remoterequestinvalid'] = 'There is a request to install a plugin from the Moodle plugins directory on this site. Unfortunately the request is not valid and so the plugin cannot be installed.';
|
||||
$string['remoterequestpermcheck'] = 'There is a request to install plugin {$a->name} ({$a->component}) version {$a->version} from the Moodle plugins directory on this site. However, the location <strong>{$a->typepath}</strong> is <strong>not writable</strong>. You need to give write access for the web server user to the location, then press the continue button to repeat the check.';
|
||||
$string['remoterequestpluginfoexception'] = 'Oops... An error occurred while trying to obtain information about the plugin {$a->name} ({$a->component}) version {$a->version}. The plugin cannot be installed. Turn debugging mode on to see details of the error.';
|
||||
$string['validation'] = 'Plugin package validation';
|
||||
$string['pluginname'] = 'Add-on installer';
|
||||
$string['remoterequestalreadyinstalled'] = 'There is a request to install add-on {$a->name} ({$a->component}) version {$a->version} from the Moodle plugins directory on this site. However, this plugin is <strong>already installed</strong> on the site.';
|
||||
$string['remoterequestconfirm'] = 'There is a request to install add-on <strong>{$a->name}</strong> ({$a->component}) version {$a->version} from the Moodle plugins directory on this site. If you continue, the add-on ZIP package will be downloaded for validation. Nothing will be installed yet.';
|
||||
$string['remoterequestinvalid'] = 'There is a request to install an add-on from the Moodle plugins directory on this site. Unfortunately the request is not valid and so the add-on cannot be installed.';
|
||||
$string['remoterequestpermcheck'] = 'There is a request to install add-on {$a->name} ({$a->component}) version {$a->version} from the Moodle plugins directory on this site. However, the plugin type location <strong>{$a->typepath}</strong> is <strong>not writable</strong>. You need to give write access for the web server user to the plugin type location, then press the continue button to repeat the check.';
|
||||
$string['remoterequestpluginfoexception'] = 'Oops... An error occurred while trying to obtain information about the add-on {$a->name} ({$a->component}) version {$a->version}. The add-on cannot be installed. Turn debugging mode on to see details of the error.';
|
||||
$string['validation'] = 'Add-on package validation';
|
||||
$string['validationmsg_componentmatch'] = 'Full component name';
|
||||
$string['validationmsg_componentmismatchname'] = 'Plugin name mismatch';
|
||||
$string['validationmsg_componentmismatchname_help'] = 'Some ZIP packages, such as those generated by Github, may contain an incorrect root directory name. You need to fix the name of the root directory to match the declared plugin name.';
|
||||
$string['validationmsg_componentmismatchname_info'] = 'The plugin declares its name is \'{$a}\' but that does not match the name of the root directory.';
|
||||
$string['validationmsg_componentmismatchtype'] = 'Plugin type mismatch';
|
||||
$string['validationmsg_componentmismatchtype_info'] = 'You have selected the type \'{$a->expected}\' but the plugin declares its type is \'{$a->found}\'.';
|
||||
$string['validationmsg_componentmismatchname'] = 'Add-on name mismatch';
|
||||
$string['validationmsg_componentmismatchname_help'] = 'Some ZIP packages, such as those generated by Github, may contain an incorrect root directory name. You need to fix the name of the root directory to match the declared add-on name.';
|
||||
$string['validationmsg_componentmismatchname_info'] = 'The add-on declares its name is \'{$a}\' but that does not match the name of the root directory.';
|
||||
$string['validationmsg_componentmismatchtype'] = 'Add-on type mismatch';
|
||||
$string['validationmsg_componentmismatchtype_info'] = 'You have selected the type \'{$a->expected}\' but the add-on declares its type is \'{$a->found}\'.';
|
||||
$string['validationmsg_filenotexists'] = 'Extracted file not found';
|
||||
$string['validationmsg_filesnumber'] = 'Not enough files found in the package';
|
||||
$string['validationmsg_filestatus'] = 'Unable to extract all files';
|
||||
$string['validationmsg_filestatus_info'] = 'Attempting to extract file {$a->file} resulted in error \'{$a->status}\'.';
|
||||
$string['validationmsg_maturity'] = 'Declared maturity level';
|
||||
$string['validationmsg_maturity_help'] = 'The plugin can declare its maturity level. If the maintainer considers the plugin stable, the declared maturity level will read MATURITY_STABLE. All other maturity levels (such as alpha or beta) should be considered unstable and a warning is raised.';
|
||||
$string['validationmsg_maturity_help'] = 'The add-on can declare its maturity level. If the maintainer considers the add-on stable, the declared maturity level will read MATURITY_STABLE. All other maturity levels (such as alpha or beta) should be considered unstable and a warning is raised.';
|
||||
$string['validationmsg_missingexpectedlangenfile'] = 'English language file name mismatch';
|
||||
$string['validationmsg_missingexpectedlangenfile_info'] = 'The given plugin type is missing the expected English language file {$a}.';
|
||||
$string['validationmsg_missingexpectedlangenfile_info'] = 'The given add-on type is missing the expected English language file {$a}.';
|
||||
$string['validationmsg_missinglangenfile'] = 'No English language file found';
|
||||
$string['validationmsg_missinglangenfolder'] = 'Missing English language folder';
|
||||
$string['validationmsg_missingversion'] = 'Plugin does not declare its version';
|
||||
$string['validationmsg_missingversion'] = 'Add-on does not declare its version';
|
||||
$string['validationmsg_missingversionphp'] = 'File version.php not found';
|
||||
$string['validationmsg_multiplelangenfiles'] = 'Multiple English language files found';
|
||||
$string['validationmsg_onedir'] = 'Invalid structure of the ZIP package.';
|
||||
$string['validationmsg_onedir_help'] = 'The ZIP package must contain just one root directory that holds the plugin code. The name of that root directory must match the name of the plugin.';
|
||||
$string['validationmsg_onedir_help'] = 'The ZIP package must contain just one root directory that holds the add-on code. The name of that root directory must match the name of the plugin.';
|
||||
$string['validationmsg_pathwritable'] = 'Write access check';
|
||||
$string['validationmsg_pluginversion'] = 'Plugin version';
|
||||
$string['validationmsg_release'] = 'Plugin release';
|
||||
$string['validationmsg_pluginversion'] = 'Add-on version';
|
||||
$string['validationmsg_release'] = 'Add-on release';
|
||||
$string['validationmsg_requiresmoodle'] = 'Required Moodle version';
|
||||
$string['validationmsg_rootdir'] = 'Name of the plugin to be installed';
|
||||
$string['validationmsg_rootdir_help'] = 'The name of the root directory in the ZIP package forms the name of the plugin to be installed. If the name is not correct, you may wish to rename the root directory in the ZIP prior to installing the plugin.';
|
||||
$string['validationmsg_rootdirinvalid'] = 'Invalid plugin name';
|
||||
$string['validationmsg_rootdirinvalid_help'] = 'The name of the root directory in the ZIP package violates formal syntax requirements. Some ZIP packages, such as those generated by Github, may contain an incorrect root directory name. You need to fix the name of the root directory to match the plugin name.';
|
||||
$string['validationmsg_rootdir'] = 'Name of the add-on to be installed';
|
||||
$string['validationmsg_rootdir_help'] = 'The name of the root directory in the ZIP package forms the name of the add-on to be installed. If the name is not correct, you may wish to rename the root directory in the ZIP prior to installing the add-on.';
|
||||
$string['validationmsg_rootdirinvalid'] = 'Invalid add-on name';
|
||||
$string['validationmsg_rootdirinvalid_help'] = 'The name of the root directory in the ZIP package violates formal syntax requirements. Some ZIP packages, such as those generated by Github, may contain an incorrect root directory name. You need to fix the name of the root directory to match the add-on name.';
|
||||
$string['validationmsg_targetexists'] = 'Target location already exists';
|
||||
$string['validationmsg_targetexists_help'] = 'The directory that the plugin is to be installed to must not yet exist.';
|
||||
$string['validationmsg_targetexists_help'] = 'The directory that the add-on is to be installed to, must not exist yet.';
|
||||
$string['validationmsg_unknowntype'] = 'Unknown plugin type';
|
||||
$string['validationmsglevel_debug'] = 'Debug';
|
||||
$string['validationmsglevel_error'] = 'Error';
|
||||
$string['validationmsglevel_info'] = 'OK';
|
||||
$string['validationmsglevel_warning'] = 'Warning';
|
||||
$string['validationresult0'] = 'Validation failed!';
|
||||
$string['validationresult0_help'] = 'A serious problem was detected and so it is not safe to install the plugin. See the validation log messages for details.';
|
||||
$string['validationresult0_help'] = 'A serious problem was detected and so it is not safe to install the add-on. See the validation log messages for details.';
|
||||
$string['validationresult1'] = 'Validation passed!';
|
||||
$string['validationresult2_help'] = 'No serious problems were detected. You can continue with the plugin installation. See the validation log messages for more details and eventual warnings.';
|
||||
$string['validationresult1_help'] = 'The plugin package has been validated and no serious problems were detected.';
|
||||
$string['validationresult1_help'] = 'No serious problems were detected. You can continue with the add-on installation. See the validation log messages for more details and eventual warnings.';
|
||||
$string['validationresult1_help'] = 'The add-on package has been validated and no serious problems were detected.';
|
||||
$string['validationresultinfo'] = 'Info';
|
||||
$string['validationresultmsg'] = 'Message';
|
||||
$string['validationresultstatus'] = 'Status';
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->component = 'tool_installaddon';
|
||||
$plugin->version = 2014051200;
|
||||
$plugin->requires = 2014050800;
|
||||
$plugin->version = 2013110500;
|
||||
$plugin->requires = 2013110500;
|
||||
$plugin->maturity = MATURITY_STABLE;
|
||||
|
||||
@@ -69,7 +69,7 @@ $notice_ok = array();
|
||||
$notice_error = array();
|
||||
|
||||
if (($mode == INSTALLATION_OF_SELECTED_LANG) and confirm_sesskey() and !empty($pack)) {
|
||||
core_php_time_limit::raise();
|
||||
set_time_limit(0);
|
||||
make_temp_directory('');
|
||||
make_upload_directory('lang');
|
||||
|
||||
@@ -125,7 +125,7 @@ if ($mode == DELETION_OF_SELECTED_LANG and !empty($uninstalllang)) {
|
||||
}
|
||||
|
||||
if ($mode == UPDATE_ALL_LANG) {
|
||||
core_php_time_limit::raise();
|
||||
set_time_limit(0);
|
||||
|
||||
$installer = new lang_installer();
|
||||
|
||||
|
||||
@@ -25,6 +25,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2014051200; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2014050800; // Requires this Moodle version
|
||||
$plugin->version = 2013110500; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2013110500; // Requires this Moodle version
|
||||
$plugin->component = 'tool_langimport'; // Full name of the plugin (used for diagnostics)
|
||||
|
||||
@@ -1,127 +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/>.
|
||||
|
||||
/**
|
||||
* Helper trait buffered_writer
|
||||
*
|
||||
* @package tool_log
|
||||
* @copyright 2014 onwards Ankit Agarwal
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
namespace tool_log\helper;
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* Helper trait buffered_writer. Adds buffer support for the store.
|
||||
*
|
||||
* @package tool_log
|
||||
* @copyright 2014 onwards Ankit Agarwal
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
trait buffered_writer {
|
||||
|
||||
/** @var array $buffer buffer of events. */
|
||||
protected $buffer = array();
|
||||
|
||||
/** @var array $buffer buffer size of events. */
|
||||
protected $buffersize;
|
||||
|
||||
/** @var int $count Counter. */
|
||||
protected $count = 0;
|
||||
|
||||
/**
|
||||
* Should the event be ignored (== not logged)?
|
||||
* @param \core\event\base $event
|
||||
* @return bool
|
||||
*/
|
||||
abstract protected function is_event_ignored(\core\event\base $event);
|
||||
|
||||
/**
|
||||
* Write event in the store with buffering. Method insert_event_entries() must be
|
||||
* defined.
|
||||
*
|
||||
* @param \core\event\base $event
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function write(\core\event\base $event) {
|
||||
global $PAGE;
|
||||
|
||||
if ($this->is_event_ignored($event)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// We need to capture current info at this moment,
|
||||
// at the same time this lowers memory use because
|
||||
// snapshots and custom objects may be garbage collected.
|
||||
$entry = $event->get_data();
|
||||
$entry['other'] = serialize($entry['other']);
|
||||
$entry['origin'] = $PAGE->requestorigin;
|
||||
$entry['ip'] = $PAGE->requestip;
|
||||
$entry['realuserid'] = \core\session\manager::is_loggedinas() ? $GLOBALS['USER']->realuser : null;
|
||||
|
||||
$this->buffer[] = $entry;
|
||||
$this->count++;
|
||||
|
||||
if (!isset($this->buffersize)) {
|
||||
$this->buffersize = $this->get_config('buffersize', 50);
|
||||
}
|
||||
|
||||
if ($this->count >= $this->buffersize) {
|
||||
$this->flush();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Flush event buffer.
|
||||
*/
|
||||
public function flush() {
|
||||
if ($this->count == 0) {
|
||||
return;
|
||||
}
|
||||
$events = $this->buffer;
|
||||
$this->count = 0;
|
||||
$this->buffer = array();
|
||||
$this->insert_event_entries($events);
|
||||
}
|
||||
|
||||
/**
|
||||
* Bulk write a given array of events to the backend. Stores must implement this.
|
||||
*
|
||||
* @param array $evententries raw event data
|
||||
*/
|
||||
abstract protected function insert_event_entries($evententries);
|
||||
|
||||
/**
|
||||
* Get a config value for the store.
|
||||
*
|
||||
* @param string $name Config name
|
||||
* @param mixed $default default value
|
||||
*
|
||||
* @return mixed config value if set, else the default value.
|
||||
*/
|
||||
abstract protected function get_config($name, $default = null);
|
||||
|
||||
/**
|
||||
* Push any remaining events to the database. Insert_events() must be
|
||||
* defined. override in stores if the store doesn't support buffering.
|
||||
*
|
||||
*/
|
||||
public function dispose() {
|
||||
$this->flush();
|
||||
}
|
||||
}
|
||||
@@ -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/>.
|
||||
|
||||
/**
|
||||
* Reader helper trait.
|
||||
*
|
||||
* @package tool_log
|
||||
* @copyright 2014 onwards Ankit Agarwal
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
namespace tool_log\helper;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* Reader helper trait.
|
||||
* \tool_log\helper\store must be included before using this trait.
|
||||
*
|
||||
* @package tool_log
|
||||
* @copyright 2014 onwards Ankit Agarwal
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*
|
||||
* @property string $component Frankenstyle plugin name initialised in store trait.
|
||||
* @property string $store short plugin name initialised in store trait.
|
||||
*/
|
||||
trait reader {
|
||||
/**
|
||||
* Default get name api.
|
||||
*
|
||||
* @return string name of the store.
|
||||
*/
|
||||
public function get_name() {
|
||||
if (get_string_manager()->string_exists('pluginname', $this->component)) {
|
||||
return get_string('pluginname', $this->component);
|
||||
}
|
||||
return $this->store;
|
||||
}
|
||||
|
||||
/**
|
||||
* Default get description method.
|
||||
*
|
||||
* @return string description of the store.
|
||||
*/
|
||||
public function get_description() {
|
||||
if (get_string_manager()->string_exists('pluginname_desc', $this->component)) {
|
||||
return get_string('pluginname_desc', $this->component);
|
||||
}
|
||||
return $this->store;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds ID column to $sort to make sure events from one request
|
||||
* within 1 second are returned in the same order.
|
||||
*
|
||||
* @param string $sort
|
||||
* @return string sort string
|
||||
*/
|
||||
protected static function tweak_sort_by_id($sort) {
|
||||
if (empty($sort)) {
|
||||
// Mysql does this - unlikely to be used in real life because $sort is always expected.
|
||||
$sort = "id ASC";
|
||||
} else if (stripos($sort, 'timecreated') === false) {
|
||||
$sort .= ", id ASC";
|
||||
} else if (stripos($sort, 'timecreated DESC') !== false) {
|
||||
$sort .= ", id DESC";
|
||||
} else {
|
||||
$sort .= ", id ASC";
|
||||
}
|
||||
|
||||
return $sort;
|
||||
}
|
||||
}
|
||||
@@ -1,79 +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/>.
|
||||
|
||||
/**
|
||||
* Helper trait store.
|
||||
*
|
||||
* @package tool_log
|
||||
* @copyright 2014 onwards Ankit Agarwal
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
namespace tool_log\helper;
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* Helper trait store. Adds some helper methods for stores.
|
||||
*
|
||||
* @package tool_log
|
||||
* @copyright 2014 onwards Ankit Agarwal
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
trait store {
|
||||
|
||||
/** @var \tool_log\log\manager $manager manager instance. */
|
||||
protected $manager;
|
||||
|
||||
/** @var string $component Frankenstyle store name. */
|
||||
protected $component;
|
||||
|
||||
/** @var string $store name of the store. */
|
||||
protected $store;
|
||||
|
||||
|
||||
/**
|
||||
* Setup store specific variables.
|
||||
*
|
||||
* @param \tool_log\log\manager $manager manager instance.
|
||||
*/
|
||||
protected function helper_setup(\tool_log\log\manager $manager) {
|
||||
$this->manager = $manager;
|
||||
$called = get_called_class();
|
||||
$parts = explode('\\', $called);
|
||||
if (!isset($parts[0]) || strpos($parts[0], 'logstore_') !== 0) {
|
||||
throw new \coding_exception("Store $called doesn't define classes in correct namespaces.");
|
||||
}
|
||||
$this->component = $parts[0];
|
||||
$this->store = str_replace('logstore_', '', $this->store);
|
||||
}
|
||||
|
||||
/**
|
||||
* Api to get plugin config
|
||||
*
|
||||
* @param string $name name of the config.
|
||||
* @param null|mixed $default default value to return.
|
||||
*
|
||||
* @return mixed|null return config value.
|
||||
*/
|
||||
protected function get_config($name, $default = null) {
|
||||
$value = get_config($this->component, $name);
|
||||
if ($value !== false) {
|
||||
return $value;
|
||||
}
|
||||
return $default;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,223 +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/>.
|
||||
|
||||
/**
|
||||
* Log store manager.
|
||||
*
|
||||
* @package tool_log
|
||||
* @copyright 2013 Petr Skoda {@link http://skodak.org}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
namespace tool_log\log;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
class manager implements \core\log\manager {
|
||||
/** @var \core\log\reader[] $readers list of initialised log readers */
|
||||
protected $readers;
|
||||
|
||||
/** @var \tool_log\log\writer[] $writers list of initialised log writers */
|
||||
protected $writers;
|
||||
|
||||
/** @var \tool_log\log\store[] $stores list of all enabled stores */
|
||||
protected $stores;
|
||||
|
||||
/**
|
||||
* Delayed initialisation of singleton.
|
||||
*/
|
||||
protected function init() {
|
||||
if (isset($this->stores)) {
|
||||
// Do not bother checking readers and writers here
|
||||
// because everything is init here.
|
||||
return;
|
||||
}
|
||||
$this->stores = array();
|
||||
$this->readers = array();
|
||||
$this->writers = array();
|
||||
|
||||
// Register shutdown handler - this may be useful for buffering, file handle closing, etc.
|
||||
\core_shutdown_manager::register_function(array($this, 'dispose'));
|
||||
|
||||
$plugins = get_config('tool_log', 'enabled_stores');
|
||||
if (empty($plugins)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$plugins = explode(',', $plugins);
|
||||
foreach ($plugins as $plugin) {
|
||||
$classname = "\\$plugin\\log\\store";
|
||||
if (class_exists($classname)) {
|
||||
$store = new $classname($this);
|
||||
$this->stores[$plugin] = $store;
|
||||
if ($store instanceof \tool_log\log\writer) {
|
||||
$this->writers[$plugin] = $store;
|
||||
}
|
||||
if ($store instanceof \core\log\reader) {
|
||||
$this->readers[$plugin] = $store;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called from the observer only.
|
||||
*
|
||||
* @param \core\event\base $event
|
||||
*/
|
||||
public function process(\core\event\base $event) {
|
||||
$this->init();
|
||||
foreach ($this->writers as $plugin => $writer) {
|
||||
try {
|
||||
$writer->write($event, $this);
|
||||
} catch (\Exception $e) {
|
||||
debugging('Exception detected when logging event ' . $event->eventname . ' in ' . $plugin . ': ' .
|
||||
$e->getMessage(), DEBUG_NORMAL, $e->getTrace());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns list of available log readers.
|
||||
*
|
||||
* This way the reports find out available sources of data.
|
||||
*
|
||||
* @param string $interface Returned stores must implement this interface.
|
||||
*
|
||||
* @return \core\log\reader[] list of available log data readers
|
||||
*/
|
||||
public function get_readers($interface = null) {
|
||||
$this->init();
|
||||
$return = array();
|
||||
foreach ($this->readers as $plugin => $reader) {
|
||||
if (empty($interface) || ($reader instanceof $interface)) {
|
||||
$return[$plugin] = $reader;
|
||||
}
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of reports that support the given store instance.
|
||||
*
|
||||
* @param string $logstore Name of the store.
|
||||
*
|
||||
* @return array List of supported reports
|
||||
*/
|
||||
public function get_supported_reports($logstore) {
|
||||
|
||||
$allstores = self::get_store_plugins();
|
||||
if (empty($allstores[$logstore])) {
|
||||
// Store doesn't exist.
|
||||
return array();
|
||||
}
|
||||
|
||||
$reports = get_plugin_list_with_function('report', 'supports_logstore', 'lib.php');
|
||||
$enabled = $this->stores;
|
||||
|
||||
if (empty($enabled[$logstore])) {
|
||||
// Store is not enabled, init an instance.
|
||||
$classname = '\\' . $logstore . '\log\store';
|
||||
$instance = new $classname($this);
|
||||
} else {
|
||||
$instance = $enabled[$logstore];
|
||||
}
|
||||
|
||||
$return = array();
|
||||
foreach ($reports as $report => $fulldir) {
|
||||
if (component_callback($report, 'supports_logstore', array($instance), false)) {
|
||||
$return[$report] = get_string('pluginname', $report);
|
||||
}
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* For a given report, returns a list of log stores that are supported.
|
||||
*
|
||||
* @param string $component component.
|
||||
*
|
||||
* @return false|array list of logstores that support the given report. It returns false if the given $component doesn't
|
||||
* require logstores.
|
||||
*/
|
||||
public function get_supported_logstores($component) {
|
||||
|
||||
$allstores = self::get_store_plugins();
|
||||
$enabled = $this->stores;
|
||||
|
||||
$function = component_callback_exists($component, 'supports_logstore');
|
||||
if (!$function) {
|
||||
// The report doesn't define the callback, most probably it doesn't need log stores.
|
||||
return false;
|
||||
}
|
||||
|
||||
$return = array();
|
||||
foreach ($allstores as $store => $logclass) {
|
||||
$instance = empty($enabled[$store]) ? new $logclass($this) : $enabled[$store];
|
||||
if ($function($instance)) {
|
||||
$return[$store] = get_string('pluginname', $store);
|
||||
}
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Intended for store management, do not use from reports.
|
||||
*
|
||||
* @return store[] Returns list of available store plugins.
|
||||
*/
|
||||
public static function get_store_plugins() {
|
||||
return \core_component::get_plugin_list_with_class('logstore', 'log\store');
|
||||
}
|
||||
|
||||
/**
|
||||
* Usually called automatically from shutdown manager,
|
||||
* this allows us to implement buffering of write operations.
|
||||
*/
|
||||
public function dispose() {
|
||||
if ($this->stores) {
|
||||
foreach ($this->stores as $store) {
|
||||
$store->dispose();
|
||||
}
|
||||
}
|
||||
$this->stores = null;
|
||||
$this->readers = null;
|
||||
$this->writers = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Legacy add_to_log() redirection.
|
||||
*
|
||||
* To be used only from deprecated add_to_log() function and event trigger() method.
|
||||
*
|
||||
* NOTE: this is hardcoded to legacy log store plugin, hopefully we can get rid of it soon.
|
||||
*
|
||||
* @param int $courseid The course id
|
||||
* @param string $module The module name e.g. forum, journal, resource, course, user etc
|
||||
* @param string $action 'view', 'update', 'add' or 'delete', possibly followed by another word to clarify
|
||||
* @param string $url The file and parameters used to see the results of the action
|
||||
* @param string $info Additional description information
|
||||
* @param int $cm The course_module->id if there is one
|
||||
* @param int|\stdClass $user If log regards $user other than $USER
|
||||
*/
|
||||
public function legacy_add_to_log($courseid, $module, $action, $url = '', $info = '', $cm = 0, $user = 0) {
|
||||
$this->init();
|
||||
if (isset($this->stores['logstore_legacy'])) {
|
||||
$this->stores['logstore_legacy']->legacy_add_to_log($courseid, $module, $action, $url, $info, $cm, $user);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,43 +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/>.
|
||||
|
||||
/**
|
||||
* Event observer.
|
||||
*
|
||||
* @package tool_log
|
||||
* @copyright 2013 Petr Skoda {@link http://skodak.org}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
namespace tool_log\log;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
class observer {
|
||||
/**
|
||||
* Redirect all events to this log manager, but only if this
|
||||
* log manager is actually used.
|
||||
*
|
||||
* @param \core\event\base $event
|
||||
*/
|
||||
public static function store(\core\event\base $event) {
|
||||
$logmanager = get_log_manager();
|
||||
if (get_class($logmanager) === 'tool_log\log\manager') {
|
||||
/** @var \tool_log\log\manager $logmanager */
|
||||
$logmanager->process($event);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,43 +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/>.
|
||||
|
||||
/**
|
||||
* Log store interface.
|
||||
*
|
||||
* @package tool_log
|
||||
* @copyright 2013 Petr Skoda {@link http://skodak.org}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
namespace tool_log\log;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
interface store {
|
||||
/**
|
||||
* Create new instance of store,
|
||||
* the calling code must make sure only one instance exists.
|
||||
*
|
||||
* @param manager $manager
|
||||
*/
|
||||
public function __construct(\tool_log\log\manager $manager);
|
||||
|
||||
/**
|
||||
* Notify store no more events are going to be written/read from it.
|
||||
* @return void
|
||||
*/
|
||||
public function dispose();
|
||||
}
|
||||
@@ -1,37 +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/>.
|
||||
|
||||
/**
|
||||
* Log store writer interface.
|
||||
*
|
||||
* @package tool_log
|
||||
* @copyright 2013 Petr Skoda {@link http://skodak.org}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
namespace tool_log\log;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
interface writer extends store {
|
||||
/**
|
||||
* Write one event to the store.
|
||||
*
|
||||
* @param \core\event\base $event
|
||||
* @return void
|
||||
*/
|
||||
public function write(\core\event\base $event);
|
||||
}
|
||||
@@ -1,89 +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/>.
|
||||
|
||||
/**
|
||||
* Subplugin info class.
|
||||
*
|
||||
* @package tool_log
|
||||
* @copyright 2013 Petr Skoda {@link http://skodak.org}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
namespace tool_log\plugininfo;
|
||||
|
||||
use core\plugininfo\base, moodle_url, part_of_admin_tree, admin_settingpage;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* Plugin info class for logging store plugins.
|
||||
*/
|
||||
class logstore extends base {
|
||||
|
||||
public function is_enabled() {
|
||||
$enabled = get_config('tool_log', 'enabled_stores');
|
||||
if (!$enabled) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$enabled = array_flip(explode(',', $enabled));
|
||||
return isset($enabled['logstore_' . $this->name]);
|
||||
}
|
||||
|
||||
public function get_settings_section_name() {
|
||||
return 'logsetting' . $this->name;
|
||||
}
|
||||
|
||||
public function load_settings(part_of_admin_tree $adminroot, $parentnodename, $hassiteconfig) {
|
||||
global $CFG, $USER, $DB, $OUTPUT, $PAGE; // In case settings.php wants to refer to them.
|
||||
$ADMIN = $adminroot; // May be used in settings.php.
|
||||
$section = $this->get_settings_section_name();
|
||||
|
||||
if (!$this->is_installed_and_upgraded()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$hassiteconfig or !file_exists($this->full_path('settings.php'))) {
|
||||
return;
|
||||
}
|
||||
|
||||
$settings = new admin_settingpage($section, $this->displayname, 'moodle/site:config', $this->is_enabled() === false);
|
||||
include($this->full_path('settings.php'));
|
||||
|
||||
if ($settings) {
|
||||
$ADMIN->add($parentnodename, $settings);
|
||||
}
|
||||
}
|
||||
|
||||
public static function get_manage_url() {
|
||||
return new moodle_url('/admin/settings.php', array('section' => 'managelogging'));
|
||||
}
|
||||
|
||||
public function is_uninstall_allowed() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public function uninstall_cleanup() {
|
||||
$enabled = get_config('tool_log', 'enabled_stores');
|
||||
if ($enabled) {
|
||||
$enabled = array_flip(explode(',', $enabled));
|
||||
unset($enabled['logstore_' . $this->name]);
|
||||
$enabled = array_flip($enabled);
|
||||
set_config('enabled_stores', implode(',', $enabled), 'tool_log');
|
||||
}
|
||||
|
||||
parent::uninstall_cleanup();
|
||||
}
|
||||
}
|
||||
@@ -1,242 +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/>.
|
||||
|
||||
/**
|
||||
* Store management setting.
|
||||
*
|
||||
* @package tool_log
|
||||
* @copyright 2013 Petr Skoda {@link http://skodak.org}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
require_once("$CFG->libdir/adminlib.php");
|
||||
|
||||
class tool_log_setting_managestores extends admin_setting {
|
||||
/**
|
||||
* Calls parent::__construct with specific arguments
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->nosave = true;
|
||||
parent::__construct('tool_log_manageui', get_string('managelogging', 'tool_log'), '', '');
|
||||
}
|
||||
|
||||
/**
|
||||
* Always returns true, does nothing.
|
||||
*
|
||||
* @return true
|
||||
*/
|
||||
public function get_setting() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Always returns true, does nothing.
|
||||
*
|
||||
* @return true
|
||||
*/
|
||||
public function get_defaultsetting() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Always returns '', does not write anything.
|
||||
*
|
||||
* @param mixed $data ignored
|
||||
* @return string Always returns ''
|
||||
*/
|
||||
public function write_setting($data) {
|
||||
// Do not write any setting.
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if $query is one of the available log plugins.
|
||||
*
|
||||
* @param string $query The string to search for
|
||||
* @return bool Returns true if found, false if not
|
||||
*/
|
||||
public function is_related($query) {
|
||||
if (parent::is_related($query)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$query = core_text::strtolower($query);
|
||||
$plugins = \tool_log\log\manager::get_store_plugins();
|
||||
foreach ($plugins as $plugin => $fulldir) {
|
||||
if (strpos(core_text::strtolower($plugin), $query) !== false) {
|
||||
return true;
|
||||
}
|
||||
$localised = get_string('pluginname', $plugin);
|
||||
if (strpos(core_text::strtolower($localised), $query) !== false) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the XHTML to display the control.
|
||||
*
|
||||
* @param string $data Unused
|
||||
* @param string $query
|
||||
* @return string
|
||||
*/
|
||||
public function output_html($data, $query = '') {
|
||||
global $OUTPUT, $PAGE;
|
||||
|
||||
// Display strings.
|
||||
$strup = get_string('up');
|
||||
$strdown = get_string('down');
|
||||
$strsettings = get_string('settings');
|
||||
$strenable = get_string('enable');
|
||||
$strdisable = get_string('disable');
|
||||
$struninstall = get_string('uninstallplugin', 'core_admin');
|
||||
$strversion = get_string('version');
|
||||
|
||||
$pluginmanager = core_plugin_manager::instance();
|
||||
$logmanager = new \tool_log\log\manager();
|
||||
$available = $logmanager->get_store_plugins();
|
||||
$enabled = get_config('tool_log', 'enabled_stores');
|
||||
if (!$enabled) {
|
||||
$enabled = array();
|
||||
} else {
|
||||
$enabled = array_flip(explode(',', $enabled));
|
||||
}
|
||||
|
||||
$allstores = array();
|
||||
foreach ($enabled as $key => $store) {
|
||||
$allstores[$key] = true;
|
||||
$enabled[$key] = true;
|
||||
}
|
||||
foreach ($available as $key => $store) {
|
||||
$allstores[$key] = true;
|
||||
$available[$key] = true;
|
||||
}
|
||||
|
||||
$return = $OUTPUT->heading(get_string('actlogshdr', 'tool_log'), 3, 'main', true);
|
||||
$return .= $OUTPUT->box_start('generalbox loggingui');
|
||||
|
||||
$table = new html_table();
|
||||
$table->head = array(get_string('name'), get_string('reportssupported', 'tool_log'), $strversion, $strenable,
|
||||
$strup . '/' . $strdown, $strsettings, $struninstall);
|
||||
$table->colclasses = array('leftalign', 'centeralign', 'centeralign', 'centeralign', 'centeralign', 'centeralign',
|
||||
'centeralign');
|
||||
$table->id = 'logstoreplugins';
|
||||
$table->attributes['class'] = 'admintable generaltable';
|
||||
$table->data = array();
|
||||
|
||||
// Iterate through store plugins and add to the display table.
|
||||
$updowncount = 1;
|
||||
$storecount = count($enabled);
|
||||
$url = new moodle_url('/admin/tool/log/stores.php', array('sesskey' => sesskey()));
|
||||
$printed = array();
|
||||
foreach ($allstores as $store => $unused) {
|
||||
$plugininfo = $pluginmanager->get_plugin_info($store);
|
||||
$version = get_config($store, 'version');
|
||||
if ($version === false) {
|
||||
$version = '';
|
||||
}
|
||||
|
||||
if (get_string_manager()->string_exists('pluginname', $store)) {
|
||||
$name = get_string('pluginname', $store);
|
||||
} else {
|
||||
$name = $store;
|
||||
}
|
||||
|
||||
$reports = $logmanager->get_supported_reports($store);
|
||||
if (!empty($reports)) {
|
||||
$supportedreports = implode(', ', $reports);
|
||||
} else {
|
||||
$supportedreports = '-';
|
||||
}
|
||||
|
||||
// Hide/show links.
|
||||
if (isset($enabled[$store])) {
|
||||
$aurl = new moodle_url($url, array('action' => 'disable', 'store' => $store));
|
||||
$hideshow = "<a href=\"$aurl\">";
|
||||
$hideshow .= "<img src=\"" . $OUTPUT->pix_url('t/hide') . "\" class=\"iconsmall\" alt=\"$strdisable\" /></a>";
|
||||
$isenabled = true;
|
||||
$displayname = "<span>$name</span>";
|
||||
} else {
|
||||
if (isset($available[$store])) {
|
||||
$aurl = new moodle_url($url, array('action' => 'enable', 'store' => $store));
|
||||
$hideshow = "<a href=\"$aurl\">";
|
||||
$hideshow .= "<img src=\"" . $OUTPUT->pix_url('t/show') . "\" class=\"iconsmall\" alt=\"$strenable\" /></a>";
|
||||
$isenabled = false;
|
||||
$displayname = "<span class=\"dimmed_text\">$name</span>";
|
||||
} else {
|
||||
$hideshow = '';
|
||||
$isenabled = false;
|
||||
$displayname = '<span class="notifyproblem">' . $name . '</span>';
|
||||
}
|
||||
}
|
||||
if ($PAGE->theme->resolve_image_location('icon', $store, false)) {
|
||||
$icon = $OUTPUT->pix_icon('icon', '', $store, array('class' => 'icon pluginicon'));
|
||||
} else {
|
||||
$icon = $OUTPUT->pix_icon('spacer', '', 'moodle', array('class' => 'icon pluginicon noicon'));
|
||||
}
|
||||
|
||||
// Up/down link (only if store is enabled).
|
||||
$updown = '';
|
||||
if ($isenabled) {
|
||||
if ($updowncount > 1) {
|
||||
$aurl = new moodle_url($url, array('action' => 'up', 'store' => $store));
|
||||
$updown .= "<a href=\"$aurl\">";
|
||||
$updown .= "<img src=\"" . $OUTPUT->pix_url('t/up') . "\" alt=\"$strup\" class=\"iconsmall\" /></a> ";
|
||||
} else {
|
||||
$updown .= "<img src=\"" . $OUTPUT->pix_url('spacer') . "\" class=\"iconsmall\" alt=\"\" /> ";
|
||||
}
|
||||
if ($updowncount < $storecount) {
|
||||
$aurl = new moodle_url($url, array('action' => 'down', 'store' => $store));
|
||||
$updown .= "<a href=\"$aurl\">";
|
||||
$updown .= "<img src=\"" . $OUTPUT->pix_url('t/down') . "\" alt=\"$strdown\" class=\"iconsmall\" /></a>";
|
||||
} else {
|
||||
$updown .= "<img src=\"" . $OUTPUT->pix_url('spacer') . "\" class=\"iconsmall\" alt=\"\" />";
|
||||
}
|
||||
++$updowncount;
|
||||
}
|
||||
|
||||
// Add settings link.
|
||||
if (!$version) {
|
||||
$settings = '';
|
||||
} else {
|
||||
if ($surl = $plugininfo->get_settings_url()) {
|
||||
$settings = html_writer::link($surl, $strsettings);
|
||||
} else {
|
||||
$settings = '';
|
||||
}
|
||||
}
|
||||
|
||||
// Add uninstall info.
|
||||
$uninstall = '';
|
||||
if ($uninstallurl = core_plugin_manager::instance()->get_uninstall_url($store, 'manage')) {
|
||||
$uninstall = html_writer::link($uninstallurl, $struninstall);
|
||||
}
|
||||
|
||||
// Add a row to the table.
|
||||
$table->data[] = array($icon . $displayname, $supportedreports, $version, $hideshow, $updown, $settings, $uninstall);
|
||||
|
||||
$printed[$store] = true;
|
||||
}
|
||||
|
||||
$return .= html_writer::table($table);
|
||||
$return .= get_string('configlogplugins', 'tool_log') . '<br />' . get_string('tablenosave', 'admin');
|
||||
$return .= $OUTPUT->box_end();
|
||||
return highlight($query, $return);
|
||||
}
|
||||
}
|
||||
@@ -1,35 +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/>.
|
||||
|
||||
/**
|
||||
* Event observer.
|
||||
*
|
||||
* @package tool_log
|
||||
* @category event
|
||||
* @copyright 2013 Petr Skoda {@link http://skodak.org}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$observers = array(
|
||||
array(
|
||||
'eventname' => '*',
|
||||
'callback' => '\tool_log\log\observer::store',
|
||||
'internal' => false, // This means that we get events only after transaction commit.
|
||||
'priority' => 1000,
|
||||
),
|
||||
);
|
||||
@@ -1,52 +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/>.
|
||||
|
||||
/**
|
||||
* Logging support.
|
||||
*
|
||||
* @package tool_log
|
||||
* @copyright 2013 Petr Skoda {@link http://skodak.org}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* Install the plugin.
|
||||
*/
|
||||
function xmldb_tool_log_install() {
|
||||
global $CFG, $DB;
|
||||
|
||||
$enabled = array();
|
||||
|
||||
// Add data to new log only from now on.
|
||||
if (file_exists("$CFG->dirroot/$CFG->admin/tool/log/store/standard")) {
|
||||
$enabled[] = 'logstore_standard';
|
||||
}
|
||||
|
||||
// Enable legacy log reading, but only if there are existing data.
|
||||
if (file_exists("$CFG->dirroot/$CFG->admin/tool/log/store/legacy")) {
|
||||
unset_config('loglegacy', 'logstore_legacy');
|
||||
// Do not enabled legacy logging if somebody installed a new
|
||||
// site and in less than one day upgraded to 2.7.
|
||||
$params = array('yesterday' => time() - 60*60*24);
|
||||
if ($DB->record_exists_select('log', "time < :yesterday", $params)) {
|
||||
$enabled[] = 'logstore_legacy';
|
||||
}
|
||||
}
|
||||
|
||||
set_config('enabled_stores', implode(',', $enabled), 'tool_log');
|
||||
}
|
||||
@@ -1,25 +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/>.
|
||||
|
||||
/**
|
||||
* Logging subplugins.
|
||||
*
|
||||
* @package tool_log
|
||||
* @copyright 2013 Petr Skoda {@link http://skodak.org}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
$subplugins = array('logstore' => 'admin/tool/log/store');
|
||||
@@ -1,50 +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/>.
|
||||
|
||||
/**
|
||||
* Logging support.
|
||||
*
|
||||
* @package tool_log
|
||||
* @copyright 2014 Petr Skoda {@link http://skodak.org}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* Upgrade the plugin.
|
||||
*
|
||||
* @param int $oldversion
|
||||
* @return bool always true
|
||||
*/
|
||||
function xmldb_tool_log_upgrade($oldversion) {
|
||||
global $CFG, $DB, $OUTPUT;
|
||||
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
if ($oldversion < 2014040600) {
|
||||
// Reset logging defaults in dev branches,
|
||||
// in production upgrade the install.php is executed instead.
|
||||
require_once(__DIR__ . '/install.php');
|
||||
xmldb_tool_log_install();
|
||||
upgrade_plugin_savepoint(true, 2014040600, 'tool', 'log');
|
||||
}
|
||||
|
||||
// Moodle v2.7.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1,32 +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/>.
|
||||
|
||||
/**
|
||||
* Store management UI lang strings.
|
||||
*
|
||||
* @package tool_log
|
||||
* @copyright 2013 Petr Skoda {@link http://skodak.org}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
$string['actlogshdr'] = 'Available log stores';
|
||||
$string['configlogplugins'] = 'Please enable all required plugins and arrange them in appropriate order.';
|
||||
$string['logging'] = 'Logging';
|
||||
$string['managelogging'] = 'Manage log stores';
|
||||
$string['reportssupported'] = 'Reports supported';
|
||||
$string['pluginname'] = 'Log store manager';
|
||||
$string['subplugintype_logstore'] = 'Log store';
|
||||
$string['subplugintype_logstore_plural'] = 'Log stores';
|
||||
@@ -1,38 +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/>.
|
||||
|
||||
/**
|
||||
* Logging settings.
|
||||
*
|
||||
* @package tool_log
|
||||
* @copyright 2013 Petr Skoda {@link http://skodak.org/}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
if ($hassiteconfig) {
|
||||
$ADMIN->add('modules', new admin_category('logging', new lang_string('logging', 'tool_log')));
|
||||
|
||||
$temp = new admin_settingpage('managelogging', new lang_string('managelogging', 'tool_log'));
|
||||
$temp->add(new tool_log_setting_managestores());
|
||||
$ADMIN->add('logging', $temp);
|
||||
|
||||
foreach (core_plugin_manager::instance()->get_plugins_of_type('logstore') as $plugin) {
|
||||
/** @var \tool_log\plugininfo\logstore $plugin */
|
||||
$plugin->load_settings($ADMIN, 'logging', $hassiteconfig);
|
||||
}
|
||||
}
|
||||
@@ -1,78 +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/>.
|
||||
|
||||
/**
|
||||
* Helper class locally used.
|
||||
*
|
||||
* @package logstore_database
|
||||
* @copyright 2014 onwards Ankit Agarwal
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
namespace logstore_database;
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
|
||||
/**
|
||||
* Helper class locally used.
|
||||
*
|
||||
* @copyright 2014 onwards Ankit Agarwal
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class helper {
|
||||
/**
|
||||
* Returns list of fully working database drivers present in system.
|
||||
* @return array
|
||||
*/
|
||||
public static function get_drivers() {
|
||||
return array(
|
||||
'' => get_string('choosedots'),
|
||||
'native/mysqli' => \moodle_database::get_driver_instance('mysqli', 'native')->get_name(),
|
||||
'native/mariadb' => \moodle_database::get_driver_instance('mariadb', 'native')->get_name(),
|
||||
'native/pgsql' => \moodle_database::get_driver_instance('pgsql', 'native')->get_name(),
|
||||
'native/oci' => \moodle_database::get_driver_instance('oci', 'native')->get_name(),
|
||||
'native/sqlsrv' => \moodle_database::get_driver_instance('sqlsrv', 'native')->get_name(),
|
||||
'native/mssql' => \moodle_database::get_driver_instance('mssql', 'native')->get_name()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of edu levels.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function get_level_options() {
|
||||
return array(
|
||||
\core\event\base::LEVEL_TEACHING => get_string('teaching', 'logstore_database'),
|
||||
\core\event\base::LEVEL_PARTICIPATING => get_string('participating', 'logstore_database'),
|
||||
\core\event\base::LEVEL_OTHER => get_string('other', 'logstore_database'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of database actions.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function get_action_options() {
|
||||
return array(
|
||||
'c' => get_string('create', 'logstore_database'),
|
||||
'r' => get_string('read', 'logstore_database'),
|
||||
'u' => get_string('update', 'logstore_database'),
|
||||
'd' => get_string('delete')
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,240 +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/>.
|
||||
|
||||
/**
|
||||
* External database store.
|
||||
*
|
||||
* @package logstore_database
|
||||
* @copyright 2013 Petr Skoda {@link http://skodak.org}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
namespace logstore_database\log;
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
class store implements \tool_log\log\writer, \core\log\sql_select_reader {
|
||||
use \tool_log\helper\store,
|
||||
\tool_log\helper\reader,
|
||||
\tool_log\helper\buffered_writer {
|
||||
dispose as helper_dispose;
|
||||
}
|
||||
|
||||
/** @var \moodle_database $extdb */
|
||||
protected $extdb;
|
||||
|
||||
/** @var bool $logguests true if logging guest access */
|
||||
protected $logguests;
|
||||
|
||||
/** @var array $includelevels An array of education levels to include */
|
||||
protected $includelevels = array();
|
||||
|
||||
/** @var array $includeactions An array of actions types to include */
|
||||
protected $includeactions = array();
|
||||
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param \tool_log\log\manager $manager
|
||||
*/
|
||||
public function __construct(\tool_log\log\manager $manager) {
|
||||
$this->helper_setup($manager);
|
||||
$this->buffersize = $this->get_config('buffersize', 50);
|
||||
$this->logguests = $this->get_config('logguests', 1);
|
||||
$actions = $this->get_config('includeactions', '');
|
||||
$levels = $this->get_config('includelevels', '');
|
||||
$this->includeactions = $actions === '' ? array() : explode(',', $actions);
|
||||
$this->includelevels = $levels === '' ? array() : explode(',', $levels);
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup the Database.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function init() {
|
||||
if (isset($this->extdb)) {
|
||||
return !empty($this->extdb);
|
||||
}
|
||||
|
||||
$dbdriver = $this->get_config('dbdriver');
|
||||
if (empty($dbdriver)) {
|
||||
$this->extdb = false;
|
||||
return false;
|
||||
}
|
||||
list($dblibrary, $dbtype) = explode('/', $dbdriver);
|
||||
|
||||
if (!$db = \moodle_database::get_driver_instance($dbtype, $dblibrary, true)) {
|
||||
debugging("Unknown driver $dblibrary/$dbtype", DEBUG_DEVELOPER);
|
||||
$this->extdb = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
$dboptions = array();
|
||||
$dboptions['dbpersist'] = $this->get_config('dbpersist', '0');
|
||||
$dboptions['dbsocket'] = $this->get_config('dbsocket', '');
|
||||
$dboptions['dbport'] = $this->get_config('dbport', '');
|
||||
$dboptions['dbschema'] = $this->get_config('dbschema', '');
|
||||
$dboptions['dbcollation'] = $this->get_config('dbcollation', '');
|
||||
try {
|
||||
$db->connect($this->get_config('dbhost'), $this->get_config('dbuser'), $this->get_config('dbpass'),
|
||||
$this->get_config('dbname'), false, $dboptions);
|
||||
$tables = $db->get_tables();
|
||||
if (!in_array($this->get_config('dbtable'), $tables)) {
|
||||
debugging('Cannot find the specified table', DEBUG_DEVELOPER);
|
||||
$this->extdb = false;
|
||||
return false;
|
||||
}
|
||||
} catch (\moodle_exception $e) {
|
||||
debugging('Cannot connect to external database: ' . $e->getMessage(), DEBUG_DEVELOPER);
|
||||
$this->extdb = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->extdb = $db;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Should the event be ignored (== not logged)?
|
||||
* @param \core\event\base $event
|
||||
* @return bool
|
||||
*/
|
||||
protected function is_event_ignored(\core\event\base $event) {
|
||||
if (!in_array($event->crud, $this->includeactions) &&
|
||||
!in_array($event->edulevel, $this->includelevels)
|
||||
) {
|
||||
// Ignore event if the store settings do not want to store it.
|
||||
return true;
|
||||
}
|
||||
if ((!CLI_SCRIPT or PHPUNIT_TEST) and !$this->logguests) {
|
||||
// Always log inside CLI scripts because we do not login there.
|
||||
if (!isloggedin() or isguestuser()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert events in bulk to the database.
|
||||
*
|
||||
* @param array $evententries raw event data
|
||||
*/
|
||||
protected function insert_event_entries($evententries) {
|
||||
if (!$this->init()) {
|
||||
return;
|
||||
}
|
||||
if (!$dbtable = $this->get_config('dbtable')) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
$this->extdb->insert_records($dbtable, $evententries);
|
||||
} catch (\moodle_exception $e) {
|
||||
debugging('Cannot write to external database: ' . $e->getMessage(), DEBUG_DEVELOPER);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an array of events based on the passed on params.
|
||||
*
|
||||
* @param string $selectwhere select conditions.
|
||||
* @param array $params params.
|
||||
* @param string $sort sortorder.
|
||||
* @param int $limitfrom limit constraints.
|
||||
* @param int $limitnum limit constraints.
|
||||
*
|
||||
* @return array|\core\event\base[] array of events.
|
||||
*/
|
||||
public function get_events_select($selectwhere, array $params, $sort, $limitfrom, $limitnum) {
|
||||
if (!$this->init()) {
|
||||
return array();
|
||||
}
|
||||
|
||||
if (!$dbtable = $this->get_config('dbtable')) {
|
||||
return array();
|
||||
}
|
||||
|
||||
$sort = self::tweak_sort_by_id($sort);
|
||||
|
||||
$events = array();
|
||||
$records = $this->extdb->get_records_select($dbtable, $selectwhere, $params, $sort, '*', $limitfrom, $limitnum);
|
||||
|
||||
foreach ($records as $data) {
|
||||
$extra = array('origin' => $data->origin, 'realuserid' => $data->realuserid, 'ip' => $data->ip);
|
||||
$data = (array)$data;
|
||||
$id = $data['id'];
|
||||
$data['other'] = unserialize($data['other']);
|
||||
if ($data['other'] === false) {
|
||||
$data['other'] = array();
|
||||
}
|
||||
unset($data['origin']);
|
||||
unset($data['ip']);
|
||||
unset($data['realuserid']);
|
||||
unset($data['id']);
|
||||
|
||||
$event = \core\event\base::restore($data, $extra);
|
||||
// Add event to list if it's valid.
|
||||
if ($event) {
|
||||
$events[$id] = $event;
|
||||
}
|
||||
}
|
||||
|
||||
return $events;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get number of events present for the given select clause.
|
||||
*
|
||||
* @param string $selectwhere select conditions.
|
||||
* @param array $params params.
|
||||
*
|
||||
* @return int Number of events available for the given conditions
|
||||
*/
|
||||
public function get_events_select_count($selectwhere, array $params) {
|
||||
if (!$this->init()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!$dbtable = $this->get_config('dbtable')) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return $this->extdb->count_records_select($dbtable, $selectwhere, $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Are the new events appearing in the reader?
|
||||
*
|
||||
* @return bool true means new log events are being added, false means no new data will be added
|
||||
*/
|
||||
public function is_logging() {
|
||||
if (!$this->init()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispose off database connection after pushing any buffered events to the database.
|
||||
*/
|
||||
public function dispose() {
|
||||
$this->helper_dispose();
|
||||
if ($this->extdb) {
|
||||
$this->extdb->dispose();
|
||||
}
|
||||
$this->extdb = null;
|
||||
}
|
||||
}
|
||||
@@ -1,40 +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/>.
|
||||
|
||||
/**
|
||||
* Database log store upgrade.
|
||||
*
|
||||
* @package logstore_database
|
||||
* @copyright 2014 onwards Ankit Agarwal <ankit.agrr@gmail.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
function xmldb_logstore_database_upgrade($oldversion) {
|
||||
|
||||
if ($oldversion < 2014041700) {
|
||||
// Clean up old config.
|
||||
unset_config('excludelevels', 'logstore_database');
|
||||
unset_config('excludeactions', 'logstore_database');
|
||||
|
||||
// Savepoint reached.
|
||||
upgrade_plugin_savepoint(true, 2014041700, 'logstore', 'database');
|
||||
}
|
||||
|
||||
// Moodle v2.7.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1,51 +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/>.
|
||||
|
||||
/**
|
||||
* Log store lang strings.
|
||||
*
|
||||
* @package logstore_database
|
||||
* @copyright 2013 Petr Skoda {@link http://skodak.org}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
$string['buffersize'] = 'Buffer size';
|
||||
$string['buffersize_help'] = 'Number of log entries inserted in one batch database operation, which improves performance.';
|
||||
$string['conectexception'] = 'Cannot connect to the database.';
|
||||
$string['create'] = 'Create';
|
||||
$string['databasesettings'] = 'Database settings';
|
||||
$string['databasesettings_help'] = 'Connection details for the external log database: {$a}';
|
||||
$string['databasepersist'] = 'Persistent database connections';
|
||||
$string['databaseschema'] = 'Database schema';
|
||||
$string['databasecollation'] = 'Database collation';
|
||||
$string['databasetable'] = 'Database table';
|
||||
$string['databasetable_help'] = 'Name of the table where logs will be stored. This table should have a structure identical to the one used by logstore_standard (mdl_logstore_standard_log).';
|
||||
$string['includeactions'] = 'Include actions of these types';
|
||||
$string['includelevels'] = 'Include actions with these educational levels';
|
||||
$string['filters'] = 'Filter logs';
|
||||
$string['filters_help'] = 'Enable filters that exclude some actions from being logged.';
|
||||
$string['logguests'] = 'Log guest actions';
|
||||
$string['other'] = 'Other';
|
||||
$string['participating'] = 'Participating';
|
||||
$string['pluginname'] = 'External database log';
|
||||
$string['pluginname_desc'] = 'A log plugin that stores log entries in an external database table.';
|
||||
$string['read'] = 'Read';
|
||||
$string['tablenotfound'] = 'Specified table was not found';
|
||||
$string['teaching'] = 'Teaching';
|
||||
$string['testsettings'] = 'Test connection';
|
||||
$string['testingsettings'] = 'Testing database settings...';
|
||||
$string['update'] = 'Update';
|
||||
|
||||
@@ -1,71 +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/>.
|
||||
|
||||
/**
|
||||
* External database log store settings.
|
||||
*
|
||||
* @package logstore_database
|
||||
* @copyright 2013 Petr Skoda {@link http://skodak.org}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
if ($hassiteconfig) {
|
||||
$testurl = new moodle_url('/admin/tool/log/store/database/test_settings.php', array('sesskey' => sesskey()));
|
||||
$test = new admin_externalpage('logstoredbtestsettings', get_string('testsettings', 'logstore_database'),
|
||||
$testurl, 'moodle/site:config', true);
|
||||
$ADMIN->add('logging', $test);
|
||||
|
||||
$drivers = \logstore_database\helper::get_drivers();
|
||||
// Database settings.
|
||||
$link = html_writer::link($testurl, get_string('testsettings', 'logstore_database'), array('target' => '_blank'));
|
||||
$settings->add(new admin_setting_heading('dbsettings', get_string('databasesettings', 'logstore_database'),
|
||||
get_string('databasesettings_help', 'logstore_database', $link)));
|
||||
$settings->add(new admin_setting_configselect('logstore_database/dbdriver', get_string('databasetypehead', 'install'), '',
|
||||
'', $drivers));
|
||||
|
||||
$settings->add(new admin_setting_configtext('logstore_database/dbhost', get_string('databasehost', 'install'), '', ''));
|
||||
$settings->add(new admin_setting_configtext('logstore_database/dbuser', get_string('databaseuser', 'install'), '', ''));
|
||||
$settings->add(new admin_setting_configpasswordunmask('logstore_database/dbpass', get_string('databasepass', 'install'), '', ''));
|
||||
$settings->add(new admin_setting_configtext('logstore_database/dbname', get_string('databasename', 'install'), '', ''));
|
||||
$settings->add(new admin_setting_configtext('logstore_database/dbtable', get_string('databasetable', 'logstore_database'),
|
||||
get_string('databasetable_help', 'logstore_database'), ''));
|
||||
|
||||
$settings->add(new admin_setting_configcheckbox('logstore_database/dbpersist', get_string('databasepersist',
|
||||
'logstore_database'), '', '0'));
|
||||
$settings->add(new admin_setting_configtext('logstore_database/dbsocket', get_string('databasesocket', 'install'), '',
|
||||
''));
|
||||
$settings->add(new admin_setting_configtext('logstore_database/dbport', get_string('databaseport', 'install'), '', ''));
|
||||
$settings->add(new admin_setting_configtext('logstore_database/dbschema', get_string('databaseschema',
|
||||
'logstore_database'), '', ''));
|
||||
$settings->add(new admin_setting_configtext('logstore_database/dbcollation', get_string('databasecollation',
|
||||
'logstore_database'), '', ''));
|
||||
$settings->add(new admin_setting_configtext('logstore_database/buffersize', get_string('buffersize',
|
||||
'logstore_database'), get_string('buffersize_help', 'logstore_database'), 50));
|
||||
|
||||
// Filters.
|
||||
$settings->add(new admin_setting_heading('filters', get_string('filters', 'logstore_database'), get_string('filters_help',
|
||||
'logstore_database')));
|
||||
$settings->add(new admin_setting_configcheckbox('logstore_database/logguests', get_string('logguests',
|
||||
'logstore_database'), '', '0'));
|
||||
$levels = \logstore_database\helper::get_level_options();
|
||||
$settings->add(new admin_setting_configmulticheckbox('logstore_database/includelevels', get_string('includelevels',
|
||||
'logstore_database'), '', $levels, $levels));
|
||||
$actions = \logstore_database\helper::get_action_options();
|
||||
$settings->add(new admin_setting_configmulticheckbox('logstore_database/includeactions', get_string('includeactions',
|
||||
'logstore_database'), '', $actions, $actions));
|
||||
}
|
||||
@@ -1,107 +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/>.
|
||||
|
||||
/**
|
||||
* Filter form.
|
||||
*
|
||||
* @package logstore_database
|
||||
* @copyright 2014 onwards Ankit Agarwal
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
require_once('../../../../../config.php');
|
||||
require_once($CFG->dirroot . '/lib/adminlib.php');
|
||||
|
||||
require_login();
|
||||
$context = context_system::instance();
|
||||
require_capability('moodle/site:config', $context);
|
||||
require_sesskey();
|
||||
|
||||
navigation_node::override_active_url(new moodle_url('/admin/settings.php', array('section' => 'logsettingdatabase')));
|
||||
admin_externalpage_setup('logstoredbtestsettings');
|
||||
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading(get_string('testingsettings', 'logstore_database'));
|
||||
|
||||
// NOTE: this is not localised intentionally, admins are supposed to understand English at least a bit...
|
||||
|
||||
raise_memory_limit(MEMORY_HUGE);
|
||||
$dbtable = get_config('logstore_database', 'dbtable');
|
||||
if (empty($dbtable)) {
|
||||
echo $OUTPUT->notification('External table not specified.', 'notifyproblem');
|
||||
die();
|
||||
}
|
||||
|
||||
$dbdriver = get_config('logstore_database', 'dbdriver');
|
||||
list($dblibrary, $dbtype) = explode('/', $dbdriver);
|
||||
if (!$db = \moodle_database::get_driver_instance($dbtype, $dblibrary, true)) {
|
||||
echo $OUTPUT->notification("Unknown driver $dblibrary/$dbtype", "notifyproblem");
|
||||
die();
|
||||
}
|
||||
|
||||
$olddebug = $CFG->debug;
|
||||
$olddisplay = ini_get('display_errors');
|
||||
ini_set('display_errors', '1');
|
||||
$CFG->debug = DEBUG_DEVELOPER;
|
||||
error_reporting($CFG->debug);
|
||||
|
||||
$dboptions = array();
|
||||
$dboptions['dbpersist'] = get_config('logstore_database', 'dbpersist');
|
||||
$dboptions['dbsocket'] = get_config('logstore_database', 'dbsocket');
|
||||
$dboptions['dbport'] = get_config('logstore_database', 'dbport');
|
||||
$dboptions['dbschema'] = get_config('logstore_database', 'dbschema');
|
||||
$dboptions['dbcollation'] = get_config('logstore_database', 'dbcollation');
|
||||
|
||||
try {
|
||||
$db->connect(get_config('logstore_database', 'dbhost'), get_config('logstore_database', 'dbuser'),
|
||||
get_config('logstore_database', 'dbpass'), get_config('logstore_database', 'dbname'), false, $dboptions);
|
||||
} catch (\moodle_exception $e) {
|
||||
echo $OUTPUT->notification('Cannot connect to the database.', 'notifyproblem');
|
||||
$CFG->debug = $olddebug;
|
||||
ini_set('display_errors', $olddisplay);
|
||||
error_reporting($CFG->debug);
|
||||
ob_end_flush();
|
||||
echo $OUTPUT->footer();
|
||||
die();
|
||||
}
|
||||
echo $OUTPUT->notification('Connection made.', 'notifysuccess');
|
||||
$tables = $db->get_tables();
|
||||
if (!in_array($dbtable, $tables)) {
|
||||
echo $OUTPUT->notification('Cannot find the specified table ' . $dbtable, 'notifyproblem');
|
||||
$CFG->debug = $olddebug;
|
||||
ini_set('display_errors', $olddisplay);
|
||||
error_reporting($CFG->debug);
|
||||
ob_end_flush();
|
||||
echo $OUTPUT->footer();
|
||||
die();
|
||||
}
|
||||
echo $OUTPUT->notification('Table ' . $dbtable . ' found.', 'notifysuccess');
|
||||
|
||||
$cols = $db->get_columns($dbtable);
|
||||
if (empty($cols)) {
|
||||
echo $OUTPUT->notification('Can not read external table.', 'notifyproblem');
|
||||
} else {
|
||||
$columns = array_keys((array)$cols);
|
||||
echo $OUTPUT->notification('External table contains following columns:<br />' . implode(', ', $columns), 'notifysuccess');
|
||||
}
|
||||
|
||||
$db->dispose();
|
||||
|
||||
$CFG->debug = $olddebug;
|
||||
ini_set('display_errors', $olddisplay);
|
||||
error_reporting($CFG->debug);
|
||||
ob_end_flush();
|
||||
echo $OUTPUT->footer();
|
||||
@@ -1,47 +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/>.
|
||||
|
||||
/**
|
||||
* Fixtures for database log storage testing.
|
||||
*
|
||||
* @package logstore_database
|
||||
* @copyright 2014 Petr Skoda
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
namespace logstore_database\event;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
|
||||
class unittest_executed extends \core\event\base {
|
||||
public static function get_name() {
|
||||
return 'xxx';
|
||||
}
|
||||
|
||||
public function get_description() {
|
||||
return 'yyy';
|
||||
}
|
||||
|
||||
protected function init() {
|
||||
$this->data['crud'] = 'u';
|
||||
$this->data['edulevel'] = self::LEVEL_PARTICIPATING;
|
||||
}
|
||||
|
||||
public function get_url() {
|
||||
return new \moodle_url('/somepath/somefile.php', array('id' => $this->data['other']['sample']));
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user