1 |
efrain |
1 |
Description of PhpSpreadsheet import into Moodle
|
|
|
2 |
|
1441 |
ariadna |
3 |
```sh
|
|
|
4 |
mv lib/phpspreadsheet/readme_moodle.txt ./
|
|
|
5 |
mv lib/phpspreadsheet/moodle.diff ./
|
|
|
6 |
rm -rf lib/phpspreadsheet/*
|
|
|
7 |
tempdir=`mktemp -d`
|
|
|
8 |
cd "${tempdir}"
|
|
|
9 |
composer init --require phpoffice/phpspreadsheet:^4 -n
|
|
|
10 |
cat composer.json | jq '.replace."composer/pcre"="*"' --indent 4 > composer.json.tmp; mv composer.json.tmp composer.json
|
|
|
11 |
cat composer.json | jq '.replace."maennchen/zipstream-php"="*"' --indent 4 > composer.json.tmp; mv composer.json.tmp composer.json
|
|
|
12 |
cat composer.json | jq '.replace."psr/http-client"="*"' --indent 4 > composer.json.tmp; mv composer.json.tmp composer.json
|
|
|
13 |
cat composer.json | jq '.replace."psr/http-factory"="*"' --indent 4 > composer.json.tmp; mv composer.json.tmp composer.json
|
|
|
14 |
cat composer.json | jq '.replace."psr/http-message"="*"' --indent 4 > composer.json.tmp; mv composer.json.tmp composer.json
|
|
|
15 |
cat composer.json | jq '.replace."psr/simple-cache"="*"' --indent 4 > composer.json.tmp; mv composer.json.tmp composer.json
|
|
|
16 |
composer install
|
|
|
17 |
rm -rf vendor/composer
|
|
|
18 |
rm vendor/autoload.php
|
|
|
19 |
# Delete all hidden files and phpstan.neon
|
|
|
20 |
find vendor -name '.*' | xargs rm -rf {} \;
|
|
|
21 |
find vendor -name 'phpstan*' | xargs rm -rf {} \;
|
|
|
22 |
# Delete legacy Xls (Excel5) files.
|
|
|
23 |
find vendor -name 'Xls.php' | xargs rm -rf {} \;
|
|
|
24 |
find vendor -name 'Xls' | xargs rm -rf {} \;
|
|
|
25 |
# Delete legacy OLE files.
|
|
|
26 |
find vendor -name 'OLE' | xargs rm -rf {} \;
|
|
|
27 |
find vendor -name 'OLERead.php' | xargs rm -rf {} \;
|
|
|
28 |
find vendor -name 'OLE.php' | xargs rm -rf {} \;
|
|
|
29 |
find vendor -name '*.dist' | xargs rm -rf {} \;
|
|
|
30 |
# Remove examples.
|
|
|
31 |
find vendor -name 'examples' | xargs rm -rf {} \;
|
|
|
32 |
cd -
|
|
|
33 |
cp -rf "${tempdir}/vendor/"* lib/phpspreadsheet/
|
|
|
34 |
mv readme_moodle.txt lib/phpspreadsheet/
|
|
|
35 |
mv moodle.diff ./lib/phpspreadsheet/
|
|
|
36 |
mv lib/phpspreadsheet/phpoffice/phpspreadsheet lib/phpspreadsheet
|
|
|
37 |
rm -rf $tempdir
|
|
|
38 |
git add .
|
|
|
39 |
```
|
1 |
efrain |
40 |
|
1441 |
ariadna |
41 |
Now update the lib/thirpartylibs.xml with the upgrades, and commit the changes.
|
|
|
42 |
Now apply the local Moodle customisations diff:
|
1 |
efrain |
43 |
|
1441 |
ariadna |
44 |
```sh
|
|
|
45 |
git apply lib/phpspreadsheet/moodle.diff
|
|
|
46 |
git add .
|
|
|
47 |
git commit
|
|
|
48 |
```
|
1 |
efrain |
49 |
|
1441 |
ariadna |
50 |
Now verify the changes:
|
1 |
efrain |
51 |
|
1441 |
ariadna |
52 |
Go to http://<your moodle root>/lib/tests/other/spreadsheettestpage.php and test the generated files
|