Skip to content
Snippets Groups Projects
Commit bd1f3c8d authored by Tim Steiner's avatar Tim Steiner
Browse files

[gh-69] Merging from testing to staging

git-svn-id: file:///tmp/wdn_thm_drupal/branches/drupal-7.x/staging@410 20a16fea-79d4-4915-8869-1ea9d5ebf173
parent 6c4f07c5
No related branches found
No related tags found
No related merge requests found
...@@ -121,6 +121,7 @@ class Unl_Migration_Tool ...@@ -121,6 +121,7 @@ class Unl_Migration_Tool
private $_blocks = array(); private $_blocks = array();
private $_isFrontier = FALSE; private $_isFrontier = FALSE;
private $_frontierIndexFiles = array('low_bandwidth.shtml', 'index.shtml', 'index.html', 'index.htm', 'default.shtml'); private $_frontierIndexFiles = array('low_bandwidth.shtml', 'index.shtml', 'index.html', 'index.htm', 'default.shtml');
private $_frontierFilesScanned = array();
private $_ignoreDuplicates = FALSE; private $_ignoreDuplicates = FALSE;
/** /**
...@@ -134,6 +135,8 @@ class Unl_Migration_Tool ...@@ -134,6 +135,8 @@ class Unl_Migration_Tool
const STATE_CREATING_NODES = 4; const STATE_CREATING_NODES = 4;
const STATE_DONE = 5; const STATE_DONE = 5;
private $_start_time;
public function __construct($baseUrl, $frontierPath, $frontierUser, $frontierPass, $ignoreDuplicates) public function __construct($baseUrl, $frontierPath, $frontierUser, $frontierPass, $ignoreDuplicates)
{ {
header('Content-type: text/plain'); header('Content-type: text/plain');
...@@ -163,14 +166,16 @@ class Unl_Migration_Tool ...@@ -163,14 +166,16 @@ class Unl_Migration_Tool
public function migrate($time_limit = 30) public function migrate($time_limit = 30)
{ {
$start_time = time(); $this->_start_time = time();
ini_set('memory_limit', -1); ini_set('memory_limit', -1);
if ($this->_state == self::STATE_NONE) { if ($this->_state == self::STATE_NONE) {
$this->_frontierScan(''); if (!$this->_frontierScan('', $time_limit)) {
return FALSE;
}
$this->_state = self::STATE_PROCESSING_BLOCKS; $this->_state = self::STATE_PROCESSING_BLOCKS;
if (time() - $start_time > $time_limit) { if (time() - $this->_start_time > $time_limit) {
return FALSE; return FALSE;
} }
} }
...@@ -189,7 +194,7 @@ class Unl_Migration_Tool ...@@ -189,7 +194,7 @@ class Unl_Migration_Tool
$pagesToProcess = $this->_getPagesToProcess(); $pagesToProcess = $this->_getPagesToProcess();
foreach ($pagesToProcess as $pageToProcess) { foreach ($pagesToProcess as $pageToProcess) {
if (time() - $start_time > $time_limit) { if (time() - $this->_start_time > $time_limit) {
return FALSE; return FALSE;
} }
$this->_processPage($pageToProcess); $this->_processPage($pageToProcess);
...@@ -221,7 +226,7 @@ class Unl_Migration_Tool ...@@ -221,7 +226,7 @@ class Unl_Migration_Tool
if (in_array($path, $this->_createdContent, TRUE)) { if (in_array($path, $this->_createdContent, TRUE)) {
continue; continue;
} }
if (time() - $start_time > $time_limit) { if (time() - $this->_start_time > $time_limit) {
return FALSE; return FALSE;
} }
set_time_limit(30); set_time_limit(30);
...@@ -860,7 +865,7 @@ class Unl_Migration_Tool ...@@ -860,7 +865,7 @@ class Unl_Migration_Tool
return $this->_frontier; return $this->_frontier;
} }
private function _frontierScan($path) private function _frontierScan($path, $time_limit)
{ {
if (!$this->_frontierConnect()) { if (!$this->_frontierConnect()) {
return; return;
...@@ -872,13 +877,24 @@ class Unl_Migration_Tool ...@@ -872,13 +877,24 @@ class Unl_Migration_Tool
$files = array(); $files = array();
foreach ($rawFileList as $index => $rawListing) { foreach ($rawFileList as $index => $rawListing) {
$file = substr($fileList[$index], strlen($ftpPath)); $file = substr($fileList[$index], strlen($ftpPath));
if (time() - $this->_start_time > $time_limit) {
return FALSE;
}
if (in_array($path . $file, $this->_frontierFilesScanned)) {
continue;
}
if (in_array($file, array('_notes', '_baks'))) { if (in_array($file, array('_notes', '_baks'))) {
continue; continue;
} }
if (substr($rawListing, 0, 1) == 'd') { if (substr($rawListing, 0, 1) == 'd') {
//file is a directory //file is a directory
$this->_frontierScan($path . $file . '/'); if (!$this->_frontierScan($path . $file . '/', $time_limit)) {
return FALSE;
};
} else { } else {
if (substr($path, 0, 1) == '/') { if (substr($path, 0, 1) == '/') {
$path = substr($path, 1); $path = substr($path, 1);
...@@ -890,7 +906,9 @@ class Unl_Migration_Tool ...@@ -890,7 +906,9 @@ class Unl_Migration_Tool
$this->_addSitePath($path . $file); $this->_addSitePath($path . $file);
} }
} }
$this->_frontierFilesScanned[] = $path . $file;
} }
return TRUE;
} }
private function _log($message) private function _log($message)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment