本文整理汇总了PHP中DBUtil::whereUpdate方法的典型用法代码示例。如果您正苦于以下问题:PHP DBUtil::whereUpdate方法的具体用法?PHP DBUtil::whereUpdate怎么用?PHP DBUtil::whereUpdate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBUtil
的用法示例。
在下文中一共展示了DBUtil::whereUpdate方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateServerConfigSettings
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'));
}
}
示例2: do_update
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'));
}
示例3: setItemStatus
/**
* 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;
}
示例4: setAvailability
function setAvailability($sNamespace, $bAvailable = true)
{
$aValues = array('unavailable' => $bAvailable);
$aWhere = array('namespace' => $sNamespace);
$res = DBUtil::whereUpdate('plugins', $aValues, $aWhere);
return $res;
}