Commit 10bce91c authored by Nigel McNie's avatar Nigel McNie
Browse files

Removed a whole bunch of random debugging lines, and added some at more important spots.

Namely, when a block doesn't migrate properly.

Also reduced the size of resized images in views somewhat to work better on smaller screens.
parent 487bf144
...@@ -99,12 +99,6 @@ function upgrade_template_migration() { ...@@ -99,12 +99,6 @@ function upgrade_template_migration() {
} }
$numcolumns = count($viewcolumns); $numcolumns = count($viewcolumns);
// Temporary, testing the migration of certain templates only
if ($view->template != 'generaltemplate') {
//log_debug('skipping template, it is not blogreflection');
continue;
}
// Handle all label blocks, by converting them to WYSIWYG blocks // Handle all label blocks, by converting them to WYSIWYG blocks
if ($lblocks = get_records_array('view_content', 'view', $view->id)) { if ($lblocks = get_records_array('view_content', 'view', $view->id)) {
foreach ($lblocks as $block) { foreach ($lblocks as $block) {
...@@ -228,13 +222,11 @@ function upgrade_template_migration() { ...@@ -228,13 +222,11 @@ function upgrade_template_migration() {
} }
} }
if ($empty) { if ($empty) {
log_debug("Column $c is empty");
$numcolumns--; $numcolumns--;
unset($viewcolumns[$c]); unset($viewcolumns[$c]);
} }
} }
} }
log_debug("Final number of columns in view: $numcolumns");
// Make all the block instances have the correct column and order // Make all the block instances have the correct column and order
foreach ($viewcolumns as $c => $col) { foreach ($viewcolumns as $c => $col) {
...@@ -270,7 +262,6 @@ function upgrade_template_migration() { ...@@ -270,7 +262,6 @@ function upgrade_template_migration() {
* @param BlockInstance $bi blockinstance to insert * @param BlockInstance $bi blockinstance to insert
*/ */
function upgrade_template_insert_block(&$columns, $key, BlockInstance $bi) { function upgrade_template_insert_block(&$columns, $key, BlockInstance $bi) {
log_debug('upgrade_template_insert_block() for key ' . $key);
foreach ($columns as &$c) { foreach ($columns as &$c) {
if (array_key_exists($key, $c)) { if (array_key_exists($key, $c)) {
if (!empty($c[$key])) { if (!empty($c[$key])) {
...@@ -615,10 +606,10 @@ function upgrade_template_convert_block_to_blockinstance($block, $view) { ...@@ -615,10 +606,10 @@ function upgrade_template_convert_block_to_blockinstance($block, $view) {
} }
else { else {
$blocktype = 'image'; $blocktype = 'image';
$configdata = array('artefactid' => $block->artefact, 'width' => ($view->template == 'gallery' ? 200 : '')); $configdata = array('artefactid' => $block->artefact, 'width' => ($view->template == 'gallery' ? 175 : 350));
} }
$bi = new BlockInstance(0, array( $bi = new BlockInstance(0, array(
'title' => ($view->template == 'gallery' ? '' : $block->title), 'title' => '',
'blocktype' => $blocktype, 'blocktype' => $blocktype,
'configdata' => serialize($configdata), 'configdata' => serialize($configdata),
'view' => $view->id, 'view' => $view->id,
...@@ -654,6 +645,8 @@ function upgrade_template_convert_block_to_blockinstance($block, $view) { ...@@ -654,6 +645,8 @@ function upgrade_template_convert_block_to_blockinstance($block, $view) {
return $bi; return $bi;
} }
log_info("Created a placeholder blockinstance for:");
log_info($block);
$bi = new BlockInstance(0, array( $bi = new BlockInstance(0, array(
'title' => 'TODO - correct blocktype', 'title' => 'TODO - correct blocktype',
'blocktype' => 'textbox', 'blocktype' => 'textbox',
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
defined('INTERNAL') || die(); defined('INTERNAL') || die();
function xmldb_core_upgrade($oldversion=0) { function xmldb_core_upgrade($oldversion=0) {
ini_set('max_execution_time', 120); // Let's be safe
$status = true; $status = true;
......
...@@ -1446,7 +1446,6 @@ function db_begin() { ...@@ -1446,7 +1446,6 @@ function db_begin() {
global $db; global $db;
$GLOBALS['_TRANSACTION_LEVEL']++; $GLOBALS['_TRANSACTION_LEVEL']++;
log_debug('db_begin(): transaction level now ' . $GLOBALS['_TRANSACTION_LEVEL']);
$db->StartTrans(); $db->StartTrans();
} }
...@@ -1459,7 +1458,6 @@ function db_begin() { ...@@ -1459,7 +1458,6 @@ function db_begin() {
function db_commit() { function db_commit() {
global $db; global $db;
$GLOBALS['_TRANSACTION_LEVEL']--; $GLOBALS['_TRANSACTION_LEVEL']--;
log_debug('db_commit(): transaction level now ' . $GLOBALS['_TRANSACTION_LEVEL']);
if ($GLOBALS['_TRANSACTION_LEVEL'] == 0) { if ($GLOBALS['_TRANSACTION_LEVEL'] == 0) {
...@@ -1469,7 +1467,6 @@ function db_commit() { ...@@ -1469,7 +1467,6 @@ function db_commit() {
} }
} }
log_debug('peforming commit');
return $db->CompleteTrans(); return $db->CompleteTrans();
} }
...@@ -1478,7 +1475,6 @@ function db_commit() { ...@@ -1478,7 +1475,6 @@ function db_commit() {
*/ */
function db_rollback() { function db_rollback() {
global $db; global $db;
log_debug('db_rollback(): rolling back transaction from level '. $GLOBALS['_TRANSACTION_LEVEL']);
$db->FailTrans(); $db->FailTrans();
for ($i = $GLOBALS['_TRANSACTION_LEVEL']; $i >= 0; $i--) { for ($i = $GLOBALS['_TRANSACTION_LEVEL']; $i >= 0; $i--) {
$db->CompleteTrans(); $db->CompleteTrans();
......
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