function updateServerConfigSettings() { global $default; $port = $_SERVER['SERVER_PORT'] + 0; if ($port > 0) { DBUtil::whereUpdate('config_settings', array('value' => $port), array('item' => 'internal_server_port', 'group_name' => 'server')); } }
function do_update() { $sTable = KTUtil::getTableName('plugins'); $aIds = (array) KTUtil::arrayGet($_REQUEST, 'pluginids'); // Update disabled plugins $sIds = implode(',', $aIds); $sQuery = "UPDATE {$sTable} SET disabled = 1 WHERE id NOT IN ({$sIds})"; DBUtil::runQuery(array($sQuery)); // Select disabled plugins that have been enabled $sQuery = "SELECT * FROM {$sTable} WHERE disabled = 1 AND id IN ({$sIds})"; $res = DBUtil::getResultArray($sQuery); if (!PEAR::isError($res)) { // Enable the disabled plugins $sQuery = "UPDATE {$sTable} SET disabled = 0 WHERE id IN ({$sIds})"; DBUtil::runQuery(array($sQuery)); // run setup for each plugin $aEnabled = array(); if (!empty($res)) { foreach ($res as $item) { $aEnabled[] = $item['id']; } $sEnabled = implode(',', $aEnabled); $sQuery = "SELECT h.classname, h.pathname FROM {$sTable} p\n INNER JOIN plugin_helper h ON (p.namespace = h.plugin)\n WHERE classtype = 'plugin' AND p.id IN ({$sEnabled})"; $res = DBUtil::getResultArray($sQuery); if (!PEAR::isError($res)) { foreach ($res as $item) { $classname = $item['classname']; $path = $item['pathname']; if (!empty($path)) { require_once $path; } $oPlugin = new $classname($path); $oPlugin->setup(); } } } } KTPluginEntity::clearAllCaches(); // FIXME!!! Plugin manager needs to be updated to deal with this situation. This code should be in the plugin. //enabling or disabling Tag fieldset depending on whether tag cloud plugin is enabled or disabled. //Get tag cloud object $oTagClouPlugin = KTPluginEntity::getByNamespace('ktcore.tagcloud.plugin'); if (!PEAR::isError($oTagClouPlugin) && !is_a($oTagClouPlugin, 'KTEntityNoObjects') && !is_null($oTagClouPlugin)) { if ($oTagClouPlugin->getDisabled() == '1') { //disable tag fieldset $aFV = array('disabled' => true); $aWFV = array('namespace' => 'tagcloud'); $res = DBUtil::whereUpdate('fieldsets', $aFV, $aWFV); } else { //enable tag fieldset $aFV = array('disabled' => false); $aWFV = array('namespace' => 'tagcloud'); $res = DBUtil::whereUpdate('fieldsets', $aFV, $aWFV); } } // we reregister the plugins to ensure they are in the correct order KTPluginUtil::registerPlugins(); $this->successRedirectToMain(_kt('Plugins updated')); }
/** * Set the status of an item and any errors that may have occurred while trying to archive it. * * @param string $code The identification string * @param integer $status The new status of the item * @param string $error Optional. The error's generated during the archive * @return boolean */ public function setItemStatus($code, $status = 1, $error = null) { $fields = array(); $fields['status'] = $status; $fields['errors'] = !empty($error) ? json_encode($error) : null; $where = array('code' => $code); $res = DBUtil::whereUpdate('download_queue', $fields, $where); return $res; }
function setAvailability($sNamespace, $bAvailable = true) { $aValues = array('unavailable' => $bAvailable); $aWhere = array('namespace' => $sNamespace); $res = DBUtil::whereUpdate('plugins', $aValues, $aWhere); return $res; }