Merge branch 'MDL-78457' of https://github.com/paulholden/moodle
[moodle.git] / lib / phpspreadsheet / readme_moodle.txt
blob2af6a20758ff568556c3d6296d913bd61be563a5
1 Description of PhpSpreadsheet import into Moodle
3 Last release package can be found in https://github.com/PHPOffice/PhpSpreadsheet/releases
5 NOTICE:
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
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):
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     }
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
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
77 CHANGES:
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');
84          return realpath(dirname($temp));
85      }
86   This hack is needed because it can not be guaranteed that sysGetTempDir() works everywhere.