| 1 |
<?php |
<?php |
| 2 |
// $Id: update.inc,v 1.1.2.22 2009/10/24 14:28:06 joachim Exp $ |
// $Id: update.inc,v 1.1.2.23 2009/10/24 18:46:27 joachim Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 13 |
|
|
| 14 |
|
|
| 15 |
/** |
/** |
| 16 |
* Updates documentation. Settings have already been checked. |
* Updates hook documentation files. |
| 17 |
* |
* |
| 18 |
* A file of all processed data is saved. |
* This function should be called after all settings have been checked. |
| 19 |
* See module_builder_process_hook_data() for format details. |
* It ensures hook documentation files are available (on Drupal 5 and 6 by |
| 20 |
* The directory to save into is obtained from _module_builder_get_hooks_directory(). |
* downloading them). |
| 21 |
|
* |
| 22 |
|
* After calling this function, you probably want to pass the returned list |
| 23 |
|
* of files to module_builder_process_hook_data(). |
| 24 |
|
* Though really, instead of this function you probably want module_builder_update_data(). |
| 25 |
|
* Just saying. |
| 26 |
* |
* |
| 27 |
* @return |
* @return |
| 28 |
* TRUE on success, FALSE on failure |
* Array of hook files. |
| 29 |
*/ |
*/ |
| 30 |
function module_builder_update_documentation() { |
function module_builder_update_documentation() { |
| 31 |
$directory = _module_builder_get_hooks_directory(); |
$directory = _module_builder_get_hooks_directory(); |
| 38 |
// For testing only: skip downloading, just process. |
// For testing only: skip downloading, just process. |
| 39 |
/* |
/* |
| 40 |
module_builder_process_hook_data($hook_files); |
module_builder_process_hook_data($hook_files); |
| 41 |
return TRUE; |
return $hook_files; |
| 42 |
*/ |
*/ |
| 43 |
|
|
| 44 |
// Retrieve each file and store it in the hooks directory, overwriting what's currently there |
// Retrieve each file and store it in the hooks directory, overwriting what's currently there |
| 49 |
file_put_contents("$directory/$file_name", $destination . $file_contents->data); |
file_put_contents("$directory/$file_name", $destination . $file_contents->data); |
| 50 |
} |
} |
| 51 |
|
|
|
// Set the last updated variable |
|
|
// TODO: skip this if no bootstrap. |
|
|
variable_set('module_builder_last_update', format_date(time())); |
|
|
|
|
|
// Process the hook files. |
|
|
// Include component file. |
|
|
module_builder_include('process'); |
|
|
module_builder_process_hook_data($hook_files); |
|
|
|
|
| 52 |
// inform that hook documentation has been downloaded. |
// inform that hook documentation has been downloaded. |
| 53 |
drupal_set_message(t("Module Builder has just downloaded hook documentation to your %dir directory from CVS. This documentation contains detailed descriptions and usage examples of each of Drupal's hooks. Please view the files for more information, or view them online at the <a href=\"!api\">Drupal API documentation</a> site.", array('%dir' => 'files/'. variable_get('module_builder_hooks_directory', 'hooks'), '!api' => url('http://api.drupal.org/')))); |
drupal_set_message(t("Module Builder has just downloaded hook documentation to your %dir directory from CVS. This documentation contains detailed descriptions and usage examples of each of Drupal's hooks. Please view the files for more information, or view them online at the <a href=\"!api\">Drupal API documentation</a> site.", array('%dir' => 'files/'. variable_get('module_builder_hooks_directory', 'hooks'), '!api' => url('http://api.drupal.org/')))); |
| 54 |
|
|
| 55 |
return TRUE; // FTW! |
return $hook_files; |
| 56 |
} |
} |
| 57 |
|
|
| 58 |
/** |
/** |