-
Notifications
You must be signed in to change notification settings - Fork 95
/
hugo-export-cli.php
38 lines (32 loc) · 1.1 KB
/
hugo-export-cli.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
/*
* Run the exporter from the command line and spit the zipfile to STDOUT.
*
* Usage:
*
* $ php hugo-export-cli.php > my-hugo-files.zip
*
* Usage: (With configured tmp folder if the avaiable space in system /tmp is insufficent for migration)
*
* $ php hugo-export-cli.php /mnt/tmp-folder
*
* Must be run in the wordpress-to-hugo-exporter/ directory.
*
*/
include_once "../../../wp-load.php";
include_once "../../../wp-admin/includes/file.php";
require_once "hugo-export.php";
$tmpFolder = $argv[1];
$je = new Hugo_Export();
if (isset($tmpFolder)) {
if ('null' !== strtolower($tmpFolder) && is_dir($tmpFolder)) {
echo "[INFO] Start to export data to configured folder $tmpFolder";
$je->setTempDir($tmpFolder);
} else {
echo "[WARN] Passed TEMP folder $tmpFolder is not a valid folder. Remove the argument or create it as a folder before contiune";
exit(1);
}
} else {
echo "[INFO] tmp folder not found, use default. You could invoke php hugo-export-cli.php with an extra argument as the temporary folder path if needful.";
}
$je->export();