WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#9903 closed enhancement (invalid)

Tweak export function: make the export planned

Reported by: csseur3 Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.8
Component: Export Keywords: export
Focuses: Cc:

Description

Hello,

i use Wordpress for a xml reader and i need to propose a export xml every hour, but i think a core-function is needed, because the authentification is needed to make an export.

Change History (9)

comment:1 @ryan6 years ago

  • Milestone changed from 2.8 to Future Release

Details?

comment:2 @dd326 years ago

I have a feeling they're http-requesting the export page.

My advice, would be to use a output buffer, in combination with export_wp($author_id); (Which prints the export file)

comment:3 @Denis-de-Bernardy6 years ago

couldn't this be done like... with a plugin on an hourly cron or something?

comment:4 @csseur36 years ago

i find a hack:

#!/bin/bash

# Settings
BACKUP_DIR=/home/toto/ftp
URL=http://www.website.com
USER=admin
PASS=passpass

COOKIES_FILE=/tmp/wp-backup.cookies

# Compute some aliases
DATE=`date +%Y-%m-%d`
BACKUP_FILE=$BACKUP_DIR/wp-backup-$DATE.xml

# Authentication
wget --keep-session-cookies --save-cookies $COOKIES_FILE  --post-data "log=$USER&pwd=$PASS&wp-submit=Connexion&testcookie=1" -O /dev/null "$URL/wp-login.php" > /dev/null

# Get the 'export' xml file
wget -O $BACKUP_FILE --load-cookies $COOKIES_FILE "$URL/wp-admin/export.php?author=all&submit=1&download=true"

chmod 777 $BACKUP_FILE

#end of file

but i have the login page in html format, in the xml backup file :(

what is wrong?

bye

comment:5 @csseur36 years ago

no solution? :(

comment:6 @Denis-de-Bernardy6 years ago

  • Milestone Future Release deleted
  • Resolution set to invalid
  • Status changed from new to closed

you can use wp_schedule_event() to generate the backup. and wp_set_current_user() if it needs to be "as if it was a particular author".

comment:7 follow-up: @filosofo6 years ago

And if you have shell access to your server, why don't you just dump your database? That's a much more robust solution.

comment:8 in reply to: ↑ 7 @Denis-de-Bernardy6 years ago

Replying to filosofo:

And if you have shell access to your server, why don't you just dump your database? That's a much more robust solution.

only if the table prefixes aren't the same

comment:9 @Denis-de-Bernardy6 years ago

are the same, even

Note: See TracTickets for help on using tickets.