| 1 |
<?php |
<?php |
| 2 |
// $Id: update.inc,v 1.1.2.23 2009/10/24 18:46:27 joachim Exp $ |
// $Id: update.inc,v 1.1.2.24 2009/10/24 19:19:55 joachim Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 8 |
* Fetches files from locations specified by hook_module_builder_info |
* Fetches files from locations specified by hook_module_builder_info |
| 9 |
* implementations (including our own). |
* implementations (including our own). |
| 10 |
* |
* |
| 11 |
* Convention: functions beginning with underscores are internal to this file. |
* The main function here is module_builder_update_documentation(). |
| 12 |
|
* Other functions (beginning with underscores) are internal to this file. |
| 13 |
|
* |
| 14 |
|
* The data that gets passed around is an array keyed by filename. Filenames |
| 15 |
|
* thus be unique; if there is a possibility of filename clash these must |
| 16 |
|
* be rendered safe, for example by prefixing the module name. |
| 17 |
|
* The keys to each item are: |
| 18 |
|
* - path: the full path to this file |
| 19 |
|
* - url: (internal to this file) URL to download this file from. |
| 20 |
|
* - destination: the module code file where the hooks from this hook data file |
| 21 |
|
* should be saved by code generation |
| 22 |
|
* - group: the group this file's hooks should be shown in the Drupal UI. |
| 23 |
|
* Example: |
| 24 |
|
* [system.core.php] => array( |
| 25 |
|
* [path] => /Users/you/data/drupal_hooks/6/system.core.php |
| 26 |
|
* [url] => http://cvs.drupal.org/viewvc.py/drupal/contributions/docs/developer/hooks/core.php?view=co&pathrev=DRUPAL-6--1 |
| 27 |
|
* [destination] => %module.module |
| 28 |
|
* [group] => core |
| 29 |
*/ |
*/ |
| 30 |
|
|
|
|
|
| 31 |
/** |
/** |
| 32 |
* Updates hook documentation files. |
* Updates hook documentation files. |
| 33 |
* |
* |
| 41 |
* Just saying. |
* Just saying. |
| 42 |
* |
* |
| 43 |
* @return |
* @return |
| 44 |
* Array of hook files. |
* Array of hook files suitable for passing to module_builder_process_hook_data(). |
| 45 |
|
* See file documentation for details. |
| 46 |
*/ |
*/ |
| 47 |
function module_builder_update_documentation() { |
function module_builder_update_documentation() { |
| 48 |
$directory = _module_builder_get_hooks_directory(); |
$directory = _module_builder_get_hooks_directory(); |
| 78 |
* @return |
* @return |
| 79 |
* An array of data about the files to download, keyed by (safe) filename: |
* An array of data about the files to download, keyed by (safe) filename: |
| 80 |
[system.core.php] => Array |
[system.core.php] => Array |
| 81 |
|
[path] => the full path this file should be saved to |
| 82 |
[url] => URL |
[url] => URL |
| 83 |
[destination] => %module.module |
[destination] => %module.module |
| 84 |
[group] => core |
[group] => core |
| 122 |
); |
); |
| 123 |
// Create our own safe filename with module prefix. |
// Create our own safe filename with module prefix. |
| 124 |
$hook_file_safe_name = "$module.$hook_file"; |
$hook_file_safe_name = "$module.$hook_file"; |
| 125 |
|
$directory = _module_builder_get_hooks_directory(); |
| 126 |
|
$urls[$hook_file_safe_name]['path'] = $directory . '/' . $hook_file_safe_name; |
| 127 |
$urls[$hook_file_safe_name]['url'] = $url; |
$urls[$hook_file_safe_name]['url'] = $url; |
| 128 |
$urls[$hook_file_safe_name]['destination'] = $destination; |
$urls[$hook_file_safe_name]['destination'] = $destination; |
| 129 |
if ($module_data['group'] == '#filenames') { |
if ($module_data['group'] == '#filenames') { |