Skip to content

Instantly share code, notes, and snippets.

Avatar

Doc gWorldz gWorldz

View GitHub Profile
View multisite_delete_revisions.php
<?php
// WordPress Multisite - Delete all revisions from all posts in a netword.
// Quick hack by @mrazzari, 2014.
// For context see this thread started by Kitchin at the forums:
// http://wordpress.org/support/topic/deleting-post-revisions-do-not-use-the-abc-join-code-you-see-everywhere
// HOWTO
// This snippet is meant to be called as a standalone script.
// Like http://example.com/tmp/multisite_delete_revisions.php
View relative recursive.php
<pre><?php
function ZipFolder($folder, $to='archive.zip', $basedir) {
$zip = new ZipArchive();
if ($zip->open($to, ZIPARCHIVE::CREATE)) {
$found = array(rtrim($folder,DIRECTORY_SEPARATOR.'\/'));
while ($path = each($found)) {
$path = current($path);
if (is_dir($path)) {
$zip->addEmptyDir(substr($path, strlen($basedir)));