Commit eef6e452 authored by Tim Steiner's avatar Tim Steiner
Browse files

Merge pull request #515 from erasmussen2/issue-469

Pull request: Closes #469 Move migration code into its own module
parents 245d3969 c69d4815
...@@ -30,5 +30,6 @@ dependencies[] = imce_mkdir ...@@ -30,5 +30,6 @@ dependencies[] = imce_mkdir
dependencies[] = imce_rename dependencies[] = imce_rename
dependencies[] = imce_wysiwyg dependencies[] = imce_wysiwyg
dependencies[] = unl dependencies[] = unl
dependencies[] = unl_migration
dependencies[] = unl_wysiwyg dependencies[] = unl_wysiwyg
dependencies[] = unl_varnish dependencies[] = unl_varnish
...@@ -232,11 +232,6 @@ function unl_node_presave($node) { ...@@ -232,11 +232,6 @@ function unl_node_presave($node) {
*/ */
function unl_permission() { function unl_permission() {
return array( return array(
'unl migration' => array(
'title' => t('Migration'),
'description' => t('Migrate UNL Template based sites to drupal'),
),
'unl grant all permissions' => array( 'unl grant all permissions' => array(
'title' => t('Grant All Permissions'), 'title' => t('Grant All Permissions'),
'description' => t('If this is not checked, a user can only grant permissions that they themselves have. Requires the "Administer permissions" permission.'), 'description' => t('If this is not checked, a user can only grant permissions that they themselves have. Requires the "Administer permissions" permission.'),
...@@ -315,17 +310,6 @@ function unl_menu() { ...@@ -315,17 +310,6 @@ function unl_menu() {
'file' => 'technical_feedback.php', 'file' => 'technical_feedback.php',
); );
// Adds UNL Migration Tool to the Content menu for admin
$items['admin/content/unl/migration'] = array(
'title' => 'UNL Migration Tool',
'description' => 'Migrate a static UNL template page into Drupal.',
'access arguments' => array('unl migration'),
'page callback' => 'drupal_get_form',
'page arguments' => array('unl_migration'),
'type' => MENU_LOCAL_TASK,
'file' => 'unl_migration.php',
);
$items['admin/content/unl/reset'] = array( $items['admin/content/unl/reset'] = array(
'title' => 'Reset Site', 'title' => 'Reset Site',
'description' => 'Remove all nodes, menu items, etc from this site.', 'description' => 'Remove all nodes, menu items, etc from this site.',
...@@ -815,34 +799,6 @@ function unl_user_admin_role_validate($form, &$form_state) { ...@@ -815,34 +799,6 @@ function unl_user_admin_role_validate($form, &$form_state) {
} }
} }
/**
* Implementation of hook_cron().
*/
function unl_cron() {
_unl_cron_migration_step();
}
/**
* If a site is being migrated via cron jobs, do some work towards that migration.
*/
function _unl_cron_migration_step() {
// We don't want this running as system user, only the web user.
if (PHP_SAPI == 'cli') {
return;
}
$queue = DrupalQueue::get('unl_migration');
if ($queue->numberOfItems() > 0) {
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'unl_migration.php';
$item = $queue->claimItem(120);
$queue->deleteItem($item);
if (unl_migration_queue_step($item->data)) {
module_load_include('module', 'unl_multisite');
_unl_multisite_send_site_created_email();
}
}
}
/** /**
* Custom function to sanitize user created URLs * Custom function to sanitize user created URLs
*/ */
......
name = UNL Migration
description = Migrate websites into UNLcms.
package = UNL
dependencies[] = unl
core = 7.x
version = "7.x-1.x"
files[] = unl_migration.module
files[] = unl_migration.php
<?php
/**
* Implementation of hook_menu().
*/
function unl_migration_menu() {
$items = array();
// Adds UNL Migration Tool to the Content menu for admin
$items['admin/content/unl/migration'] = array(
'title' => 'UNL Migration Tool',
'description' => 'Migrate a static UNL template page into Drupal.',
'access arguments' => array('unl migration'),
'page callback' => 'drupal_get_form',
'page arguments' => array('unl_migration'),
'type' => MENU_LOCAL_TASK,
'file' => 'unl_migration.php',
);
return $items;
}
/**
* Implementation of hook_permission().
*/
function unl_migration_permission() {
return array(
'unl migration' => array(
'title' => t('Migration'),
'description' => t('Migrate UNL Template based sites to drupal'),
),
);
}
/**
* Implementation of hook_cron().
*/
function unl_migration_cron() {
_unl_migration_cron_migration_step();
}
/**
* If a site is being migrated via cron jobs, do some work towards that migration.
*/
function _unl_migration_cron_migration_step() {
// We don't want this running as system user, only the web user.
if (PHP_SAPI == 'cli') {
return;
}
$queue = DrupalQueue::get('unl_migration');
if ($queue->numberOfItems() > 0) {
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'unl_migration.php';
$item = $queue->claimItem(120);
$queue->deleteItem($item);
if (unl_migration_queue_step($item->data)) {
module_load_include('module', 'unl');
unl_send_site_created_email();
}
}
}
Supports Markdown
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