function __construct()
 {
     $step_size = get_option('image_cleanup_step_size', 100);
     $post_step_size = get_option('image_cleanup_post_step_size', 100);
     self::$STEPSIZE = $step_size;
     self::$POSTSTEPSIZE = $post_step_size;
     $uploads = wp_upload_dir();
     self::$UPLOAD_DIR = $uploads['basedir'];
     self::$UPLOAD_URL = $uploads['baseurl'];
     /**
     	TODO: register_uninstall_hook($file, $callback) 
     
     	//if uninstall not called from WordPress exit
     	if ( !defined( 'WP_UNINSTALL_PLUGIN' ) ) 
     	    exit();
     
     	- Delete DB entries
     	- Delete Folder
     */
     add_action('admin_notices', array(&$this, 'admin_notice'));
     add_action('admin_init', array(&$this, 'admin_init'));
     add_action('admin_menu', array(&$this, 'admin_menu'));
     add_action('admin_init', array(&$this, 'column_css'));
 }
Example #2
0
                    $db->rollback();
                    return;
                }
            }
            if (rename($path, $finalPath)) {
                $db->commit();
            } else {
                $this->log("RENAME FAILED");
                $db->rollback();
            }
        }
    }
    function appendTitle($name, $suffix)
    {
        return preg_replace('/^(.*)(\\..*?)$/', "\\1{$suffix}\\2", $name);
    }
    function buildSafeTitle($name)
    {
        global $wgLegalTitleChars;
        $x = preg_replace_callback("/([^{$wgLegalTitleChars}])/", array($this, 'hexChar'), $name);
        $test = Title::makeTitleSafe(NS_IMAGE, $x);
        if (is_null($test) || $test->getDbKey() !== $x) {
            $this->log("Unable to generate safe title from '{$name}', got '{$x}'");
            return false;
        }
        return $x;
    }
}
$wgUser->setName('Conversion script');
$caps = new ImageCleanup(!isset($options['fix']));
$caps->cleanup();