Skip to content

Commit

Permalink
Update script.php
Browse files Browse the repository at this point in the history
  • Loading branch information
sonvnn committed Nov 1, 2024
1 parent 773bfbf commit 62d4ddb
Showing 1 changed file with 31 additions and 31 deletions.
62 changes: 31 additions & 31 deletions script.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,37 +105,37 @@ public function installModule($module, $module_dir)
$db->setQuery($query);
$db->execute();

// if ($module_name === 'mod_astroid_clear_cache') {
// $query = $db->getQuery(true);
// $query->update('#__modules');
// $query->set($db->quoteName('published') . ' = 1');
// $query->set($db->quoteName('position') . ' = ' . $db->quote('status'));
// $query->set($db->quoteName('params') . ' = ' . $db->quote('{"layout":"_:default","moduleclass_sfx":"","style":"0","module_tag":"div","bootstrap_size":"0","header_tag":"h3","header_class":""}'));
// $query->where($db->quoteName('module') . ' = ' . $db->quote($module_name));
// $db->setQuery($query);
// $db->execute();
// }
//
// // Retrieve ID
// $query = $db->getQuery(true);
// $query->select($db->quoteName('id'));
// $query->from($db->quoteName('#__modules'));
// $query->where($db->quoteName('module') . ' = ' . $db->quote($module_name));
// $db->setQuery($query);
// $id = (int) $db->loadResult();
//
// if ($id) {
// $query = $db->getQuery(true);
// $query->select($db->quoteName('moduleid'));
// $query->from($db->quoteName('#__modules_menu'));
// $query->where($db->quoteName('moduleid') . ' = ' . $id);
// $db->setQuery($query);
// if (!$db->loadResult()) {
// $db->getQuery(true);
// $db->setQuery("INSERT INTO #__modules_menu (`moduleid`,`menuid`) VALUES (".$id.", 0)");
// $db->execute();
// }
// }
if ($module_name === 'mod_astroid_clear_cache') {
$query = $db->getQuery(true);
$query->update('#__modules');
$query->set($db->quoteName('published') . ' = 1');
$query->set($db->quoteName('position') . ' = ' . $db->quote('status'));
$query->set($db->quoteName('params') . ' = ' . $db->quote('{"layout":"_:default","moduleclass_sfx":"","style":"0","module_tag":"div","bootstrap_size":"0","header_tag":"h3","header_class":""}'));
$query->where($db->quoteName('module') . ' = ' . $db->quote($module_name));
$db->setQuery($query);
$db->execute();
}

// Retrieve ID
$query = $db->getQuery(true);
$query->select($db->quoteName('id'));
$query->from($db->quoteName('#__modules'));
$query->where($db->quoteName('module') . ' = ' . $db->quote($module_name));
$db->setQuery($query);
$id = (int) $db->loadResult();

if ($id) {
$query = $db->getQuery(true);
$query->select($db->quoteName('moduleid'));
$query->from($db->quoteName('#__modules_menu'));
$query->where($db->quoteName('moduleid') . ' = ' . $id);
$db->setQuery($query);
if (!$db->loadResult()) {
$db->getQuery(true);
$db->setQuery("INSERT INTO #__modules_menu (`moduleid`,`menuid`) VALUES (".$id.", 0)");
$db->execute();
}
}
return true;
}

Expand Down

0 comments on commit 62d4ddb

Please sign in to comment.