本文整理汇总了PHP中DBManager::get方法的典型用法代码示例。如果您正苦于以下问题:PHP DBManager::get方法的具体用法?PHP DBManager::get怎么用?PHP DBManager::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBManager
的用法示例。
在下文中一共展示了DBManager::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: down
function down ()
{
$db = DBManager::get();
$db->exec("ALTER TABLE log_actions CHANGE expires
expires int(20) default NULL");
}
示例2: get_booked_rooms_action
function get_booked_rooms_action($api_key, $start_timestamp, $end_timestamp)
{
$ret = array();
if (!$start_timestamp) {
$start_timestamp = strtotime('today');
}
if (!$end_timestamp) {
$end_timestamp = strtotime("+2 weeks", $start_timestamp);
}
$db = DBManager::get();
$rs = $db->query(sprintf("\n SELECT begin, end, s.Name AS lecture_title, s.Beschreibung, i.Name AS lecture_home_institute, r.resource_id, r.name AS room, GROUP_CONCAT( CONCAT_WS( '|', auth_user_md5.Vorname, auth_user_md5.Nachname, user_info.title_front, user_info.title_rear )\n ORDER BY seminar_user.position\n SEPARATOR ';' ) AS lecturer_name\n FROM resources_assign ra\n INNER JOIN resources_objects r ON ra.resource_id = r.resource_id\n INNER JOIN termine t ON termin_id = assign_user_id\n INNER JOIN seminare s ON range_id = Seminar_id\n INNER JOIN Institute i ON i.Institut_id = s.Institut_id\n LEFT JOIN seminar_user ON s.seminar_id = seminar_user.seminar_id\n AND seminar_user.status = 'dozent'\n LEFT JOIN auth_user_md5 ON seminar_user.user_id = auth_user_md5.user_id\n LEFT JOIN user_info ON user_info.user_id = auth_user_md5.user_id\n WHERE begin\n BETWEEN %s\n AND %s\n GROUP BY assign_id", $db->quote($start_timestamp), $db->quote($end_timestamp)));
while ($row = $rs->fetch(PDO::FETCH_ASSOC)) {
$lecturers = explode(';', $row['lecturer_name']);
list($vorname, $nachname, $titel1, $titel2) = explode('|', $lecturers[0]);
$room = new Studip_Booked_Room();
$room->start_time = $row['begin'];
$room->end_time = $row['end'];
$room->room = $row['room'];
$room->room_id = $row['resource_id'];
$room->lecture_title = $row['lecture_title'];
$room->lecture_home_institute = $row['lecture_home_institute'];
$room->lecture_description = $row['Beschreibung'];
$room->lecturer_title_front = $titel1;
$room->lecturer_title_rear = $titel2;
$room->lecturer_name = $vorname . ' ' . $nachname;
$ret[] = $room;
}
return $ret;
}
示例3: Ilias4ConnectedUser
/**
* constructor
*
* init class.
* @access
* @param string $cms system-type
*/
function Ilias4ConnectedUser($cms, $user_id = false)
{
// get auth_plugin
$user_id = $user_id ? $user_id : $GLOBALS['user']->id;
$this->auth_plugin = DBManager::get()->query("SELECT IFNULL(auth_plugin, 'standard') FROM auth_user_md5 WHERE user_id = '" . $user_id . "'")->fetchColumn();
parent::Ilias3ConnectedUser($cms, $user_id);
}
示例4: down
function down()
{
$db = DBManager::get();
foreach ($this->options as $name => $descrition) {
$db->exec("DELETE FROM config WHERE field = '{$name}'");
}
}
示例5: increatePrioritiesByUserId
/**
*
*/
public static function increatePrioritiesByUserId($user_id)
{
$query = "UPDATE kategorien SET priority = priority + 1 WHERE range_id = ?";
$statement = DBManager::get()->prepare($query);
$statement->execute(array($user_id));
return $statement->rowCount() > 0;
}
示例6: down
function down()
{
$db = DBManager::get();
$db->exec("DROP TABLE `seminar_cycle_dates`");
$db->exec("ALTER TABLE `seminare` ADD `metadata_dates` TEXT NOT NULL DEFAULT ''");
$db->exec("DELETE FROM config WHERE field LIKE 'ALLOW_METADATE_SORTING'");
}
示例7: afterStoreCallback
public function afterStoreCallback()
{
if ($this->isDirty()) {
//add notification to writer of review
if (!$this->review['host_id'] && $this->review['user_id'] !== $this['user_id']) {
PersonalNotifications::add($this->review['user_id'], URLHelper::getURL("plugins.php/lernmarktplatz/market/discussion/" . $this['review_id'] . "#comment_" . $this->getId()), sprintf(_("%s hat einen Kommentar zu Ihrem Review geschrieben."), $this['host_id'] ? LernmarktplatzUser::find($this['user_id'])->name : get_fullname($this['user_id'])), "comment_" . $this->getId(), Icon::create("support", "clickable"));
}
//add notification to all users of this servers who discussed this review but are neither the new
//commentor nor the writer of the review
$statement = DBManager::get()->prepare("\n SELECT user_id\n FROM lernmarktplatz_comments\n WHERE review_id = :review_id\n AND host_id IS NULL\n GROUP BY user_id\n ");
$statement->execute(array('review_id' => $this->review->getId()));
foreach ($statement->fetchAll(PDO::FETCH_COLUMN, 0) as $user_id) {
if (!in_array($user_id, array($this->review['user_id'], $this['user_id']))) {
PersonalNotifications::add($user_id, URLHelper::getURL("plugins.php/lernmarktplatz/market/discussion/" . $this['review_id'] . "#comment_" . $this->getId()), sprintf(_("%s hat auch einen Kommentar geschrieben."), $this['host_id'] ? LernmarktplatzUser::find($this['user_id'])->name : get_fullname($this['user_id'])), "comment_" . $this->getId(), Icon::create("support", "clickable"));
}
}
//only push if the comment is from this server and the material-server is different
if (!$this['host_id']) {
$myHost = LernmarktplatzHost::thisOne();
$data = array();
$data['host'] = array('name' => $myHost['name'], 'url' => $myHost['url'], 'public_key' => $myHost['public_key']);
$data['data'] = $this->toArray();
$data['data']['foreign_comment_id'] = $data['data']['comment_id'];
unset($data['data']['comment_id']);
unset($data['data']['id']);
unset($data['data']['user_id']);
unset($data['data']['host_id']);
$user_description_datafield = DataField::find(get_config("LERNMARKTPLATZ_USER_DESCRIPTION_DATAFIELD")) ?: DataField::findOneBySQL("name = ?", array(get_config("LERNMARKTPLATZ_USER_DESCRIPTION_DATAFIELD")));
if ($user_description_datafield) {
$datafield_entry = DatafieldEntryModel::findOneBySQL("range_id = ? AND datafield_id = ?", array($this['user_id'], $user_description_datafield->getId()));
}
$data['user'] = array('user_id' => $this['user_id'], 'name' => get_fullname($this['user_id']), 'avatar' => Avatar::getAvatar($this['user_id'])->getURL(Avatar::NORMAL), 'description' => $datafield_entry ? $datafield_entry['content'] : null);
$statement = DBManager::get()->prepare("\n SELECT host_id\n FROM lernmarktplatz_comments\n WHERE review_id = :review_id\n AND host_id IS NOT NULL\n GROUP BY host_id\n ");
$statement->execute(array('review_id' => $this->review->getId()));
$hosts = $statement->fetchAll(PDO::FETCH_COLUMN, 0);
if ($this->review['host_id'] && !in_array($this->review['host_id'], $hosts)) {
$hosts[] = $this->review['host_id'];
}
if ($this->review->material['host_id'] && !in_array($this->review->material['host_id'], $hosts)) {
$hosts[] = $this->review->material['host_id'];
}
foreach ($hosts as $host_id) {
$remote = new LernmarktplatzHost($host_id);
if (!$remote->isMe()) {
$review_id = $this->review['foreign_review_id'] ?: $this->review->getId();
if ($this->review['foreign_review_id']) {
if ($this->review->host_id === $remote->getId()) {
$host_hash = null;
} else {
$host_hash = md5($this->review->host['public_key']);
}
} else {
$host_hash = md5($myHost['public_key']);
}
$remote->pushDataToEndpoint("add_comment/" . $review_id . "/" . $host_hash, $data);
}
}
}
}
}
示例8: getDatesFromDb
private function getDatesFromDb()
{
$db = DBManager::get();
$dayend = $this->day + $this->daysec;
$sql = "SELECT resources_objects.name AS 'Raum',\n resources_assign.assign_id,\n\t\tresources_assign.begin,\n resources_assign.end,\n resources_assign.repeat_interval,\n resources_assign.repeat_day_of_week,\n resources_assign.repeat_week_of_month,\n resources_assign.repeat_day_of_month,\n resources_assign.repeat_month_of_year,\n resources_assign.assign_user_id AS 'id',\n resources_assign.user_free_name AS 'titel',\n resources_assign.repeat_end,\n resources_assign.repeat_day_of_week\n FROM `resources_assign`\n INNER JOIN resources_objects ON resources_assign.resource_id = resources_objects.resource_id\n WHERE ((resources_assign.begin > ? AND resources_assign.begin < ?) OR (resources_assign.begin < ? AND resources_assign.repeat_end > ?))\n AND resources_assign.resource_id in (SELECT resource_id FROM `resources_objects` WHERE parent_id = ? ORDER BY Name)\n ORDER BY end ASC";
$sqldebug = "SELECT resources_objects.name AS 'Raum',\n resources_assign.begin,\n resources_assign.end,\n resources_assign.repeat_interval,\n resources_assign.repeat_day_of_week,\n resources_assign.repeat_week_of_month,\n resources_assign.repeat_day_of_month,\n resources_assign.repeat_month_of_year,\n resources_assign.assign_user_id AS 'id',\n resources_assign.user_free_name AS 'titel',\n resources_assign.repeat_end,\n resources_assign.repeat_day_of_week\n FROM `resources_assign`\n INNER JOIN resources_objects ON resources_assign.resource_id = resources_objects.resource_id\n WHERE ((resources_assign.begin > {$this->day} AND resources_assign.begin < {$dayend}) OR (resources_assign.begin < {$this->day} AND resources_assign.repeat_end < {$this->day}))\n AND resources_assign.resource_id in (SELECT resource_id FROM `resources_objects` WHERE parent_id = '" . $this->building . "' ORDER BY Name)\n ORDER BY end ASC";
//$this->debug($sqldebug);
$db = DBManager::get()->prepare($sql);
$db->execute(array($this->day, $dayend, $this->day, $this->day, $this->building));
//$dayend
$result = $db->fetchAll();
if (empty($result)) {
return false;
}
foreach ($result as $date) {
if (!empty($date)) {
if (date("w", $date['begin']) == date("w", $this->day) or $date['repeat_interval'] == "1" and $date['repeat_day_of_week'] == "0" or $date['repeat_interval'] == "0" and $date['repeat_day_of_week'] == "0" and $date['repeat_week_of_month'] == "0" and $date['repeat_day_of_month'] == "0" and $date['repeat_day_of_month'] == "0") {
if (date("j", $date['begin']) != date("j", $this->day)) {
$tempdate = mktime(date("H", $date['begin']), date("i", $date['begin']), date("s", $date['begin']), date("m", $this->day), date("j", $this->day), date("Y", $this->day));
$date['begin'] = $tempdate;
}
if (date("j", $date['end']) != date("j", $this->day)) {
$tempdate = mktime(date("H", $date['end']), date("i", $date['end']), date("s", $date['end']), date("m", $this->day), date("j", $this->day), date("Y", $this->day));
$date['end'] = $tempdate;
}
//$this->debug($date);
if ($date['repeat_day_of_week'] != date("N", $this->day)) {
$this->dates[] = $date;
}
}
}
}
//$this->debug($this->dates);
}
示例9: up
function up()
{
$this->announce("add new value SEM_TREE_ALLOW_BRANCH_ASSIGN to table config");
$db = DBManager::get();
$db->exec("INSERT IGNORE INTO `config` " . "VALUES ('34f348c06bbd5d9fc7bb36a8d829e12e', '', " . "'SEM_TREE_ALLOW_BRANCH_ASSIGN', '1', 1, 'boolean', 'global', " . "'', 0, 1222947575, 1222947575, " . "'Diese Option beeinflusst die Möglichkeit, Veranstaltungen " . "entweder nur an die Blätter oder überall in der " . "Veranstaltungshierarchie einhängen zu dürfen.', '', '')");
$this->announce("done.");
}
示例10: up
function up()
{
$db = DBManager::get();
$db->exec("\n CREATE TABLE IF NOT EXISTS `blubber` (\n `topic_id` varchar(32) NOT NULL DEFAULT '',\n `parent_id` varchar(32) NOT NULL DEFAULT '',\n `root_id` varchar(32) NOT NULL DEFAULT '',\n `context_type` enum('public','private','course') NOT NULL DEFAULT 'public',\n `name` varchar(255) DEFAULT NULL,\n `description` text,\n `mkdate` int(20) NOT NULL DEFAULT '0',\n `chdate` int(20) NOT NULL DEFAULT '0',\n `author_host` varchar(255) DEFAULT NULL,\n `Seminar_id` varchar(32) NOT NULL DEFAULT '',\n `user_id` varchar(32) NOT NULL DEFAULT '',\n `external_contact` tinyint(4) NOT NULL DEFAULT '0',\n PRIMARY KEY (`topic_id`),\n KEY `root_id` (`root_id`),\n KEY `Seminar_id` (`Seminar_id`),\n KEY `parent_id` (`parent_id`),\n KEY `chdate` (`chdate`),\n KEY `mkdate` (`mkdate`),\n KEY `user_id` (`user_id`,`Seminar_id`)\n ) ENGINE=MyISAM;\n ");
//Spezialevents, bisher nur für Löschen von Beiträgen verwendet
$db->exec("\n CREATE TABLE IF NOT EXISTS `blubber_events_queue` (\n `event_type` varchar(32) NOT NULL,\n `item_id` varchar(32) NOT NULL,\n `mkdate` int(11) NOT NULL,\n PRIMARY KEY (`event_type`,`item_id`,`mkdate`),\n KEY `item_id` (`item_id`)\n ) ENGINE=MyISAM\n ");
//Blubberautoren, die nicht in Stud.IP angemeldet sind wie anonyme
$db->exec("\n CREATE TABLE IF NOT EXISTS `blubber_external_contact` (\n `external_contact_id` varchar(32) NOT NULL,\n `mail_identifier` varchar(256) DEFAULT NULL,\n `contact_type` varchar(16) NOT NULL DEFAULT 'anonymous',\n `name` varchar(256) NOT NULL,\n `data` text,\n `chdate` bigint(20) NOT NULL,\n `mkdate` bigint(20) NOT NULL,\n PRIMARY KEY (`external_contact_id`),\n KEY `mail_identifier` (`mail_identifier`),\n KEY `contact_type` (`contact_type`)\n ) ENGINE=MyISAM\n ");
$db->exec("\n CREATE TABLE IF NOT EXISTS `blubber_follower` (\n `studip_user_id` varchar(32) NOT NULL,\n `external_contact_id` varchar(32) NOT NULL,\n `left_follows_right` tinyint(1) NOT NULL,\n KEY `studip_user_id` (`studip_user_id`),\n KEY `external_contact_id` (`external_contact_id`)\n ) ENGINE=MyISAM\n ");
//Rechte für private Blubber
$db->exec("\n CREATE TABLE IF NOT EXISTS `blubber_mentions` (\n `topic_id` varchar(32) NOT NULL,\n `user_id` varchar(32) NOT NULL,\n `external_contact` tinyint(4) NOT NULL DEFAULT '0',\n `mkdate` int(11) NOT NULL,\n UNIQUE KEY `unique_users_per_topic` (`topic_id`,`user_id`,`external_contact`),\n KEY `topic_id` (`topic_id`),\n KEY `user_id` (`user_id`)\n ) ENGINE=MyISAM\n ");
$old_blubber = $db->query("SELECT * FROM plugins WHERE pluginclassname = 'Blubber' " . "")->fetch(PDO::FETCH_ASSOC);
if ($old_blubber) {
//Umschreiben des Ortes von Blubber
$db->exec("\n UPDATE plugins SET pluginpath = 'core/Blubber' WHERE pluginclassname = 'Blubber'\n ");
if ($old_blubber['pluginpath'] !== "core/Blubber") {
@rmdirr($GLOBALS['PLUGINS_PATH'] . "/" . $old_blubber['pluginpath']);
}
$db->exec("\n INSERT IGNORE INTO blubber (`topic_id`,`parent_id`,`root_id`,`context_type`,`name`,`description`,`mkdate`,`chdate`,`author_host`,`Seminar_id`,`user_id`,`external_contact`)\n SELECT `topic_id`,`parent_id`,`root_id`,'course',`name`,`description`,`mkdate`,`chdate`,`author_host`,`Seminar_id`,`user_id`,0\n FROM px_topics\n ");
} else {
//Installieren des Plugins
$db->exec("\n INSERT INTO plugins\n SET pluginclassname = 'Blubber',\n pluginpath = 'core/Blubber',\n pluginname = 'Blubber',\n plugintype = 'StandardPlugin,SystemPlugin',\n enabled = 'yes',\n navigationpos = '1'\n ");
$plugin_id = $db->lastInsertId();
$db->exec("\n INSERT IGNORE INTO roles_plugins (roleid, pluginid)\n SELECT roleid, " . $db->quote($plugin_id) . " FROM roles WHERE system = 'y'\n ");
}
}
示例11: down
function down()
{
$db = DBManager::get();
$db->exec("ALTER TABLE `lock_rules` DROP `permission`");
$db->exec("DELETE FROM config WHERE field = 'RANGE_TREE_ADMIN_PERM'");
$db->exec("DELETE FROM config WHERE field = 'SEM_TREE_ADMIN_PERM'");
}
示例12: up
public function up()
{
// Get all resources on a specific level. These will be used
// as parent ids to find the children on the next level.
$query = "SELECT `resource_id`\n FROM `resources_objects`\n WHERE `level` = :level";
$parent_statement = DBManager::get()->prepare($query);
// Update the level for all children of a set of parent ids.
$query = "UPDATE `resources_objects`\n SET `level` = :level\n WHERE `parent_id` IN (:ids)";
$child_statement = DBManager::get()->prepare($query);
// Loop until the hierarchy has been built.
$level = 0;
do {
// Read parent ids
$parent_statement->bindValue(':level', $level);
$parent_statement->execute();
$parent_ids = $parent_statement->fetchAll(PDO::FETCH_COLUMN);
// No parents, no children -> we're done.
if (count($parent_ids) === 0) {
break;
}
// Increase level
$level = $level + 1;
// Update level on all children, exit if no children have been
// found/updated.
$child_statement->bindValue(':level', $level);
$child_statement->bindValue(':ids', $parent_ids, StudipPDO::PARAM_ARRAY);
$updated_rows = $child_statement->execute();
} while ($updated_rows > 0);
}
示例13: execute
public function execute($last_result, $parameters = array())
{
$db = DBManager::get();
$dd_func = function ($d) {
delete_document($d);
};
//abgelaufenen News löschen
$deleted_news = StudipNews::DoGarbageCollect();
//messages aufräumen
$to_delete = $db->query("SELECT message_id, count( message_id ) AS gesamt, count(IF (deleted =0, NULL , 1) ) AS geloescht\n FROM message_user GROUP BY message_id HAVING gesamt = geloescht")->fetchAll(PDO::FETCH_COLUMN, 0);
if (count($to_delete)) {
$db->exec("DELETE FROM message_user WHERE message_id IN(" . $db->quote($to_delete) . ")");
$db->exec("DELETE FROM message WHERE message_id IN(" . $db->quote($to_delete) . ")");
$to_delete_attach = $db->query("SELECT dokument_id FROM dokumente WHERE range_id IN(" . $db->quote($to_delete) . ")")->fetchAll(PDO::FETCH_COLUMN, 0);
array_walk($to_delete_attach, $dd_func);
}
//Attachments von nicht versendeten Messages aufräumen
$to_delete_attach = $db->query("SELECT dokument_id FROM dokumente WHERE range_id = 'provisional' AND chdate < UNIX_TIMESTAMP(DATE_ADD(NOW(),INTERVAL -2 HOUR))")->fetchAll(PDO::FETCH_COLUMN, 0);
array_walk($to_delete_attach, $dd_func);
if ($parameters['verbose']) {
printf(_("Gelöschte Ankündigungen: %u") . "\n", (int) $deleted_news);
printf(_("Gelöschte Nachrichten: %u") . "\n", count($to_delete));
printf(_("Gelöschte Dateianhänge: %u") . "\n", count($to_delete_attach));
}
PersonalNotifications::doGarbageCollect();
// Remove old plugin assets
PluginAsset::deleteBySQL('chdate < ?', array(time() - PluginAsset::CACHE_DURATION));
}
示例14: down
function down ()
{
$db = DBManager::get();
$db->exec("DELETE FROM config WHERE field = 'AUX_RULE_ADMIN_PERM'");
$db->exec("DELETE FROM config WHERE field = 'LOCK_RULE_ADMIN_PERM'");
}
示例15: down
function down()
{
$db = DBManager::get();
$db->exec("DROP TABLE IF EXISTS `personal_notifications` ");
$db->exec("DROP TABLE IF EXISTS `personal_notifications_user` ");
$db->exec("DELETE FROM `config` WHERE `field` = 'PERSONAL_NOTIFICATIONS_ACTIVATED'");
}