123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191 |
- <?php
- function update_test_system_theme_info() {
- $themes['update_test_basetheme'] = drupal_get_path('module', 'update_test') . '/themes/update_test_basetheme/update_test_basetheme.info';
- $themes['update_test_subtheme'] = drupal_get_path('module', 'update_test') . '/themes/update_test_subtheme/update_test_subtheme.info';
- return $themes;
- }
- function update_test_menu() {
- $items = array();
- $items['update-test'] = array(
- 'title' => t('Update test'),
- 'page callback' => 'update_test_mock_page',
- 'access callback' => TRUE,
- 'type' => MENU_CALLBACK,
- );
- $items['503-error'] = array(
- 'title' => t('503 Service unavailable'),
- 'page callback' => 'update_callback_service_unavailable',
- 'access callback' => TRUE,
- 'type' => MENU_CALLBACK,
- );
- return $items;
- }
- function update_test_system_info_alter(&$info, $file) {
- $setting = variable_get('update_test_system_info', array());
- foreach (array('#all', $file->name) as $id) {
- if (!empty($setting[$id])) {
- foreach ($setting[$id] as $key => $value) {
- $info[$key] = $value;
- }
- }
- }
- }
- function update_test_update_status_alter(&$projects) {
- $setting = variable_get('update_test_update_status', array());
- if (!empty($setting)) {
- foreach ($projects as $project_name => &$project) {
- foreach (array('#all', $project_name) as $id) {
- if (!empty($setting[$id])) {
- foreach ($setting[$id] as $key => $value) {
- $project[$key] = $value;
- }
- }
- }
- }
- }
- }
- function update_test_mock_page($project_name) {
- $xml_map = variable_get('update_test_xml_map', FALSE);
- if (isset($xml_map[$project_name])) {
- $availability_scenario = $xml_map[$project_name];
- }
- elseif (isset($xml_map['#all'])) {
- $availability_scenario = $xml_map['#all'];
- }
- else {
-
-
-
-
-
- $availability_scenario = '#broken#';
- }
- $path = drupal_get_path('module', 'update_test');
- readfile("$path/$project_name.$availability_scenario.xml");
- }
- function update_test_archiver_info() {
- return array(
- 'update_test_archiver' => array(
-
- 'class' => 'ArchiverUpdateTest',
- 'extensions' => array('update-test-extension'),
- ),
- );
- }
- function update_test_filetransfer_info() {
-
-
-
- return array(
- 'system_test' => array(
- 'title' => t('Update Test FileTransfer'),
-
-
- 'file' => 'update_test.module',
- 'class' => 'UpdateTestFileTransfer',
- 'weight' => -20,
- ),
- );
- }
- class UpdateTestFileTransfer {
-
- public static function factory() {
- return new UpdateTestFileTransfer;
- }
-
- public function getSettingsForm() {
- $form = array();
- $form['udpate_test_username'] = array(
- '#type' => 'textfield',
- '#title' => t('Update Test Username'),
- );
- return $form;
- }
- }
- function update_callback_service_unavailable() {
- drupal_add_http_header('Status', '503 Service unavailable');
- print "503 Service Temporarily Unavailable";
- }
|