Commit f0a8150b authored by Dries's avatar Dries

- Patch #604618 by axyjo, sun: archiver code clean-up.

parent 9dda515b
<?php
// $Id$
/**
* @file
......
......@@ -2595,7 +2595,7 @@ function l($text, $path, array $options = array()) {
*
* In order for page callbacks to be reusable in different delivery formats,
* they should not issue any "print" or "echo" statements, but instead just
* return content.
* return content.
*
* @param $page_callback_result
* The result of a page callback. Can be one of:
......@@ -2608,7 +2608,7 @@ function l($text, $path, array $options = array()) {
* to be appropriate for the page request as determined by the calling
* function (e.g., menu_execute_active_handler()). If not given, it is
* determined from the menu router information of the current page. In either
* case, modules have a final chance to alter which function is called.
* case, modules have a final chance to alter which function is called.
*
* @see menu_execute_active_handler()
* @see hook_menu()
......@@ -2655,7 +2655,7 @@ function drupal_deliver_html_page($page_callback_result) {
// Menu status constants are integers; page content is a string or array.
if (is_int($page_callback_result)) {
// @todo: Break these up into separate functions?
switch ($page_callback_result) {
switch ($page_callback_result) {
case MENU_NOT_FOUND:
// Print a 404 page.
drupal_add_http_header('404 Not Found');
......@@ -2719,7 +2719,7 @@ function drupal_deliver_html_page($page_callback_result) {
drupal_add_http_header('503 Service unavailable');
drupal_set_title(t('Site under maintenance'));
print theme('maintenance_page', array('content' => filter_xss_admin(variable_get('maintenance_mode_message',
t('@site is currently under maintenance. We should be back shortly. Thank you for your patience.', array('@site' => variable_get('site_name', 'Drupal')))))));
t('@site is currently under maintenance. We should be back shortly. Thank you for your patience.', array('@site' => variable_get('site_name', 'Drupal')))))));
break;
}
}
......@@ -5983,16 +5983,16 @@ function archiver_get_archiver($file) {
$archiver_info = archiver_get_info();
foreach ($archiver_info as $implementation) {
foreach ($implementation['extensions'] as $extension) {
// Because extensions may be multi-part, such as .tar.gz,
// we cannot use simpler approaches like substr() or pathinfo().
// This method isn't quite as clean but gets the job done.
// Also note that the file may not yet exist, so we cannot rely
// on fileinfo() or other disk-level utilities.
if (strrpos($file, '.' . $extension) === strlen($file) - strlen('.' . $extension)) {
return new $implementation['class']($file);
}
}
foreach ($implementation['extensions'] as $extension) {
// Because extensions may be multi-part, such as .tar.gz,
// we cannot use simpler approaches like substr() or pathinfo().
// This method isn't quite as clean but gets the job done.
// Also note that the file may not yet exist, so we cannot rely
// on fileinfo() or other disk-level utilities.
if (strrpos($file, '.' . $extension) === strlen($file) - strlen('.' . $extension)) {
return new $implementation['class']($file);
}
}
}
}
......
......@@ -2333,7 +2333,7 @@ function hook_drupal_goto_alter(&$path, &$options, &$http_response_code) {
* the Drupal installation process that occurs after the installation profile
* is selected.
* @param $install_state
* An array of information about the current installation state.
* An array of information about the current installation state.
*/
function hook_install_tasks_alter(&$tasks, $install_state) {
// Replace the "Choose language" installation task provided by Drupal core
......@@ -2455,17 +2455,15 @@ function hook_action_info_alter(&$actions) {
* zip files and tar.gz files. All archiver classes must implement
* ArchiverInterface.
*
* When mapping a
*
* Each entry should be keyed on a unique value, and specify three
* additional keys:
* - class: The name of the PHP class for this archiver.
* - extensions: An array of file extensions that this archiver supports.
* - weight: This optional key specifies the weight of this archiver.
* When mapping file extensions to archivers, the first archiver by
* weight found that supports the requested extension will be used.
* - class: The name of the PHP class for this archiver.
* - extensions: An array of file extensions that this archiver supports.
* - weight: This optional key specifies the weight of this archiver.
* When mapping file extensions to archivers, the first archiver by
* weight found that supports the requested extension will be used.
*/
function system_archiver_info() {
function hook_archiver_info() {
return array(
'tar' => array(
'class' => 'ArchiverTar',
......@@ -2508,7 +2506,7 @@ function hook_date_format_types() {
* module can define additional types that can be used when displaying dates. A
* date type is a key which can be passed to format_date() to return a date in
* the configured displayed format. A date format is a string defining the date
* and time elements to use. For example, a date type could be
* and time elements to use. For example, a date type could be
* 'mymodule_extra_long', while a date format is like 'Y-m-d'.
*
* New date types must first be declared using hook_date_format_types(). It is
......@@ -2536,7 +2534,7 @@ function hook_date_format_types() {
* 'short', 'mymodule_extra_long'. It must first be declared in
* hook_date_format_types() unless extending a type provided by another
* module.
* - 'format': a string defining the date and time elements to use. It
* - 'format': a string defining the date and time elements to use. It
* can contain any of the formatting options described at
* http://php.net/manual/en/function.date.php
* - 'locales': (optional) an array of 2 and 5 character language codes, for
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment