Skip to content

Instantly share code, notes, and snippets.

@Ben-Ho
Created December 17, 2013 13:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ben-Ho/8005113 to your computer and use it in GitHub Desktop.
Save Ben-Ho/8005113 to your computer and use it in GitHub Desktop.
This code snippet should be used when updating koala-framework from version 3.5 to anything above because ImageComponent changed incompatible by removing alternative preview image. It's returning a list of links to components using an alternative preview image. Check which components have to updated after updating kwf.
$data = Kwf_Registry::get('db')->query('SELECT * FROM `kwc_basic_image` WHERE data like \'%preview_image":true%\'')->fetchAll();
foreach ($data as $row) {
$component = Kwf_Component_Data_Root::getInstance()->getComponentByDbId($row['component_id'], array('ignoreVisible' => false));
if ($component) {
if ($component->componentClass != 'Kwc_Basic_LinkTag_Empty_Component') {
if ($component->getComponent()->getRow()->kwf_upload_id) {
//d($component->componentClass);
$components[$component->getAbsoluteUrl()] = '<a href="'.$component->getAbsoluteUrl().'">'.$component->getAbsoluteUrl().'</a>';
}
}
// $components[] = $component->getUrl();
}
}
d(array_values($components));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment