| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449 | <?phpdb_insert('files')->fields(array(  'fid',  'uid',  'filename',  'filepath',  'filemime',  'filesize',  'status',  'timestamp',))/* * This entry is deliberately omitted to test the upgrade routine when facing * possible data corruption. *->values(array(  'fid' => '1',  'uid' => '1',  'filename' => 'powered-blue-80x15.png',  'filepath' => 'sites/default/files/powered-blue-80x15.png',  'filemime' => 'image/png',  'filesize' => '1011',  'status' => '1',  'timestamp' => '1285700240',)) */->values(array(  'fid' => '2',  'uid' => '1',  'filename' => 'powered-blue-80x15.png',  'filepath' => 'sites/default/files/powered-blue-80x15_0.png',  'filemime' => 'image/png',  'filesize' => '1011',  'status' => '1',  'timestamp' => '1285700317',))->values(array(  'fid' => '3',  'uid' => '1',  'filename' => 'powered-blue-88x31.png',  'filepath' => 'sites/default/files/powered-blue-88x31.png',  'filemime' => 'image/png',  'filesize' => '2113',  'status' => '1',  'timestamp' => '1285700343',))->values(array(  'fid' => '4',  'uid' => '1',  'filename' => 'powered-blue-135x42.png',  'filepath' => 'sites/default/files/powered-blue-135x42.png',  'filemime' => 'image/png',  'filesize' => '3027',  'status' => '1',  'timestamp' => '1285700366',))->values(array(  'fid' => '5',  'uid' => '1',  'filename' => 'powered-black-80x15.png',  'filepath' => 'sites/default/files/powered-black-80x15.png',  'filemime' => 'image/png',  'filesize' => '1467',  'status' => '1',  'timestamp' => '1285700529',))->values(array(  'fid' => '6',  'uid' => '1',  'filename' => 'powered-black-135x42.png',  'filepath' => 'sites/default/files/powered-black-135x42.png',  'filemime' => 'image/png',  'filesize' => '2817',  'status' => '1',  'timestamp' => '1285700552',))->values(array(  'fid' => '7',  'uid' => '1',  'filename' => 'forum-hot-new.png',  'filepath' => 'sites/default/files/forum-hot-new.png',  'filemime' => 'image/png',  'filesize' => '237',  'status' => '1',  'timestamp' => '1285708937',))->values(array(  'fid' => '8',  'uid' => '1',  'filename' => 'forum-hot.png',  'filepath' => 'sites/default/files/forum-hot.png',  'filemime' => 'image/png',  'filesize' => '229',  'status' => '1',  'timestamp' => '1285708944',))->values(array(  'fid' => '9',  'uid' => '1',  'filename' => 'forum-new.png',  'filepath' => 'sites/default/files/forum-new.png',  'filemime' => 'image/png',  'filesize' => '175',  'status' => '1',  'timestamp' => '1285708950',))->values(array(  'fid' => '10',  'uid' => '1',  'filename' => 'forum-sticky.png',  'filepath' => 'sites/default/files/forum-sticky.png',  'filemime' => 'image/png',  'filesize' => '329',  'status' => '1',  'timestamp' => '1285708957',))/* * This is a case where the path is repeated twice. */->values(array(  'fid' => '11',  'uid' => '1',  'filename' => 'crazy-basename.png',  'filepath' => '/drupal-6/file/directory/path/drupal-6/file/directory/path/crazy-basename.png',  'filemime' => 'image/png',  'filesize' => '329',  'status' => '1',  'timestamp' => '1285708958',))->execute();db_insert('node')->fields(array(  'nid',  'vid',  'type',  'language',  'title',  'uid',  'status',  'created',  'changed',  'comment',  'promote',  'moderate',  'sticky',  'tnid',  'translate',))->values(array(  'nid' => '38',  'vid' => '50',  'type' => 'page',  'language' => '',  'title' => 'node title 38 revision 50',  'uid' => '1',  'status' => '1',  'created' => '1285603317',  'changed' => '1285603317',  'comment' => '0',  'promote' => '0',  'moderate' => '0',  'sticky' => '0',  'tnid' => '0',  'translate' => '0',))->values(array(  'nid' => '39',  'vid' => '52',  'type' => 'page',  'language' => '',  'title' => 'node title 39 revision 52',  'uid' => '1',  'status' => '1',  'created' => '1285700317',  'changed' => '1285700600',  'comment' => '0',  'promote' => '0',  'moderate' => '0',  'sticky' => '0',  'tnid' => '0',  'translate' => '0',))->values(array(  'nid' => '40',  'vid' => '53',  'type' => 'page',  'language' => '',  'title' => 'node title 40 revision 53',  'uid' => '1',  'status' => '1',  'created' => '1285709012',  'changed' => '1285709012',  'comment' => '0',  'promote' => '0',  'moderate' => '0',  'sticky' => '0',  'tnid' => '0',  'translate' => '0',)) ->execute();db_insert('node_revisions')->fields(array(  'nid',  'vid',  'uid',  'title',  'body',  'teaser',  'log',  'timestamp',  'format',))->values(array(  'nid' => '38',  'vid' => '50',  'uid' => '1',  'title' => 'node title 38 revision 50',  'body' => "Attachments:\r\npowered-blue-80x15.png",  'teaser' => "Attachments:\r\npowered-blue-80x15.png",  'log' => '',  'timestamp' => '1285603317',  'format' => '1',))->values(array(  'nid' => '39',  'vid' => '51',  'uid' => '1',  'title' => 'node title 39 revision 51',  'body' => "Attachments:\r\npowered-blue-80x15.png\r\npowered-blue-88x31.png\r\npowered-blue-135x42.png",  'teaser' => "Attachments:\r\npowered-blue-80x15.png\r\npowered-blue-88x31.png\r\npowered-blue-135x42.png",  'log' => '',  'timestamp' => '1285700487',  'format' => '1',))->values(array(  'nid' => '39',  'vid' => '52',  'uid' => '1',  'title' => 'node title 39 revision 52',  'body' => "Attachments:\r\npowered-blue-88x31.png\r\npowered-black-80x15.png\r\npowered-black-135x42.png",  'teaser' => "Attachments:\r\npowered-blue-88x31.png\r\npowered-black-80x15.png\r\npowered-black-135x42.png",  'log' => '',  'timestamp' => '1285700600',  'format' => '1',))->values(array(  'nid' => '40',  'vid' => '53',  'uid' => '1',  'title' => 'node title 40 revision 53',  'body' => "Attachments:\r\nforum-hot-new.png\r\nforum-hot.png\r\nforum-sticky.png\r\nforum-new.png\r\ncrazy-basename.png",  'teaser' => "Attachments:\r\nforum-hot-new.png\r\nforum-hot.png\r\nforum-sticky.png\r\nforum-new.png\r\ncrazy-basename.png",  'log' => '',  'timestamp' => '1285709012',  'format' => '1',)) ->execute();db_create_table('upload', array(  'fields' => array(    'fid' => array(      'type' => 'int',      'unsigned' => TRUE,      'not null' => TRUE,      'default' => 0,    ),    'nid' => array(      'type' => 'int',      'unsigned' => TRUE,      'not null' => TRUE,      'default' => 0,    ),    'vid' => array(      'type' => 'int',      'unsigned' => TRUE,      'not null' => TRUE,      'default' => 0,    ),    'description' => array(      'type' => 'varchar',      'length' => 255,      'not null' => TRUE,      'default' => '',    ),    'list' => array(      'type' => 'int',      'unsigned' => TRUE,      'not null' => TRUE,      'default' => 0,      'size' => 'tiny',    ),    'weight' => array(      'type' => 'int',      'not null' => TRUE,      'default' => 0,      'size' => 'tiny',    ),  ),  'primary key' => array(    'vid',    'fid',  ),  'indexes' => array(    'fid' => array(      'fid',    ),    'nid' => array(      'nid',    ),  ),  'module' => 'upload',  'name' => 'upload',));db_insert('upload')->fields(array(  'fid',  'nid',  'vid',  'description',  'list',  'weight',))->values(array(  'fid' => '1',  'nid' => '38',  'vid' => '50',  'description' => 'powered-blue-80x15.png',  'list' => '1',  'weight' => '0',))->values(array(  'fid' => '2',  'nid' => '39',  'vid' => '51',  'description' => 'powered-blue-80x15.png',  'list' => '1',  'weight' => '0',))->values(array(  'fid' => '3',  'nid' => '39',  'vid' => '51',  'description' => 'powered-blue-88x31.png',  'list' => '1',  'weight' => '0',))->values(array(  'fid' => '4',  'nid' => '39',  'vid' => '51',  'description' => 'powered-blue-135x42.png',  'list' => '1',  'weight' => '0',))->values(array(  'fid' => '3',  'nid' => '39',  'vid' => '52',  'description' => 'powered-blue-88x31.png',  'list' => '1',  'weight' => '0',))->values(array(  'fid' => '5',  'nid' => '39',  'vid' => '52',  'description' => 'powered-black-80x15.png',  'list' => '1',  'weight' => '0',))->values(array(  'fid' => '6',  'nid' => '39',  'vid' => '52',  'description' => 'powered-black-135x42.png',  'list' => '1',  'weight' => '0',))->values(array(  'fid' => '7',  'nid' => '40',  'vid' => '53',  'description' => 'forum-hot-new.png',  'list' => '1',  'weight' => '-4',))->values(array(  'fid' => '8',  'nid' => '40',  'vid' => '53',  'description' => 'forum-hot.png',  'list' => '1',  'weight' => '-3',))->values(array(  'fid' => '10',  'nid' => '40',  'vid' => '53',  'description' => 'forum-sticky.png',  'list' => '1',  'weight' => '-2',))->values(array(  'fid' => '9',  'nid' => '40',  'vid' => '53',  'description' => 'forum-new.png',  'list' => '1',  'weight' => '-1',))->values(array(  'fid' => '11',  'nid' => '40',  'vid' => '53',  'description' => 'crazy-basename.png',  'list' => '1',  'weight' => '0',))->execute();// Add series of entries for invalid node vids to the {upload} table.for ($i = 30; $i < 250; $i += 2) {  db_insert('upload')->fields(array(    'fid',    'nid',    'vid',    'description',    'list',    'weight',  ))  // Invalid fid, invalid vid.  ->values(array(    'fid' => $i,    'nid' => '40',    'vid' => 24 + $i,    'description' => 'crazy-basename.png',    'list' => '1',    'weight' => '0',  ))  // Valid fid, invalid vid.  ->values(array(    'fid' => 2,    'nid' => '40',    'vid' => 24 + $i + 1,    'description' => 'crazy-basename.png',    'list' => '1',    'weight' => '0',  ))  ->execute();}
 |