GithubHelp home page GithubHelp logo

carl-alberto / wordpress-db-exporter.php Goto Github PK

View Code? Open in Web Editor NEW

This project forked from 2createstudio/shuttle-export

0.0 3.0 0.0 42 KB

Pure PHP MySQL dumping utility

License: GNU General Public License v2.0

PHP 100.00%

wordpress-db-exporter.php's Introduction

PHP based MySQL dump library

The library provides easy way to create MySQL dumps files. It will try to create dump through:

  1. mysqldump shell utility
  2. native PHP code

For native dumps(on hosts without shell access), it works with mysqli php extension by default, and fallbacks to old-fashioned mysql whenever mysqli isn't available.

The aim of the library is to work on as many web-hosts as possible: it requires PHP 5.2 and requires just one mysql or mysqli libraries to be available.

Features:

  • support for plain text and gzip output(whenever the dump file has .gz extension, a gzip archive will be produced)
  • support for including just particular tables from the database, excluding tables, and dumping just tables with particular prefix

ToDo:

  • add support for views and triggers
  • try how things work with databases with foreign keys constraints

Examples

Dump all tables in world database:

$world_dumper = Shuttle_Dumper::create(array(
    'host' => '',
    'username' => 'root',
    'password' => '',
    'db_name' => 'world',
));
// dump the database to plain text file
$world_dumper->dump('world.sql');

// send the output to gziped file:
$world_dumper->dump('world.sql.gz');

Dump only the tables with wp_ prefix:

$wp_dumper = Shuttle_Dumper::create(array(
    'host' => '',
    'username' => 'root',
    'password' => '',
    'db_name' => 'wordpress',
));
$wp_dumper->dump('wordpress.sql', 'wp_');

Dump only country and city tables:

$countries_dumper = Shuttle_Dumper::create(array(
    'host' => '',
    'username' => 'root',
    'password' => '',
    'db_name' => 'world',
    'include_tables' => array('country', 'city'),
));
$countries_dumper->dump('world.sql.gz');

Dump all tables except for city:

$world_dumper = Shuttle_Dumper::create(array(
    'host' => '',
    'username' => 'root',
    'password' => '',
    'db_name' => 'world',
    'exclude_tables' => array('city'),
));
$world_dumper->dump('world-no-cities.sql.gz');

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.