Skip to content

Commit

Permalink
Added support for versioning
Browse files Browse the repository at this point in the history
  • Loading branch information
ausi committed Nov 13, 2014
1 parent 480d508 commit a23e5a8
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions src/MadeYourDay/Contao/CustomElementsConvert.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,17 @@ public function run()
$failedElements[] = array('content', $contentElements->id, $contentElements->type);
}
else {

$this->createInitialVersion(\ContentModel::getTable(), $contentElements->id);

$this->Database
->prepare('UPDATE ' . \ContentModel::getTable() . ' SET type = \'html\', html = ? WHERE id = ?')
->executeUncached($html, $contentElements->id);
->prepare('UPDATE ' . \ContentModel::getTable() . ' SET tstamp = ?, type = \'html\', html = ? WHERE id = ?')
->executeUncached(time(), $html, $contentElements->id);
$elementsCount++;

$this->createNewVersion(\ContentModel::getTable(), $contentElements->id);
$this->log('A new version of record "' . \ContentModel::getTable() . '.id=' . $contentElements->id . '" has been created', __METHOD__, TL_GENERAL);

}

}
Expand All @@ -82,10 +89,17 @@ public function run()
$failedElements[] = array('module', $moduleElements->id, $moduleElements->type);
}
else {

$this->createInitialVersion(\ModuleModel::getTable(), $moduleElements->id);

$this->Database
->prepare('UPDATE ' . \ModuleModel::getTable() . ' SET type = \'html\', html = ? WHERE id = ?')
->executeUncached($html, $moduleElements->id);
->prepare('UPDATE ' . \ModuleModel::getTable() . ' SET tstamp = ?, type = \'html\', html = ? WHERE id = ?')
->executeUncached(time(), $html, $moduleElements->id);
$elementsCount++;

$this->createNewVersion(\ModuleModel::getTable(), $moduleElements->id);
$this->log('A new version of record "' . \ModuleModel::getTable() . '.id=' . $moduleElements->id . '" has been created', __METHOD__, TL_GENERAL);

}

}
Expand Down

0 comments on commit a23e5a8

Please sign in to comment.