Advertisement
Guest User

Untitled

a guest
Nov 1st, 2014
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.19 KB | None | 0 0
  1. Command findpath needs the following module(s) enabled to run: . [12.98 sec, 33.73 MB] [error]
  2.  
  3. D:wwwmonSite>drush cc all
  4. 'all' cache was cleared in D:wwwmonSite#default [success]
  5.  
  6. D:wwwmonSite>drush findpath --verbose sites/default/files/upload --debug
  7. Bootstrap to phase 0. [0.55 sec, 3.45 MB] [bootstrap]
  8. Drush bootstrap phase : _drush_bootstrap_drush() [0.6 sec, 3.65 MB] [bootstrap]
  9. Cache MISS cid: 5.9-commandfiles-0-11c341785bfd2d9e3ec5fc07a41dbd3a [2.43 sec, 3.66 MB] [debug]
  10. Cache SET cid: 5.9-commandfiles-0-11c341785bfd2d9e3ec5fc07a41dbd3a [2.51 sec, 3.66 MB] [debug]
  11. Bootstrap to phase 0. [2.68 sec, 7.55 MB] [bootstrap]
  12. Bootstrap to phase 5. [2.75 sec, 7.55 MB] [bootstrap]
  13. Drush bootstrap phase : _drush_bootstrap_drupal_root() [2.77 sec, 7.55 MB] [bootstrap]
  14. Initialized Drupal 7.31 root directory at C:/Mes Documents/ReNo/WebRoot/taijiquan [3.34 sec, 9.01 MB] [notice]
  15. Drush bootstrap phase : _drush_bootstrap_drupal_site() [3.44 sec, 9.01 MB] [bootstrap]
  16. Initialized Drupal site default at sites/default [3.44 sec, 9.01 MB] [notice]
  17. Cache MISS cid: 5.9-commandfiles-2-c32acd775c18a90c5b41d0fc9accf5ab [3.62 sec, 9.01 MB] [debug]
  18. Cache SET cid: 5.9-commandfiles-2-c32acd775c18a90c5b41d0fc9accf5ab [3.95 sec, 9.02 MB] [debug]
  19. Drush bootstrap phase : _drush_bootstrap_drupal_configuration() [3.96 sec, 9.01 MB] [bootstrap]
  20. Drush bootstrap phase : _drush_bootstrap_drupal_database() [4.02 sec, 9.02 MB] [bootstrap]
  21. Successfully connected to the Drupal database. [4.02 sec, 9.02 MB] [bootstrap]
  22. Drush bootstrap phase : _drush_bootstrap_drupal_full() [4.06 sec, 9.68 MB] [bootstrap]
  23. Cache MISS cid: 5.9-commandfiles-5-d643476a6db7b83e0cc3b5363e547c36 [5.62 sec, 33 MB] [debug]
  24. Cache SET cid: 5.9-commandfiles-5-d643476a6db7b83e0cc3b5363e547c36 [9.43 sec, 33 MB] [debug]
  25. Cache MISS cid: 5.9-commandfiles-2-1c82782e4f0daa661b06df029df9c6f1 [9.7 sec, 33.69 MB] [debug]
  26. Cache SET cid: 5.9-commandfiles-2-1c82782e4f0daa661b06df029df9c6f1 [12.85 sec, 33.7 MB] [debug]
  27. Command findpath needs the following module(s) enabled to run: . [12.98 sec, 33.73 MB] [error]
  28. The drush command 'findpath sites/default/files/upload' could not be executed. [12.98 sec, 33.73 MB] [error]
  29.  
  30. <?php
  31. /**
  32. * Bulk operation to scan your files directory and ensure that every file has a
  33. * corresponding entry in the 'managed files' table.
  34. *
  35. * Without it, you can't re-use files via filefield_sources as promised.
  36. *
  37. * Original D6 by John Locke on 02/23/2010
  38. * From http://www.freelock.com/blog/john-locke/2010-02/using-file-field-imported-files-drupal-drush-rescue
  39. *
  40. * Upgraded to D7 by dman.
  41. * For a less-naive solution to this problem
  42. * (actually scan pages and attach the right files to individual nodes)
  43. * @see (link is external) http://drupal.org/project/file_ownage
  44. *
  45. *
  46. * USAGE:
  47. * Trial run:
  48. * drush --verbose findpath sites/sitename/files
  49. * Real run:
  50. * drush findpath sites/sitename/files true
  51. *
  52. * BACKUP your DB first!
  53. */
  54. #
  55. /**
  56. * Provide module specific drush commands
  57. */
  58. function findfiles_drush_command() {
  59. $items = array();
  60. $items['findpath'] = array(
  61. 'description' => 'Search filesystem for files by path',
  62. 'arguments' => array(
  63. 'filepath' => 'Name of path to find.',
  64. 'commit' => 'Save results to files table'
  65. ),
  66. );
  67. return $items;
  68. }
  69. #
  70. /**
  71. * Drush command callback
  72. */
  73. function drush_findfiles_findpath($scandir, $commit = false){
  74. $ar = file_scan_directory($scandir, '@.*@');
  75. foreach ($ar as $item){
  76. $local_filepath = str_replace($scandir . '/', '', $item->uri);
  77. // Need to think in file wrappers, from the beginning.
  78. $file = new stdClass();
  79. $file->fid = NULL;
  80. // DO NOT USE $item->name as it truncates the suffix.
  81. // Normally that would be nice but it cripples IMCE!!
  82. $file->filename = basename($item->uri);
  83. $file->uri = 'public://' . $local_filepath;
  84. $file->filemime = file_get_mimetype($file->uri);
  85. global $user;
  86. $file->uid = $user->uid;
  87. $file->status = FILE_STATUS_PERMANENT;
  88. #
  89. // Look for file in {file_managed} table.
  90. drush_log("Checking db for {$file->uri}");
  91. $result = db_query("SELECT * FROM {file_managed} WHERE uri = :uri", array(':uri' => $file->uri));
  92. $record = NULL;
  93. foreach ($result as $record) {
  94. // Found at least one
  95. drush_log("Found file: {$file->uri} fid:{$record->fid}");
  96. }
  97. #
  98. if (!$record) {
  99. drush_log('File not found in the database yet: '. $file->uri);
  100. #
  101. if ($commit){
  102. drush_log('Saving file to database: '.$file->uri);
  103. // Get file wrapper CRUD to save it for us
  104. drupal_chmod($file->uri);
  105. file_save($file);
  106. // Other modules - specifically filefield_sources -
  107. // May not play ball unless the file is 'in use' as well.
  108. // @see (link is external) file_managed_file_validate()
  109. // @see (link is external) file_usage_list($file);
  110. // We don't have anything useful to tell it, about previous usage
  111. // so just say it's managed by 'system'
  112. file_usage_add($file, 'system', 'file', $file->fid);
  113. }
  114. }
  115. }
  116. }
  117. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement