예제 #1
0
 public function __construct($processed = null)
 {
     $this->database = WPB2D_Factory::db();
     $this->config = WPB2D_Factory::get('config');
     $this->processed = $processed ? $processed : new WPB2D_Processed_DBTables();
     $this->set_wait_timeout();
 }
 public function __construct()
 {
     $this->db = WPB2D_Factory::db();
     $ret = $this->db->get_results("SELECT * FROM {$this->db->prefix}wpb2d_processed_{$this->getTableName()}");
     if (is_array($ret)) {
         $this->processed = $ret;
     }
 }
 public function __construct()
 {
     $this->db = WPB2D_Factory::db();
     $result = $this->db->get_results("SELECT * FROM {$this->db->prefix}wpb2d_excluded_files WHERE isdir = 0");
     foreach ($result as $value) {
         $this->excluded_files[] = $value->file;
     }
     $result = $this->db->get_results("SELECT * FROM {$this->db->prefix}wpb2d_excluded_files WHERE isdir = 1");
     foreach ($result as $value) {
         $this->excluded_dirs[] = $value->file;
     }
 }
function wpb2d_install()
{
    $wpdb = WPB2D_Factory::db();
    require_once ABSPATH . 'wp-admin/includes/upgrade.php';
    $table_name = $wpdb->prefix . 'wpb2d_options';
    dbDelta("CREATE TABLE {$table_name} (\n        name varchar(50) NOT NULL,\n        value varchar(255) NOT NULL,\n        UNIQUE KEY name (name)\n    );");
    $table_name = $wpdb->prefix . 'wpb2d_processed_files';
    dbDelta("CREATE TABLE {$table_name} (\n        file varchar(255) NOT NULL,\n        offset int NOT NULL DEFAULT 0,\n        uploadid varchar(50),\n        UNIQUE KEY file (file)\n    );");
    $table_name = $wpdb->prefix . 'wpb2d_processed_dbtables';
    dbDelta("CREATE TABLE {$table_name} (\n        name varchar(255) NOT NULL,\n        count int NOT NULL DEFAULT 0,\n        UNIQUE KEY name (name)\n    );");
    $table_name = $wpdb->prefix . 'wpb2d_excluded_files';
    dbDelta("CREATE TABLE {$table_name} (\n        file varchar(255) NOT NULL,\n        isdir tinyint(1) NOT NULL,\n        UNIQUE KEY file (file)\n    );");
    //Ensure that there where no insert errors
    $errors = array();
    global $EZSQL_ERROR;
    if ($EZSQL_ERROR) {
        foreach ($EZSQL_ERROR as $error) {
            if (preg_match("/^CREATE TABLE {$wpdb->prefix}wpb2d_/", $error['query'])) {
                $errors[] = $error['error_str'];
            }
        }
        delete_option('wpb2d-init-errors');
        add_option('wpb2d-init-errors', implode($errors, '<br />'), false, 'no');
    }
    //Only set the DB version if there are no errors
    if (empty($errors)) {
        WPB2D_Factory::get('config')->set_option('database_version', BACKUP_TO_DROPBOX_DATABASE_VERSION);
    }
}
 public function __construct()
 {
     $this->db = WPB2D_Factory::db();
 }