Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 1441
Línea 1... Línea 1...
1
Description of PhpSpreadsheet import into Moodle
1
Description of PhpSpreadsheet import into Moodle
Línea -... Línea 2...
-
 
2
 
-
 
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/
2
 
35
mv moodle.diff ./lib/phpspreadsheet/
-
 
36
mv lib/phpspreadsheet/phpoffice/phpspreadsheet lib/phpspreadsheet
-
 
37
rm -rf $tempdir
-
 
38
git add .
-
 
39
```
-
 
40
 
-
 
41
Now update the lib/thirpartylibs.xml with the upgrades, and commit the changes.
-
 
42
Now apply the local Moodle customisations diff:
-
 
43
 
-
 
44
```sh
-
 
45
git apply lib/phpspreadsheet/moodle.diff
-
 
46
git add .
-
 
47
git commit
Línea 3... Línea -...
3
Last release package can be found in https://github.com/PHPOffice/PhpSpreadsheet/releases
-
 
4
 
-
 
5
NOTICE:
48
```
Línea 6... Línea -...
6
 * Before running composer command, make sure you have the composer version updated.
-
 
7
 * Composer version 2.5.5 2023-03-21 11:50:05
-
 
8
 
-
 
9
STEPS:
-
 
10
 * Create a temporary folder outside your moodle installation
-
 
11
 * Create a composer.json file with the following content (you will need to replace X.YY to the proper version to be upgraded):
-
 
12
{
-
 
13
    "require": {
-
 
14
        "phpoffice/phpspreadsheet": "^X.YY"
-
 
15
    },
-
 
16
    "replace": {
-
 
17
        "ezyang/htmlpurifier": "*",
-
 
18
        "maennchen/zipstream-php": "*",
-
 
19
        "myclabs/php-enum": "*",
-
 
20
        "symfony/polyfill-mbstring": "*"
-
 
21
    }
-
 
22
}
-
 
23
 * Execute `composer require phpoffice/phpspreadsheet`
-
 
24
 * Check to make sure the following directories haven't been created
-
 
25
   - /vendor/ezyang/htmlpurifier
-
 
26
   - /vendor/maennchen/*
-
 
27
   - /vendor/myclabs/*
-
 
28
   - /vendor/symfony/polyfill-mbstring
-
 
29
 * If it has pulled these through, remove them from the required packages and run composer again.
-
 
30
 * Check any new libraries that have been added and make sure they do not exist in Moodle already.
-
 
31
 * If the following exist, remove the following folders (and their content):
-
 
32
   - vendor/phpoffice/phpspreadsheet/bin
-
 
33
   - vendor/phpoffice/phpspreadsheet/docs
-
 
34
   - vendor/phpoffice/phpspreadsheet/samples
-
 
35
 * Remove all the hidden folders and files in vendor/phpoffice/phpspreadsheet/ (find . -name ".*"):
-
 
36
   - .DS_Store
-
 
37
   - .gitattributes
-
 
38
   - .gitignore
-
 
39
   - .php_cs.dist
-
 
40
   - .sami.php
-
 
41
   - .scrutinizer.yml
-
 
42
   - .travis.yml
-
 
43
   - .phpcs.xml.dist
-
 
44
   - .php-cs-fixer.dist.php
-
 
45
   - vendor/psr/simple-cache/.editorconfig
-
 
46
   - vendor/psr/http-factory/.gitignore
-
 
47
   - vendor/psr/http-factory/.pullapprove.yml
-
 
48
   - vendor/markbaker/matrix/.github
-
 
49
   - vendor/markbaker/complex/.github
-
 
50
 * Remove the next files in related to external testing/analysis that we don't need matrix/:
-
 
51
   - vendor/markbaker/matrix/infection.json.dist (PHP mutation testing framework configuration file)
-
 
52
   - vendor/markbaker/matrix/phpstan.neon (PHP static analyzer configuration file)
-
 
53
   - vendor/phpoffice/phpspreadsheet/phpstan-baseline.neon
-
 
54
   - vendor/phpoffice/phpspreadsheet/phpstan-conditional.php
-
 
55
   - vendor/phpoffice/phpspreadsheet/phpstan.neon.dist
-
 
56
 * Shared/OLE has been removed because OLE is not DFSG compliant and is not being used in core code.
-
 
57
   Remove the files/folders (placed in vendor/phpoffice/phpspreadsheet/src/):
-
 
58
   - PhpSpreadsheet/Shared/OLE.php
-
 
59
   - PhpSpreadsheet/Shared/OLERead.php
-
 
60
   - PhpSpreadsheet/Shared/OLE/*
-
 
61
 * Xsl files have been removed. These files are for Excel version 5 (created in 1993) and are not used in core code.
-
 
62
   Remove the files/folders (placed in vendor/phpoffice/phpspreadsheet/src/):
-
 
63
   - PhpSpreadsheet/Reader/Xls.php
-
 
64
   - PhpSpreadsheet/Reader/Xls/*
-
 
65
   - PhpSpreadsheet/Shared/Xls.php
-
 
66
   - PhpSpreadsheet/Writer/Xls.php
-
 
67
   - PhpSpreadsheet/Writer/Xls/*
-
 
68
 * Remove the old 'vendor' directory in lib/phpspreadsheet/
-
 
69
 * Copy contents of 'vendor' directory
-
 
70
 * Create a commit with only the library changes
-
 
71
 * Update lib/thirdpartylibs.xml
49
 
72
 * Apply the modifications described in the CHANGES section
-
 
73
 * Create another commit with the previous two steps of changes
-
 
74
 * Go to http://<your moodle root>/lib/tests/other/spreadsheettestpage.php and test the generated files
-
 
75
 
-
 
76
 
-
 
77
CHANGES:
-
 
78
 
-
 
79
 * Add the next Moodle hack at the beginning of the function sysGetTempDir()
-
 
80
located in lib/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/File.php
-
 
81
    // Moodle hack!
-
 
82
     if (function_exists('make_temp_directory')) {
-
 
83
         $temp = make_temp_directory('phpspreadsheet');
-