/backup/drupal/modules/simpletest/tests/upgrade/drupal-6.upload.database.php

https://github.com/thomasbennett/tgb · PHP · 398 lines · 379 code · 4 blank · 15 comment · 0 complexity · c9a5fdfa62e0319e3372fe3ce75dbeb3 MD5 · raw file

  1. <?php
  2. // $Id: drupal-6.upload.database.php,v 1.2 2010/11/13 01:48:14 dries Exp $
  3. db_insert('files')->fields(array(
  4. 'fid',
  5. 'uid',
  6. 'filename',
  7. 'filepath',
  8. 'filemime',
  9. 'filesize',
  10. 'status',
  11. 'timestamp',
  12. ))
  13. /*
  14. * This entry is deliberately omitted to test the upgrade routine when facing
  15. * possible data corruption.
  16. *
  17. ->values(array(
  18. 'fid' => '1',
  19. 'uid' => '1',
  20. 'filename' => 'powered-blue-80x15.png',
  21. 'filepath' => 'sites/default/files/powered-blue-80x15.png',
  22. 'filemime' => 'image/png',
  23. 'filesize' => '1011',
  24. 'status' => '1',
  25. 'timestamp' => '1285700240',
  26. )) */
  27. ->values(array(
  28. 'fid' => '2',
  29. 'uid' => '1',
  30. 'filename' => 'powered-blue-80x15.png',
  31. 'filepath' => 'sites/default/files/powered-blue-80x15_0.png',
  32. 'filemime' => 'image/png',
  33. 'filesize' => '1011',
  34. 'status' => '1',
  35. 'timestamp' => '1285700317',
  36. ))
  37. ->values(array(
  38. 'fid' => '3',
  39. 'uid' => '1',
  40. 'filename' => 'powered-blue-88x31.png',
  41. 'filepath' => 'sites/default/files/powered-blue-88x31.png',
  42. 'filemime' => 'image/png',
  43. 'filesize' => '2113',
  44. 'status' => '1',
  45. 'timestamp' => '1285700343',
  46. ))
  47. ->values(array(
  48. 'fid' => '4',
  49. 'uid' => '1',
  50. 'filename' => 'powered-blue-135x42.png',
  51. 'filepath' => 'sites/default/files/powered-blue-135x42.png',
  52. 'filemime' => 'image/png',
  53. 'filesize' => '3027',
  54. 'status' => '1',
  55. 'timestamp' => '1285700366',
  56. ))
  57. ->values(array(
  58. 'fid' => '5',
  59. 'uid' => '1',
  60. 'filename' => 'powered-black-80x15.png',
  61. 'filepath' => 'sites/default/files/powered-black-80x15.png',
  62. 'filemime' => 'image/png',
  63. 'filesize' => '1467',
  64. 'status' => '1',
  65. 'timestamp' => '1285700529',
  66. ))
  67. ->values(array(
  68. 'fid' => '6',
  69. 'uid' => '1',
  70. 'filename' => 'powered-black-135x42.png',
  71. 'filepath' => 'sites/default/files/powered-black-135x42.png',
  72. 'filemime' => 'image/png',
  73. 'filesize' => '2817',
  74. 'status' => '1',
  75. 'timestamp' => '1285700552',
  76. ))
  77. ->values(array(
  78. 'fid' => '7',
  79. 'uid' => '1',
  80. 'filename' => 'forum-hot-new.png',
  81. 'filepath' => 'sites/default/files/forum-hot-new.png',
  82. 'filemime' => 'image/png',
  83. 'filesize' => '237',
  84. 'status' => '1',
  85. 'timestamp' => '1285708937',
  86. ))
  87. ->values(array(
  88. 'fid' => '8',
  89. 'uid' => '1',
  90. 'filename' => 'forum-hot.png',
  91. 'filepath' => 'sites/default/files/forum-hot.png',
  92. 'filemime' => 'image/png',
  93. 'filesize' => '229',
  94. 'status' => '1',
  95. 'timestamp' => '1285708944',
  96. ))
  97. ->values(array(
  98. 'fid' => '9',
  99. 'uid' => '1',
  100. 'filename' => 'forum-new.png',
  101. 'filepath' => 'sites/default/files/forum-new.png',
  102. 'filemime' => 'image/png',
  103. 'filesize' => '175',
  104. 'status' => '1',
  105. 'timestamp' => '1285708950',
  106. ))
  107. ->values(array(
  108. 'fid' => '10',
  109. 'uid' => '1',
  110. 'filename' => 'forum-sticky.png',
  111. 'filepath' => 'sites/default/files/forum-sticky.png',
  112. 'filemime' => 'image/png',
  113. 'filesize' => '329',
  114. 'status' => '1',
  115. 'timestamp' => '1285708957',
  116. ))
  117. ->execute();
  118. db_insert('node')->fields(array(
  119. 'nid',
  120. 'vid',
  121. 'type',
  122. 'language',
  123. 'title',
  124. 'uid',
  125. 'status',
  126. 'created',
  127. 'changed',
  128. 'comment',
  129. 'promote',
  130. 'moderate',
  131. 'sticky',
  132. 'tnid',
  133. 'translate',
  134. ))
  135. ->values(array(
  136. 'nid' => '38',
  137. 'vid' => '50',
  138. 'type' => 'page',
  139. 'language' => '',
  140. 'title' => 'node title 38 revision 50',
  141. 'uid' => '1',
  142. 'status' => '1',
  143. 'created' => '1285603317',
  144. 'changed' => '1285603317',
  145. 'comment' => '0',
  146. 'promote' => '0',
  147. 'moderate' => '0',
  148. 'sticky' => '0',
  149. 'tnid' => '0',
  150. 'translate' => '0',
  151. ))
  152. ->values(array(
  153. 'nid' => '39',
  154. 'vid' => '52',
  155. 'type' => 'page',
  156. 'language' => '',
  157. 'title' => 'node title 39 revision 52',
  158. 'uid' => '1',
  159. 'status' => '1',
  160. 'created' => '1285700317',
  161. 'changed' => '1285700600',
  162. 'comment' => '0',
  163. 'promote' => '0',
  164. 'moderate' => '0',
  165. 'sticky' => '0',
  166. 'tnid' => '0',
  167. 'translate' => '0',
  168. ))
  169. ->values(array(
  170. 'nid' => '40',
  171. 'vid' => '53',
  172. 'type' => 'page',
  173. 'language' => '',
  174. 'title' => 'node title 40 revision 53',
  175. 'uid' => '1',
  176. 'status' => '1',
  177. 'created' => '1285709012',
  178. 'changed' => '1285709012',
  179. 'comment' => '0',
  180. 'promote' => '0',
  181. 'moderate' => '0',
  182. 'sticky' => '0',
  183. 'tnid' => '0',
  184. 'translate' => '0',
  185. ))
  186. ->execute();
  187. db_insert('node_revisions')->fields(array(
  188. 'nid',
  189. 'vid',
  190. 'uid',
  191. 'title',
  192. 'body',
  193. 'teaser',
  194. 'log',
  195. 'timestamp',
  196. 'format',
  197. ))
  198. ->values(array(
  199. 'nid' => '38',
  200. 'vid' => '50',
  201. 'uid' => '1',
  202. 'title' => 'node title 38 revision 50',
  203. 'body' => "Attachments:\r\npowered-blue-80x15.png",
  204. 'teaser' => "Attachments:\r\npowered-blue-80x15.png",
  205. 'log' => '',
  206. 'timestamp' => '1285603317',
  207. 'format' => '1',
  208. ))
  209. ->values(array(
  210. 'nid' => '39',
  211. 'vid' => '51',
  212. 'uid' => '1',
  213. 'title' => 'node title 39 revision 51',
  214. 'body' => "Attachments:\r\npowered-blue-80x15.png\r\npowered-blue-88x31.png\r\npowered-blue-135x42.png",
  215. 'teaser' => "Attachments:\r\npowered-blue-80x15.png\r\npowered-blue-88x31.png\r\npowered-blue-135x42.png",
  216. 'log' => '',
  217. 'timestamp' => '1285700487',
  218. 'format' => '1',
  219. ))
  220. ->values(array(
  221. 'nid' => '39',
  222. 'vid' => '52',
  223. 'uid' => '1',
  224. 'title' => 'node title 39 revision 52',
  225. 'body' => "Attachments:\r\npowered-blue-88x31.png\r\npowered-black-80x15.png\r\npowered-black-135x42.png",
  226. 'teaser' => "Attachments:\r\npowered-blue-88x31.png\r\npowered-black-80x15.png\r\npowered-black-135x42.png",
  227. 'log' => '',
  228. 'timestamp' => '1285700600',
  229. 'format' => '1',
  230. ))
  231. ->values(array(
  232. 'nid' => '40',
  233. 'vid' => '53',
  234. 'uid' => '1',
  235. 'title' => 'node title 40 revision 53',
  236. 'body' => "Attachments:\r\nforum-hot-new.png\r\nforum-hot.png\r\nforum-sticky.png\r\nforum-new.png",
  237. 'teaser' => "Attachments:\r\nforum-hot-new.png\r\nforum-hot.png\r\nforum-sticky.png\r\nforum-new.png",
  238. 'log' => '',
  239. 'timestamp' => '1285709012',
  240. 'format' => '1',
  241. ))
  242. ->execute();
  243. db_create_table('upload', array(
  244. 'fields' => array(
  245. 'fid' => array(
  246. 'type' => 'int',
  247. 'unsigned' => TRUE,
  248. 'not null' => TRUE,
  249. 'default' => 0,
  250. ),
  251. 'nid' => array(
  252. 'type' => 'int',
  253. 'unsigned' => TRUE,
  254. 'not null' => TRUE,
  255. 'default' => 0,
  256. ),
  257. 'vid' => array(
  258. 'type' => 'int',
  259. 'unsigned' => TRUE,
  260. 'not null' => TRUE,
  261. 'default' => 0,
  262. ),
  263. 'description' => array(
  264. 'type' => 'varchar',
  265. 'length' => 255,
  266. 'not null' => TRUE,
  267. 'default' => '',
  268. ),
  269. 'list' => array(
  270. 'type' => 'int',
  271. 'unsigned' => TRUE,
  272. 'not null' => TRUE,
  273. 'default' => 0,
  274. 'size' => 'tiny',
  275. ),
  276. 'weight' => array(
  277. 'type' => 'int',
  278. 'not null' => TRUE,
  279. 'default' => 0,
  280. 'size' => 'tiny',
  281. ),
  282. ),
  283. 'primary key' => array(
  284. 'vid',
  285. 'fid',
  286. ),
  287. 'indexes' => array(
  288. 'fid' => array(
  289. 'fid',
  290. ),
  291. 'nid' => array(
  292. 'nid',
  293. ),
  294. ),
  295. 'module' => 'upload',
  296. 'name' => 'upload',
  297. ));
  298. db_insert('upload')->fields(array(
  299. 'fid',
  300. 'nid',
  301. 'vid',
  302. 'description',
  303. 'list',
  304. 'weight',
  305. ))
  306. ->values(array(
  307. 'fid' => '1',
  308. 'nid' => '38',
  309. 'vid' => '50',
  310. 'description' => 'powered-blue-80x15.png',
  311. 'list' => '1',
  312. 'weight' => '0',
  313. ))
  314. ->values(array(
  315. 'fid' => '2',
  316. 'nid' => '39',
  317. 'vid' => '51',
  318. 'description' => 'powered-blue-80x15.png',
  319. 'list' => '1',
  320. 'weight' => '0',
  321. ))
  322. ->values(array(
  323. 'fid' => '3',
  324. 'nid' => '39',
  325. 'vid' => '51',
  326. 'description' => 'powered-blue-88x31.png',
  327. 'list' => '1',
  328. 'weight' => '0',
  329. ))
  330. ->values(array(
  331. 'fid' => '4',
  332. 'nid' => '39',
  333. 'vid' => '51',
  334. 'description' => 'powered-blue-135x42.png',
  335. 'list' => '1',
  336. 'weight' => '0',
  337. ))
  338. ->values(array(
  339. 'fid' => '3',
  340. 'nid' => '39',
  341. 'vid' => '52',
  342. 'description' => 'powered-blue-88x31.png',
  343. 'list' => '1',
  344. 'weight' => '0',
  345. ))
  346. ->values(array(
  347. 'fid' => '5',
  348. 'nid' => '39',
  349. 'vid' => '52',
  350. 'description' => 'powered-black-80x15.png',
  351. 'list' => '1',
  352. 'weight' => '0',
  353. ))
  354. ->values(array(
  355. 'fid' => '6',
  356. 'nid' => '39',
  357. 'vid' => '52',
  358. 'description' => 'powered-black-135x42.png',
  359. 'list' => '1',
  360. 'weight' => '0',
  361. ))
  362. ->values(array(
  363. 'fid' => '7',
  364. 'nid' => '40',
  365. 'vid' => '53',
  366. 'description' => 'forum-hot-new.png',
  367. 'list' => '1',
  368. 'weight' => '-4',
  369. ))
  370. ->values(array(
  371. 'fid' => '8',
  372. 'nid' => '40',
  373. 'vid' => '53',
  374. 'description' => 'forum-hot.png',
  375. 'list' => '1',
  376. 'weight' => '-3',
  377. ))
  378. ->values(array(
  379. 'fid' => '10',
  380. 'nid' => '40',
  381. 'vid' => '53',
  382. 'description' => 'forum-sticky.png',
  383. 'list' => '1',
  384. 'weight' => '-2',
  385. ))
  386. ->values(array(
  387. 'fid' => '9',
  388. 'nid' => '40',
  389. 'vid' => '53',
  390. 'description' => 'forum-new.png',
  391. 'list' => '1',
  392. 'weight' => '-1',
  393. ))
  394. ->execute();