Manual:ImportTextFiles.php

מתוך אוצר הספרים היהודי השיתופי
קפיצה לניווט קפיצה לחיפוש

[[Category:MediaWiki code{{#translation:}}|ImportTextFiles.php]]

Details[עריכה]

importTextFiles.php file is a maintenance script that imports text files to pages on the wiki, optionally preserving the file timestamp. The file name (without extension) is used as the page title, optionally preceded by a given prefix.

Usage[עריכה]

php importTextFiles.php [options...] <file> [<file>...]

Options[עריכה]

Option/Parameter Description
-u <user> Username to which edits should be attributed. If the specified user does not exist, it will be created. If no username has been provided, the edit will be attributed to user "Maintenance script", which also will be created if needed.
-s <summary> Edit summary. If no summary is provided, "Imported from text file" will be used.
--rc Display edits in recent changes. By default, this option is not set so that the edits are not shown in the recent changes.
--bot In the recent changes, mark the edits as "Bot edits" (only relevant if—rc is passed as well). By default, this option is not set.
--prefix <prefix> The page names will by default be the file names without file extension. If a prefix is set here, the pages will be prefixed with this prefix. So the prefix is a string to place in front of the file name when creating the page name.
--use-timestamp Use the modification date of the text file as the timestamp for the edit. By default, --use-timestamp is not set; in this case, the current timestamp of the moment of the import of the text file is used.
--overwrite Overwrite existing pages. Defaults to false, so that existing pages are skipped. If—use-timestamp is passed as well, --overwrite will only overwrite pages if the file has been modified since the page was last modified – in other words, if, according to their modification timestamps, the file is newer than the page.

Examples[עריכה]

php importTextFiles.php -s "Updating weather observations" --prefix "Template:Latest meteo/" --overwrite --use-timestamp meteo-*.txt

This command imports files matching the wildcard meteo-*.txt in the current directory to pages starting with Template:Latest meteo/. For example, meteo-Sydney.txt will be imported to the page Template:Latest meteo/meteo-Sydney. The file's modification timestamp will be used as the revision timestamp. Existing pages will be overwritten.

[[Category:Maintenance scripts{{#translation:}}|ImportTextFiles.php]]